[MEP] renew the sim confirm dialog UI

- renew the sim confirm dialog

Bug: 199902896
Test: build pass and local UI test
Change-Id: Icb00b3fc32066e21d22cbeca1fdf50e5d7dbef20
Merged-In: Icb00b3fc32066e21d22cbeca1fdf50e5d7dbef20
This commit is contained in:
SongFerngWang
2021-12-21 05:39:09 +08:00
committed by SongFerng Wang
parent db2ddb6a92
commit ba9d26696b
12 changed files with 212 additions and 26 deletions

View File

@@ -690,12 +690,12 @@
<activity android:name=".network.telephony.ToggleSubscriptionDialogActivity" <activity android:name=".network.telephony.ToggleSubscriptionDialogActivity"
android:exported="false" android:exported="false"
android:permission="android.permission.WRITE_EMBEDDED_SUBSCRIPTIONS" android:permission="android.permission.WRITE_EMBEDDED_SUBSCRIPTIONS"
android:theme="@style/Theme.AlertDialog"/> android:theme="@style/Theme.AlertDialog.SimConfirmDialog"/>
<activity android:name=".network.telephony.DeleteEuiccSubscriptionDialogActivity" <activity android:name=".network.telephony.DeleteEuiccSubscriptionDialogActivity"
android:exported="false" android:exported="false"
android:permission="android.permission.WRITE_EMBEDDED_SUBSCRIPTIONS" android:permission="android.permission.WRITE_EMBEDDED_SUBSCRIPTIONS"
android:theme="@style/Theme.AlertDialog"/> android:theme="@style/Theme.AlertDialog.SimConfirmDialog"/>
<activity <activity
android:name="Settings$TetherSettingsActivity" android:name="Settings$TetherSettingsActivity"
@@ -4202,14 +4202,14 @@
android:exported="false" android:exported="false"
android:permission="android.permission.WRITE_EMBEDDED_SUBSCRIPTIONS" android:permission="android.permission.WRITE_EMBEDDED_SUBSCRIPTIONS"
android:launchMode="singleInstance" android:launchMode="singleInstance"
android:theme="@style/Theme.AlertDialog"/> android:theme="@style/Theme.AlertDialog.SimConfirmDialog"/>
<activity <activity
android:name=".sim.DsdsDialogActivity" android:name=".sim.DsdsDialogActivity"
android:exported="false" android:exported="false"
android:permission="android.permission.WRITE_EMBEDDED_SUBSCRIPTIONS" android:permission="android.permission.WRITE_EMBEDDED_SUBSCRIPTIONS"
android:launchMode="singleInstance" android:launchMode="singleInstance"
android:theme="@style/Theme.AlertDialog"/> android:theme="@style/Theme.AlertDialog.SimConfirmDialog"/>
<service android:name=".sim.SimNotificationService" <service android:name=".sim.SimNotificationService"
android:permission="android.permission.BIND_JOB_SERVICE" /> android:permission="android.permission.BIND_JOB_SERVICE" />

View File

@@ -0,0 +1,41 @@
<?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
~
~ 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.
-->
<inset xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
android:insetTop="16dp"
android:insetBottom="24dp">
<ripple android:color="?android:attr/colorControlHighlight">
<item android:id="@android:id/mask">
<shape android:shape="rectangle">
<solid android:color="@android:color/white"/>
<corners android:radius="24dp"/>
</shape>
</item>
<item>
<shape android:shape="rectangle">
<corners android:radius="24dp"/>
<solid android:color="@android:color/transparent"/>
<stroke android:color="?androidprv:attr/colorAccentPrimaryVariant"
android:width="1dp" />
<padding android:left="16dp"
android:top="8dp"
android:right="16dp"
android:bottom="8dp"/>
</shape>
</item>
</ripple>
</inset>

View File

@@ -0,0 +1,30 @@
<?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
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.
-->
<inset xmlns:android="http://schemas.android.com/apk/res/android"
android:insetLeft="24dp"
android:insetRight="24dp">
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/settingslib_state_on_color"/>
<corners
android:bottomLeftRadius="8dp"
android:topLeftRadius="8dp"
android:bottomRightRadius="8dp"
android:topRightRadius="8dp"
/>
</shape>
</inset>

