Bug 1263726 - Settings title remains as "Language" after switching locale and returning to "General Settings". r=grisha

MozReview-Commit-ID: L4hPzJ7kRc5

--HG--
extra : transplant_source : %3D%EB%24M%FA%16%C0dek%C7%E8%83%88_%1F%1B%BE%BE%17
This commit is contained in:
dlim@mozilla.com 2016-06-06 16:59:09 -07:00
parent f40dcc79b5
commit 9507ce53f1
2 changed files with 9 additions and 8 deletions

View File

@ -114,6 +114,7 @@ OnSharedPreferenceChangeListener
// some devices look bad. Don't use transitions on those
// devices.
private static final boolean NO_TRANSITIONS = HardwareUtils.IS_KINDLE_DEVICE;
private static final int NO_SUCH_ID = 0;
public static final String NON_PREF_PREFIX = "android.not_a_preference.";
public static final String INTENT_EXTRA_RESOURCES = "resource";
@ -281,7 +282,12 @@ OnSharedPreferenceChangeListener
}
// Update the title to for the preference pane that we're currently showing.
setTitle(R.string.pref_category_language);
final int titleId = getIntent().getExtras().getInt(PreferenceActivity.EXTRA_SHOW_FRAGMENT_TITLE);
if (titleId != NO_SUCH_ID) {
setTitle(titleId);
} else {
throw new IllegalStateException("Title id not found in intent bundle extras");
}
// Don't finish the activity -- we just reloaded all of the
// individual parts! -- but when it returns, make sure that the
@ -428,6 +434,8 @@ OnSharedPreferenceChangeListener
// Build fragment intent.
intent.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT, GeckoPreferenceFragment.class.getName());
intent.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT_ARGUMENTS, fragmentArgs);
// Used to get fragment title when locale changes (see onLocaleChanged method above)
intent.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT_TITLE, R.string.settings_title);
}
@Override

View File

@ -6,10 +6,7 @@ package org.mozilla.gecko.tests;
import org.mozilla.gecko.Actions;
import org.mozilla.gecko.Assert;
import org.mozilla.gecko.BrowserApp;
import org.mozilla.gecko.Driver;
import org.mozilla.gecko.GeckoAppShell;
import org.mozilla.gecko.GeckoEvent;
import org.mozilla.gecko.tests.components.AboutHomeComponent;
import org.mozilla.gecko.tests.components.AppMenuComponent;
import org.mozilla.gecko.tests.components.BaseComponent;
@ -18,10 +15,6 @@ import org.mozilla.gecko.tests.components.TabStripComponent;
import org.mozilla.gecko.tests.components.ToolbarComponent;
import org.mozilla.gecko.tests.helpers.HelperInitializer;
import android.content.Intent;
import android.content.res.Resources;
import android.text.TextUtils;
import com.robotium.solo.Solo;
/**