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

Commit 9f72756f authored by Fabrice Di Meglio's avatar Fabrice Di Meglio Committed by Android (Google) Code Review
Browse files

Merge "Fix bug #14499324 Label of the "Language & input " page doesn't get...

Merge "Fix bug #14499324 Label of the "Language & input " page doesn't get updated ...as per the newly selected language" into lmp-preview-dev
parents 8b9fb64d a9e77993
Loading
Loading
Loading
Loading
+44 −26
Original line number Diff line number Diff line
@@ -175,10 +175,11 @@ public class SettingsActivity extends Activity

    /**
     * When starting this activity and using {@link #EXTRA_SHOW_FRAGMENT},
     * this extra can also be specify to supply the title to be shown for
     * those extra can also be specify to supply the title or title res id to be shown for
     * that fragment.
     */
    public static final String EXTRA_SHOW_FRAGMENT_TITLE = ":settings:show_fragment_title";
    public static final String EXTRA_SHOW_FRAGMENT_TITLE_RESID = ":settings:show_fragment_title_resid";

    private static final String META_DATA_KEY_FRAGMENT_CLASS =
        "com.android.settings.FRAGMENT_CLASS";
@@ -192,6 +193,7 @@ public class SettingsActivity extends Activity
    private String mFragmentClass;

    private CharSequence mInitialTitle;
    private int mInitialTitleResId;

    // Show only these settings for restricted users
    private int[] SETTINGS_FOR_RESTRICTED = {
@@ -478,9 +480,7 @@ public class SettingsActivity extends Activity
            mSearchMenuItemExpanded = savedState.getBoolean(SAVE_KEY_SEARCH_MENU_EXPANDED);
            mSearchQuery = savedState.getString(SAVE_KEY_SEARCH_QUERY);

            final String initialTitle = getIntent().getStringExtra(EXTRA_SHOW_FRAGMENT_TITLE);
            mInitialTitle = (initialTitle != null) ? initialTitle : getTitle();
            setTitle(mInitialTitle);
            setTitleFromIntent(getIntent());

            ArrayList<DashboardCategory> categories =
                    savedState.getParcelableArrayList(SAVE_KEY_CATEGORIES);
@@ -500,19 +500,17 @@ public class SettingsActivity extends Activity
                    mDisplayHomeAsUpEnabled = false;
                    mDisplaySearch = false;
                }
                final String initialTitle = getIntent().getStringExtra(EXTRA_SHOW_FRAGMENT_TITLE);
                mInitialTitle = (initialTitle != null) ? initialTitle : getTitle();
                setTitle(mInitialTitle);
                setTitleFromIntent(getIntent());

                Bundle initialArguments = getIntent().getBundleExtra(EXTRA_SHOW_FRAGMENT_ARGUMENTS);
                switchToFragment(initialFragmentName, initialArguments, true, false,
                        mInitialTitle, false);
                        mInitialTitleResId, mInitialTitle, false);
            } else {
                // No UP if we are displaying the main Dashboard
                mDisplayHomeAsUpEnabled = false;
                mInitialTitle = getText(R.string.dashboard_title);
                mInitialTitleResId = R.string.dashboard_title;
                switchToFragment(DashboardSummary.class.getName(), null, false, false,
                        mInitialTitle, false);
                        mInitialTitleResId, mInitialTitle, false);
            }
        }