View File

@@ -0,0 +1,30 @@
<?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
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.
-->
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/listPreferredItemHeightSmall"
style="?attr/materialAlertDialogBodyTextStyle"
android:gravity="center"
android:paddingTop="?attr/listPreferredItemPaddingStart"
android:paddingBottom="?attr/listPreferredItemPaddingEnd"
android:paddingLeft="?attr/listPreferredItemPaddingLeft"
android:paddingRight="?attr/listPreferredItemPaddingRight"
android:background="@drawable/sim_confirm_dialog_rounded_bg"
android:textAppearance="@style/TextAppearance.SimConfirmDialogList"
/>

View File

@@ -16,42 +16,49 @@
<LinearLayout <LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="vertical">
style="@style/Theme.Material3.DayNight.Dialog.Alert">
<TextView <TextView
android:id="@+id/msg" android:id="@+id/msg"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content"/> android:layout_height="wrap_content"
android:paddingEnd="24dp"
android:paddingTop="16dp"
android:paddingStart="24dp"
android:gravity="center"
android:textAppearance="@style/TextAppearance.DialogMessage"/>
<ListView <ListView
android:id="@+id/carrier_list" android:id="@+id/carrier_list"
android:layout_width="wrap_content" android:layout_gravity="center"
android:paddingTop="16dp"
android:dividerHeight="1dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"/> android:layout_height="wrap_content"/>
<LinearLayout <LinearLayout
android:id="@+id/info_outline_layout"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:minWidth="56dp"
android:gravity="start|top" android:gravity="start|top"
android:orientation="horizontal" android:orientation="horizontal"
android:paddingEnd="12dp" android:paddingEnd="24dp"
android:paddingTop="16dp" android:paddingTop="16dp"
android:paddingBottom="4dp" android:paddingStart="24dp"
android:layout_marginBottom="16dp"
android:baselineAligned="true"> android:baselineAligned="true">
<ImageView <ImageView
android:src="@drawable/ic_info_outline_24dp" android:src="@drawable/ic_info_outline_24dp"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:tint="?android:attr/textColorTertiary"/> android:tint="?android:attr/textColorTertiary"/>
<TextView <TextView
android:id="@+id/info_outline" android:id="@+id/info_outline"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingTop="16dp" android:paddingLeft="16dp"
android:paddingBottom="8dp"
android:text="@string/sim_action_switch_sub_dialog_info_outline_for_turning_off" android:text="@string/sim_action_switch_sub_dialog_info_outline_for_turning_off"
android:textColor="?android:attr/textColorSecondary" /> android:textColor="?android:attr/textColorSecondary"
android:textAppearance="@style/TextAppearance.DialogMessage"/>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>

View File

@@ -0,0 +1,25 @@
<?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
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.
-->
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingEnd="24dp"
android:paddingTop="16dp"
android:paddingLeft="24dp"
android:gravity="center"
style="?android:attr/textAppearanceLarge"/>

View File

@@ -16,9 +16,18 @@
--> -->
<resources> <resources>
<style name="Widget.ActionBar.Base" parent="@android:style/Widget.DeviceDefault.ActionBar.Solid">
<style name="Widget.ActionBar.Base" parent="@android:style/Widget.DeviceDefault.ActionBar.Solid">
<item name="android:background">?android:attr/colorPrimaryDark</item> <item name="android:background">?android:attr/colorPrimaryDark</item>
</style> </style>
<style name="TextAppearance.SimConfirmDialogList" parent="@style/TextAppearance.DialogMessage">
<item name="android:fontFamily">@*android:string/config_headlineFontFamily</item>
<item name="android:textColor">?android:attr/textColorPrimaryInverse</item>
</style>
<style name="TextAppearance.SimConfirmDialogList.Summary">
<item name="android:textAppearance">?android:attr/textAppearanceSmall</item>
<item name="android:fontFamily">@*android:string/config_headlineFontFamily</item>
<item name="android:textColor">?android:attr/textColorPrimaryInverse</item>
</style>
</resources> </resources>

View File

