Misc tweaks in settings

- Tweak layout for default sms picker icon. Now icons are aligned
  and forced to be in the same size
- Update string to use correct double-quote symbol
- Multiline title for some user & account setting

Change-Id: I27c1ed6459c5cd919778d535ab846b148a3f91b6
Fixes: 64285520
Fixes: 62891178
Fixes: 62265094
Fixes: 64363209
Test: robotests
Test: visual
This commit is contained in:
Fan Zhang
2017-08-03 10:48:43 -07:00
parent 56538f1775
commit 8722509eb9
6 changed files with 25 additions and 46 deletions

View File

@@ -16,19 +16,31 @@
** 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"
xmlns:settings="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:clipToPadding="false"
android:minHeight="?android:attr/listPreferredItemHeight" android:minHeight="?android:attr/listPreferredItemHeight"
android:padding="6dip"> android:paddingStart="?android:attr/listPreferredItemPaddingStart"
<ImageView android:paddingEnd="?android:attr/listPreferredItemPaddingEnd">
<FrameLayout
android:id="@+id/icon_frame"
style="@style/preference_icon_frame"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="start|center_vertical"
android:paddingEnd="12dp"
android:paddingTop="4dp"
android:paddingBottom="4dp">
<android.support.v7.internal.widget.PreferenceImageView
android:id="@android:id/icon" android:id="@android:id/icon"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:adjustViewBounds="true" settings:maxWidth="48dp"
android:padding="6dip" settings:maxHeight="48dp" />
android:duplicateParentState="true" </FrameLayout>
/>
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View File

@@ -387,7 +387,7 @@
<string name="bluetooth_sap_acceptance_dialog_text"><xliff:g id="device_name">%1$s</xliff:g> wants to access your SIM card. Granting access to the SIM card will disable data connectivity on your device for the duration of the connection. Give access to <xliff:g id="device_name">%2$s?</xliff:g></string> <string name="bluetooth_sap_acceptance_dialog_text"><xliff:g id="device_name">%1$s</xliff:g> wants to access your SIM card. Granting access to the SIM card will disable data connectivity on your device for the duration of the connection. Give access to <xliff:g id="device_name">%2$s?</xliff:g></string>
<!-- Description for bluetooth device name summary [CHAR LIMIT=none] --> <!-- Description for bluetooth device name summary [CHAR LIMIT=none] -->
<string name="bluetooth_device_name_summary">Visible as \"<xliff:g id="device_name">^1</xliff:g>\" to other devices</string> <string name="bluetooth_device_name_summary">Visible as \u201C<xliff:g id="device_name">^1</xliff:g>\u201D to other devices</string>
<!-- Title for paired device group [CHAR LIMIT=none] --> <!-- Title for paired device group [CHAR LIMIT=none] -->
<string name="bluetooth_paired_device_title">Your devices</string> <string name="bluetooth_paired_device_title">Your devices</string>
@@ -3140,13 +3140,7 @@
<!-- Master Clear --> <!-- Master Clear -->
<!-- Button title to factory data reset the entire device --> <!-- Button title to factory data reset the entire device -->
<string name="master_clear_title">Erase all data (Factory reset)</string> <string name="master_clear_title">Erase all data (factory reset)</string>
<!-- Summary text for factory data reset describing what will be reset [CHAR_LIMIT=NONE]-->
<plurals name="master_clear_with_account_summary">
<item quantity="one">1 account will be reset</item>
<item quantity="other"><xliff:g id="account_count">%1$d</xliff:g> accounts will be reset</item>
</plurals>
<string name="master_clear_summary">Internal storage &amp; all data will be reset</string>
<!-- SD card & phone storage settings screen, message on screen after user selects Factory data reset [CHAR LIMIT=NONE] --> <!-- SD card & phone storage settings screen, message on screen after user selects Factory data reset [CHAR LIMIT=NONE] -->
<string name="master_clear_desc" product="tablet">"This will erase all data from your tablet\u2019s <b>internal storage</b>, including:\n\n<li>Your Google account</li>\n<li>System and app data and settings</li>\n<li>Downloaded apps</li>"</string> <string name="master_clear_desc" product="tablet">"This will erase all data from your tablet\u2019s <b>internal storage</b>, including:\n\n<li>Your Google account</li>\n<li>System and app data and settings</li>\n<li>Downloaded apps</li>"</string>
<!-- SD card & phone storage settings screen, message on screen after user selects Factory data reset [CHAR LIMIT=NONE] --> <!-- SD card & phone storage settings screen, message on screen after user selects Factory data reset [CHAR LIMIT=NONE] -->

