summaryrefslogtreecommitdiffstats
path: root/core/java
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2011-03-15 16:23:01 -0700
committerDianne Hackborn <hackbod@google.com>2011-03-15 16:23:01 -0700
commitb1a6e439f63e4fa2b07a4905f00b6badf58e6420 (patch)
tree72b22bb719e02a85ae6457c06894f1a36239f234 /core/java
parente196481d59982664247bc18d5743727965362dfa (diff)
downloadframeworks_base-b1a6e439f63e4fa2b07a4905f00b6badf58e6420.zip
frameworks_base-b1a6e439f63e4fa2b07a4905f00b6badf58e6420.tar.gz
frameworks_base-b1a6e439f63e4fa2b07a4905f00b6badf58e6420.tar.bz2
Add new PreferenceActivity API for settings.
Need to redirect to a different activity when on non-xlarge screens. Change-Id: I8cf4793b117325604d29ecc4478dbf10322a4689
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/preference/PreferenceActivity.java31
1 files changed, 26 insertions, 5 deletions
diff --git a/core/java/android/preference/PreferenceActivity.java b/core/java/android/preference/PreferenceActivity.java
index ad0bc84..db50bfc 100644
--- a/core/java/android/preference/PreferenceActivity.java
+++ b/core/java/android/preference/PreferenceActivity.java
@@ -961,6 +961,27 @@ public abstract class PreferenceActivity extends ListActivity implements
}
/**
+ * Called by {@link #startWithFragment(String, Bundle, Fragment, 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
+ * display the fragment.
+ *
+ * @param fragmentName The name of the fragment to display.
+ * @param args Optional arguments to supply to the fragment.
+ * @return Returns an Intent that can be launched to display the given
+ * fragment.
+ */
+ public Intent onBuildStartFragmentIntent(String fragmentName, Bundle args) {
+ 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_NO_HEADERS, true);
+ return intent;
+ }
+
+ /**
* Start a new instance of this activity, showing only the given
* preference fragment. When launched in this mode, the header list
* will be hidden and the given preference fragment will be instantiated
@@ -968,14 +989,14 @@ 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 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.
*/
public void startWithFragment(String fragmentName, Bundle args,
Fragment resultTo, int resultRequestCode) {
- 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_NO_HEADERS, true);
+ Intent intent = onBuildStartFragmentIntent(fragmentName, args);
if (resultTo == null) {
startActivity(intent);
} else {