Merge "Refresh the buttons CDM dialogs" into tm-dev

This commit is contained in:
TreeHugger Robot
2022-03-08 22:55:23 +00:00
committed by Android (Google) Code Review
11 changed files with 203 additions and 74 deletions

View File

@@ -0,0 +1,25 @@
<!--
~ Copyright (C) 2022 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
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@android:color/transparent" />
<corners android:topLeftRadius="16dp" android:topRightRadius="16dp"
android:bottomLeftRadius="16dp" android:bottomRightRadius="16dp"/>
<stroke
android:width="2dp"
android:color="@android:color/system_accent1_600" />
</shape>

View File

@@ -0,0 +1,22 @@
<!--
~ Copyright (C) 2022 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
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<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"/>
</shape>

View File

@@ -0,0 +1,22 @@
<!--
~ Copyright (C) 2022 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
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<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"/>
</shape>

View File

@@ -23,27 +23,27 @@
<!-- 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"/>
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"/>
<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" />
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" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/device_list"
@@ -59,27 +59,31 @@
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="end">
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginTop="24dp">
<!-- Do NOT change the IDs of the buttons: they are referenced in CTS tests. -->
<Button
android:id="@+id/btn_negative"
style="@android:style/Widget.Material.Button.Borderless.Colored"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/consent_no"
android:textColor="?android:attr/textColorSecondary" />
android:id="@+id/btn_negative"
style="@style/NegativeButton"
android:text="@string/consent_no" />
<Button
android:id="@+id/btn_positive"
style="@android:style/Widget.Material.Button.Borderless.Colored"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/consent_yes" />
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:text="@string/consent_no" />
</LinearLayout>

View File

@@ -28,45 +28,40 @@
<!-- 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"/>
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"/>
<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" />
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
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="end">
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginTop="24dp">
<!-- Do NOT change the IDs of the buttons: they are referenced in CTS tests. -->
<Button
android:id="@+id/btn_negative"
style="@android:style/Widget.Material.Button.Borderless.Colored"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/consent_no"
android:textColor="?android:attr/textColorSecondary" />
android:id="@+id/btn_negative"
style="@style/NegativeButton"
android:text="@string/consent_no" />
<Button
android:id="@+id/btn_positive"
style="@android:style/Widget.Material.Button.Borderless.Colored"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/consent_yes" />
android:id="@+id/btn_positive"
style="@style/PositiveButton"
android:text="@string/consent_yes" />
</LinearLayout>

View File

@@ -60,4 +60,4 @@
</LinearLayout>
</LinearLayout>
</LinearLayout>

View File

@@ -25,16 +25,16 @@
<!-- Do NOT change the ID of the root LinearLayout above: it's referenced in CTS tests. -->
<ImageView
android:id="@android:id/icon"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginRight="12dp"/>
android:id="@android:id/icon"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginRight="12dp"/>
<TextView
android:id="@android:id/text1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceListItemSmall"/>
android:id="@android:id/text1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceListItemSmall"/>
</LinearLayout>

View File

@@ -0,0 +1,26 @@
<!--
~ Copyright (C) 2022 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
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<resources>
<style name="ChooserActivity"
parent="@android:style/Theme.DeviceDefault.Dialog.NoActionBar">
<item name="*android:windowFixedHeightMajor">100%</item>
<item name="*android:windowFixedHeightMinor">100%</item>
<item name="android:windowBackground">@android:color/transparent</item>
</style>
</resources>

View File

@@ -35,4 +35,34 @@
<item name="android:background">@drawable/helper_ok_button</item>
</style>
<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: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>
</style>
<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: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>
</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:textAllCaps">false</item>
<item name="android:background">@drawable/btn_negative_multiple_devices</item>
</style>
</resources>

View File

@@ -17,11 +17,10 @@
<resources>
<style name="ChooserActivity"
parent="@android:style/Theme.DeviceDefault.Light.Dialog">
parent="@android:style/Theme.DeviceDefault.Light.Dialog.NoActionBar">
<item name="*android:windowFixedHeightMajor">100%</item>
<item name="*android:windowFixedHeightMinor">100%</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:forceDarkAllowed">true</item>
</style>
</resources>

View File

@@ -118,8 +118,9 @@ public class CompanionDeviceActivity extends FragmentActivity implements
// Present for self-managed association requests and "single-device" regular association
// regular.
private Button mButtonAllow;
// Present for all associations.
private Button mButtonNotAllow;
// Present for multiple devices association requests only.
private Button mButtonNotAllowMultipleDevices;
private LinearLayout mAssociationConfirmationDialog;
private RelativeLayout mVendorHeader;
@@ -260,9 +261,12 @@ public class CompanionDeviceActivity extends FragmentActivity implements
mButtonAllow = findViewById(R.id.btn_positive);
mButtonNotAllow = findViewById(R.id.btn_negative);
mButtonNotAllowMultipleDevices = findViewById(R.id.btn_negative_multiple_devices);
mButtonAllow.setOnClickListener(this::onPositiveButtonClick);
mButtonNotAllow.setOnClickListener(this::onNegativeButtonClick);
mButtonNotAllowMultipleDevices.setOnClickListener(this::onNegativeButtonClick);
mVendorHeaderButton.setOnClickListener(this::onShowHelperDialog);
if (mRequest.isSelfManaged()) {
@@ -490,6 +494,8 @@ public class CompanionDeviceActivity extends FragmentActivity implements
// "Remove" consent button: users would need to click on the list item.
mButtonAllow.setVisibility(View.GONE);
mButtonNotAllow.setVisibility(View.GONE);
mButtonNotAllowMultipleDevices.setVisibility(View.VISIBLE);
}
private void onListItemClick(int position) {