Merge "Import revised translations."
diff --git a/res/values/config.xml b/res/values/config.xml
index ff8dede..b8040e6 100644
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -23,8 +23,8 @@
<!-- Fade/zoom in/out duration & scale in the AllApps transition.
Note: This should be less than the workspaceShrinkTime as they happen together. -->
- <integer name="config_appsCustomizeZoomInTime">700</integer>
- <integer name="config_appsCustomizeZoomOutTime">700</integer>
+ <integer name="config_appsCustomizeZoomInTime">350</integer>
+ <integer name="config_appsCustomizeZoomOutTime">600</integer>
<integer name="config_appsCustomizeZoomScaleFactor">7</integer>
<integer name="config_appsCustomizeFadeInTime">250</integer>
<integer name="config_appsCustomizeFadeOutTime">200</integer>
diff --git a/src/com/android/launcher2/AppsCustomizePagedView.java b/src/com/android/launcher2/AppsCustomizePagedView.java
index 4f5d835..4718b31 100644
--- a/src/com/android/launcher2/AppsCustomizePagedView.java
+++ b/src/com/android/launcher2/AppsCustomizePagedView.java
@@ -1360,8 +1360,14 @@
@Override
public void reset() {
- updateCurrentTab(0);
- invalidatePageData(0);
+ AppsCustomizeTabHost tabHost = getTabHost();
+ String tag = tabHost.getCurrentTabTag();
+ if (!tag.equals(tabHost.getTabTagForContentType(ContentType.Applications))) {
+ tabHost.setCurrentTabFromContent(ContentType.Applications);
+ }
+ if (mCurrentPage != 0) {
+ invalidatePageData(0);
+ }
}
private AppsCustomizeTabHost getTabHost() {
@@ -1413,14 +1419,17 @@
protected String getCurrentPageDescription() {
int page = (mNextPage != INVALID_PAGE) ? mNextPage : mCurrentPage;
int stringId = R.string.default_scroll_format;
-
+ int count = 0;
+
if (page < mNumAppsPages) {
stringId = R.string.apps_customize_apps_scroll_format;
+ count = mNumAppsPages;
} else {
page -= mNumAppsPages;
stringId = R.string.apps_customize_widgets_scroll_format;
+ count = mNumWidgetPages;
}
- return String.format(mContext.getString(stringId), page + 1, getChildCount());
+ return String.format(mContext.getString(stringId), page + 1, count);
}
}
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 6959281..6d2ec3a 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -1209,7 +1209,7 @@
}
// Reset AllApps to its initial state
- if (mAppsCustomizeTabHost != null) {
+ if (!alreadyOnHome && mAppsCustomizeTabHost != null) {
mAppsCustomizeTabHost.reset();
}
}
@@ -2188,7 +2188,6 @@
// Shrink workspaces away if going to AppsCustomize from workspace
mWorkspace.changeState(Workspace.State.SMALL, animated);
- //hideHotseat(animated);
if (animated) {
final ValueAnimator scaleAnim = ValueAnimator.ofFloat(0f, 1f).setDuration(duration);
diff --git a/src/com/android/launcher2/LauncherApplication.java b/src/com/android/launcher2/LauncherApplication.java
index ba028ef..755168c 100644
--- a/src/com/android/launcher2/LauncherApplication.java
+++ b/src/com/android/launcher2/LauncherApplication.java
@@ -58,6 +58,7 @@
filter.addAction(Intent.ACTION_EXTERNAL_APPLICATIONS_AVAILABLE);
filter.addAction(Intent.ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE);
filter.addAction(Intent.ACTION_LOCALE_CHANGED);
+ filter.addAction(Intent.ACTION_CONFIGURATION_CHANGED);
registerReceiver(mModel, filter);
filter = new IntentFilter();
filter.addAction(SearchManager.INTENT_GLOBAL_SEARCH_ACTIVITY_CHANGED);
diff --git a/src/com/android/launcher2/LauncherModel.java b/src/com/android/launcher2/LauncherModel.java
index fc31d65..3ee2732 100644
--- a/src/com/android/launcher2/LauncherModel.java
+++ b/src/com/android/launcher2/LauncherModel.java
@@ -30,6 +30,7 @@
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
+import android.content.res.Configuration;
import android.content.res.Resources;
import android.database.Cursor;
import android.graphics.Bitmap;
@@ -120,6 +121,8 @@
private static int mCellCountX;
private static int mCellCountY;
+ protected Configuration mPreviousConfig;
+
public interface Callbacks {
public boolean setLoadOnResume();
public int getCurrentWorkspaceScreen();
@@ -146,9 +149,10 @@
mDefaultIcon = Utilities.createIconBitmap(
mIconCache.getFullResDefaultActivityIcon(), app);
- mAllAppsLoadDelay = app.getResources().getInteger(R.integer.config_allAppsBatchLoadDelay);
-
- mBatchSize = app.getResources().getInteger(R.integer.config_allAppsBatchSize);
+ final Resources res = app.getResources();
+ mAllAppsLoadDelay = res.getInteger(R.integer.config_allAppsBatchLoadDelay);
+ mBatchSize = res.getInteger(R.integer.config_allAppsBatchSize);
+ mPreviousConfig = res.getConfiguration();
}
public Bitmap getFallbackIcon() {
@@ -612,14 +616,20 @@
enqueuePackageUpdated(new PackageUpdatedTask(
PackageUpdatedTask.OP_UNAVAILABLE, packages));
} else if (Intent.ACTION_LOCALE_CHANGED.equals(action)) {
- // If we have changed locale we need to clear out the labels in all apps.
- // Do this here because if the launcher activity is running it will be restarted.
- // If it's not running startLoaderFromBackground will merely tell it that it needs
- // to reload. Either way, mAllAppsLoaded will be cleared so it re-reads everything
- // next time.
- mAllAppsLoaded = false;
- mWorkspaceLoaded = false;
- startLoaderFromBackground();
+ // If we have changed locale we need to clear out the labels in all apps/workspace.
+ forceReload();
+ } else if (Intent.ACTION_CONFIGURATION_CHANGED.equals(action)) {
+ // Check if configuration change was an mcc/mnc change which would affect app resources
+ // and we would need to clear out the labels in all apps/workspace. Same handling as
+ // above for ACTION_LOCALE_CHANGED
+ Configuration currentConfig = context.getResources().getConfiguration();
+ if((mPreviousConfig.diff(currentConfig) & ActivityInfo.CONFIG_MCC) != 0){
+ Log.d(TAG, "Reload apps on config change. curr_mcc:"
+ + currentConfig.mcc + " prevmcc:" + mPreviousConfig.mcc);
+ forceReload();
+ }
+ // Update previousConfig
+ mPreviousConfig = currentConfig;
} else if (SearchManager.INTENT_GLOBAL_SEARCH_ACTIVITY_CHANGED.equals(action) ||
SearchManager.INTENT_ACTION_SEARCHABLES_CHANGED.equals(action)) {
if (mCallbacks != null) {
@@ -631,6 +641,20 @@
}
}
+ private void forceReload() {
+ synchronized (mLock) {
+ // Stop any existing loaders first, so they don't set mAllAppsLoaded or
+ // mWorkspaceLoaded to true later
+ stopLoaderLocked();
+ mAllAppsLoaded = false;
+ mWorkspaceLoaded = false;
+ }
+ // Do this here because if the launcher activity is running it will be restarted.
+ // If it's not running startLoaderFromBackground will merely tell it that it needs
+ // to reload.
+ startLoaderFromBackground();
+ }
+
/**
* When the launcher is in the background, it's possible for it to miss paired
* configuration changes. So whenever we trigger the loader from the background
@@ -653,6 +677,20 @@
}
}
+ // If there is already a loader task running, tell it to stop.
+ // returns true if isLaunching() was true on the old task
+ private boolean stopLoaderLocked() {
+ boolean isLaunching = false;
+ LoaderTask oldTask = mLoaderTask;
+ if (oldTask != null) {
+ if (oldTask.isLaunching()) {
+ isLaunching = true;
+ }
+ oldTask.stopLocked();
+ }
+ return isLaunching;
+ }
+
public void startLoader(Context context, boolean isLaunching) {
synchronized (mLock) {
if (DEBUG_LOADERS) {
@@ -662,14 +700,8 @@
// Don't bother to start the thread if we know it's not going to do anything
if (mCallbacks != null && mCallbacks.get() != null) {
// If there is already one running, tell it to stop.
- LoaderTask oldTask = mLoaderTask;
- if (oldTask != null) {
- if (oldTask.isLaunching()) {
- // don't downgrade isLaunching if we're already running
- isLaunching = true;
- }
- oldTask.stopLocked();
- }
+ // also, don't downgrade isLaunching if we're already running
+ isLaunching = isLaunching || stopLoaderLocked();
mLoaderTask = new LoaderTask(context, isLaunching);
sWorkerThread.setPriority(Thread.NORM_PRIORITY);
sWorker.post(mLoaderTask);
@@ -721,10 +753,12 @@
if (!mWorkspaceLoaded) {
loadWorkspace();
- if (mStopped) {
- return;
+ synchronized (LoaderTask.this) {
+ if (mStopped) {
+ return;
+ }
+ mWorkspaceLoaded = true;
}
- mWorkspaceLoaded = true;
}
// Bind the workspace
@@ -1289,10 +1323,12 @@
}
if (!mAllAppsLoaded) {
loadAllAppsByBatch();
- if (mStopped) {
- return;
+ synchronized (LoaderTask.this) {
+ if (mStopped) {
+ return;
+ }
+ mAllAppsLoaded = true;
}
- mAllAppsLoaded = true;
} else {
onlyBindAllApps();
}
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index 8a492a2..d1f9617 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -1421,8 +1421,8 @@
* ZInterpolator compounded with an ease-out.
*/
static class ZoomOutInterpolator implements TimeInterpolator {
- private final ZInterpolator zInterpolator = new ZInterpolator(0.2f);
- private final DecelerateInterpolator decelerate = new DecelerateInterpolator(1.8f);
+ private final DecelerateInterpolator decelerate = new DecelerateInterpolator(0.75f);
+ private final ZInterpolator zInterpolator = new ZInterpolator(0.13f);
public float getInterpolation(float input) {
return decelerate.getInterpolation(zInterpolator.getInterpolation(input));