gesture descriptions on android < 8 (cf. #55)

This commit is contained in:
Josia Pietsch 2024-11-02 00:17:10 +01:00
parent 2cc4d02587
commit 3f1263f648
Signed by: jrpie
GPG key ID: E70B571D66986A2D
4 changed files with 46 additions and 25 deletions

View file

@ -34,7 +34,7 @@ enum class Gesture(
),
TIME("action.time",
R.string.settings_gesture_time,
R.string.settings_gesture_time,
R.string.settings_gesture_description_time,
R.array.default_time),
DATE("action.date",
R.string.settings_gesture_date,

View file

@ -84,6 +84,7 @@ class ActionsRecyclerAdapter(val activity: Activity) :
inner class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView),
View.OnClickListener {
var textView: TextView = itemView.findViewById(R.id.settings_actions_row_name)
var descriptionTextView: TextView = itemView.findViewById(R.id.settings_actions_row_description)
var img: ImageView = itemView.findViewById(R.id.settings_actions_row_icon_img)
var chooseButton: Button = itemView.findViewById(R.id.settings_actions_row_button_choose)
var removeAction: ImageView = itemView.findViewById(R.id.settings_actions_row_remove)
@ -115,12 +116,16 @@ class ActionsRecyclerAdapter(val activity: Activity) :
override fun onBindViewHolder(viewHolder: ViewHolder, i: Int) {
val gesture = gesturesList[i]
viewHolder.textView.text = gesture.getLabel(activity)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
val description = gesture.getDescription(activity)
val description = gesture.getDescription(activity)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
viewHolder.textView.tooltipText = description
viewHolder.img.tooltipText = description
viewHolder.chooseButton.tooltipText = description
} else {
viewHolder.descriptionTextView.visibility = View.VISIBLE
viewHolder.descriptionTextView.text = description
}
if (LauncherPreferences.theme().monochromeIcons())
transformGrayscale(viewHolder.img)

View file

@ -7,19 +7,34 @@
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/settings_actions_row_name"
<LinearLayout
android:orientation="vertical"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="5dp"
android:layout_marginRight="5dp"
android:gravity="start"
android:text=""
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/settings_actions_row_button_choose"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintTop_toTopOf="parent">
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:gravity="start"
android:id="@+id/settings_actions_row_name"
android:text=""
android:textSize="20sp" />
<TextView
android:id="@+id/settings_actions_row_description"
android:gravity="start"
android:visibility="gone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="11sp" />
</LinearLayout>
<Button
android:id="@+id/settings_actions_row_button_choose"
@ -54,4 +69,5 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/settings_actions_row_icon_img"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -25,37 +25,37 @@
- Settings : Apps
-
-->
<string name="settings_gesture_up">Swipe Up</string>
<string name="settings_gesture_up">Up</string>
<string name="settings_gesture_description_up">Swipe up</string>
<string name="settings_gesture_double_up">Double Up</string>
<string name="settings_gesture_description_double_up">Swipe up with two fingers</string>
<string name="settings_gesture_down">Swipe Down</string>
<string name="settings_gesture_down">Down</string>
<string name="settings_gesture_description_down">Swipe down</string>
<string name="settings_gesture_double_down">Double Down</string>
<string name="settings_gesture_description_double_down">Swipe down with two fingers</string>
<string name="settings_gesture_left">Swipe Left</string>
<string name="settings_gesture_left">Left</string>
<string name="settings_gesture_description_left">Swipe left</string>
<string name="settings_gesture_double_left">Double Left</string>
<string name="settings_gesture_description_double_left">Swipe left with two fingers</string>
<string name="settings_gesture_right">Swipe Right</string>
<string name="settings_gesture_right">Right</string>
<string name="settings_gesture_description_right">Swipe right</string>
<string name="settings_gesture_double_right">Double Right</string>
<string name="settings_gesture_description_double_right">Swipe right with two fingers</string>
<string name="settings_gesture_right_top_edge">Swipe Right (Top)</string>
<string name="settings_gesture_right_top_edge">Right (Top)</string>
<string name="settings_gesture_description_right_top_edge">Swipe right at the top of the screen</string>
<string name="settings_gesture_right_bottom_edge">Swipe Right (Bottom)</string>
<string name="settings_gesture_right_bottom_edge">Right (Bottom)</string>
<string name="settings_gesture_description_right_bottom_edge">Swipe right at the bottom of the screen</string>
<string name="settings_gesture_left_bottom_edge">Swipe Left (Bottom)</string>
<string name="settings_gesture_left_bottom_edge">Left (Bottom)</string>
<string name="settings_gesture_description_left_bottom_edge">Swipe left at the bottom of the screen</string>
<string name="settings_gesture_left_top_edge">Swipe Left (Top)</string>
<string name="settings_gesture_left_top_edge">Left (Top)</string>
<string name="settings_gesture_description_left_top_edge">Swipe left at the top of the screen</string>
<string name="settings_gesture_up_left_edge">Swipe Up (Left Edge)</string>
<string name="settings_gesture_up_left_edge">Up (Left Edge)</string>
<string name="settings_gesture_description_up_left_edge">Swipe up at the left edge of the screen</string>
<string name="settings_gesture_up_right_edge">Swipe Up (Right Edge)</string>
<string name="settings_gesture_up_right_edge">Up (Right Edge)</string>
<string name="settings_gesture_description_up_right_edge">Swipe up at the right edge of the screen</string>
<string name="settings_gesture_down_left_edge">Swipe Down (Left Edge)</string>
<string name="settings_gesture_down_left_edge">Down (Left Edge)</string>
<string name="settings_gesture_description_down_left_edge">Swipe down at the left edge of the screen</string>
<string name="settings_gesture_down_right_edge">Swipe Down (Right Edge)</string>
<string name="settings_gesture_down_right_edge">Down (Right Edge)</string>
<string name="settings_gesture_description_down_right_edge">Swipe down at the right edge of the screen</string>
<string name="settings_gesture_vol_up">Volume Up</string>
<string name="settings_gesture_description_vol_up">Press the volume up button</string>
@ -65,10 +65,10 @@
<string name="settings_gesture_description_double_click">Double click an empty area</string>
<string name="settings_gesture_long_click">Long Click</string>
<string name="settings_gesture_description_long_click">Long click an empty area</string>
<string name="settings_gesture_date">Click on Date</string>
<string name="settings_gesture_description_date">Click on Date</string>
<string name="settings_gesture_time">Click on Time</string>
<string name="settings_gesture_description_time">Click on Time</string>
<string name="settings_gesture_date">Date</string>
<string name="settings_gesture_description_date">Click on date</string>
<string name="settings_gesture_time">Time</string>
<string name="settings_gesture_description_time">Click on time</string>
<string name="settings_apps_choose">Choose App</string>