Merge "Add a spinner for singleDevice" into tm-dev
This commit is contained in:
@@ -12,120 +12,135 @@
|
|||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:id="@+id/activity_confirmation"
|
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:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="32dp"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center"
|
android:layout_gravity="center"
|
||||||
android:layout_marginTop="18dp"
|
android:minWidth="340dp">
|
||||||
android:tint="@android:color/system_accent1_600"/>
|
|
||||||
|
|
||||||
<LinearLayout style="@style/Description">
|
<LinearLayout android:id="@+id/association_confirmation"
|
||||||
<TextView
|
style="@style/ContainerLayout">
|
||||||
android:id="@+id/title"
|
|
||||||
style="@style/DescriptionTitle" />
|
|
||||||
|
|
||||||
<TextView
|
<!-- A header for selfManaged devices only. -->
|
||||||
android:id="@+id/summary"
|
<include layout="@layout/vendor_header" />
|
||||||
style="@style/DescriptionSummary" />
|
|
||||||
|
<!-- 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>
|
</LinearLayout>
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1">
|
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
|
<ProgressBar
|
||||||
android:id="@+id/spinner"
|
android:id="@+id/spinner_single_device"
|
||||||
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"
|
android:visibility="gone"
|
||||||
style="?android:attr/progressBarStyleLarge" />
|
style="@style/Spinner" />
|
||||||
|
</RelativeLayout>>
|
||||||
</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>
|
</LinearLayout>
|
||||||
@@ -108,4 +108,11 @@
|
|||||||
<item name="android:background">@android:color/system_accent1_300</item>
|
<item name="android:background">@android:color/system_accent1_300</item>
|
||||||
</style>
|
</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>
|
</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
|
// Progress indicator is only shown while we are looking for the first suitable device for a
|
||||||
// multiple device association.
|
// 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
|
// Present for self-managed association requests and "single-device" regular association
|
||||||
// regular.
|
// regular.
|
||||||
@@ -255,7 +258,7 @@ public class CompanionDeviceActivity extends FragmentActivity implements
|
|||||||
setContentView(R.layout.activity_confirmation);
|
setContentView(R.layout.activity_confirmation);
|
||||||
|
|
||||||
mMultipleDeviceList = findViewById(R.id.multiple_device_list);
|
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);
|
mVendorHeader = findViewById(R.id.vendor_header);
|
||||||
|
|
||||||
mTitle = findViewById(R.id.title);
|
mTitle = findViewById(R.id.title);
|
||||||
@@ -269,7 +272,8 @@ public class CompanionDeviceActivity extends FragmentActivity implements
|
|||||||
|
|
||||||
mDeviceListRecyclerView = findViewById(R.id.device_list);
|
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);
|
mDeviceAdapter = new DeviceListAdapter(this, this::onListItemClick);
|
||||||
|
|
||||||
mPermissionListRecyclerView = findViewById(R.id.permission_list);
|
mPermissionListRecyclerView = findViewById(R.id.permission_list);
|
||||||
@@ -468,8 +472,10 @@ public class CompanionDeviceActivity extends FragmentActivity implements
|
|||||||
deviceFilterPairs -> updateSingleDeviceUi(
|
deviceFilterPairs -> updateSingleDeviceUi(
|
||||||
deviceFilterPairs, deviceProfile, appLabel));
|
deviceFilterPairs, deviceProfile, appLabel));
|
||||||
|
|
||||||
|
mSingleDeviceSpinner.setVisibility(View.VISIBLE);
|
||||||
mPermissionListRecyclerView.setVisibility(View.GONE);
|
mPermissionListRecyclerView.setVisibility(View.GONE);
|
||||||
mDeviceListRecyclerView.setVisibility(View.GONE);
|
mDeviceListRecyclerView.setVisibility(View.GONE);
|
||||||
|
mAssociationConfirmationDialog.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateSingleDeviceUi(List<DeviceFilterPair<?>> deviceFilterPairs,
|
private void updateSingleDeviceUi(List<DeviceFilterPair<?>> deviceFilterPairs,
|
||||||
@@ -499,6 +505,8 @@ public class CompanionDeviceActivity extends FragmentActivity implements
|
|||||||
mTitle.setText(title);
|
mTitle.setText(title);
|
||||||
mSummary.setText(summary);
|
mSummary.setText(summary);
|
||||||
mProfileIcon.setImageDrawable(profileIcon);
|
mProfileIcon.setImageDrawable(profileIcon);
|
||||||
|
mSingleDeviceSpinner.setVisibility(View.GONE);
|
||||||
|
mAssociationConfirmationDialog.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initUiForMultipleDevices(CharSequence appLabel) {
|
private void initUiForMultipleDevices(CharSequence appLabel) {
|
||||||
@@ -535,7 +543,7 @@ public class CompanionDeviceActivity extends FragmentActivity implements
|
|||||||
deviceFilterPairs -> {
|
deviceFilterPairs -> {
|
||||||
// Dismiss the progress bar once there's one device found for multiple devices.
|
// 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);
|
mMultipleDeviceSpinner.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
mDeviceAdapter.setDevices(deviceFilterPairs);
|
mDeviceAdapter.setDevices(deviceFilterPairs);
|
||||||
@@ -546,7 +554,7 @@ public class CompanionDeviceActivity extends FragmentActivity implements
|
|||||||
mButtonNotAllow.setVisibility(View.GONE);
|
mButtonNotAllow.setVisibility(View.GONE);
|
||||||
mButtonNotAllowMultipleDevices.setVisibility(View.VISIBLE);
|
mButtonNotAllowMultipleDevices.setVisibility(View.VISIBLE);
|
||||||
mMultipleDeviceList.setVisibility(View.VISIBLE);
|
mMultipleDeviceList.setVisibility(View.VISIBLE);
|
||||||
mProgressIndicator.setVisibility(View.VISIBLE);
|
mMultipleDeviceSpinner.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onListItemClick(int position) {
|
private void onListItemClick(int position) {
|
||||||
|
|||||||
Reference in New Issue
Block a user