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:gravity="center_horizontal" >
<TextView
android:id="@id/description"
android:id="@+id/description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="15dip"

View File

@@ -524,6 +524,9 @@
<!-- 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>
<!-- 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] -->
<plurals name="dlg_remove_locales_title">
<item quantity="one">Remove selected language?</item>

View File

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

View File

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

View File

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