View File

@@ -38,7 +38,6 @@
<com.android.settingslib.RestrictedPreference <com.android.settingslib.RestrictedPreference
android:key="factory_reset" android:key="factory_reset"
android:title="@string/master_clear_title" android:title="@string/master_clear_title"
android:summary="@string/master_clear_summary"
settings:keywords="@string/keywords_factory_data_reset" settings:keywords="@string/keywords_factory_data_reset"
settings:userRestriction="no_factory_reset" settings:userRestriction="no_factory_reset"
settings:useAdminDisabledSummary="true" settings:useAdminDisabledSummary="true"

View File

@@ -48,6 +48,7 @@
<com.android.settingslib.RestrictedSwitchPreference <com.android.settingslib.RestrictedSwitchPreference
android:key="add_users_when_locked" android:key="add_users_when_locked"
android:title="@string/user_add_on_lockscreen_menu" android:title="@string/user_add_on_lockscreen_menu"
android:singleLineTitle="false"
android:order="105"/> android:order="105"/>
<PreferenceCategory <PreferenceCategory

View File

@@ -15,33 +15,24 @@
*/ */
package com.android.settings.system; package com.android.settings.system;
import android.accounts.Account;
import android.accounts.AccountManager;
import android.content.Context; import android.content.Context;
import android.content.pm.UserInfo;
import android.os.UserHandle;
import android.os.UserManager; import android.os.UserManager;
import android.support.v7.preference.Preference;
import com.android.settings.R; import com.android.settings.R;
import com.android.settings.Utils; import com.android.settings.Utils;
import com.android.settings.core.PreferenceControllerMixin; import com.android.settings.core.PreferenceControllerMixin;
import com.android.settingslib.core.AbstractPreferenceController; import com.android.settingslib.core.AbstractPreferenceController;
import java.util.List;
public class FactoryResetPreferenceController extends AbstractPreferenceController public class FactoryResetPreferenceController extends AbstractPreferenceController
implements PreferenceControllerMixin { implements PreferenceControllerMixin {
/** Key of the "Factory reset" preference in {@link R.xml.reset_dashboard_fragment}. */ /** Key of the "Factory reset" preference in {@link R.xml.reset_dashboard_fragment}. */
private static final String KEY_FACTORY_RESET = "factory_reset"; private static final String KEY_FACTORY_RESET = "factory_reset";
private final UserManager mUm; private final UserManager mUm;
private final AccountManager mAm;
public FactoryResetPreferenceController(Context context) { public FactoryResetPreferenceController(Context context) {
super(context); super(context);
mUm = (UserManager) context.getSystemService(Context.USER_SERVICE); mUm = (UserManager) context.getSystemService(Context.USER_SERVICE);
mAm = (AccountManager) context.getSystemService(Context.ACCOUNT_SERVICE);
} }
/** Hide "Factory reset" settings for secondary users, except demo users. */ /** Hide "Factory reset" settings for secondary users, except demo users. */
@@ -54,22 +45,4 @@ public class FactoryResetPreferenceController extends AbstractPreferenceControll
public String getPreferenceKey() { public String getPreferenceKey() {
return KEY_FACTORY_RESET; return KEY_FACTORY_RESET;
} }
@Override
public void updateState(Preference preference) {
final List<UserInfo> profiles = mUm.getProfiles(UserHandle.myUserId());
int accountsCount = 0;
for (UserInfo userInfo : profiles) {
final int profileId = userInfo.id;
Account[] accounts = mAm.getAccountsAsUser(profileId);
accountsCount += accounts.length;
}
if (accountsCount == 0) {
preference.setSummary(R.string.master_clear_summary);
} else {
preference.setSummary(mContext.getResources().getQuantityString(
R.plurals.master_clear_with_account_summary,
accountsCount, accountsCount));
}
}
} }

View File

@@ -74,7 +74,7 @@ public class BluetoothDeviceNamePreferenceControllerTest {
final CharSequence summary = mPreference.getSummary(); final CharSequence summary = mPreference.getSummary();
assertThat(summary.toString()) assertThat(summary.toString())
.isEqualTo("Visible as \"Nightshade\" to other devices"); .isEqualTo("Visible as \u201CNightshade\u201D to other devices");
assertThat(mPreference.isSelectable()).isFalse(); assertThat(mPreference.isSelectable()).isFalse();
} }