Modify account settings for better locale resolution
Bug: 16282173 Change-Id: I2ab861464cdbbb1c1b0a5a7231f960d8ed9e90c6
This commit is contained in:
@@ -590,16 +590,52 @@ public final class Utils {
|
||||
* @param title String to display for the title of this set of preferences.
|
||||
*/
|
||||
public static void startWithFragment(Context context, String fragmentName, Bundle args,
|
||||
Fragment resultTo, int resultRequestCode, int titleResId, CharSequence title) {
|
||||
Fragment resultTo, int resultRequestCode, int titleResId,
|
||||
CharSequence title) {
|
||||
startWithFragment(context, fragmentName, args, resultTo, resultRequestCode,
|
||||
titleResId, title, false /* not a shortcut */);
|
||||
null /* titleResPackageName */, titleResId, title, false /* not a shortcut */);
|
||||
}
|
||||
|
||||
/**
|
||||
* Start a new instance of the activity, showing only the given fragment.
|
||||
* When launched in this mode, the given preference fragment will be instantiated and fill the
|
||||
* entire activity.
|
||||
*
|
||||
* @param context The context.
|
||||
* @param fragmentName The name of the fragment to display.
|
||||
* @param args Optional arguments to supply to the fragment.
|
||||
* @param resultTo Option fragment that should receive the result of the activity launch.
|
||||
* @param resultRequestCode If resultTo is non-null, this is the request code in which
|
||||
* to report the result.
|
||||
* @param titleResPackageName Optional package name for the resource id of the title.
|
||||
* @param titleResId resource id for the String to display for the title of this set
|
||||
* of preferences.
|
||||
* @param title String to display for the title of this set of preferences.
|
||||
*/
|
||||
public static void startWithFragment(Context context, String fragmentName, Bundle args,
|
||||
Fragment resultTo, int resultRequestCode, String titleResPackageName, int titleResId,
|
||||
CharSequence title) {
|
||||
startWithFragment(context, fragmentName, args, resultTo, resultRequestCode,
|
||||
titleResPackageName, titleResId, title, false /* not a shortcut */);
|
||||
}
|
||||
|
||||
public static void startWithFragment(Context context, String fragmentName, Bundle args,
|
||||
Fragment resultTo, int resultRequestCode, int titleResId, CharSequence title,
|
||||
boolean isShortcut) {
|
||||
Intent intent = onBuildStartFragmentIntent(context, fragmentName, args, titleResId,
|
||||
title, isShortcut);
|
||||
Fragment resultTo, int resultRequestCode, int titleResId,
|
||||
CharSequence title, boolean isShortcut) {
|
||||
Intent intent = onBuildStartFragmentIntent(context, fragmentName, args,
|
||||
null /* titleResPackageName */, titleResId, title, isShortcut);
|
||||
if (resultTo == null) {
|
||||
context.startActivity(intent);
|
||||
} else {
|
||||
resultTo.startActivityForResult(intent, resultRequestCode);
|
||||
}
|
||||
}
|
||||
|
||||
public static void startWithFragment(Context context, String fragmentName, Bundle args,
|
||||
Fragment resultTo, int resultRequestCode, String titleResPackageName, int titleResId,
|
||||
CharSequence title, boolean isShortcut) {
|
||||
Intent intent = onBuildStartFragmentIntent(context, fragmentName, args, titleResPackageName,
|
||||
titleResId, title, isShortcut);
|
||||
if (resultTo == null) {
|
||||
context.startActivity(intent);
|
||||
} else {
|
||||
@@ -608,9 +644,20 @@ public final class Utils {
|
||||
}
|
||||
|
||||
public static void startWithFragmentAsUser(Context context, String fragmentName, Bundle args,
|
||||
int titleResId, CharSequence title, boolean isShortcut, UserHandle userHandle) {
|
||||
Intent intent = onBuildStartFragmentIntent(context, fragmentName, args, titleResId,
|
||||
title, isShortcut);
|
||||
int titleResId, CharSequence title, boolean isShortcut,
|
||||
UserHandle userHandle) {
|
||||
Intent intent = onBuildStartFragmentIntent(context, fragmentName, args,
|
||||
null /* titleResPackageName */, titleResId, title, isShortcut);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||
context.startActivityAsUser(intent, userHandle);
|
||||
}
|
||||
|
||||
public static void startWithFragmentAsUser(Context context, String fragmentName, Bundle args,
|
||||
String titleResPackageName, int titleResId, CharSequence title, boolean isShortcut,
|
||||
UserHandle userHandle) {
|
||||
Intent intent = onBuildStartFragmentIntent(context, fragmentName, args, titleResPackageName,
|
||||
titleResId, title, isShortcut);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||
context.startActivityAsUser(intent, userHandle);
|
||||
@@ -625,6 +672,7 @@ public final class Utils {
|
||||
* @param context The Context.
|
||||
* @param fragmentName The name of the fragment to display.
|
||||
* @param args Optional arguments to supply to the fragment.
|
||||
* @param titleResPackageName Optional package name for the resource id of the title.
|
||||
* @param titleResId Optional title resource id to show for this item.
|
||||
* @param title Optional title to show for this item.
|
||||
* @param isShortcut tell if this is a Launcher Shortcut or not
|
||||
@@ -632,11 +680,14 @@ public final class Utils {
|
||||
* fragment.
|
||||
*/
|
||||
public static Intent onBuildStartFragmentIntent(Context context, String fragmentName,
|
||||
Bundle args, int titleResId, CharSequence title, boolean isShortcut) {
|
||||
Bundle args, String titleResPackageName, int titleResId, CharSequence title,
|
||||
boolean isShortcut) {
|
||||
Intent intent = new Intent(Intent.ACTION_MAIN);
|
||||
intent.setClass(context, SubSettings.class);
|
||||
intent.putExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT, fragmentName);
|
||||
intent.putExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT_ARGUMENTS, args);
|
||||
intent.putExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT_TITLE_RES_PACKAGE_NAME,
|
||||
titleResPackageName);
|
||||
intent.putExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT_TITLE_RESID, titleResId);
|
||||
intent.putExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT_TITLE, title);
|
||||
intent.putExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT_AS_SHORTCUT, isShortcut);
|
||||
|
Reference in New Issue
Block a user