@@ -34,6 +34,12 @@
<item name="android:colorBackground">@*android:color/surface_dark</item> <item name="android:colorBackground">@*android:color/surface_dark</item>
</style> </style>
<style name="Theme.AlertDialog.Base.Material3" parent="Theme.MaterialComponents.DayNight.Dialog.Alert">
<item name="colorPrimary">@*android:color/primary_device_default_settings</item>
<item name="colorAccent">@*android:color/accent_device_default_dark</item>
<item name="android:colorBackground">@*android:color/surface_dark</item>
</style>
<!-- Material theme for the pages containing TabLayout and ViewPager --> <!-- Material theme for the pages containing TabLayout and ViewPager -->
<style name="Theme.TabTheme" parent="@style/Theme.MaterialComponents.DayNight"> <style name="Theme.TabTheme" parent="@style/Theme.MaterialComponents.DayNight">
<item name="colorPrimary">@*android:color/edge_effect_device_default_dark</item> <item name="colorPrimary">@*android:color/edge_effect_device_default_dark</item>

View File

@@ -12762,7 +12762,7 @@
<!-- Status message indicating the device is in the process of disconnecting from one mobile network and immediately connecting to another. [CHAR_LIMIT=NONE] --> <!-- Status message indicating the device is in the process of disconnecting from one mobile network and immediately connecting to another. [CHAR_LIMIT=NONE] -->
<string name="sim_action_enabling_sim_without_carrier_name">Connecting to network&#8230;</string> <string name="sim_action_enabling_sim_without_carrier_name">Connecting to network&#8230;</string>
<!-- Text of progress dialog indicating the subscription switch is in progress. [CHAR_LIMIT=NONE] --> <!-- Text of progress dialog indicating the subscription switch is in progress. [CHAR_LIMIT=NONE] -->
<string name="sim_action_switch_sub_dialog_progress">Switching to <xliff:g id="carrier_name" example="Google Fi">%1$s</xliff:g></string> <string name="sim_action_switch_sub_dialog_progress">Switching to <xliff:g id="carrier_name" example="Google Fi">%1$s</xliff:g> for calls and messages&#8230;</string>
<!-- Title of error message indicating that the device could not disconnect from one mobile network and immediately connect to another. [CHAR_LIMIT=NONE] --> <!-- Title of error message indicating that the device could not disconnect from one mobile network and immediately connect to another. [CHAR_LIMIT=NONE] -->
<string name="sim_action_enable_sim_fail_title">Can\u2019t switch carrier</string> <string name="sim_action_enable_sim_fail_title">Can\u2019t switch carrier</string>
<!-- Body text of error message indicating the device could not disconnect from one mobile network and immediately connect to another, due to an unspecified issue. [CHAR_LIMIT=NONE] --> <!-- Body text of error message indicating the device could not disconnect from one mobile network and immediately connect to another, due to an unspecified issue. [CHAR_LIMIT=NONE] -->

View File

@@ -914,4 +914,25 @@
parent="@*android:style/TextAppearance.DeviceDefault"> parent="@*android:style/TextAppearance.DeviceDefault">
<item name="android:textColor">?android:attr/textColorSecondary</item> <item name="android:textColor">?android:attr/textColorSecondary</item>
</style> </style>
<style name="TextAppearance.SimConfirmDialogList" parent="@style/TextAppearance.DialogMessage"/>
<style name="TextAppearance.SimConfirmDialogList.Summary">
<item name="android:textAppearance">?android:attr/textAppearanceSmall</item>
</style>
<style name="SimConfirmDialog.OutlineButton" parent="@android:style/Widget.Material.Button">
<item name="android:layout_marginStart">8dp</item>
<item name="android:layout_height">36dp</item>
<item name="android:minWidth">0dp</item>
<item name="android:textSize">14sp</item>
<item name="android:lineHeight">20sp</item>
<item name="android:fontFamily">@*android:string/config_bodyFontFamilyMedium</item>
<item name="android:textColor">?android:attr/textColorPrimary</item>
<item name="android:background">@drawable/sim_confirm_dialog_btn_outline</item>
</style>
<style name="SimConfirmDialog.ButtonBarStyle" parent="@android:style/Widget.Material.ButtonBar">
<item name="android:paddingEnd">8dp</item>
</style>
</resources> </resources>

