ThemePickerLeaf: Unify font/icon label sizes and scroll the text

consistency is key, longer labels made spacing look weird, this way it's always the same length

Co-Authored-By: Tim Zimmermann <tim@linux4.de>
Change-Id: Ib52e022a1e0f6f2627477493e87e6c0607455d36
diff --git a/res/layout/theme_font_option.xml b/res/layout/theme_font_option.xml
index df03df6..1d30500 100644
--- a/res/layout/theme_font_option.xml
+++ b/res/layout/theme_font_option.xml
@@ -39,12 +39,16 @@
             android:text="@string/font_component_option_thumbnail"/>
     </FrameLayout>
 
-    <TextView
+    <org.leafos.customization.widget.AlwaysSelectedTextView
         android:id="@+id/option_label"
-        android:layout_width="wrap_content"
+        android:layout_width="@dimen/option_label_width"
         android:layout_height="24dp"
         android:layout_gravity="center_horizontal"
         android:layout_marginTop="@dimen/theme_option_label_margin"
         android:gravity="center"
-        android:textAppearance="@style/OptionTitleTextAppearance" />
+        android:textAppearance="@style/OptionTitleTextAppearance"
+        android:singleLine="true"
+        android:scrollHorizontally="true"
+        android:ellipsize="marquee"
+        android:marqueeRepeatLimit="marquee_forever"/>
 </LinearLayout>
diff --git a/res/layout/theme_icon_option.xml b/res/layout/theme_icon_option.xml
index 020ebc7..cd13143 100644
--- a/res/layout/theme_icon_option.xml
+++ b/res/layout/theme_icon_option.xml
@@ -36,12 +36,16 @@
             android:tint="?android:colorForeground"/>
     </FrameLayout>
 
-    <TextView
+    <org.leafos.customization.widget.AlwaysSelectedTextView
         android:id="@+id/option_label"
-        android:layout_width="wrap_content"
+        android:layout_width="@dimen/option_label_width"
         android:layout_height="24dp"
         android:layout_gravity="center_horizontal"
         android:layout_marginTop="@dimen/theme_option_label_margin"
         android:gravity="center"
-        android:textAppearance="@style/OptionTitleTextAppearance" />
+        android:textAppearance="@style/OptionTitleTextAppearance"
+        android:singleLine="true"
+        android:scrollHorizontally="true"
+        android:ellipsize="marquee"
+        android:marqueeRepeatLimit="marquee_forever"/>
 </LinearLayout>
diff --git a/res/layout/theme_shape_option.xml b/res/layout/theme_shape_option.xml
index 61456f0..b57683a 100644
--- a/res/layout/theme_shape_option.xml
+++ b/res/layout/theme_shape_option.xml
@@ -34,12 +34,16 @@
             android:layout_gravity="center"/>
     </FrameLayout>
 
-    <TextView
+    <org.leafos.customization.widget.AlwaysSelectedTextView
         android:id="@+id/option_label"
-        android:layout_width="wrap_content"
+        android:layout_width="@dimen/option_label_width"
         android:layout_height="24dp"
         android:layout_gravity="center_horizontal"
         android:layout_marginTop="@dimen/theme_option_label_margin"
         android:gravity="center"
-        android:textAppearance="@style/OptionTitleTextAppearance" />
+        android:textAppearance="@style/OptionTitleTextAppearance"
+        android:singleLine="true"
+        android:scrollHorizontally="true"
+        android:ellipsize="marquee"
+        android:marqueeRepeatLimit="marquee_forever"/>
 </LinearLayout>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
new file mode 100644
index 0000000..a88b82d
--- /dev/null
+++ b/res/values/dimens.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+     Copyright (C) 2023 The LeafOS Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+<resources>
+    <!-- Dimensions for the customization option tiles -->
+    <dimen name="option_label_width">100dp</dimen>
+</resources>
diff --git a/src/org/leafos/customization/widget/AlwaysSelectedTextView.java b/src/org/leafos/customization/widget/AlwaysSelectedTextView.java
new file mode 100644
index 0000000..ca8e1ce
--- /dev/null
+++ b/src/org/leafos/customization/widget/AlwaysSelectedTextView.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2023 The LeafOS Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.leafos.customization.widget;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.widget.TextView;
+
+public class AlwaysSelectedTextView extends TextView {
+    public AlwaysSelectedTextView(Context context, AttributeSet attrs, int defStyleAttr) {
+        super(context, attrs, defStyleAttr);
+
+        setSelected(true);
+    }
+
+    public AlwaysSelectedTextView(Context context, AttributeSet attrs) {
+        super(context, attrs);
+
+        setSelected(true);
+    }
+
+    public AlwaysSelectedTextView(Context context) {
+        super(context);
+
+        setSelected(true);
+    }
+}