diff options
4 files changed, 32 insertions, 3 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml index add9263e6..6a9f1ae97 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -292,7 +292,7 @@ <activity android:name="com.android.gallery3d.filtershow.FilterShowActivity" android:theme="@style/Theme.FilterShow" - android:configChanges="keyboardHidden|orientation|screenSize"> + android:configChanges="keyboardHidden|orientation|screenSize|locale|layoutDirection"> <intent-filter> <action android:name="android.intent.action.EDIT" /> <category android:name="android.intent.category.DEFAULT" /> diff --git a/gallerycommon/src/com/android/gallery3d/common/ApiHelper.java b/gallerycommon/src/com/android/gallery3d/common/ApiHelper.java index 06bace867..da36f9d4e 100644 --- a/gallerycommon/src/com/android/gallery3d/common/ApiHelper.java +++ b/gallerycommon/src/com/android/gallery3d/common/ApiHelper.java @@ -207,6 +207,17 @@ public class ApiHelper { } } + public static boolean getBooleanFieldIfExists(Object obj, String fieldName, + boolean defaultVal) { + Class<?> klass = obj.getClass(); + try { + Field f = klass.getDeclaredField(fieldName); + return f.getBoolean(obj); + } catch (Exception e) { + return defaultVal; + } + } + private static boolean hasField(Class<?> klass, String fieldName) { try { klass.getDeclaredField(fieldName); diff --git a/src/com/android/gallery3d/filtershow/category/MainPanel.java b/src/com/android/gallery3d/filtershow/category/MainPanel.java index bfa6b4fa4..f4b22e37b 100644 --- a/src/com/android/gallery3d/filtershow/category/MainPanel.java +++ b/src/com/android/gallery3d/filtershow/category/MainPanel.java @@ -16,6 +16,7 @@ package com.android.gallery3d.filtershow.category; +import android.content.res.Configuration; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentTransaction; @@ -26,8 +27,11 @@ import android.widget.ImageButton; import android.widget.LinearLayout; import org.codeaurora.gallery.R; + +import com.android.gallery3d.common.ApiHelper; import com.android.gallery3d.filtershow.FilterShowActivity; import com.android.gallery3d.filtershow.editors.EditorPanel; +import com.android.gallery3d.filtershow.filters.FiltersManager; import com.android.gallery3d.filtershow.filters.HazeBusterActs; import com.android.gallery3d.filtershow.filters.SeeStraightActs; import com.android.gallery3d.filtershow.filters.SimpleMakeupImageFilter; @@ -548,9 +552,23 @@ public class MainPanel extends Fragment implements BottomPanel.BottomPanelDelega public void updateDualCameraButton() { if(dualCamButton != null) { DdmStatus status = MasterImage.getImage().getDepthMapLoadingStatus(); - boolean enable = (status == DdmStatus.DDM_LOADING || + boolean enable = (status == DdmStatus.DDM_LOADING || status == DdmStatus.DDM_LOADED); dualCamButton.setVisibility(enable?View.VISIBLE:View.GONE); } } + + @Override + public void onConfigurationChanged(Configuration newConfig) { + super.onConfigurationChanged(newConfig); + if (ApiHelper.getBooleanFieldIfExists(newConfig, "userSetLocale", false)) { + FiltersManager.reset(); + FilterShowActivity activity = (FilterShowActivity) getActivity(); + activity.getProcessingService().setupPipeline(); + activity.fillCategories(); + if (mCurrentSelected != -1) { + showPanel(mCurrentSelected); + } + } + } } diff --git a/src/com/android/gallery3d/filtershow/pipeline/ProcessingService.java b/src/com/android/gallery3d/filtershow/pipeline/ProcessingService.java index e1a83600b..86d4c92c1 100644 --- a/src/com/android/gallery3d/filtershow/pipeline/ProcessingService.java +++ b/src/com/android/gallery3d/filtershow/pipeline/ProcessingService.java @@ -292,7 +292,7 @@ public class ProcessingService extends Service { } } - private void setupPipeline() { + public void setupPipeline() { Resources res = getResources(); FiltersManager.setResources(res); CachingPipeline.createRenderscriptContext(this); |