Merge "[Panlingual] Add a description for per app language." into tm-dev

This commit is contained in:
Tom Hsu
2022-04-14 08:56:24 +00:00
committed by Android (Google) Code Review
5 changed files with 21 additions and 4 deletions

View File

@@ -19,7 +19,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center_horizontal" > android:gravity="center_horizontal" >
<TextView <TextView
android:id="@id/description" android:id="@+id/description"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="15dip" android:layout_marginLeft="15dip"

View File

@@ -524,6 +524,9 @@
<!-- Description for the app without any supported languages. [CHAR LIMIT=NONE]--> <!-- Description for the app without any supported languages. [CHAR LIMIT=NONE]-->
<string name="desc_no_available_supported_locale">Language selection for this app isn\u2019t available from Settings.</string> <string name="desc_no_available_supported_locale">Language selection for this app isn\u2019t available from Settings.</string>
<!-- Description for the disclaimer of per app language. [CHAR LIMIT=NONE]-->
<string name="desc_app_locale_disclaimer">Language may differ from languages available in the app. Some apps may not support this setting.</string>
<!-- The title of the confirmation dialog shown when the user selects one / several languages and tries to remove them [CHAR LIMIT=60] --> <!-- The title of the confirmation dialog shown when the user selects one / several languages and tries to remove them [CHAR LIMIT=60] -->
<plurals name="dlg_remove_locales_title"> <plurals name="dlg_remove_locales_title">
<item quantity="one">Remove selected language?</item> <item quantity="one">Remove selected language?</item>

View File

@@ -19,14 +19,20 @@
xmlns:settings="http://schemas.android.com/apk/res-auto" xmlns:settings="http://schemas.android.com/apk/res-auto"
android:title="@string/app_locale_picker_title"> android:title="@string/app_locale_picker_title">
<com.android.settingslib.widget.TopIntroPreference
android:title="@string/desc_app_locale_disclaimer"
android:order="1"/>
<com.android.settingslib.widget.BannerMessagePreference <com.android.settingslib.widget.BannerMessagePreference
android:key="key_warnings" android:key="key_warnings"
android:order="20"
android:icon="@drawable/ic_error_outline" android:icon="@drawable/ic_error_outline"
android:title="@string/warnings_title" android:title="@string/warnings_title"
android:summary="@string/warnings_summary"/> android:summary="@string/warnings_summary"/>
<com.android.settingslib.widget.LayoutPreference <com.android.settingslib.widget.LayoutPreference
android:key="app_locale_description" android:key="app_locale_description"
android:order="30"
android:layout="@layout/app_locale_details_description" android:layout="@layout/app_locale_details_description"
android:selectable="false" android:selectable="false"
android:visibility="gone" android:visibility="gone"

View File

@@ -146,6 +146,7 @@ public class AppLocaleDetails extends SettingsPreferenceFragment {
.setUid(mApplicationInfo.uid) .setUid(mApplicationInfo.uid)
.setHasAppInfoLink(true) .setHasAppInfoLink(true)
.setButtonActions(ActionType.ACTION_NONE, ActionType.ACTION_NONE) .setButtonActions(ActionType.ACTION_NONE, ActionType.ACTION_NONE)
.setOrder(10)
.done(activity, getPrefContext()); .done(activity, getPrefContext());
getPreferenceScreen().addPreference(pref); getPreferenceScreen().addPreference(pref);
} }

View File

@@ -74,6 +74,7 @@ public class EntityHeaderController {
private Lifecycle mLifecycle; private Lifecycle mLifecycle;
private RecyclerView mRecyclerView; private RecyclerView mRecyclerView;
private Drawable mIcon; private Drawable mIcon;
private int mPrefOrder = -1000;
private String mIconContentDescription; private String mIconContentDescription;
private CharSequence mLabel; private CharSequence mLabel;
private CharSequence mSummary; private CharSequence mSummary;
@@ -214,12 +215,18 @@ public class EntityHeaderController {
} }
public EntityHeaderController setIsInstantApp(boolean isInstantApp) { public EntityHeaderController setIsInstantApp(boolean isInstantApp) {
this.mIsInstantApp = isInstantApp; mIsInstantApp = isInstantApp;
return this; return this;
} }
public EntityHeaderController setEditListener(View.OnClickListener listener) { public EntityHeaderController setEditListener(View.OnClickListener listener) {
this.mEditOnClickListener = listener; mEditOnClickListener = listener;
return this;
}
/** Sets this preference order. */
public EntityHeaderController setOrder(int order) {
mPrefOrder = order;
return this; return this;
} }
@@ -229,7 +236,7 @@ public class EntityHeaderController {
public LayoutPreference done(Activity activity, Context uiContext) { public LayoutPreference done(Activity activity, Context uiContext) {
final LayoutPreference pref = new LayoutPreference(uiContext, done(activity)); final LayoutPreference pref = new LayoutPreference(uiContext, done(activity));
// Makes sure it's the first preference onscreen. // Makes sure it's the first preference onscreen.
pref.setOrder(-1000); pref.setOrder(mPrefOrder);
pref.setSelectable(false); pref.setSelectable(false);
pref.setKey(PREF_KEY_APP_HEADER); pref.setKey(PREF_KEY_APP_HEADER);
pref.setAllowDividerBelow(true); pref.setAllowDividerBelow(true);