From 911fb2ad907d47a882c023b871c6457db32359f8 Mon Sep 17 00:00:00 2001 From: Fabrice Di Meglio Date: Fri, 4 Apr 2014 17:55:57 -0700 Subject: [PATCH] Fix bug #13817456 User not take to previous sub setting screen when Home ...affordance is tapped from second level sub settings page - start an Activity instead of switch Fragments Change-Id: I0e47d6539a3a048d7aa25bdb125c4c99031f9e85 --- .../android/settings/SettingsActivity.java | 43 +++---------------- 1 file changed, 7 insertions(+), 36 deletions(-) diff --git a/src/com/android/settings/SettingsActivity.java b/src/com/android/settings/SettingsActivity.java index 83ac173c90f..7cdf78176a0 100644 --- a/src/com/android/settings/SettingsActivity.java +++ b/src/com/android/settings/SettingsActivity.java @@ -737,7 +737,13 @@ public class SettingsActivity extends Activity */ public void startPreferencePanel(String fragmentClass, Bundle args, int titleRes, CharSequence titleText, Fragment resultTo, int resultRequestCode) { - switchToFragment(fragmentClass, args, resultTo, resultRequestCode, titleRes, titleText); + String title; + if (titleRes > 0) { + title = getString(titleRes); + } else { + title = titleText.toString(); + } + startWithFragment(fragmentClass, args, resultTo, resultRequestCode, title); } /** @@ -772,41 +778,6 @@ public class SettingsActivity extends Activity transaction.commitAllowingStateLoss(); } - /** - * Start a new fragment. Used by #startPreferencePanel. - * - * @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 titleRes Resource ID of string to display for the title of. If the Resource ID is a - * valid one then it will be used to get the title. Otherwise the titleText - * argument will be used as the title. - * @param titleText string to display for the title of. - */ - private void switchToFragment(String fragmentName, Bundle args, Fragment resultTo, - int resultRequestCode, int titleRes, CharSequence titleText) { - final CharSequence cs; - if (titleRes != 0) { - cs = getText(titleRes); - } else { - cs = titleText; - } - - Fragment f = Fragment.instantiate(this, fragmentName, args); - if (resultTo != null) { - f.setTargetFragment(resultTo, resultRequestCode); - } - FragmentTransaction transaction = getFragmentManager().beginTransaction(); - transaction.replace(R.id.prefs, f); - transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN); - transaction.addToBackStack(BACK_STACK_PREFS); - transaction.setBreadCrumbTitle(cs); - transaction.commitAllowingStateLoss(); - } - /** * Switch to a specific Fragment with taking care of validation, Title and BackStack */