@@ -579,6 +577,20 @@ public class SettingsActivity extends Activity
        }
    }

    private void setTitleFromIntent(Intent intent) {
        final int initialTitleResId = intent.getIntExtra(EXTRA_SHOW_FRAGMENT_TITLE_RESID, -1);
        if (initialTitleResId > 0) {
            mInitialTitle = null;
            mInitialTitleResId = initialTitleResId;
            setTitle(mInitialTitleResId);
        } else {
            mInitialTitleResId = -1;
            final String initialTitle = intent.getStringExtra(EXTRA_SHOW_FRAGMENT_TITLE);
            mInitialTitle = (initialTitle != null) ? initialTitle : getTitle();
            setTitle(mInitialTitle);
        }
    }

    @Override
    public void onBackStackChanged() {
        setTitleFromBackStack();
@@ -588,7 +600,11 @@ public class SettingsActivity extends Activity
        final int count = getFragmentManager().getBackStackEntryCount();

        if (count == 0) {
            if (mInitialTitleResId > 0) {
                setTitle(mInitialTitleResId);
            } else {
                setTitle(mInitialTitle);
            }
            return 0;
        }

@@ -753,16 +769,17 @@ public class SettingsActivity extends Activity
     */
    public void startPreferencePanel(String fragmentClass, Bundle args, int titleRes,
            CharSequence titleText, Fragment resultTo, int resultRequestCode) {
        String title;
        if (titleRes > 0) {
            title = getString(titleRes);
        } else if (titleText != null) {
        String title = null;
        if (titleRes < 0) {
            if (titleText != null) {
                title = titleText.toString();
            } else {
                // There not much we can do in that case
                title = "";
            }
        Utils.startWithFragment(this, fragmentClass, args, resultTo, resultRequestCode, title);
        }
        Utils.startWithFragment(this, fragmentClass, args, resultTo, resultRequestCode,
                titleRes, title);
    }

    /**
@@ -801,7 +818,7 @@ public class SettingsActivity extends Activity
     * Switch to a specific Fragment with taking care of validation, Title and BackStack
     */
    private Fragment switchToFragment(String fragmentName, Bundle args, boolean validate,
            boolean addToBackStack, CharSequence title, boolean withTransition) {
            boolean addToBackStack, int titleResId, CharSequence title, boolean withTransition) {
        if (validate && !isValidFragment(fragmentName)) {
            throw new IllegalArgumentException("Invalid fragment for this activity: "
                    + fragmentName);
@@ -815,7 +832,9 @@ public class SettingsActivity extends Activity
        if (addToBackStack) {
            transaction.addToBackStack(SettingsActivity.BACK_STACK_PREFS);
        }
        if (title != null) {
        if (titleResId > 0) {
            transaction.setBreadCrumbTitle(titleResId);
        } else if (title != null) {
            transaction.setBreadCrumbTitle(title);
        }
        transaction.commitAllowingStateLoss();
@@ -1270,10 +1289,9 @@ public class SettingsActivity extends Activity
        if (current != null && current instanceof SearchResultsSummary) {
            mSearchResultsFragment = (SearchResultsSummary) current;
        } else {
            String title = getString(R.string.search_results_title);
            mSearchResultsFragment = (SearchResultsSummary) switchToFragment(
                    SearchResultsSummary.class.getName(), null, false, true, title,
                    true);
                    SearchResultsSummary.class.getName(), null, false, true,
                    R.string.search_results_title, null, true);
        }
        mSearchResultsFragment.setSearchView(mSearchView);
        mSearchMenuItemExpanded = true;
+10 −7
Original line number Diff line number Diff line
@@ -519,15 +519,16 @@ public class Utils {
     * @param context The context.
     * @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 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 titleResId resource id for the String to display for the title of this set
     *                   of preferences.
     * @param title String to display for the title of this set of preferences.
     */
    public static void startWithFragment(Context context, String fragmentName, Bundle args,
            Fragment resultTo, int resultRequestCode, CharSequence title) {
        Intent intent = onBuildStartFragmentIntent(context, fragmentName, args, title);
            Fragment resultTo, int resultRequestCode, int titleResId, CharSequence title) {
        Intent intent = onBuildStartFragmentIntent(context, fragmentName, args, titleResId, title);
        if (resultTo == null) {
            context.startActivity(intent);
        } else {
@@ -543,16 +544,18 @@ public class Utils {
     * @param context The Context.
     * @param fragmentName The name of the fragment to display.
     * @param args Optional arguments to supply to the fragment.
     * @param titleResId Optional title resource id to show for this item.
     * @param title Optional title to show for this item.
     * @return Returns an Intent that can be launched to display the given
     * fragment.
     */
    public static Intent onBuildStartFragmentIntent(Context context, String fragmentName,
            Bundle args, CharSequence title) {
            Bundle args, int titleResId, CharSequence title) {
        Intent intent = new Intent(Intent.ACTION_MAIN);
        intent.setClass(context, SubSettings.class);
        intent.putExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT, fragmentName);
        intent.putExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT_ARGUMENTS, args);
        intent.putExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT_TITLE_RESID, titleResId);
        intent.putExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT_TITLE, title);
        return intent;
    }
+1 −1
Original line number Diff line number Diff line
@@ -85,7 +85,7 @@ public class DashboardTileView extends FrameLayout implements View.OnClickListen
    public void onClick(View v) {
        if (mTile.fragment != null) {
            Utils.startWithFragment(getContext(), mTile.fragment, mTile.fragmentArguments, null, 0,
                    mTile.getTitle(getResources()));
                    mTile.titleRes, mTile.getTitle(getResources()));
        } else if (mTile.intent != null) {
            getContext().startActivity(mTile.intent);
        }
+1 −1
Original line number Diff line number Diff line
@@ -181,7 +181,7 @@ public class SearchResultsSummary extends Fragment {
                    Bundle args = new Bundle();
                    args.putString(SettingsActivity.EXTRA_FRAGMENT_ARG_KEY, key);

                    Utils.startWithFragment(sa, className, args, null, 0, screenTitle);
                    Utils.startWithFragment(sa, className, args, null, 0, -1, screenTitle);
                } else {
                    final Intent intent = new Intent(action);