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

Commit 84245e84 authored by Samuel Fufa's avatar Samuel Fufa
Browse files

Default name's language of folder won't change after changing the system language

Test: Manual - Create unnamed folder and change system language. Folder
name should pickup new language.
Bug:78611156
Change-Id: Ie06baebe5b9a64e91630c581b75b674f363b9973
parent aec2d5af
Loading
Loading
Loading
Loading
+0 −2
Original line number Original line Diff line number Diff line
@@ -23,8 +23,6 @@


    <!-- Application name -->
    <!-- Application name -->
    <string name="app_name">Launcher3</string>
    <string name="app_name">Launcher3</string>
    <!-- Default folder name -->
    <string name="folder_name"></string>
    <!-- Work folder name -->
    <!-- Work folder name -->
    <string name="work_folder_name">Work</string>
    <string name="work_folder_name">Work</string>
    <!-- Displayed when user selects a shortcut for an app that was uninstalled [CHAR_LIMIT=none]-->
    <!-- Displayed when user selects a shortcut for an app that was uninstalled [CHAR_LIMIT=none]-->
+1 −1
Original line number Original line Diff line number Diff line
@@ -549,7 +549,7 @@ public class AutoInstallsLayout {
            if (titleResId != 0) {
            if (titleResId != 0) {
                title = mSourceRes.getString(titleResId);
                title = mSourceRes.getString(titleResId);
            } else {
            } else {
                title = mContext.getResources().getString(R.string.folder_name);
                title = "";
            }
            }


            mValues.put(Favorites.TITLE, title);
            mValues.put(Favorites.TITLE, title);
+1 −7
Original line number Original line Diff line number Diff line
@@ -16,7 +16,6 @@


package com.android.launcher3;
package com.android.launcher3;


import static android.content.pm.ActivityInfo.CONFIG_LOCALE;
import static android.content.pm.ActivityInfo.CONFIG_ORIENTATION;
import static android.content.pm.ActivityInfo.CONFIG_ORIENTATION;
import static android.content.pm.ActivityInfo.CONFIG_SCREEN_SIZE;
import static android.content.pm.ActivityInfo.CONFIG_SCREEN_SIZE;


@@ -95,7 +94,6 @@ import com.android.launcher3.dot.DotInfo;
import com.android.launcher3.dragndrop.DragController;
import com.android.launcher3.dragndrop.DragController;
import com.android.launcher3.dragndrop.DragLayer;
import com.android.launcher3.dragndrop.DragLayer;
import com.android.launcher3.dragndrop.DragView;
import com.android.launcher3.dragndrop.DragView;
import com.android.launcher3.folder.Folder;
import com.android.launcher3.folder.FolderGridOrganizer;
import com.android.launcher3.folder.FolderGridOrganizer;
import com.android.launcher3.folder.FolderIcon;
import com.android.launcher3.folder.FolderIcon;
import com.android.launcher3.graphics.RotationMode;
import com.android.launcher3.graphics.RotationMode;
@@ -419,10 +417,6 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
    public void onConfigurationChanged(Configuration newConfig) {
    public void onConfigurationChanged(Configuration newConfig) {
        int diff = newConfig.diff(mOldConfig);
        int diff = newConfig.diff(mOldConfig);


        if ((diff & CONFIG_LOCALE) != 0) {
            Folder.setLocaleDependentFields(getResources(), true /* force */);
        }

        if ((diff & (CONFIG_ORIENTATION | CONFIG_SCREEN_SIZE)) != 0) {
        if ((diff & (CONFIG_ORIENTATION | CONFIG_SCREEN_SIZE)) != 0) {
            onIdpChanged(mDeviceProfile.inv);
            onIdpChanged(mDeviceProfile.inv);
        }
        }
@@ -1669,7 +1663,7 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
    FolderIcon addFolder(CellLayout layout, int container, final int screenId, int cellX,
    FolderIcon addFolder(CellLayout layout, int container, final int screenId, int cellX,
            int cellY) {
            int cellY) {
        final FolderInfo folderInfo = new FolderInfo();
        final FolderInfo folderInfo = new FolderInfo();
        folderInfo.title = getText(R.string.folder_name);
        folderInfo.title = "";


        // Update the model
        // Update the model
        getModelWriter().addItemToDatabase(folderInfo, container, screenId, cellX, cellY);
        getModelWriter().addItemToDatabase(folderInfo, container, screenId, cellX, cellY);
+8 −18
Original line number Original line Diff line number Diff line
@@ -26,12 +26,12 @@ import android.animation.AnimatorSet;
import android.annotation.SuppressLint;
import android.annotation.SuppressLint;
import android.appwidget.AppWidgetHostView;
import android.appwidget.AppWidgetHostView;
import android.content.Context;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.Canvas;
import android.graphics.Path;
import android.graphics.Path;
import android.graphics.Rect;
import android.graphics.Rect;
import android.text.InputType;
import android.text.InputType;
import android.text.Selection;
import android.text.Selection;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.AttributeSet;
import android.util.Log;
import android.util.Log;
import android.util.Pair;
import android.util.Pair;
@@ -126,9 +126,6 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
    private static final Rect sTempRect = new Rect();
    private static final Rect sTempRect = new Rect();
    private static final int MIN_FOLDERS_FOR_HARDWARE_OPTIMIZATION = 10;
    private static final int MIN_FOLDERS_FOR_HARDWARE_OPTIMIZATION = 10;


    private static String sDefaultFolderName;
    private static String sHintText;

    private final Alarm mReorderAlarm = new Alarm();
    private final Alarm mReorderAlarm = new Alarm();
    private final Alarm mOnExitAlarm = new Alarm();
    private final Alarm mOnExitAlarm = new Alarm();
    private final Alarm mOnScrollHintAlarm = new Alarm();
    private final Alarm mOnScrollHintAlarm = new Alarm();
@@ -196,8 +193,6 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
        super(context, attrs);
        super(context, attrs);
        setAlwaysDrawnWithCacheEnabled(false);
        setAlwaysDrawnWithCacheEnabled(false);


        setLocaleDependentFields(getResources(), false /* force */);

        mLauncher = Launcher.getLauncher(context);
        mLauncher = Launcher.getLauncher(context);
        // We need this view to be focusable in touch mode so that when text editing of the folder
        // We need this view to be focusable in touch mode so that when text editing of the folder
        // name is complete, we have something to focus on, thus hiding the cursor and giving
        // name is complete, we have something to focus on, thus hiding the cursor and giving
@@ -318,7 +313,11 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
        mInfo.setTitle(newTitle);
        mInfo.setTitle(newTitle);
        mLauncher.getModelWriter().updateItemInDatabase(mInfo);
        mLauncher.getModelWriter().updateItemInDatabase(mInfo);


        mFolderName.setHint(sDefaultFolderName.contentEquals(newTitle) ? sHintText : null);
        if (TextUtils.isEmpty(mInfo.title)) {
            mFolderName.setHint(R.string.folder_hint_text);
        } else {
            mFolderName.setHint(null);
        }


        sendCustomAccessibilityEvent(
        sendCustomAccessibilityEvent(
                this, AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED,
                this, AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED,
@@ -400,12 +399,12 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
        updateTextViewFocus();
        updateTextViewFocus();
        mInfo.addListener(this);
        mInfo.addListener(this);


        if (!sDefaultFolderName.contentEquals(mInfo.title)) {
        if (TextUtils.isEmpty(mInfo.title)) {
            mFolderName.setText(mInfo.title);
            mFolderName.setText(mInfo.title);
            mFolderName.setHint(null);
            mFolderName.setHint(null);
        } else {
        } else {
            mFolderName.setText("");
            mFolderName.setText("");
            mFolderName.setHint(sHintText);
            mFolderName.setHint(R.string.folder_hint_text);
        }
        }


        // In case any children didn't come across during loading, clean up the folder accordingly
        // In case any children didn't come across during loading, clean up the folder accordingly
@@ -1483,15 +1482,6 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
        return false;
        return false;
    }
    }


    public static void setLocaleDependentFields(Resources res, boolean force) {
        if (sDefaultFolderName == null || force) {
            sDefaultFolderName = res.getString(R.string.folder_name);
        }
        if (sHintText == null || force) {
            sHintText = res.getString(R.string.folder_hint_text);
        }
    }

    /**
    /**
     * Alternative to using {@link #getClipToOutline()} as it only works with derivatives of
     * Alternative to using {@link #getClipToOutline()} as it only works with derivatives of
     * rounded rect.
     * rounded rect.