Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 20f8f298 authored by Evan Chen's avatar Evan Chen Committed by Android (Google) Code Review
Browse files

Merge "Add a spinner for singleDevice" into tm-dev

parents c88a1ff3 564a1203
Loading
Loading
Loading
Loading
+99 −84
Original line number Diff line number Diff line
@@ -12,8 +12,15 @@
     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"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:minWidth="340dp">

    <LinearLayout android:id="@+id/association_confirmation"
                  style="@style/ContainerLayout">

        <!-- A header for selfManaged devices only. -->
@@ -77,14 +84,9 @@
                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_multiple_device"
                android:visibility="gone"
            style="?android:attr/progressBarStyleLarge" />
                style="@style/Spinner"  />

        </RelativeLayout>

@@ -129,3 +131,16 @@
        </LinearLayout>

    </LinearLayout>

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1">

        <ProgressBar
            android:id="@+id/spinner_single_device"
            android:visibility="gone"
            style="@style/Spinner" />
    </RelativeLayout>>

</LinearLayout>
 No newline at end of file
+7 −0
Original line number Diff line number Diff line
@@ -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>
 No newline at end of file
+13 −5
Original line number Diff line number Diff line
@@ -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) {