Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b1a6e439 authored by Dianne Hackborn's avatar Dianne Hackborn
Browse files

Add new PreferenceActivity API for settings.

Need to redirect to a different activity when on non-xlarge screens.

Change-Id: I8cf4793b117325604d29ecc4478dbf10322a4689
parent e196481d
Loading
Loading
Loading
Loading
+16 −1
Original line number Diff line number Diff line
@@ -154794,6 +154794,21 @@
<parameter name="target" type="java.util.List&lt;android.preference.PreferenceActivity.Header&gt;">
</parameter>
</method>
<method name="onBuildStartFragmentIntent"
 return="android.content.Intent"
 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>
</method>
<method name="onGetInitialHeader"
 return="android.preference.PreferenceActivity.Header"
 abstract="false"
@@ -267130,7 +267145,7 @@
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="t" type="T">
<parameter name="arg0" type="T">
</parameter>
</method>
</interface>
+26 −5
Original line number Diff line number Diff line
@@ -960,6 +960,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
@@ -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 {