Add a spinner for singleDevice
Introduce a new singleDevice spinner with
RelativeLayout.
Test: atest CtsCompanionDeviceManagerCoreTestCases
atest CtsCompanionDeviceManagerUiAutomationTestCases
atest CtsOsTestCases:CompanionDeviceManagerTest
Fix: 224798445
Bug: 225174174
Change-Id: I91e4182f47a644e659360ab262a93bf51a70b58c
This commit is contained in:
@@ -12,120 +12,135 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/activity_confirmation"
|
||||
style="@style/ContainerLayout">
|
||||
|
||||
<!-- 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:id="@+id/activity_confirmation"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="32dp"
|
||||
android:gravity="center"
|
||||
android:layout_marginTop="18dp"
|
||||
android:tint="@android:color/system_accent1_600"/>
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:minWidth="340dp">
|
||||
|
||||
<LinearLayout style="@style/Description">
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
style="@style/DescriptionTitle" />
|
||||
<LinearLayout android:id="@+id/association_confirmation"
|
||||
style="@style/ContainerLayout">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/summary"
|
||||
style="@style/DescriptionSummary" />
|
||||
<!-- 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_marginTop="18dp"
|
||||
android:tint="@android:color/system_accent1_600"/>
|
||||
|
||||
<LinearLayout style="@style/Description">
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
style="@style/DescriptionTitle" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/summary"
|
||||
style="@style/DescriptionSummary" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1">
|
||||
|
||||
<LinearLayout
|
||||
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"
|
||||
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
|
||||
android:id="@+id/border_bottom"
|
||||
style="@style/DeviceListBorder" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/permission_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/spinner_multiple_device"
|
||||
android:visibility="gone"
|
||||
style="@style/Spinner" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginTop="16dp">
|
||||
|
||||
<!-- Do NOT change the IDs of the buttons: they are referenced in CTS tests. -->
|
||||
|
||||
<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
|
||||
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>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1">
|
||||
|
||||
<LinearLayout
|
||||
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"
|
||||
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
|
||||
android:id="@+id/border_bottom"
|
||||
style="@style/DeviceListBorder" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/permission_list"
|
||||
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:id="@+id/spinner_single_device"
|
||||
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="16dp">
|
||||
|
||||
<!-- Do NOT change the IDs of the buttons: they are referenced in CTS tests. -->
|
||||
|
||||
<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
|
||||
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>
|
||||
style="@style/Spinner" />
|
||||
</RelativeLayout>>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -108,4 +108,11 @@
|
||||
<item name="android:background">@android:color/system_accent1_300</item>
|
||||
</style>
|
||||
|
||||
<style name="Spinner"
|
||||
parent="@android:style/Widget.Material.Light.ProgressBar.Large">
|
||||
<item name="android:layout_width">56dp</item>
|
||||
<item name="android:layout_height">56dp</item>
|
||||
<item name="android:indeterminate">true</item>
|
||||
<item name="android:layout_centerInParent">true</item>
|
||||
</style>
|
||||
</resources>
|
||||
@@ -122,7 +122,10 @@ public class CompanionDeviceActivity extends FragmentActivity implements
|
||||
|
||||
// Progress indicator is only shown while we are looking for the first suitable device for a
|
||||
// multiple device association.
|
||||
private ProgressBar mProgressIndicator;
|
||||
private ProgressBar mMultipleDeviceSpinner;
|
||||
// Progress indicator is only shown while we are looking for the first suitable device for a
|
||||
// single device association.
|
||||
private ProgressBar mSingleDeviceSpinner;
|
||||
|
||||
// Present for self-managed association requests and "single-device" regular association
|
||||
// regular.
|
||||
@@ -255,7 +258,7 @@ public class CompanionDeviceActivity extends FragmentActivity implements
|
||||
setContentView(R.layout.activity_confirmation);
|
||||
|
||||
mMultipleDeviceList = findViewById(R.id.multiple_device_list);
|
||||
mAssociationConfirmationDialog = findViewById(R.id.activity_confirmation);
|
||||
mAssociationConfirmationDialog = findViewById(R.id.association_confirmation);
|
||||
mVendorHeader = findViewById(R.id.vendor_header);
|
||||
|
||||
mTitle = findViewById(R.id.title);
|
||||
@@ -269,7 +272,8 @@ public class CompanionDeviceActivity extends FragmentActivity implements
|
||||
|
||||
mDeviceListRecyclerView = findViewById(R.id.device_list);
|
||||
|
||||
mProgressIndicator = findViewById(R.id.spinner);
|
||||
mMultipleDeviceSpinner = findViewById(R.id.spinner_multiple_device);
|
||||
mSingleDeviceSpinner = findViewById(R.id.spinner_single_device);
|
||||
mDeviceAdapter = new DeviceListAdapter(this, this::onListItemClick);
|
||||
|
||||
mPermissionListRecyclerView = findViewById(R.id.permission_list);
|
||||
@@ -468,8 +472,10 @@ public class CompanionDeviceActivity extends FragmentActivity implements
|
||||
deviceFilterPairs -> updateSingleDeviceUi(
|
||||
deviceFilterPairs, deviceProfile, appLabel));
|
||||
|
||||
mSingleDeviceSpinner.setVisibility(View.VISIBLE);
|
||||
mPermissionListRecyclerView.setVisibility(View.GONE);
|
||||
mDeviceListRecyclerView.setVisibility(View.GONE);
|
||||
mAssociationConfirmationDialog.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
private void updateSingleDeviceUi(List<DeviceFilterPair<?>> deviceFilterPairs,
|
||||
@@ -499,6 +505,8 @@ public class CompanionDeviceActivity extends FragmentActivity implements
|
||||
mTitle.setText(title);
|
||||
mSummary.setText(summary);
|
||||
mProfileIcon.setImageDrawable(profileIcon);
|
||||
mSingleDeviceSpinner.setVisibility(View.GONE);
|
||||
mAssociationConfirmationDialog.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
private void initUiForMultipleDevices(CharSequence appLabel) {
|
||||
@@ -535,7 +543,7 @@ public class CompanionDeviceActivity extends FragmentActivity implements
|
||||
deviceFilterPairs -> {
|
||||
// Dismiss the progress bar once there's one device found for multiple devices.
|
||||
if (deviceFilterPairs.size() >= 1) {
|
||||
mProgressIndicator.setVisibility(View.GONE);
|
||||
mMultipleDeviceSpinner.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
mDeviceAdapter.setDevices(deviceFilterPairs);
|
||||
@@ -546,7 +554,7 @@ public class CompanionDeviceActivity extends FragmentActivity implements
|
||||
mButtonNotAllow.setVisibility(View.GONE);
|
||||
mButtonNotAllowMultipleDevices.setVisibility(View.VISIBLE);
|
||||
mMultipleDeviceList.setVisibility(View.VISIBLE);
|
||||
mProgressIndicator.setVisibility(View.VISIBLE);
|
||||
mMultipleDeviceSpinner.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
private void onListItemClick(int position) {
|
||||
|
||||
Reference in New Issue
Block a user