Loading core/java/android/preference/PreferenceActivity.java +56 −2 Original line number Diff line number Diff line Loading @@ -150,6 +150,10 @@ public abstract class PreferenceActivity extends ListActivity implements */ public static final String EXTRA_SHOW_FRAGMENT_TITLE = ":android:show_fragment_title"; // fix for title text for startPreferencePanel in a single pane mode /** @hide */ public static final String EXTRA_SHOW_FRAGMENT_TITLE_TEXT = ":android:show_fragment_title_text"; /** * When starting this activity and using {@link #EXTRA_SHOW_FRAGMENT}, * this extra can also be specify to supply the short title to be shown for Loading @@ -158,6 +162,11 @@ public abstract class PreferenceActivity extends ListActivity implements public static final String EXTRA_SHOW_FRAGMENT_SHORT_TITLE = ":android:show_fragment_short_title"; // fix for short title text for startPreferencePanel in a single pane mode /** @hide */ public static final String EXTRA_SHOW_FRAGMENT_SHORT_TITLE_TEXT = ":android:show_fragment_short_title_text"; /** * When starting this activity, the invoking Intent can contain this extra * boolean that the header list should not be displayed. This is most often Loading Loading @@ -542,6 +551,13 @@ public abstract class PreferenceActivity extends ListActivity implements CharSequence initialShortTitleStr = initialShortTitle != 0 ? getText(initialShortTitle) : null; showBreadCrumbs(initialTitleStr, initialShortTitleStr); } else { CharSequence initialTitleStr = getIntent().getStringExtra(EXTRA_SHOW_FRAGMENT_TITLE_TEXT); if ( initialTitleStr != null ) { CharSequence initialShortTitleStr = getIntent().getStringExtra(EXTRA_SHOW_FRAGMENT_SHORT_TITLE_TEXT); showBreadCrumbs(initialTitleStr, initialShortTitleStr); } } } else { Loading Loading @@ -575,6 +591,13 @@ public abstract class PreferenceActivity extends ListActivity implements CharSequence initialShortTitleStr = initialShortTitle != 0 ? getText(initialShortTitle) : null; showBreadCrumbs(initialTitleStr, initialShortTitleStr); } else { CharSequence initialTitleStr = getIntent().getStringExtra(EXTRA_SHOW_FRAGMENT_TITLE_TEXT); if ( initialTitleStr != null ) { CharSequence initialShortTitleStr = getIntent().getStringExtra(EXTRA_SHOW_FRAGMENT_SHORT_TITLE_TEXT); showBreadCrumbs(initialTitleStr, initialShortTitleStr); } } } else if (mHeaders.size() > 0) { setListAdapter(new HeaderAdapter(this, mHeaders)); Loading Loading @@ -1027,6 +1050,20 @@ public abstract class PreferenceActivity extends ListActivity implements return intent; } // fix for title text for startPreferencePanel in a single pane mode /** @hide */ public Intent onBuildStartFragmentIntent(String fragmentName, Bundle args, CharSequence titleText, CharSequence shortTitleText) { Intent intent = new Intent(Intent.ACTION_MAIN); intent.setClass(this, getClass()); intent.putExtra(EXTRA_SHOW_FRAGMENT, fragmentName); intent.putExtra(EXTRA_SHOW_FRAGMENT_ARGUMENTS, args); intent.putExtra(EXTRA_SHOW_FRAGMENT_TITLE_TEXT, titleText); intent.putExtra(EXTRA_SHOW_FRAGMENT_SHORT_TITLE_TEXT, shortTitleText); intent.putExtra(EXTRA_NO_HEADERS, true); return intent; } /** * Like {@link #startWithFragment(String, Bundle, Fragment, int, int, int)} * but uses a 0 titleRes. Loading Loading @@ -1063,6 +1100,18 @@ public abstract class PreferenceActivity extends ListActivity implements } } // fix for title text for startPreferencePanel in a single pane mode /** @hide */ public void startWithFragment(String fragmentName, Bundle args, Fragment resultTo, int resultRequestCode, CharSequence titleText, CharSequence shortTitleText) { Intent intent = onBuildStartFragmentIntent(fragmentName, args, titleText, shortTitleText); if (resultTo == null) { startActivity(intent); } else { resultTo.startActivityForResult(intent, resultRequestCode); } } /** * Change the base title of the bread crumbs for the current preferences. * This will normally be called for you. See Loading Loading @@ -1253,7 +1302,12 @@ public abstract class PreferenceActivity extends ListActivity implements public void startPreferencePanel(String fragmentClass, Bundle args, int titleRes, CharSequence titleText, Fragment resultTo, int resultRequestCode) { if (mSinglePane) { // fix for title text for startPreferencePanel in a single pane mode if (titleRes == 0 && titleText != null) { startWithFragment(fragmentClass, args, resultTo, resultRequestCode, titleText, null); } else { startWithFragment(fragmentClass, args, resultTo, resultRequestCode, titleRes, 0); } } else { Fragment f = Fragment.instantiate(this, fragmentClass, args); if (resultTo != null) { Loading Loading
core/java/android/preference/PreferenceActivity.java +56 −2 Original line number Diff line number Diff line Loading @@ -150,6 +150,10 @@ public abstract class PreferenceActivity extends ListActivity implements */ public static final String EXTRA_SHOW_FRAGMENT_TITLE = ":android:show_fragment_title"; // fix for title text for startPreferencePanel in a single pane mode /** @hide */ public static final String EXTRA_SHOW_FRAGMENT_TITLE_TEXT = ":android:show_fragment_title_text"; /** * When starting this activity and using {@link #EXTRA_SHOW_FRAGMENT}, * this extra can also be specify to supply the short title to be shown for Loading @@ -158,6 +162,11 @@ public abstract class PreferenceActivity extends ListActivity implements public static final String EXTRA_SHOW_FRAGMENT_SHORT_TITLE = ":android:show_fragment_short_title"; // fix for short title text for startPreferencePanel in a single pane mode /** @hide */ public static final String EXTRA_SHOW_FRAGMENT_SHORT_TITLE_TEXT = ":android:show_fragment_short_title_text"; /** * When starting this activity, the invoking Intent can contain this extra * boolean that the header list should not be displayed. This is most often Loading Loading @@ -542,6 +551,13 @@ public abstract class PreferenceActivity extends ListActivity implements CharSequence initialShortTitleStr = initialShortTitle != 0 ? getText(initialShortTitle) : null; showBreadCrumbs(initialTitleStr, initialShortTitleStr); } else { CharSequence initialTitleStr = getIntent().getStringExtra(EXTRA_SHOW_FRAGMENT_TITLE_TEXT); if ( initialTitleStr != null ) { CharSequence initialShortTitleStr = getIntent().getStringExtra(EXTRA_SHOW_FRAGMENT_SHORT_TITLE_TEXT); showBreadCrumbs(initialTitleStr, initialShortTitleStr); } } } else { Loading Loading @@ -575,6 +591,13 @@ public abstract class PreferenceActivity extends ListActivity implements CharSequence initialShortTitleStr = initialShortTitle != 0 ? getText(initialShortTitle) : null; showBreadCrumbs(initialTitleStr, initialShortTitleStr); } else { CharSequence initialTitleStr = getIntent().getStringExtra(EXTRA_SHOW_FRAGMENT_TITLE_TEXT); if ( initialTitleStr != null ) { CharSequence initialShortTitleStr = getIntent().getStringExtra(EXTRA_SHOW_FRAGMENT_SHORT_TITLE_TEXT); showBreadCrumbs(initialTitleStr, initialShortTitleStr); } } } else if (mHeaders.size() > 0) { setListAdapter(new HeaderAdapter(this, mHeaders)); Loading Loading @@ -1027,6 +1050,20 @@ public abstract class PreferenceActivity extends ListActivity implements return intent; } // fix for title text for startPreferencePanel in a single pane mode /** @hide */ public Intent onBuildStartFragmentIntent(String fragmentName, Bundle args, CharSequence titleText, CharSequence shortTitleText) { Intent intent = new Intent(Intent.ACTION_MAIN); intent.setClass(this, getClass()); intent.putExtra(EXTRA_SHOW_FRAGMENT, fragmentName); intent.putExtra(EXTRA_SHOW_FRAGMENT_ARGUMENTS, args); intent.putExtra(EXTRA_SHOW_FRAGMENT_TITLE_TEXT, titleText); intent.putExtra(EXTRA_SHOW_FRAGMENT_SHORT_TITLE_TEXT, shortTitleText); intent.putExtra(EXTRA_NO_HEADERS, true); return intent; } /** * Like {@link #startWithFragment(String, Bundle, Fragment, int, int, int)} * but uses a 0 titleRes. Loading Loading @@ -1063,6 +1100,18 @@ public abstract class PreferenceActivity extends ListActivity implements } } // fix for title text for startPreferencePanel in a single pane mode /** @hide */ public void startWithFragment(String fragmentName, Bundle args, Fragment resultTo, int resultRequestCode, CharSequence titleText, CharSequence shortTitleText) { Intent intent = onBuildStartFragmentIntent(fragmentName, args, titleText, shortTitleText); if (resultTo == null) { startActivity(intent); } else { resultTo.startActivityForResult(intent, resultRequestCode); } } /** * Change the base title of the bread crumbs for the current preferences. * This will normally be called for you. See Loading Loading @@ -1253,7 +1302,12 @@ public abstract class PreferenceActivity extends ListActivity implements public void startPreferencePanel(String fragmentClass, Bundle args, int titleRes, CharSequence titleText, Fragment resultTo, int resultRequestCode) { if (mSinglePane) { // fix for title text for startPreferencePanel in a single pane mode if (titleRes == 0 && titleText != null) { startWithFragment(fragmentClass, args, resultTo, resultRequestCode, titleText, null); } else { startWithFragment(fragmentClass, args, resultTo, resultRequestCode, titleRes, 0); } } else { Fragment f = Fragment.instantiate(this, fragmentClass, args); if (resultTo != null) { Loading