Merge changes from topics "presubmit-am-1a8adc3a42824e489007f2ef846a0f71", "presubmit-am-71bbe918d83d491e8ccb96c26458149c", "presubmit-am-e80e22a9aeb8442eb3b3332c3b2ea804" into tm-dev
* changes: CDM UI cleanUp Introduce a progessBar for multiple devices Make the Allow button at the top
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (C) 2022 The Android Open Source Project
|
||||
~
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (C) 2022 The Android Open Source Project
|
||||
~
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (C) 2022 The Android Open Source Project
|
||||
~
|
||||
@@ -17,6 +18,6 @@
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="@android:color/system_accent1_100"/>
|
||||
<corners android:topLeftRadius="12dp" android:topRightRadius="12dp"
|
||||
android:bottomLeftRadius="4dp" android:bottomRightRadius="4dp"/>
|
||||
<corners android:topLeftRadius="4dp" android:topRightRadius="4dp"
|
||||
android:bottomLeftRadius="12dp" android:bottomRightRadius="12dp"/>
|
||||
</shape>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (C) 2022 The Android Open Source Project
|
||||
~
|
||||
@@ -17,6 +18,6 @@
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="@android:color/system_accent1_100"/>
|
||||
<corners android:topLeftRadius="4dp" android:topRightRadius="4dp"
|
||||
android:bottomLeftRadius="12dp" android:bottomRightRadius="12dp"/>
|
||||
<corners android:topLeftRadius="12dp" android:topRightRadius="12dp"
|
||||
android:bottomLeftRadius="4dp" android:bottomRightRadius="4dp"/>
|
||||
</shape>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (C) 2022 The Android Open Source Project
|
||||
~
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (C) 2022 The Android Open Source Project
|
||||
~
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (C) 2022 The Android Open Source Project
|
||||
~
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (C) 2022 The Android Open Source Project
|
||||
~
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (C) 2022 The Android Open Source Project
|
||||
~
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (C) 2022 The Android Open Source Project
|
||||
~
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2021 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
@@ -20,35 +19,26 @@
|
||||
<!-- A header for selfManaged devices only. -->
|
||||
<include layout="@layout/vendor_header" />
|
||||
|
||||
<!-- Do NOT change the ID of the root LinearLayout above: it's referenced in CTS tests. -->
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/profile_icon"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="32dp"
|
||||
android:gravity="center"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:layout_marginTop="1dp"
|
||||
android:layout_marginTop="18dp"
|
||||
android:tint="@android:color/system_accent1_600"/>
|
||||
|
||||
<!-- Do NOT change the ID of the root LinearLayout above: it's referenced in CTS tests. -->
|
||||
<LinearLayout style="@style/Description">
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
style="@style/DescriptionTitle" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:paddingHorizontal="12dp"
|
||||
android:layout_marginBottom="12dp"
|
||||
style="@*android:style/TextAppearance.Widget.Toolbar.Title" />
|
||||
<TextView
|
||||
android:id="@+id/summary"
|
||||
style="@style/DescriptionSummary" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/summary"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:gravity="center"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:textSize="14sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
@@ -59,18 +49,20 @@
|
||||
android:id="@+id/multiple_device_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone">
|
||||
|
||||
<View
|
||||
android:id="@+id/border_top"
|
||||
android:layout_marginTop="12dp"
|
||||
style="@style/DeviceListBorder" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/device_list"
|
||||
android:layout_width="match_parent"
|
||||
android:scrollbars="vertical"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:layout_height="200dp" />
|
||||
|
||||
<View
|
||||
@@ -84,35 +76,56 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/spinner"
|
||||
android:layout_width="56dp"
|
||||
android:layout_height="56dp"
|
||||
android:layout_centerInParent="true"
|
||||
android:indeterminate="true"
|
||||
android:tint="@android:color/system_accent1_600"
|
||||
android:visibility="gone"
|
||||
style="?android:attr/progressBarStyleLarge" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginTop="24dp">
|
||||
android:layout_marginTop="16dp">
|
||||
|
||||
<!-- Do NOT change the IDs of the buttons: they are referenced in CTS tests. -->
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_negative"
|
||||
style="@style/NegativeButton"
|
||||
android:text="@string/consent_no" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_positive"
|
||||
style="@style/PositiveButton"
|
||||
android:text="@string/consent_yes" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_negative_multiple_devices"
|
||||
android:layout_marginLeft="170dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
style="@style/NegativeButtonMultipleDevices"
|
||||
android:textColor = "?android:textColorPrimary"
|
||||
android:visibility="gone"
|
||||
android:id="@+id/btn_negative"
|
||||
android:layout_marginBottom="12dp"
|
||||
style="@style/NegativeButton"
|
||||
android:text="@string/consent_no" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="bottom|right"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_marginBottom="16dp">
|
||||
|
||||
<!-- Do NOT change the IDs of the buttons: they are referenced in CTS tests. -->
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_negative_multiple_devices"
|
||||
style="@style/NegativeButtonMultipleDevices"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:visibility="gone"
|
||||
android:text="@string/consent_no" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -15,54 +15,42 @@
|
||||
~ limitations under the License.
|
||||
-->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/activity_confirmation"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/dialog_background"
|
||||
android:elevation="16dp"
|
||||
android:maxHeight="400dp"
|
||||
android:orientation="vertical"
|
||||
android:padding="18dp"
|
||||
android:layout_gravity="center">
|
||||
android:id="@+id/data_transfer_confirmation"
|
||||
style="@style/ContainerLayout">
|
||||
|
||||
<!-- Do NOT change the ID of the root LinearLayout above: it's referenced in CTS tests. -->
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:paddingHorizontal="12dp"
|
||||
style="@*android:style/TextAppearance.Widget.Toolbar.Title"/>
|
||||
<LinearLayout style="@style/Description">
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
style="@style/DescriptionTitle" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/summary"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:gravity="center"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:textSize="14sp" />
|
||||
<TextView
|
||||
android:id="@+id/summary"
|
||||
style="@style/DescriptionSummary" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginTop="24dp">
|
||||
android:layout_marginTop="16dp">
|
||||
|
||||
<!-- Do NOT change the IDs of the buttons: they are referenced in CTS tests. -->
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_negative"
|
||||
style="@style/NegativeButton"
|
||||
android:text="@string/consent_no" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_positive"
|
||||
style="@style/PositiveButton"
|
||||
android:text="@string/consent_yes" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_negative"
|
||||
android:layout_marginBottom="12dp"
|
||||
style="@style/NegativeButton"
|
||||
android:text="@string/consent_no" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -1,3 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (C) 2022 The Android Open Source Project
|
||||
~
|
||||
@@ -17,6 +18,7 @@
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/helper_confirmation"
|
||||
android:theme="@style/ChooserActivity"
|
||||
android:padding="12dp"
|
||||
style="@style/ContainerLayout">
|
||||
|
||||
<ImageView
|
||||
@@ -24,8 +26,8 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="32dp"
|
||||
android:gravity="center"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:layout_marginTop="1dp"/>
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginBottom="12dp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/helper_title"
|
||||
@@ -33,17 +35,18 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:paddingHorizontal="12dp"
|
||||
style="@*android:style/TextAppearance.Widget.Toolbar.Title"
|
||||
android:textSize="20sp" />
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textSize="22sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/helper_summary"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="24dp"
|
||||
android:layout_marginRight="24dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginBottom="24dp"
|
||||
android:gravity="start"
|
||||
android:gravity="center"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:textSize="14sp" />
|
||||
|
||||
@@ -51,6 +54,8 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginRight="12dp"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:gravity="end">
|
||||
|
||||
<Button
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
android:id="@android:id/icon"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginLeft="24dp"
|
||||
android:layout_marginRight="12dp"
|
||||
android:tint="@android:color/system_accent1_600"/>
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (C) 2022 The Android Open Source Project
|
||||
~
|
||||
@@ -19,13 +20,15 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:padding="5dp">
|
||||
android:paddingLeft="32dp"
|
||||
android:paddingRight="32dp"
|
||||
android:paddingBottom="14dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/permission_icon"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginTop="7dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:tint="@android:color/system_accent1_600"
|
||||
android:contentDescription="Permission Icon"/>
|
||||
@@ -48,6 +51,7 @@
|
||||
android:id="@+id/permission_summary"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingRight="24dp"
|
||||
android:textSize="14sp"
|
||||
android:textColor="?android:attr/textColorSecondary"/>
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (C) 2022 The Android Open Source Project
|
||||
~
|
||||
@@ -21,7 +22,10 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:paddingTop="24dp"
|
||||
android:paddingBottom="4dp"
|
||||
android:paddingLeft="24dp"
|
||||
android:paddingRight="24dp"
|
||||
android:visibility="gone" >
|
||||
|
||||
<ImageView
|
||||
@@ -42,7 +46,6 @@
|
||||
style="?android:attr/actionOverflowButtonStyle"
|
||||
android:layout_width="31dp"
|
||||
android:layout_height="32dp"
|
||||
android:layout_marginLeft="100dp"
|
||||
android:layout_alignParentRight="true" />
|
||||
|
||||
</RelativeLayout>
|
||||
@@ -1,3 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (C) 2022 The Android Open Source Project
|
||||
~
|
||||
@@ -16,51 +17,86 @@
|
||||
|
||||
<resources>
|
||||
<style name="ContainerLayout">
|
||||
<item name="android:padding">18dp</item>
|
||||
<item name="android:elevation">16dp</item>
|
||||
<item name="android:maxHeight">400dp</item>
|
||||
<item name="android:orientation">vertical</item>
|
||||
<item name="android:layout_gravity">center</item>
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:orientation">vertical</item>
|
||||
<item name="android:layout_gravity">center</item>
|
||||
<item name="android:minWidth">340dp</item>
|
||||
<item name="android:background">@drawable/dialog_background</item>
|
||||
</style>
|
||||
|
||||
<style name="Description">
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:orientation">vertical</item>
|
||||
<item name="android:layout_marginTop">18dp</item>
|
||||
<item name="android:layout_marginBottom">18dp</item>
|
||||
<item name="android:layout_marginLeft">24dp</item>
|
||||
<item name="android:layout_marginRight">24dp</item>
|
||||
</style>
|
||||
|
||||
<style name="DescriptionTitle"
|
||||
parent="@*android:style/TextAppearance.Widget.Toolbar.Title">
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:gravity">center</item>
|
||||
<item name="android:layout_marginLeft">14dp</item>
|
||||
<item name="android:layout_marginRight">14dp</item>
|
||||
<item name="android:textSize">20sp</item>
|
||||
<item name="android:textColor">?android:attr/textColorPrimary</item>
|
||||
</style>
|
||||
|
||||
<style name="DescriptionSummary">
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:gravity">center</item>
|
||||
<item name="android:layout_marginTop">18dp</item>
|
||||
<item name="android:layout_marginLeft">18dp</item>
|
||||
<item name="android:layout_marginRight">18dp</item>
|
||||
<item name="android:textSize">14sp</item>
|
||||
<item name="android:textColor">?android:attr/textColorSecondary</item>
|
||||
</style>
|
||||
|
||||
<style name="VendorHelperOkButton"
|
||||
parent="@android:style/Widget.Material.Button.Borderless.Colored">
|
||||
<item name="android:layout_width">50dp</item>
|
||||
<item name="android:layout_height">35dp</item>
|
||||
<item name="android:layout_height">36dp</item>
|
||||
<item name="android:layout_marginTop">20dp</item>
|
||||
<item name="android:textColor">@android:color/system_neutral1_900</item>
|
||||
<item name="android:background">@drawable/helper_ok_button</item>
|
||||
</style>
|
||||
|
||||
<style name="NegativeButton"
|
||||
<style name="PositiveButton"
|
||||
parent="@android:style/Widget.Material.Button.Borderless.Colored">
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:layout_width">300dp</item>
|
||||
<item name="android:layout_height">56dp</item>
|
||||
<item name="android:layout_marginLeft">24dp</item>
|
||||
<item name="android:layout_marginRight">24dp</item>
|
||||
<item name="android:layout_marginBottom">2dp</item>
|
||||
<item name="android:textAllCaps">false</item>
|
||||
<item name="android:textSize">14sp</item>
|
||||
<item name="android:textColor">@android:color/system_neutral1_900</item>
|
||||
<item name="android:background">@drawable/btn_negative_top</item>
|
||||
<item name="android:background">@drawable/btn_positive_bottom</item>
|
||||
</style>
|
||||
|
||||
<style name="PositiveButton"
|
||||
<style name="NegativeButton"
|
||||
parent="@android:style/Widget.Material.Button.Borderless.Colored">
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:layout_width">300dp</item>
|
||||
<item name="android:layout_height">56dp</item>
|
||||
<item name="android:layout_marginLeft">24dp</item>
|
||||
<item name="android:layout_marginRight">24dp</item>
|
||||
<item name="android:layout_marginTop">2dp</item>
|
||||
<item name="android:textAllCaps">false</item>
|
||||
<item name="android:textSize">14sp</item>
|
||||
<item name="android:textColor">@android:color/system_neutral1_900</item>
|
||||
<item name="android:layout_marginTop">4dp</item>
|
||||
<item name="android:background">@drawable/btn_positive_bottom</item>
|
||||
<item name="android:background">@drawable/btn_negative_top</item>
|
||||
</style>
|
||||
|
||||
<style name="NegativeButtonMultipleDevices"
|
||||
parent="@android:style/Widget.Material.Button.Colored">
|
||||
<item name="android:layout_width">100dp</item>
|
||||
<item name="android:layout_height">35dp</item>
|
||||
<item name="android:layout_marginTop">20dp</item>
|
||||
<item name="android:layout_height">36dp</item>
|
||||
<item name="android:textAllCaps">false</item>
|
||||
<item name="android:background">@drawable/btn_negative_multiple_devices</item>
|
||||
</style>
|
||||
|
||||
@@ -57,6 +57,7 @@ import android.widget.Button;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
@@ -116,14 +117,14 @@ public class CompanionDeviceActivity extends FragmentActivity implements
|
||||
private ImageButton mVendorHeaderButton;
|
||||
|
||||
// Progress indicator is only shown while we are looking for the first suitable device for a
|
||||
// "regular" (ie. not self-managed) association.
|
||||
private View mProgressIndicator;
|
||||
// multiple device association.
|
||||
private ProgressBar mProgressIndicator;
|
||||
|
||||
// Present for self-managed association requests and "single-device" regular association
|
||||
// regular.
|
||||
private Button mButtonAllow;
|
||||
private Button mButtonNotAllow;
|
||||
// Present for multiple device association requests only.
|
||||
// Present for multiple devices' association requests only.
|
||||
private Button mButtonNotAllowMultipleDevices;
|
||||
|
||||
private LinearLayout mAssociationConfirmationDialog;
|
||||
@@ -263,6 +264,8 @@ public class CompanionDeviceActivity extends FragmentActivity implements
|
||||
mVendorHeaderButton = findViewById(R.id.vendor_header_button);
|
||||
|
||||
mDeviceListRecyclerView = findViewById(R.id.device_list);
|
||||
|
||||
mProgressIndicator = findViewById(R.id.spinner);
|
||||
mDeviceAdapter = new DeviceListAdapter(this, this::onListItemClick);
|
||||
|
||||
mPermissionListRecyclerView = findViewById(R.id.permission_list);
|
||||
@@ -502,21 +505,25 @@ public class CompanionDeviceActivity extends FragmentActivity implements
|
||||
mSummary.setText(summary);
|
||||
mProfileIcon.setImageDrawable(profileIcon);
|
||||
|
||||
mDeviceAdapter = new DeviceListAdapter(this, this::onListItemClick);
|
||||
|
||||
// TODO: hide the list and show a spinner until a first device matching device is found.
|
||||
mDeviceListRecyclerView.setAdapter(mDeviceAdapter);
|
||||
mDeviceListRecyclerView.setLayoutManager(new LinearLayoutManager(this));
|
||||
|
||||
CompanionDeviceDiscoveryService.getScanResult().observe(
|
||||
/* lifecycleOwner */ this,
|
||||
/* observer */ mDeviceAdapter);
|
||||
CompanionDeviceDiscoveryService.getScanResult().observe(this,
|
||||
deviceFilterPairs -> {
|
||||
// Dismiss the progress bar once there's one device found for multiple devices.
|
||||
if (deviceFilterPairs.size() >= 1) {
|
||||
mProgressIndicator.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
mDeviceAdapter.setDevices(deviceFilterPairs);
|
||||
});
|
||||
|
||||
// "Remove" consent button: users would need to click on the list item.
|
||||
mButtonAllow.setVisibility(View.GONE);
|
||||
mButtonNotAllow.setVisibility(View.GONE);
|
||||
mButtonNotAllowMultipleDevices.setVisibility(View.VISIBLE);
|
||||
mMultipleDeviceList.setVisibility(View.VISIBLE);
|
||||
mProgressIndicator.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
private void onListItemClick(int position) {
|
||||
@@ -564,7 +571,7 @@ public class CompanionDeviceActivity extends FragmentActivity implements
|
||||
CompanionVendorHelperDialogFragment.newInstance(mRequest.getPackageName(),
|
||||
mRequest.getUserId(), mRequest.getDeviceProfile());
|
||||
|
||||
mAssociationConfirmationDialog.setVisibility(View.GONE);
|
||||
mAssociationConfirmationDialog.setVisibility(View.INVISIBLE);
|
||||
|
||||
fragmentDialog.show(fragmentManager, /* Tag */ FRAGMENT_DIALOG_TAG);
|
||||
}
|
||||
|
||||
@@ -150,6 +150,8 @@ public class CompanionDeviceDiscoveryService extends Service {
|
||||
mBtAdapter = mBtManager.getAdapter();
|
||||
mBleScanner = mBtAdapter.getBluetoothLeScanner();
|
||||
mWifiManager = getSystemService(WifiManager.class);
|
||||
|
||||
sScanResultsLiveData.setValue(Collections.emptyList());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -186,7 +188,6 @@ public class CompanionDeviceDiscoveryService extends Service {
|
||||
mStopAfterFirstMatch = request.isSingleDevice();
|
||||
mDiscoveryStarted = true;
|
||||
sStateLiveData.setValue(DiscoveryState.DISCOVERY_IN_PROGRESS);
|
||||
sScanResultsLiveData.setValue(Collections.emptyList());
|
||||
|
||||
final List<DeviceFilter<?>> allFilters = request.getDeviceFilters();
|
||||
final List<BluetoothDeviceFilter> btFilters =
|
||||
|
||||
@@ -25,15 +25,13 @@ import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.lifecycle.Observer;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import java.util.List;
|
||||
/**
|
||||
* Adapter for the list of "found" devices.
|
||||
*/
|
||||
class DeviceListAdapter extends RecyclerView.Adapter<DeviceListAdapter.ViewHolder> implements
|
||||
Observer<List<DeviceFilterPair<?>>> {
|
||||
class DeviceListAdapter extends RecyclerView.Adapter<DeviceListAdapter.ViewHolder> {
|
||||
public int mSelectedPosition = RecyclerView.NO_POSITION;
|
||||
|
||||
private final Context mContext;
|
||||
@@ -96,9 +94,8 @@ class DeviceListAdapter extends RecyclerView.Adapter<DeviceListAdapter.ViewHolde
|
||||
mSelectedPosition = position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChanged(List<DeviceFilterPair<?>> deviceFilterPairs) {
|
||||
mDevices = deviceFilterPairs;
|
||||
void setDevices(List<DeviceFilterPair<?>> devices) {
|
||||
mDevices = devices;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user