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

Commit 3b983256 authored by LuK1337's avatar LuK1337 Committed by Michael Bestas
Browse files

Trebuchet: Allow enabling icon labels for landscape mode

Change-Id: I620ffd7727de367e52c2a70c05d5b6fcc04285bb
parent 53d68438
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@
    <!-- Hide labels -->
    <string name="desktop_show_labels">Show icon labels on desktop</string>
    <string name="drawer_show_labels">Show icon labels in drawer</string>
    <string name="show_labels_landscape">Show icon labels in landscape mode</string>

    <!-- Trust apps -->
    <string name="trust_apps_manager_name">Hidden &amp; Protected apps</string>
+6 −0
Original line number Diff line number Diff line
@@ -73,4 +73,10 @@
        android:title="@string/drawer_show_labels"
        android:defaultValue="true"
        android:persistent="true" />

    <SwitchPreference
        android:key="pref_show_labels_landscape"
        android:title="@string/show_labels_landscape"
        android:defaultValue="false"
        android:persistent="true" />
</androidx.preference.PreferenceScreen>
+9 −2
Original line number Diff line number Diff line
@@ -16,7 +16,10 @@

package com.android.launcher3;

import static com.android.launcher3.InvariantDeviceProfile.KEY_SHOW_LABELS_LANDSCAPE;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Point;
@@ -140,6 +143,8 @@ public class DeviceProfile {
    public DotRenderer mDotRendererWorkSpace;
    public DotRenderer mDotRendererAllApps;

    private SharedPreferences mPrefs;

    DeviceProfile(Context context, InvariantDeviceProfile inv, DefaultDisplay.Info info,
            Point minSize, Point maxSize, int width, int height, boolean isLandscape,
            boolean isMultiWindowMode, boolean transposeLayoutWithOrientation,
@@ -176,6 +181,8 @@ public class DeviceProfile {
        // Some more constants
        this.transposeLayoutWithOrientation = transposeLayoutWithOrientation;

        mPrefs = Utilities.getPrefs(context.getApplicationContext());

        context = getContext(context, info, isVerticalBarLayout()
                ? Configuration.ORIENTATION_LANDSCAPE
                : Configuration.ORIENTATION_PORTRAIT);
@@ -381,8 +388,8 @@ public class DeviceProfile {
        }
        allAppsCellWidthPx = allAppsIconSizePx + allAppsIconDrawablePaddingPx;

        if (isVerticalBarLayout()) {
            // Always hide the Workspace text with vertical bar layout.
        if (isVerticalBarLayout() && !mPrefs.getBoolean(KEY_SHOW_LABELS_LANDSCAPE, false)) {
            // Hide Workspace text with vertical bar layout if needed.
            adjustToHideWorkspaceLabels();
        }

+3 −0
Original line number Diff line number Diff line
@@ -82,6 +82,7 @@ public class InvariantDeviceProfile implements OnSharedPreferenceChangeListener

    public static final String KEY_SHOW_DESKTOP_LABELS = "pref_desktop_show_labels";
    public static final String KEY_SHOW_DRAWER_LABELS = "pref_drawer_show_labels";
    public static final String KEY_SHOW_LABELS_LANDSCAPE = "pref_show_labels_landscape";
    public static final String KEY_ICON_PATH_REF = "pref_icon_shape_path";
    public static final String KEY_WORKSPACE_EDIT = "pref_workspace_edit";

@@ -203,6 +204,8 @@ public class InvariantDeviceProfile implements OnSharedPreferenceChangeListener
    public void onSharedPreferenceChanged(SharedPreferences prefs, String key) {
        if (KEY_SHOW_DESKTOP_LABELS.equals(key) || KEY_SHOW_DRAWER_LABELS.equals(key)) {
            apply(mContext, CHANGE_FLAG_ICON_PARAMS);
        } else if (KEY_SHOW_LABELS_LANDSCAPE.equals(key)) {
            onConfigChanged(mContext);
        }
    }