mirror of
https://github.com/jrpie/Launcher.git
synced 2025-02-23 06:21:31 +01:00
tooltips for gestures (cf. #55)
This commit is contained in:
parent
874a2bcdad
commit
2cc4d02587
3 changed files with 70 additions and 4 deletions
|
@ -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.
|
* @param animationOut res id of transition animation (out) when using the gesture to launch an app.
|
||||||
*/
|
*/
|
||||||
enum class Gesture(
|
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,
|
internal val defaultsResource: Int,
|
||||||
private val animationIn: Int = android.R.anim.fade_in,
|
private val animationIn: Int = android.R.anim.fade_in,
|
||||||
private val animationOut: Int = android.R.anim.fade_out
|
private val animationOut: Int = android.R.anim.fade_out
|
||||||
|
@ -19,6 +21,7 @@ enum class Gesture(
|
||||||
VOLUME_UP(
|
VOLUME_UP(
|
||||||
"action.volume_up",
|
"action.volume_up",
|
||||||
R.string.settings_gesture_vol_up,
|
R.string.settings_gesture_vol_up,
|
||||||
|
R.string.settings_gesture_description_vol_up,
|
||||||
R.array.default_volume_up,
|
R.array.default_volume_up,
|
||||||
0,
|
0,
|
||||||
0
|
0
|
||||||
|
@ -26,108 +29,136 @@ enum class Gesture(
|
||||||
VOLUME_DOWN(
|
VOLUME_DOWN(
|
||||||
"action.volume_down",
|
"action.volume_down",
|
||||||
R.string.settings_gesture_vol_down,
|
R.string.settings_gesture_vol_down,
|
||||||
|
R.string.settings_gesture_description_vol_down,
|
||||||
R.array.default_volume_down, 0, 0
|
R.array.default_volume_down, 0, 0
|
||||||
),
|
),
|
||||||
TIME("action.time", R.string.settings_gesture_time, R.array.default_time),
|
TIME("action.time",
|
||||||
DATE("action.date", R.string.settings_gesture_date, R.array.default_date),
|
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(
|
LONG_CLICK(
|
||||||
"action.long_click",
|
"action.long_click",
|
||||||
R.string.settings_gesture_long_click,
|
R.string.settings_gesture_long_click,
|
||||||
|
R.string.settings_gesture_description_long_click,
|
||||||
R.array.default_long_click, 0, 0
|
R.array.default_long_click, 0, 0
|
||||||
),
|
),
|
||||||
DOUBLE_CLICK(
|
DOUBLE_CLICK(
|
||||||
"action.double_click",
|
"action.double_click",
|
||||||
R.string.settings_gesture_double_click,
|
R.string.settings_gesture_double_click,
|
||||||
|
R.string.settings_gesture_description_double_click,
|
||||||
R.array.default_double_click, 0, 0
|
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(
|
SWIPE_UP_LEFT_EDGE(
|
||||||
"action.up_left",
|
"action.up_left",
|
||||||
R.string.settings_gesture_up_left_edge,
|
R.string.settings_gesture_up_left_edge,
|
||||||
|
R.string.settings_gesture_description_up_left_edge,
|
||||||
R.array.default_up_left,
|
R.array.default_up_left,
|
||||||
R.anim.bottom_up
|
R.anim.bottom_up
|
||||||
),
|
),
|
||||||
SWIPE_UP_RIGHT_EDGE(
|
SWIPE_UP_RIGHT_EDGE(
|
||||||
"action.up_right",
|
"action.up_right",
|
||||||
R.string.settings_gesture_up_right_edge,
|
R.string.settings_gesture_up_right_edge,
|
||||||
|
R.string.settings_gesture_description_up_right_edge,
|
||||||
R.array.default_up_right,
|
R.array.default_up_right,
|
||||||
R.anim.bottom_up
|
R.anim.bottom_up
|
||||||
),
|
),
|
||||||
SWIPE_UP_DOUBLE(
|
SWIPE_UP_DOUBLE(
|
||||||
"action.double_up",
|
"action.double_up",
|
||||||
R.string.settings_gesture_double_up,
|
R.string.settings_gesture_double_up,
|
||||||
|
R.string.settings_gesture_description_double_up,
|
||||||
R.array.default_double_up,
|
R.array.default_double_up,
|
||||||
R.anim.bottom_up
|
R.anim.bottom_up
|
||||||
),
|
),
|
||||||
SWIPE_DOWN(
|
SWIPE_DOWN(
|
||||||
"action.down",
|
"action.down",
|
||||||
R.string.settings_gesture_down,
|
R.string.settings_gesture_down,
|
||||||
|
R.string.settings_gesture_description_down,
|
||||||
R.array.default_down,
|
R.array.default_down,
|
||||||
R.anim.top_down
|
R.anim.top_down
|
||||||
),
|
),
|
||||||
SWIPE_DOWN_LEFT_EDGE(
|
SWIPE_DOWN_LEFT_EDGE(
|
||||||
"action.down_left",
|
"action.down_left",
|
||||||
R.string.settings_gesture_down_left_edge,
|
R.string.settings_gesture_down_left_edge,
|
||||||
|
R.string.settings_gesture_description_down_left_edge,
|
||||||
R.array.default_down_left,
|
R.array.default_down_left,
|
||||||
R.anim.top_down
|
R.anim.top_down
|
||||||
),
|
),
|
||||||
SWIPE_DOWN_RIGHT_EDGE(
|
SWIPE_DOWN_RIGHT_EDGE(
|
||||||
"action.down_right",
|
"action.down_right",
|
||||||
R.string.settings_gesture_down_right_edge,
|
R.string.settings_gesture_down_right_edge,
|
||||||
|
R.string.settings_gesture_description_down_right_edge,
|
||||||
R.array.default_down_right,
|
R.array.default_down_right,
|
||||||
R.anim.top_down
|
R.anim.top_down
|
||||||
),
|
),
|
||||||
SWIPE_DOWN_DOUBLE(
|
SWIPE_DOWN_DOUBLE(
|
||||||
"action.double_down",
|
"action.double_down",
|
||||||
R.string.settings_gesture_double_down,
|
R.string.settings_gesture_double_down,
|
||||||
|
R.string.settings_gesture_description_double_down,
|
||||||
R.array.default_double_down,
|
R.array.default_double_down,
|
||||||
R.anim.top_down
|
R.anim.top_down
|
||||||
),
|
),
|
||||||
SWIPE_LEFT(
|
SWIPE_LEFT(
|
||||||
"action.left",
|
"action.left",
|
||||||
R.string.settings_gesture_left,
|
R.string.settings_gesture_left,
|
||||||
|
R.string.settings_gesture_description_left,
|
||||||
R.array.default_left,
|
R.array.default_left,
|
||||||
R.anim.right_left
|
R.anim.right_left
|
||||||
),
|
),
|
||||||
SWIPE_LEFT_TOP_EDGE(
|
SWIPE_LEFT_TOP_EDGE(
|
||||||
"action.left_top",
|
"action.left_top",
|
||||||
R.string.settings_gesture_left_top_edge,
|
R.string.settings_gesture_left_top_edge,
|
||||||
|
R.string.settings_gesture_description_left_top_edge,
|
||||||
R.array.default_left_top,
|
R.array.default_left_top,
|
||||||
R.anim.right_left
|
R.anim.right_left
|
||||||
),
|
),
|
||||||
SWIPE_LEFT_BOTTOM_EDGE(
|
SWIPE_LEFT_BOTTOM_EDGE(
|
||||||
"action.left_bottom",
|
"action.left_bottom",
|
||||||
R.string.settings_gesture_left_bottom_edge,
|
R.string.settings_gesture_left_bottom_edge,
|
||||||
|
R.string.settings_gesture_description_left_bottom_edge,
|
||||||
R.array.default_left_bottom,
|
R.array.default_left_bottom,
|
||||||
R.anim.right_left
|
R.anim.right_left
|
||||||
),
|
),
|
||||||
SWIPE_LEFT_DOUBLE(
|
SWIPE_LEFT_DOUBLE(
|
||||||
"action.double_left",
|
"action.double_left",
|
||||||
R.string.settings_gesture_double_left,
|
R.string.settings_gesture_double_left,
|
||||||
|
R.string.settings_gesture_description_double_left,
|
||||||
R.array.default_double_left,
|
R.array.default_double_left,
|
||||||
R.anim.right_left
|
R.anim.right_left
|
||||||
),
|
),
|
||||||
SWIPE_RIGHT(
|
SWIPE_RIGHT(
|
||||||
"action.right",
|
"action.right",
|
||||||
R.string.settings_gesture_right,
|
R.string.settings_gesture_right,
|
||||||
|
R.string.settings_gesture_description_right,
|
||||||
R.array.default_right,
|
R.array.default_right,
|
||||||
R.anim.left_right
|
R.anim.left_right
|
||||||
),
|
),
|
||||||
SWIPE_RIGHT_TOP_EDGE(
|
SWIPE_RIGHT_TOP_EDGE(
|
||||||
"action.right_top",
|
"action.right_top",
|
||||||
R.string.settings_gesture_right_top_edge,
|
R.string.settings_gesture_right_top_edge,
|
||||||
|
R.string.settings_gesture_description_right_top_edge,
|
||||||
R.array.default_right_top,
|
R.array.default_right_top,
|
||||||
R.anim.left_right
|
R.anim.left_right
|
||||||
),
|
),
|
||||||
SWIPE_RIGHT_BOTTOM_EDGE(
|
SWIPE_RIGHT_BOTTOM_EDGE(
|
||||||
"action.right_bottom",
|
"action.right_bottom",
|
||||||
R.string.settings_gesture_right_bottom_edge,
|
R.string.settings_gesture_right_bottom_edge,
|
||||||
|
R.string.settings_gesture_description_right_bottom_edge,
|
||||||
R.array.default_right_bottom,
|
R.array.default_right_bottom,
|
||||||
R.anim.left_right
|
R.anim.left_right
|
||||||
),
|
),
|
||||||
SWIPE_RIGHT_DOUBLE(
|
SWIPE_RIGHT_DOUBLE(
|
||||||
"action.double_right",
|
"action.double_right",
|
||||||
R.string.settings_gesture_double_right,
|
R.string.settings_gesture_double_right,
|
||||||
|
R.string.settings_gesture_description_double_right,
|
||||||
R.array.default_double_right,
|
R.array.default_double_right,
|
||||||
R.anim.left_right
|
R.anim.left_right
|
||||||
);
|
);
|
||||||
|
@ -139,6 +170,9 @@ enum class Gesture(
|
||||||
fun getLabel(context: Context): String {
|
fun getLabel(context: Context): String {
|
||||||
return context.resources.getString(this.labelResource)
|
return context.resources.getString(this.labelResource)
|
||||||
}
|
}
|
||||||
|
fun getDescription(context: Context): String {
|
||||||
|
return context.resources.getString(this.descriptionResource)
|
||||||
|
}
|
||||||
|
|
||||||
fun getDoubleVariant(): Gesture {
|
fun getDoubleVariant(): Gesture {
|
||||||
return when (this) {
|
return when (this) {
|
||||||
|
|
|
@ -3,6 +3,7 @@ package de.jrpie.android.launcher.ui.settings.actions
|
||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
|
import android.os.Build
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
@ -10,6 +11,7 @@ import android.view.ViewGroup
|
||||||
import android.widget.Button
|
import android.widget.Button
|
||||||
import android.widget.ImageView
|
import android.widget.ImageView
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
|
import androidx.annotation.RequiresApi
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
@ -113,6 +115,13 @@ class ActionsRecyclerAdapter(val activity: Activity) :
|
||||||
override fun onBindViewHolder(viewHolder: ViewHolder, i: Int) {
|
override fun onBindViewHolder(viewHolder: ViewHolder, i: Int) {
|
||||||
val gesture = gesturesList[i]
|
val gesture = gesturesList[i]
|
||||||
viewHolder.textView.text = gesture.getLabel(activity)
|
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())
|
if (LauncherPreferences.theme().monochromeIcons())
|
||||||
transformGrayscale(viewHolder.img)
|
transformGrayscale(viewHolder.img)
|
||||||
updateViewHolder(gesture, viewHolder)
|
updateViewHolder(gesture, viewHolder)
|
||||||
|
|
|
@ -26,27 +26,50 @@
|
||||||
-
|
-
|
||||||
-->
|
-->
|
||||||
<string name="settings_gesture_up">Swipe Up</string>
|
<string name="settings_gesture_up">Swipe Up</string>
|
||||||
|
<string name="settings_gesture_description_up">Swipe up</string>
|
||||||
<string name="settings_gesture_double_up">Double 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">Swipe Down</string>
|
||||||
|
<string name="settings_gesture_description_down">Swipe down</string>
|
||||||
<string name="settings_gesture_double_down">Double 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">Swipe Left</string>
|
||||||
|
<string name="settings_gesture_description_left">Swipe left</string>
|
||||||
<string name="settings_gesture_double_left">Double 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">Swipe Right</string>
|
||||||
|
<string name="settings_gesture_description_right">Swipe right</string>
|
||||||
<string name="settings_gesture_double_right">Double 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">Swipe 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">Swipe 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">Swipe 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">Swipe 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">Swipe 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">Swipe 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">Swipe 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">Swipe 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_vol_up">Volume Up</string>
|
||||||
|
<string name="settings_gesture_description_vol_up">Press the volume up button</string>
|
||||||
<string name="settings_gesture_vol_down">Volume Down</string>
|
<string name="settings_gesture_vol_down">Volume Down</string>
|
||||||
|
<string name="settings_gesture_description_vol_down">Press the volume down button</string>
|
||||||
<string name="settings_gesture_double_click">Double Click</string>
|
<string name="settings_gesture_double_click">Double Click</string>
|
||||||
|
<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_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_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_time">Click on Time</string>
|
||||||
|
<string name="settings_gesture_description_time">Click on Time</string>
|
||||||
|
|
||||||
|
|
||||||
<string name="settings_apps_choose">Choose App</string>
|
<string name="settings_apps_choose">Choose App</string>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue