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
This commit is contained in:
Fabrice Di Meglio
2014-04-04 17:55:57 -07:00
parent 6068967fd9
commit 911fb2ad90

View File

@@ -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
*/