diff --git a/app/src/main/java/de/jrpie/android/launcher/actions/Gesture.kt b/app/src/main/java/de/jrpie/android/launcher/actions/Gesture.kt index 6725e27..f231658 100644 --- a/app/src/main/java/de/jrpie/android/launcher/actions/Gesture.kt +++ b/app/src/main/java/de/jrpie/android/launcher/actions/Gesture.kt @@ -11,7 +11,9 @@ import de.jrpie.android.launcher.R * @param animationOut res id of transition animation (out) when using the gesture to launch an app. */ enum class Gesture( - val id: String, private val labelResource: Int, + val id: String, + private val labelResource: Int, + private val descriptionResource: Int, internal val defaultsResource: Int, private val animationIn: Int = android.R.anim.fade_in, private val animationOut: Int = android.R.anim.fade_out @@ -19,6 +21,7 @@ enum class Gesture( VOLUME_UP( "action.volume_up", R.string.settings_gesture_vol_up, + R.string.settings_gesture_description_vol_up, R.array.default_volume_up, 0, 0 @@ -26,108 +29,136 @@ enum class Gesture( VOLUME_DOWN( "action.volume_down", R.string.settings_gesture_vol_down, + R.string.settings_gesture_description_vol_down, R.array.default_volume_down, 0, 0 ), - TIME("action.time", R.string.settings_gesture_time, R.array.default_time), - DATE("action.date", R.string.settings_gesture_date, R.array.default_date), + TIME("action.time", + R.string.settings_gesture_time, + R.string.settings_gesture_time, + R.array.default_time), + DATE("action.date", + R.string.settings_gesture_date, + R.string.settings_gesture_description_date, + R.array.default_date), LONG_CLICK( "action.long_click", R.string.settings_gesture_long_click, + R.string.settings_gesture_description_long_click, R.array.default_long_click, 0, 0 ), DOUBLE_CLICK( "action.double_click", R.string.settings_gesture_double_click, + R.string.settings_gesture_description_double_click, R.array.default_double_click, 0, 0 ), - SWIPE_UP("action.up", R.string.settings_gesture_up, R.array.default_up, R.anim.bottom_up), + SWIPE_UP("action.up", + R.string.settings_gesture_up, + R.string.settings_gesture_description_up, + R.array.default_up, + R.anim.bottom_up), SWIPE_UP_LEFT_EDGE( "action.up_left", R.string.settings_gesture_up_left_edge, + R.string.settings_gesture_description_up_left_edge, R.array.default_up_left, R.anim.bottom_up ), SWIPE_UP_RIGHT_EDGE( "action.up_right", R.string.settings_gesture_up_right_edge, + R.string.settings_gesture_description_up_right_edge, R.array.default_up_right, R.anim.bottom_up ), SWIPE_UP_DOUBLE( "action.double_up", R.string.settings_gesture_double_up, + R.string.settings_gesture_description_double_up, R.array.default_double_up, R.anim.bottom_up ), SWIPE_DOWN( "action.down", R.string.settings_gesture_down, + R.string.settings_gesture_description_down, R.array.default_down, R.anim.top_down ), SWIPE_DOWN_LEFT_EDGE( "action.down_left", R.string.settings_gesture_down_left_edge, + R.string.settings_gesture_description_down_left_edge, R.array.default_down_left, R.anim.top_down ), SWIPE_DOWN_RIGHT_EDGE( "action.down_right", R.string.settings_gesture_down_right_edge, + R.string.settings_gesture_description_down_right_edge, R.array.default_down_right, R.anim.top_down ), SWIPE_DOWN_DOUBLE( "action.double_down", R.string.settings_gesture_double_down, + R.string.settings_gesture_description_double_down, R.array.default_double_down, R.anim.top_down ), SWIPE_LEFT( "action.left", R.string.settings_gesture_left, + R.string.settings_gesture_description_left, R.array.default_left, R.anim.right_left ), SWIPE_LEFT_TOP_EDGE( "action.left_top", R.string.settings_gesture_left_top_edge, + R.string.settings_gesture_description_left_top_edge, R.array.default_left_top, R.anim.right_left ), SWIPE_LEFT_BOTTOM_EDGE( "action.left_bottom", R.string.settings_gesture_left_bottom_edge, + R.string.settings_gesture_description_left_bottom_edge, R.array.default_left_bottom, R.anim.right_left ), SWIPE_LEFT_DOUBLE( "action.double_left", R.string.settings_gesture_double_left, + R.string.settings_gesture_description_double_left, R.array.default_double_left, R.anim.right_left ), SWIPE_RIGHT( "action.right", R.string.settings_gesture_right, + R.string.settings_gesture_description_right, R.array.default_right, R.anim.left_right ), SWIPE_RIGHT_TOP_EDGE( "action.right_top", R.string.settings_gesture_right_top_edge, + R.string.settings_gesture_description_right_top_edge, R.array.default_right_top, R.anim.left_right ), SWIPE_RIGHT_BOTTOM_EDGE( "action.right_bottom", R.string.settings_gesture_right_bottom_edge, + R.string.settings_gesture_description_right_bottom_edge, R.array.default_right_bottom, R.anim.left_right ), SWIPE_RIGHT_DOUBLE( "action.double_right", R.string.settings_gesture_double_right, + R.string.settings_gesture_description_double_right, R.array.default_double_right, R.anim.left_right ); @@ -139,6 +170,9 @@ enum class Gesture( fun getLabel(context: Context): String { return context.resources.getString(this.labelResource) } + fun getDescription(context: Context): String { + return context.resources.getString(this.descriptionResource) + } fun getDoubleVariant(): Gesture { return when (this) { diff --git a/app/src/main/java/de/jrpie/android/launcher/ui/settings/actions/SettingsFragmentActionsRecycler.kt b/app/src/main/java/de/jrpie/android/launcher/ui/settings/actions/SettingsFragmentActionsRecycler.kt index f80a558..4f7c901 100644 --- a/app/src/main/java/de/jrpie/android/launcher/ui/settings/actions/SettingsFragmentActionsRecycler.kt +++ b/app/src/main/java/de/jrpie/android/launcher/ui/settings/actions/SettingsFragmentActionsRecycler.kt @@ -3,6 +3,7 @@ package de.jrpie.android.launcher.ui.settings.actions import android.app.Activity import android.content.Intent import android.content.SharedPreferences +import android.os.Build import android.os.Bundle import android.view.LayoutInflater import android.view.View @@ -10,6 +11,7 @@ import android.view.ViewGroup import android.widget.Button import android.widget.ImageView import android.widget.TextView +import androidx.annotation.RequiresApi import androidx.fragment.app.Fragment import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView @@ -113,6 +115,13 @@ 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) + viewHolder.textView.tooltipText = description + viewHolder.img.tooltipText = description + viewHolder.chooseButton.tooltipText = description + } if (LauncherPreferences.theme().monochromeIcons()) transformGrayscale(viewHolder.img) updateViewHolder(gesture, viewHolder) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 2f9fcf8..7294af3 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -26,27 +26,50 @@ - --> Swipe Up + Swipe up Double Up + Swipe up with two fingers Swipe Down + Swipe down Double Down + Swipe down with two fingers Swipe Left + Swipe left Double Left + Swipe left with two fingers Swipe Right + Swipe right Double Right + Swipe right with two fingers Swipe Right (Top) + Swipe right at the top of the screen Swipe Right (Bottom) + Swipe right at the bottom of the screen Swipe Left (Bottom) + Swipe left at the bottom of the screen Swipe Left (Top) + Swipe left at the top of the screen Swipe Up (Left Edge) + Swipe up at the left edge of the screen Swipe Up (Right Edge) + Swipe up at the right edge of the screen Swipe Down (Left Edge) + Swipe down at the left edge of the screen Swipe Down (Right Edge) + Swipe down at the right edge of the screen Volume Up + Press the volume up button Volume Down + Press the volume down button Double Click + Double click an empty area Long Click + Long click an empty area Click on Date + Click on Date Click on Time + Click on Time + Choose App