summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuK1337 <priv.luk@gmail.com>2020-01-28 16:26:39 (GMT)
committerLuK1337 <priv.luk@gmail.com>2020-03-15 13:35:26 (GMT)
commitc15927ba5820da0e6a1f7a611f930970f0d90814 (patch)
tree723a054aa0974961906b7b9d13907b9a34a63885
parent6888306888dc17e9d90afb11be523d3d3b894780 (diff)
downloadandroid_packages_apps_Trebuchet-c15927ba5820da0e6a1f7a611f930970f0d90814.zip
android_packages_apps_Trebuchet-c15927ba5820da0e6a1f7a611f930970f0d90814.tar.gz
android_packages_apps_Trebuchet-c15927ba5820da0e6a1f7a611f930970f0d90814.tar.bz2
Trebuchet: Allow enabling icon labels for landscape mode
Change-Id: I620ffd7727de367e52c2a70c05d5b6fcc04285bb
-rw-r--r--res/values/lineage_strings.xml1
-rw-r--r--res/xml/launcher_preferences.xml6
-rw-r--r--src/com/android/launcher3/DeviceProfile.java11
-rw-r--r--src/com/android/launcher3/InvariantDeviceProfile.java3
4 files changed, 19 insertions, 2 deletions
diff --git a/res/values/lineage_strings.xml b/res/values/lineage_strings.xml
index ef62aff..2e602ff 100644
--- a/res/values/lineage_strings.xml
+++ b/res/values/lineage_strings.xml
@@ -38,6 +38,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>
diff --git a/res/xml/launcher_preferences.xml b/res/xml/launcher_preferences.xml
index 3df481c..b9801fe 100644
--- a/res/xml/launcher_preferences.xml
+++ b/res/xml/launcher_preferences.xml
@@ -79,4 +79,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>
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java
index d12c665..0ffe2d7 100644
--- a/src/com/android/launcher3/DeviceProfile.java
+++ b/src/com/android/launcher3/DeviceProfile.java
@@ -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;
@@ -137,6 +140,8 @@ public class DeviceProfile {
public DotRenderer mDotRendererWorkSpace;
public DotRenderer mDotRendererAllApps;
+ private SharedPreferences mPrefs;
+
public DeviceProfile(Context context, InvariantDeviceProfile inv,
InvariantDeviceProfile originalIDP, Point minSize, Point maxSize,
int width, int height, boolean isLandscape, boolean isMultiWindowMode) {
@@ -171,6 +176,8 @@ public class DeviceProfile {
transposeLayoutWithOrientation =
res.getBoolean(R.bool.hotseat_transpose_layout_with_orientation);
+ mPrefs = Utilities.getPrefs(context.getApplicationContext());
+
context = getContext(context, isVerticalBarLayout()
? Configuration.ORIENTATION_LANDSCAPE
: Configuration.ORIENTATION_PORTRAIT);
@@ -362,8 +369,8 @@ public class DeviceProfile {
allAppsCellHeightPx = getCellSize().y;
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();
}
diff --git a/src/com/android/launcher3/InvariantDeviceProfile.java b/src/com/android/launcher3/InvariantDeviceProfile.java
index eda679f..b80cff8 100644
--- a/src/com/android/launcher3/InvariantDeviceProfile.java
+++ b/src/com/android/launcher3/InvariantDeviceProfile.java
@@ -77,6 +77,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";
@@ -188,6 +189,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);
}
}