Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1e6342d9 authored by wqi's avatar wqi Committed by Linux Build Service Account
Browse files

Gallery2: Fix the strings not translated in editor interface.

Some of strings not translated after user change language, because of
the strings not update.

Change-Id: I5e6fa05e38f4c45caf72173ce69864f238470ac1
CRs-Fixed: 1002787
parent e94e7663
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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" />
+11 −0
Original line number Diff line number Diff line
@@ -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);
+19 −1
Original line number Diff line number Diff line
@@ -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;
@@ -553,4 +557,18 @@ public class MainPanel extends Fragment implements BottomPanel.BottomPanelDelega
            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);
            }
        }
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -292,7 +292,7 @@ public class ProcessingService extends Service {
        }
    }

    private void setupPipeline() {
    public void setupPipeline() {
        Resources res = getResources();
        FiltersManager.setResources(res);
        CachingPipeline.createRenderscriptContext(this);