Loading api/current.xml +60 −0 Original line number Diff line number Diff line Loading @@ -153982,6 +153982,17 @@ visibility="public" > </method> <method name="getTitleRes" return="int" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="getView" return="android.view.View" abstract="false" Loading Loading @@ -154889,6 +154900,10 @@ </parameter> <parameter name="args" type="android.os.Bundle"> </parameter> <parameter name="titleRes" type="int"> </parameter> <parameter name="shortTitleRes" type="int"> </parameter> </method> <method name="onGetInitialHeader" return="android.preference.PreferenceActivity.Header" Loading Loading @@ -155094,6 +155109,29 @@ <parameter name="resultRequestCode" type="int"> </parameter> </method> <method name="startWithFragment" return="void" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="fragmentName" type="java.lang.String"> </parameter> <parameter name="args" type="android.os.Bundle"> </parameter> <parameter name="resultTo" type="android.app.Fragment"> </parameter> <parameter name="resultRequestCode" type="int"> </parameter> <parameter name="titleRes" type="int"> </parameter> <parameter name="shortTitleRes" type="int"> </parameter> </method> <method name="switchToHeader" return="void" abstract="false" Loading Loading @@ -155155,6 +155193,28 @@ visibility="public" > </field> <field name="EXTRA_SHOW_FRAGMENT_SHORT_TITLE" type="java.lang.String" transient="false" volatile="false" value="":android:show_fragment_short_title"" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="EXTRA_SHOW_FRAGMENT_TITLE" type="java.lang.String" transient="false" volatile="false" value="":android:show_fragment_title"" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="HEADER_ID_UNDEFINED" type="long" transient="false" core/java/android/preference/Preference.java +15 −0 Original line number Diff line number Diff line Loading @@ -89,6 +89,7 @@ public class Preference implements Comparable<Preference>, OnDependencyChangeLis private int mOrder = DEFAULT_ORDER; private CharSequence mTitle; private int mTitleRes; private CharSequence mSummary; /** * mIconResId is overridden by mIcon, if mIcon is specified. Loading Loading @@ -214,6 +215,7 @@ public class Preference implements Comparable<Preference>, OnDependencyChangeLis break; case com.android.internal.R.styleable.Preference_title: mTitleRes = a.getResourceId(attr, 0); mTitle = a.getString(attr); break; Loading Loading @@ -582,6 +584,7 @@ public class Preference implements Comparable<Preference>, OnDependencyChangeLis */ public void setTitle(CharSequence title) { if (title == null && mTitle != null || title != null && !title.equals(mTitle)) { mTitleRes = 0; mTitle = title; notifyChanged(); } Loading @@ -595,6 +598,18 @@ public class Preference implements Comparable<Preference>, OnDependencyChangeLis */ public void setTitle(int titleResId) { setTitle(mContext.getString(titleResId)); mTitleRes = titleResId; } /** * Returns the title resource ID of this Preference. If the title did * not come from a resource, 0 is returned. * * @return The title resource. * @see #setTitle(int) */ public int getTitleRes() { return mTitleRes; } /** Loading core/java/android/preference/PreferenceActivity.java +79 −19 Original line number Diff line number Diff line Loading @@ -132,12 +132,27 @@ public abstract class PreferenceActivity extends ListActivity implements /** * When starting this activity and using {@link #EXTRA_SHOW_FRAGMENT}, * this extra can also be specify to supply a Bundle of arguments to pass * this extra can also be specified to supply a Bundle of arguments to pass * to that fragment when it is instantiated during the initial creation * of PreferenceActivity. */ public static final String EXTRA_SHOW_FRAGMENT_ARGUMENTS = ":android:show_fragment_args"; /** * When starting this activity and using {@link #EXTRA_SHOW_FRAGMENT}, * this extra can also be specify to supply the title to be shown for * that fragment. */ public static final String EXTRA_SHOW_FRAGMENT_TITLE = ":android:show_fragment_title"; /** * 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 * that fragment. */ public static final String EXTRA_SHOW_FRAGMENT_SHORT_TITLE = ":android:show_fragment_short_title"; /** * 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 @@ -488,7 +503,12 @@ public abstract class PreferenceActivity extends ListActivity implements protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getResources().getConfiguration().isLayoutSizeAtLeast( Configuration.SCREENLAYOUT_SIZE_LARGE)) { setContentView(com.android.internal.R.layout.preference_list_content_large); } else { setContentView(com.android.internal.R.layout.preference_list_content); } mListFooter = (FrameLayout)findViewById(com.android.internal.R.id.list_footer); mPrefsContainer = (ViewGroup) findViewById(com.android.internal.R.id.prefs_frame); Loading @@ -496,6 +516,8 @@ public abstract class PreferenceActivity extends ListActivity implements mSinglePane = hidingHeaders || !onIsMultiPane(); String initialFragment = getIntent().getStringExtra(EXTRA_SHOW_FRAGMENT); Bundle initialArguments = getIntent().getBundleExtra(EXTRA_SHOW_FRAGMENT_ARGUMENTS); int initialTitle = getIntent().getIntExtra(EXTRA_SHOW_FRAGMENT_TITLE, 0); int initialShortTitle = getIntent().getIntExtra(EXTRA_SHOW_FRAGMENT_SHORT_TITLE, 0); if (savedInstanceState != null) { // We are restarting from a previous saved state; used that to Loading @@ -516,6 +538,12 @@ public abstract class PreferenceActivity extends ListActivity implements // new fragment mode, but don't need to compute and show // the headers. switchToHeader(initialFragment, initialArguments); if (initialTitle != 0) { CharSequence initialTitleStr = getText(initialTitle); CharSequence initialShortTitleStr = initialShortTitle != 0 ? getText(initialShortTitle) : null; showBreadCrumbs(initialTitleStr, initialShortTitleStr); } } else { // We need to try to build the headers. Loading Loading @@ -557,7 +585,12 @@ public abstract class PreferenceActivity extends ListActivity implements } else { // If there are no headers, we are in the old "just show a screen // of preferences" mode. if (getResources().getConfiguration().isLayoutSizeAtLeast( Configuration.SCREENLAYOUT_SIZE_LARGE)) { setContentView(com.android.internal.R.layout.preference_list_content_single_large); } else { setContentView(com.android.internal.R.layout.preference_list_content_single); } mListFooter = (FrameLayout) findViewById(com.android.internal.R.id.list_footer); mPrefsContainer = (ViewGroup) findViewById(com.android.internal.R.id.prefs); mPreferenceManager = new PreferenceManager(this, FIRST_REQUEST_CODE); Loading Loading @@ -942,7 +975,8 @@ public abstract class PreferenceActivity extends ListActivity implements /** * Called when the user selects an item in the header list. The default * implementation will call either {@link #startWithFragment(String, Bundle, Fragment, int)} * implementation will call either * {@link #startWithFragment(String, Bundle, Fragment, int, int, int)} * or {@link #switchToHeader(Header)} as appropriate. * * @param header The header that was selected. Loading @@ -951,7 +985,14 @@ public abstract class PreferenceActivity extends ListActivity implements public void onHeaderClick(Header header, int position) { if (header.fragment != null) { if (mSinglePane) { startWithFragment(header.fragment, header.fragmentArguments, null, 0); int titleRes = header.breadCrumbTitleRes; int shortTitleRes = header.breadCrumbShortTitleRes; if (titleRes == 0) { titleRes = header.titleRes; shortTitleRes = 0; } startWithFragment(header.fragment, header.fragmentArguments, null, 0, titleRes, shortTitleRes); } else { switchToHeader(header); } Loading @@ -961,7 +1002,7 @@ public abstract class PreferenceActivity extends ListActivity implements } /** * Called by {@link #startWithFragment(String, Bundle, Fragment, int)} when * Called by {@link #startWithFragment(String, Bundle, Fragment, int, int, int)} when * in single-pane mode, to build an Intent to launch a new activity showing * the selected fragment. The default implementation constructs an Intent * that re-launches the current activity with the appropriate arguments to Loading @@ -969,18 +1010,32 @@ public abstract class PreferenceActivity extends ListActivity implements * * @param fragmentName The name of the fragment to display. * @param args Optional arguments to supply to the fragment. * @param titleRes Optional resource ID of title to show for this item. * @param titleRes Optional resource ID of short title to show for this item. * @return Returns an Intent that can be launched to display the given * fragment. */ public Intent onBuildStartFragmentIntent(String fragmentName, Bundle args) { public Intent onBuildStartFragmentIntent(String fragmentName, Bundle args, int titleRes, int shortTitleRes) { 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, titleRes); intent.putExtra(EXTRA_SHOW_FRAGMENT_SHORT_TITLE, shortTitleRes); intent.putExtra(EXTRA_NO_HEADERS, true); return intent; } /** * Like {@link #startWithFragment(String, Bundle, Fragment, int, int, int)} * but uses a 0 titleRes. */ public void startWithFragment(String fragmentName, Bundle args, Fragment resultTo, int resultRequestCode) { startWithFragment(fragmentName, args, resultTo, resultRequestCode, 0, 0); } /** * Start a new instance of this activity, showing only the given * preference fragment. When launched in this mode, the header list Loading @@ -993,10 +1048,14 @@ public abstract class PreferenceActivity extends ListActivity implements * 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 * this set of preferences. * @param titleRes Resource ID of string to display for the short title of * this set of preferences. */ public void startWithFragment(String fragmentName, Bundle args, Fragment resultTo, int resultRequestCode) { Intent intent = onBuildStartFragmentIntent(fragmentName, args); Fragment resultTo, int resultRequestCode, int titleRes, int shortTitleRes) { Intent intent = onBuildStartFragmentIntent(fragmentName, args, titleRes, shortTitleRes); if (resultTo == null) { startActivity(intent); } else { Loading @@ -1013,16 +1072,16 @@ public abstract class PreferenceActivity extends ListActivity implements if (mFragmentBreadCrumbs == null) { View crumbs = findViewById(android.R.id.title); // For screens with a different kind of title, don't create breadcrumbs. if (!(crumbs instanceof FragmentBreadCrumbs)) return; mFragmentBreadCrumbs = (FragmentBreadCrumbs) findViewById(android.R.id.title); try { mFragmentBreadCrumbs = (FragmentBreadCrumbs)crumbs; } catch (ClassCastException e) { return; } if (mFragmentBreadCrumbs == null) { mFragmentBreadCrumbs = new FragmentBreadCrumbs(this); ActionBar actionBar = getActionBar(); if (actionBar != null) { actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM, ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_CUSTOM); actionBar.setCustomView(mFragmentBreadCrumbs); if (title != null) { setTitle(title); } return; } mFragmentBreadCrumbs.setMaxVisible(2); mFragmentBreadCrumbs.setActivity(this); Loading Loading @@ -1190,7 +1249,7 @@ public abstract class PreferenceActivity extends ListActivity implements public void startPreferencePanel(String fragmentClass, Bundle args, int titleRes, CharSequence titleText, Fragment resultTo, int resultRequestCode) { if (mSinglePane) { startWithFragment(fragmentClass, args, resultTo, resultRequestCode); startWithFragment(fragmentClass, args, resultTo, resultRequestCode, titleRes, 0); } else { Fragment f = Fragment.instantiate(this, fragmentClass, args); if (resultTo != null) { Loading Loading @@ -1236,7 +1295,8 @@ public abstract class PreferenceActivity extends ListActivity implements @Override public boolean onPreferenceStartFragment(PreferenceFragment caller, Preference pref) { startPreferencePanel(pref.getFragment(), pref.getExtras(), 0, pref.getTitle(), null, 0); startPreferencePanel(pref.getFragment(), pref.getExtras(), pref.getTitleRes(), pref.getTitle(), null, 0); return true; } Loading core/java/android/preference/PreferenceFragment.java +9 −2 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import android.app.Activity; import android.app.Fragment; import android.content.Intent; import android.content.SharedPreferences; import android.content.res.Configuration; import android.os.Bundle; import android.os.Handler; import android.os.Message; Loading Loading @@ -151,9 +152,15 @@ public abstract class PreferenceFragment extends Fragment implements @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (getResources().getConfiguration().isLayoutSizeAtLeast( Configuration.SCREENLAYOUT_SIZE_LARGE)) { return inflater.inflate(com.android.internal.R.layout.preference_list_fragment_large, container, false); } else { return inflater.inflate(com.android.internal.R.layout.preference_list_fragment, container, false); } } @Override public void onActivityCreated(Bundle savedInstanceState) { Loading core/res/res/layout/preference_list_content.xml +0 −26 Original line number Diff line number Diff line Loading @@ -36,8 +36,6 @@ android:layout_height="match_parent" android:layout_marginRight="@dimen/preference_screen_side_margin_negative" android:layout_marginLeft="@dimen/preference_screen_side_margin" android:layout_marginTop="32dp" android:layout_marginBottom="32dp" android:layout_weight="10"> <ListView android:id="@android:id/list" Loading @@ -61,33 +59,9 @@ android:layout_width="0px" android:layout_height="match_parent" android:layout_weight="20" android:layout_marginLeft="@dimen/preference_screen_side_margin" android:layout_marginRight="@dimen/preference_screen_side_margin" android:layout_marginTop="16dp" android:layout_marginBottom="16dp" android:background="?attr/detailsElementBackground" android:orientation="vertical" android:visibility="gone" > <!-- Breadcrumb inserted here --> <android.app.FragmentBreadCrumbs android:id="@android:id/title" android:layout_height="72dip" android:layout_width="match_parent" android:paddingTop="16dip" android:paddingBottom="8dip" android:gravity="center_vertical|left" android:layout_marginLeft="48dip" android:layout_marginRight="48dip" /> <ImageView android:layout_width="match_parent" android:layout_height="1dip" android:paddingLeft="32dip" android:paddingRight="32dip" android:src="#404040" /> <android.preference.PreferenceFrameLayout android:id="@+id/prefs" android:layout_width="match_parent" android:layout_height="0dip" Loading Loading
api/current.xml +60 −0 Original line number Diff line number Diff line Loading @@ -153982,6 +153982,17 @@ visibility="public" > </method> <method name="getTitleRes" return="int" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="getView" return="android.view.View" abstract="false" Loading Loading @@ -154889,6 +154900,10 @@ </parameter> <parameter name="args" type="android.os.Bundle"> </parameter> <parameter name="titleRes" type="int"> </parameter> <parameter name="shortTitleRes" type="int"> </parameter> </method> <method name="onGetInitialHeader" return="android.preference.PreferenceActivity.Header" Loading Loading @@ -155094,6 +155109,29 @@ <parameter name="resultRequestCode" type="int"> </parameter> </method> <method name="startWithFragment" return="void" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="fragmentName" type="java.lang.String"> </parameter> <parameter name="args" type="android.os.Bundle"> </parameter> <parameter name="resultTo" type="android.app.Fragment"> </parameter> <parameter name="resultRequestCode" type="int"> </parameter> <parameter name="titleRes" type="int"> </parameter> <parameter name="shortTitleRes" type="int"> </parameter> </method> <method name="switchToHeader" return="void" abstract="false" Loading Loading @@ -155155,6 +155193,28 @@ visibility="public" > </field> <field name="EXTRA_SHOW_FRAGMENT_SHORT_TITLE" type="java.lang.String" transient="false" volatile="false" value="":android:show_fragment_short_title"" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="EXTRA_SHOW_FRAGMENT_TITLE" type="java.lang.String" transient="false" volatile="false" value="":android:show_fragment_title"" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="HEADER_ID_UNDEFINED" type="long" transient="false"
core/java/android/preference/Preference.java +15 −0 Original line number Diff line number Diff line Loading @@ -89,6 +89,7 @@ public class Preference implements Comparable<Preference>, OnDependencyChangeLis private int mOrder = DEFAULT_ORDER; private CharSequence mTitle; private int mTitleRes; private CharSequence mSummary; /** * mIconResId is overridden by mIcon, if mIcon is specified. Loading Loading @@ -214,6 +215,7 @@ public class Preference implements Comparable<Preference>, OnDependencyChangeLis break; case com.android.internal.R.styleable.Preference_title: mTitleRes = a.getResourceId(attr, 0); mTitle = a.getString(attr); break; Loading Loading @@ -582,6 +584,7 @@ public class Preference implements Comparable<Preference>, OnDependencyChangeLis */ public void setTitle(CharSequence title) { if (title == null && mTitle != null || title != null && !title.equals(mTitle)) { mTitleRes = 0; mTitle = title; notifyChanged(); } Loading @@ -595,6 +598,18 @@ public class Preference implements Comparable<Preference>, OnDependencyChangeLis */ public void setTitle(int titleResId) { setTitle(mContext.getString(titleResId)); mTitleRes = titleResId; } /** * Returns the title resource ID of this Preference. If the title did * not come from a resource, 0 is returned. * * @return The title resource. * @see #setTitle(int) */ public int getTitleRes() { return mTitleRes; } /** Loading
core/java/android/preference/PreferenceActivity.java +79 −19 Original line number Diff line number Diff line Loading @@ -132,12 +132,27 @@ public abstract class PreferenceActivity extends ListActivity implements /** * When starting this activity and using {@link #EXTRA_SHOW_FRAGMENT}, * this extra can also be specify to supply a Bundle of arguments to pass * this extra can also be specified to supply a Bundle of arguments to pass * to that fragment when it is instantiated during the initial creation * of PreferenceActivity. */ public static final String EXTRA_SHOW_FRAGMENT_ARGUMENTS = ":android:show_fragment_args"; /** * When starting this activity and using {@link #EXTRA_SHOW_FRAGMENT}, * this extra can also be specify to supply the title to be shown for * that fragment. */ public static final String EXTRA_SHOW_FRAGMENT_TITLE = ":android:show_fragment_title"; /** * 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 * that fragment. */ public static final String EXTRA_SHOW_FRAGMENT_SHORT_TITLE = ":android:show_fragment_short_title"; /** * 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 @@ -488,7 +503,12 @@ public abstract class PreferenceActivity extends ListActivity implements protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getResources().getConfiguration().isLayoutSizeAtLeast( Configuration.SCREENLAYOUT_SIZE_LARGE)) { setContentView(com.android.internal.R.layout.preference_list_content_large); } else { setContentView(com.android.internal.R.layout.preference_list_content); } mListFooter = (FrameLayout)findViewById(com.android.internal.R.id.list_footer); mPrefsContainer = (ViewGroup) findViewById(com.android.internal.R.id.prefs_frame); Loading @@ -496,6 +516,8 @@ public abstract class PreferenceActivity extends ListActivity implements mSinglePane = hidingHeaders || !onIsMultiPane(); String initialFragment = getIntent().getStringExtra(EXTRA_SHOW_FRAGMENT); Bundle initialArguments = getIntent().getBundleExtra(EXTRA_SHOW_FRAGMENT_ARGUMENTS); int initialTitle = getIntent().getIntExtra(EXTRA_SHOW_FRAGMENT_TITLE, 0); int initialShortTitle = getIntent().getIntExtra(EXTRA_SHOW_FRAGMENT_SHORT_TITLE, 0); if (savedInstanceState != null) { // We are restarting from a previous saved state; used that to Loading @@ -516,6 +538,12 @@ public abstract class PreferenceActivity extends ListActivity implements // new fragment mode, but don't need to compute and show // the headers. switchToHeader(initialFragment, initialArguments); if (initialTitle != 0) { CharSequence initialTitleStr = getText(initialTitle); CharSequence initialShortTitleStr = initialShortTitle != 0 ? getText(initialShortTitle) : null; showBreadCrumbs(initialTitleStr, initialShortTitleStr); } } else { // We need to try to build the headers. Loading Loading @@ -557,7 +585,12 @@ public abstract class PreferenceActivity extends ListActivity implements } else { // If there are no headers, we are in the old "just show a screen // of preferences" mode. if (getResources().getConfiguration().isLayoutSizeAtLeast( Configuration.SCREENLAYOUT_SIZE_LARGE)) { setContentView(com.android.internal.R.layout.preference_list_content_single_large); } else { setContentView(com.android.internal.R.layout.preference_list_content_single); } mListFooter = (FrameLayout) findViewById(com.android.internal.R.id.list_footer); mPrefsContainer = (ViewGroup) findViewById(com.android.internal.R.id.prefs); mPreferenceManager = new PreferenceManager(this, FIRST_REQUEST_CODE); Loading Loading @@ -942,7 +975,8 @@ public abstract class PreferenceActivity extends ListActivity implements /** * Called when the user selects an item in the header list. The default * implementation will call either {@link #startWithFragment(String, Bundle, Fragment, int)} * implementation will call either * {@link #startWithFragment(String, Bundle, Fragment, int, int, int)} * or {@link #switchToHeader(Header)} as appropriate. * * @param header The header that was selected. Loading @@ -951,7 +985,14 @@ public abstract class PreferenceActivity extends ListActivity implements public void onHeaderClick(Header header, int position) { if (header.fragment != null) { if (mSinglePane) { startWithFragment(header.fragment, header.fragmentArguments, null, 0); int titleRes = header.breadCrumbTitleRes; int shortTitleRes = header.breadCrumbShortTitleRes; if (titleRes == 0) { titleRes = header.titleRes; shortTitleRes = 0; } startWithFragment(header.fragment, header.fragmentArguments, null, 0, titleRes, shortTitleRes); } else { switchToHeader(header); } Loading @@ -961,7 +1002,7 @@ public abstract class PreferenceActivity extends ListActivity implements } /** * Called by {@link #startWithFragment(String, Bundle, Fragment, int)} when * Called by {@link #startWithFragment(String, Bundle, Fragment, int, int, int)} when * in single-pane mode, to build an Intent to launch a new activity showing * the selected fragment. The default implementation constructs an Intent * that re-launches the current activity with the appropriate arguments to Loading @@ -969,18 +1010,32 @@ public abstract class PreferenceActivity extends ListActivity implements * * @param fragmentName The name of the fragment to display. * @param args Optional arguments to supply to the fragment. * @param titleRes Optional resource ID of title to show for this item. * @param titleRes Optional resource ID of short title to show for this item. * @return Returns an Intent that can be launched to display the given * fragment. */ public Intent onBuildStartFragmentIntent(String fragmentName, Bundle args) { public Intent onBuildStartFragmentIntent(String fragmentName, Bundle args, int titleRes, int shortTitleRes) { 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, titleRes); intent.putExtra(EXTRA_SHOW_FRAGMENT_SHORT_TITLE, shortTitleRes); intent.putExtra(EXTRA_NO_HEADERS, true); return intent; } /** * Like {@link #startWithFragment(String, Bundle, Fragment, int, int, int)} * but uses a 0 titleRes. */ public void startWithFragment(String fragmentName, Bundle args, Fragment resultTo, int resultRequestCode) { startWithFragment(fragmentName, args, resultTo, resultRequestCode, 0, 0); } /** * Start a new instance of this activity, showing only the given * preference fragment. When launched in this mode, the header list Loading @@ -993,10 +1048,14 @@ public abstract class PreferenceActivity extends ListActivity implements * 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 * this set of preferences. * @param titleRes Resource ID of string to display for the short title of * this set of preferences. */ public void startWithFragment(String fragmentName, Bundle args, Fragment resultTo, int resultRequestCode) { Intent intent = onBuildStartFragmentIntent(fragmentName, args); Fragment resultTo, int resultRequestCode, int titleRes, int shortTitleRes) { Intent intent = onBuildStartFragmentIntent(fragmentName, args, titleRes, shortTitleRes); if (resultTo == null) { startActivity(intent); } else { Loading @@ -1013,16 +1072,16 @@ public abstract class PreferenceActivity extends ListActivity implements if (mFragmentBreadCrumbs == null) { View crumbs = findViewById(android.R.id.title); // For screens with a different kind of title, don't create breadcrumbs. if (!(crumbs instanceof FragmentBreadCrumbs)) return; mFragmentBreadCrumbs = (FragmentBreadCrumbs) findViewById(android.R.id.title); try { mFragmentBreadCrumbs = (FragmentBreadCrumbs)crumbs; } catch (ClassCastException e) { return; } if (mFragmentBreadCrumbs == null) { mFragmentBreadCrumbs = new FragmentBreadCrumbs(this); ActionBar actionBar = getActionBar(); if (actionBar != null) { actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM, ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_CUSTOM); actionBar.setCustomView(mFragmentBreadCrumbs); if (title != null) { setTitle(title); } return; } mFragmentBreadCrumbs.setMaxVisible(2); mFragmentBreadCrumbs.setActivity(this); Loading Loading @@ -1190,7 +1249,7 @@ public abstract class PreferenceActivity extends ListActivity implements public void startPreferencePanel(String fragmentClass, Bundle args, int titleRes, CharSequence titleText, Fragment resultTo, int resultRequestCode) { if (mSinglePane) { startWithFragment(fragmentClass, args, resultTo, resultRequestCode); startWithFragment(fragmentClass, args, resultTo, resultRequestCode, titleRes, 0); } else { Fragment f = Fragment.instantiate(this, fragmentClass, args); if (resultTo != null) { Loading Loading @@ -1236,7 +1295,8 @@ public abstract class PreferenceActivity extends ListActivity implements @Override public boolean onPreferenceStartFragment(PreferenceFragment caller, Preference pref) { startPreferencePanel(pref.getFragment(), pref.getExtras(), 0, pref.getTitle(), null, 0); startPreferencePanel(pref.getFragment(), pref.getExtras(), pref.getTitleRes(), pref.getTitle(), null, 0); return true; } Loading
core/java/android/preference/PreferenceFragment.java +9 −2 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import android.app.Activity; import android.app.Fragment; import android.content.Intent; import android.content.SharedPreferences; import android.content.res.Configuration; import android.os.Bundle; import android.os.Handler; import android.os.Message; Loading Loading @@ -151,9 +152,15 @@ public abstract class PreferenceFragment extends Fragment implements @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (getResources().getConfiguration().isLayoutSizeAtLeast( Configuration.SCREENLAYOUT_SIZE_LARGE)) { return inflater.inflate(com.android.internal.R.layout.preference_list_fragment_large, container, false); } else { return inflater.inflate(com.android.internal.R.layout.preference_list_fragment, container, false); } } @Override public void onActivityCreated(Bundle savedInstanceState) { Loading
core/res/res/layout/preference_list_content.xml +0 −26 Original line number Diff line number Diff line Loading @@ -36,8 +36,6 @@ android:layout_height="match_parent" android:layout_marginRight="@dimen/preference_screen_side_margin_negative" android:layout_marginLeft="@dimen/preference_screen_side_margin" android:layout_marginTop="32dp" android:layout_marginBottom="32dp" android:layout_weight="10"> <ListView android:id="@android:id/list" Loading @@ -61,33 +59,9 @@ android:layout_width="0px" android:layout_height="match_parent" android:layout_weight="20" android:layout_marginLeft="@dimen/preference_screen_side_margin" android:layout_marginRight="@dimen/preference_screen_side_margin" android:layout_marginTop="16dp" android:layout_marginBottom="16dp" android:background="?attr/detailsElementBackground" android:orientation="vertical" android:visibility="gone" > <!-- Breadcrumb inserted here --> <android.app.FragmentBreadCrumbs android:id="@android:id/title" android:layout_height="72dip" android:layout_width="match_parent" android:paddingTop="16dip" android:paddingBottom="8dip" android:gravity="center_vertical|left" android:layout_marginLeft="48dip" android:layout_marginRight="48dip" /> <ImageView android:layout_width="match_parent" android:layout_height="1dip" android:paddingLeft="32dip" android:paddingRight="32dip" android:src="#404040" /> <android.preference.PreferenceFrameLayout android:id="@+id/prefs" android:layout_width="match_parent" android:layout_height="0dip" Loading