正文  UI设计 > Launcher >

Android: 更改语言时Launcher2更新apps

diff --git a/AndroidManifest.xml b/AndroidManifest.xml old mode 100644 new mode 100755 index 28c0e0d..019c969 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -74,6 +74,7 ......

diff --git a/AndroidManifest.xml b/AndroidManifest.xml  
old mode 100644  
new mode 100755  
index 28c0e0d..019c969  
--- a/AndroidManifest.xml  
+++ b/AndroidManifest.xml  
@@ -74,6 +74,7 @@  
             android:clearTaskOnLaunch="true"  
             android:stateNotNeeded="true"  
             android:theme="@style/Theme"  
+            android:configChanges="locale"  
             android:windowSoftInputMode="stateUnspecified|adjustPan">  
             <intent-filter>  
                 <action android:name="android.intent.action.MAIN" />  
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java  
old mode 100644  
new mode 100755  
index e611303..f14d29f  
--- a/src/com/android/launcher2/Launcher.java  
+++ b/src/com/android/launcher2/Launcher.java  
@@ -594,6 +594,15 @@ public final class Launcher extends Activity  
     }  
   
     @Override  
+    public void onConfigurationChanged(Configuration config) {  
+        super.onConfigurationChanged(config);  
+       checkForLocaleChange();  
+       mModel.setAllAppsLoaded(false); // Set force load all apps list;  
+       mModel.startLoader(this, true); // Reload apps list  
+   
+    }  
+  
+    @Override  
     protected void onPause() {  
         super.onPause();  
         mPaused = true;  
diff --git a/src/com/android/launcher2/LauncherModel.java b/src/com/android/launcher2/LauncherModel.java  
old mode 100644  
new mode 100755  
index b819510..03a79dc  
--- a/src/com/android/launcher2/LauncherModel.java  
+++ b/src/com/android/launcher2/LauncherModel.java  
@@ -95,6 +95,10 @@ public class LauncherModel extends BroadcastReceiver {  
   
     private Bitmap mDefaultIcon;  
   
+   public void setAllAppsLoaded(boolean load) {  
+       mAllAppsLoaded = load;  
+   }  
+     
     public interface Callbacks {  
         public boolean setLoadOnResume();  
         public int getCurrentWorkspaceScreen();