View File

@@ -142,6 +142,13 @@
<item name="buttonBarButtonStyle">@*android:style/Widget.DeviceDefault.Button.ButtonBar.AlertDialog</item> <item name="buttonBarButtonStyle">@*android:style/Widget.DeviceDefault.Button.ButtonBar.AlertDialog</item>
</style> </style>
<style name="Theme.AlertDialog.SimConfirmDialog">
<item name="buttonBarStyle">@style/SimConfirmDialog.ButtonBarStyle</item>
<item name="buttonBarButtonStyle">@style/SimConfirmDialog.OutlineButton</item>
<item name="android:textAllCaps">false</item>
</style>
<style name="Theme.ConfirmDeviceCredentials" parent="Theme.SubSettings"> <style name="Theme.ConfirmDeviceCredentials" parent="Theme.SubSettings">
<item name="confirmDeviceCredentialsSideMargin">@dimen/confirm_credentials_side_margin</item> <item name="confirmDeviceCredentialsSideMargin">@dimen/confirm_credentials_side_margin</item>
<item name="confirmDeviceCredentialsTopMargin">@dimen/confirm_credentials_top_margin</item> <item name="confirmDeviceCredentialsTopMargin">@dimen/confirm_credentials_top_margin</item>

View File

@@ -112,9 +112,7 @@ public class ConfirmDialogFragment extends BaseDialogFragment
ArrayList<String> list = getArguments().getStringArrayList(ARG_LIST); ArrayList<String> list = getArguments().getStringArrayList(ARG_LIST);
Log.i(TAG, "Showing dialog with title =" + title); Log.i(TAG, "Showing dialog with title =" + title);
AlertDialog.Builder builder = AlertDialog.Builder builder = new AlertDialog.Builder(getContext())
new AlertDialog.Builder(getContext())
.setTitle(title)
.setPositiveButton(posBtnString, this) .setPositiveButton(posBtnString, this)
.setNegativeButton(negBtnString, this); .setNegativeButton(negBtnString, this);
@@ -124,13 +122,22 @@ public class ConfirmDialogFragment extends BaseDialogFragment
View content = LayoutInflater.from(getContext()).inflate( View content = LayoutInflater.from(getContext()).inflate(
R.layout.sim_confirm_dialog_multiple_enabled_profiles_supported, null); R.layout.sim_confirm_dialog_multiple_enabled_profiles_supported, null);
if (!TextUtils.isEmpty(title)) {
View titleView = LayoutInflater.from(getContext()).inflate(
R.layout.sim_confirm_dialog_title_multiple_enabled_profiles_supported,
null);
TextView titleTextView = titleView.findViewById(R.id.title);
titleTextView.setText(title);
builder.setCustomTitle(titleTextView);
}
TextView dialogMessage = content.findViewById(R.id.msg); TextView dialogMessage = content.findViewById(R.id.msg);
if (!TextUtils.isEmpty(message) && dialogMessage != null) { if (!TextUtils.isEmpty(message) && dialogMessage != null) {
dialogMessage.setText(message); dialogMessage.setText(message);
} }
final ArrayAdapter<String> arrayAdapterItems = new ArrayAdapter<String>( final ArrayAdapter<String> arrayAdapterItems = new ArrayAdapter<String>(
getContext(), android.R.layout.select_dialog_item, list); getContext(),
R.layout.sim_confirm_dialog_item_multiple_enabled_profiles_supported, list);
final ListView lvItems = content.findViewById(R.id.carrier_list); final ListView lvItems = content.findViewById(R.id.carrier_list);
if (lvItems != null) { if (lvItems != null) {
lvItems.setAdapter(arrayAdapterItems); lvItems.setAdapter(arrayAdapterItems);
@@ -153,6 +160,9 @@ public class ConfirmDialogFragment extends BaseDialogFragment
} }
builder.setView(content); builder.setView(content);
} else { } else {
if (!TextUtils.isEmpty(title)) {
builder.setTitle(title);
}
if (!TextUtils.isEmpty(message)) { if (!TextUtils.isEmpty(message)) {
builder.setMessage(message); builder.setMessage(message);
} }