зеркало из https://github.com/mozilla/gecko-dev.git
Bug 951054 - Invalidate the current home config when the locale changes. r=lucasr
This commit is contained in:
Родитель
8df8dbf11a
Коммит
5e8ea346b3
|
@ -1631,9 +1631,9 @@ abstract public class BrowserApp extends GeckoApp
|
||||||
@Override
|
@Override
|
||||||
public void onLocaleReady(final String locale) {
|
public void onLocaleReady(final String locale) {
|
||||||
super.onLocaleReady(locale);
|
super.onLocaleReady(locale);
|
||||||
if (isHomePagerVisible()) {
|
|
||||||
// Blow it away and rebuild it with the right strings.
|
if (mHomePager != null) {
|
||||||
mHomePager.redisplay(getSupportLoaderManager(), getSupportFragmentManager());
|
mHomePager.invalidate(getSupportLoaderManager(), getSupportFragmentManager());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mMenu != null) {
|
if (mMenu != null) {
|
||||||
|
|
|
@ -47,6 +47,9 @@ public class HomePager extends ViewPager {
|
||||||
|
|
||||||
private String mInitialPageId;
|
private String mInitialPageId;
|
||||||
|
|
||||||
|
// Whether or not we need to restart the loader when we show the HomePager.
|
||||||
|
private boolean mRestartLoader;
|
||||||
|
|
||||||
// This is mostly used by UI tests to easily fetch
|
// This is mostly used by UI tests to easily fetch
|
||||||
// specific list views at runtime.
|
// specific list views at runtime.
|
||||||
static final String LIST_TAG_HISTORY = "history";
|
static final String LIST_TAG_HISTORY = "history";
|
||||||
|
@ -154,7 +157,20 @@ public class HomePager extends ViewPager {
|
||||||
super.addView(child, index, params);
|
super.addView(child, index, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void redisplay(LoaderManager lm, FragmentManager fm) {
|
/**
|
||||||
|
* Invalidates the current configuration, redisplaying the HomePager if necessary.
|
||||||
|
*/
|
||||||
|
public void invalidate(LoaderManager lm, FragmentManager fm) {
|
||||||
|
// We need to restart the loader to load the new strings.
|
||||||
|
mRestartLoader = true;
|
||||||
|
|
||||||
|
// If the HomePager is currently visible, redisplay it with the new strings.
|
||||||
|
if (isVisible()) {
|
||||||
|
redisplay(lm, fm);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void redisplay(LoaderManager lm, FragmentManager fm) {
|
||||||
final HomeAdapter adapter = (HomeAdapter) getAdapter();
|
final HomeAdapter adapter = (HomeAdapter) getAdapter();
|
||||||
|
|
||||||
// If mInitialPageId is non-null, this means the HomePager hasn't
|
// If mInitialPageId is non-null, this means the HomePager hasn't
|
||||||
|
@ -193,8 +209,13 @@ public class HomePager extends ViewPager {
|
||||||
// list of pages in place.
|
// list of pages in place.
|
||||||
mTabStrip.setVisibility(View.INVISIBLE);
|
mTabStrip.setVisibility(View.INVISIBLE);
|
||||||
|
|
||||||
// Load list of pages from configuration
|
// Load list of pages from configuration. Restart the loader if necessary.
|
||||||
lm.initLoader(LOADER_ID_CONFIG, null, mConfigLoaderCallbacks);
|
if (mRestartLoader) {
|
||||||
|
lm.restartLoader(LOADER_ID_CONFIG, null, mConfigLoaderCallbacks);
|
||||||
|
mRestartLoader = false;
|
||||||
|
} else {
|
||||||
|
lm.initLoader(LOADER_ID_CONFIG, null, mConfigLoaderCallbacks);
|
||||||
|
}
|
||||||
|
|
||||||
if (shouldAnimate) {
|
if (shouldAnimate) {
|
||||||
animator.addPropertyAnimationListener(new PropertyAnimator.PropertyAnimationListener() {
|
animator.addPropertyAnimationListener(new PropertyAnimator.PropertyAnimationListener() {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче