diff --git a/app/build.gradle b/app/build.gradle
index ac299e58..31283be8 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -41,7 +41,7 @@ android {
}
dependencies {
- implementation 'com.simplemobiletools:commons:3.15.8'
+ implementation 'com.simplemobiletools:commons:3.15.9'
implementation 'com.facebook.stetho:stetho:1.5.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
}
diff --git a/app/src/main/kotlin/com/simplemobiletools/clock/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/clock/activities/SettingsActivity.kt
index 3036d1ba..7fa2eedb 100644
--- a/app/src/main/kotlin/com/simplemobiletools/clock/activities/SettingsActivity.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/clock/activities/SettingsActivity.kt
@@ -24,13 +24,14 @@ class SettingsActivity : SimpleActivity() {
setupDisplayOtherTimeZones()
setupUseSameSnooze()
setupSnoozeTime()
+ setupVibrate()
updateTextColors(settings_holder)
setupSectionColors()
}
private fun setupSectionColors() {
val adjustedPrimaryColor = getAdjustedPrimaryColor()
- arrayListOf(clock_tab_label, alarm_tab_label).forEach {
+ arrayListOf(clock_tab_label, alarm_tab_label, stopwatch_tab_label).forEach {
it.setTextColor(adjustedPrimaryColor)
}
}
@@ -103,6 +104,14 @@ class SettingsActivity : SimpleActivity() {
}
}
+ private fun setupVibrate() {
+ settings_vibrate.isChecked = config.vibrateOnButtonPress
+ settings_vibrate_holder.setOnClickListener {
+ settings_vibrate.toggle()
+ config.vibrateOnButtonPress = settings_vibrate.isChecked
+ }
+ }
+
private fun updateSnoozeText() {
settings_snooze_time.text = formatMinutesToTimeString(config.snoozeTime)
}
diff --git a/app/src/main/kotlin/com/simplemobiletools/clock/fragments/StopwatchFragment.kt b/app/src/main/kotlin/com/simplemobiletools/clock/fragments/StopwatchFragment.kt
index 4af16110..23eaf076 100644
--- a/app/src/main/kotlin/com/simplemobiletools/clock/fragments/StopwatchFragment.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/clock/fragments/StopwatchFragment.kt
@@ -45,26 +45,32 @@ class StopwatchFragment : Fragment() {
view = (inflater.inflate(R.layout.fragment_stopwatch, container, false) as ViewGroup).apply {
stopwatch_time.setOnClickListener {
togglePlayPause()
+ checkHaptic(this)
}
stopwatch_play_pause.setOnClickListener {
togglePlayPause()
+ checkHaptic(this)
}
stopwatch_reset.setOnClickListener {
resetStopwatch()
+ checkHaptic(this)
}
stopwatch_sorting_indicator_1.setOnClickListener {
changeSorting(SORT_BY_LAP)
+ checkHaptic(this)
}
stopwatch_sorting_indicator_2.setOnClickListener {
changeSorting(SORT_BY_LAP_TIME)
+ checkHaptic(this)
}
stopwatch_sorting_indicator_3.setOnClickListener {
changeSorting(SORT_BY_TOTAL_TIME)
+ checkHaptic(this)
}
stopwatch_lap.setOnClickListener {
@@ -73,6 +79,7 @@ class StopwatchFragment : Fragment() {
laps.add(0, lap)
lapTicks = 0
updateLaps()
+ checkHaptic(this)
}
stopwatchAdapter = StopwatchAdapter(activity as SimpleActivity, ArrayList(), stopwatch_list) {
@@ -204,6 +211,12 @@ class StopwatchFragment : Fragment() {
stopwatchAdapter.updateItems(laps)
}
+ private fun checkHaptic(view: View) {
+ if (context!!.config.vibrateOnButtonPress) {
+ view.performHapticFeedback()
+ }
+ }
+
private val updateRunnable = object : Runnable {
override fun run() {
if (isRunning) {
diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml
index 8969d9cf..495b1b15 100644
--- a/app/src/main/res/layout/activity_settings.xml
+++ b/app/src/main/res/layout/activity_settings.xml
@@ -241,5 +241,45 @@
android:clickable="false"/>
+
+
+
+
+
+
+
+
+