mirror of
https://github.com/He4eT/yamf_launcher.git
synced 2026-05-05 01:47:24 +00:00
Added gesture to launch calendar by clicking date
This commit is contained in:
parent
a08bc25f6e
commit
3164694f42
3 changed files with 30 additions and 2 deletions
|
|
@ -325,7 +325,7 @@ class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceCh
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.clockLayout.setOnClickListener {_ ->
|
clock.setOnClickListener {_ ->
|
||||||
if (sharedPreferenceManager.isClockGestureEnabled()) {
|
if (sharedPreferenceManager.isClockGestureEnabled()) {
|
||||||
val intent = Intent(AlarmClock.ACTION_SHOW_ALARMS)
|
val intent = Intent(AlarmClock.ACTION_SHOW_ALARMS)
|
||||||
if (intent.resolveActivity(packageManager) != null) {
|
if (intent.resolveActivity(packageManager) != null) {
|
||||||
|
|
@ -334,7 +334,25 @@ class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceCh
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.clockLayout.setOnLongClickListener {_ ->
|
dateText.setOnClickListener { _ ->
|
||||||
|
if (sharedPreferenceManager.isDateGestureEnabled()) {
|
||||||
|
startActivity(
|
||||||
|
Intent(
|
||||||
|
Intent.makeMainSelectorActivity(
|
||||||
|
Intent.ACTION_MAIN,
|
||||||
|
Intent.CATEGORY_APP_CALENDAR
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
clock.setOnLongClickListener {_ ->
|
||||||
|
startActivity(Intent(this@MainActivity, SettingsActivity::class.java))
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
|
dateText.setOnLongClickListener {_ ->
|
||||||
startActivity(Intent(this@MainActivity, SettingsActivity::class.java))
|
startActivity(Intent(this@MainActivity, SettingsActivity::class.java))
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -131,6 +131,10 @@ class SharedPreferenceManager (private val context: Context) {
|
||||||
return preferences.getBoolean("clockClick", true)
|
return preferences.getBoolean("clockClick", true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun isDateGestureEnabled() : Boolean {
|
||||||
|
return preferences.getBoolean("dateClick", true)
|
||||||
|
}
|
||||||
|
|
||||||
// Gestures
|
// Gestures
|
||||||
fun setGestures(direction: String, appName: String?) {
|
fun setGestures(direction: String, appName: String?) {
|
||||||
val editor = preferences.edit()
|
val editor = preferences.edit()
|
||||||
|
|
|
||||||
|
|
@ -182,6 +182,12 @@
|
||||||
android:defaultValue="true"
|
android:defaultValue="true"
|
||||||
android:title="Clicking Time Opens Clock"
|
android:title="Clicking Time Opens Clock"
|
||||||
app:key="clockClick" />
|
app:key="clockClick" />
|
||||||
|
<SwitchPreference
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:defaultValue="true"
|
||||||
|
android:title="Clicking Date Opens Calendar"
|
||||||
|
app:key="dateClick" />
|
||||||
<SwitchPreference
|
<SwitchPreference
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue