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
|
||||
}
|
||||
|
||||
binding.clockLayout.setOnClickListener {_ ->
|
||||
clock.setOnClickListener {_ ->
|
||||
if (sharedPreferenceManager.isClockGestureEnabled()) {
|
||||
val intent = Intent(AlarmClock.ACTION_SHOW_ALARMS)
|
||||
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))
|
||||
true
|
||||
}
|
||||
|
|
|
|||
|
|
@ -131,6 +131,10 @@ class SharedPreferenceManager (private val context: Context) {
|
|||
return preferences.getBoolean("clockClick", true)
|
||||
}
|
||||
|
||||
fun isDateGestureEnabled() : Boolean {
|
||||
return preferences.getBoolean("dateClick", true)
|
||||
}
|
||||
|
||||
// Gestures
|
||||
fun setGestures(direction: String, appName: String?) {
|
||||
val editor = preferences.edit()
|
||||
|
|
|
|||
|
|
@ -182,6 +182,12 @@
|
|||
android:defaultValue="true"
|
||||
android:title="Clicking Time Opens Clock"
|
||||
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
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue