CDM UI cleanUp
1. Introduce some common style.
2. Make the borders full fill the view for multiple device
3. Increasing the width of cdm dilog.
Test: atest CtsCompanionDeviceManagerCoreTestCases
atest CtsCompanionDeviceManagerUiAutomationTestCases
atest CtsOsTestCases:CompanionDeviceManagerTest
Bug: 216638097
Change-Id: I848adf9287a5505882f3a9fb6c9cc45c30ae6d00
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
|
||||
~
|
||||
|
||||
@@ -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,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
|
||||
@@ -99,8 +91,9 @@
|
||||
<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. -->
|
||||
|
||||
@@ -111,18 +104,28 @@
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_negative"
|
||||
android:layout_marginBottom="12dp"
|
||||
style="@style/NegativeButton"
|
||||
android:text="@string/consent_no" />
|
||||
|
||||
<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: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,20 +17,50 @@
|
||||
|
||||
<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>
|
||||
@@ -37,8 +68,11 @@
|
||||
|
||||
<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>
|
||||
@@ -47,8 +81,11 @@
|
||||
|
||||
<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>
|
||||
@@ -59,8 +96,7 @@
|
||||
<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>
|
||||
|
||||
@@ -511,7 +511,7 @@ public class CompanionDeviceActivity extends FragmentActivity implements
|
||||
CompanionDeviceDiscoveryService.getScanResult().observe(this,
|
||||
deviceFilterPairs -> {
|
||||
// Dismiss the progress bar once there's one device found for multiple devices.
|
||||
if (deviceFilterPairs.size() == 1) {
|
||||
if (deviceFilterPairs.size() >= 1) {
|
||||
mProgressIndicator.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
@@ -571,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 =
|
||||
|
||||
Reference in New Issue
Block a user