mirror of
https://github.com/SimpleMobileTools/Simple-Clock.git
synced 2025-02-07 15:38:41 +01:00
removing the stopwatch vibrating related setting
This commit is contained in:
parent
2fc937d25d
commit
15c0a30ff3
@ -3,11 +3,9 @@ package com.simplemobiletools.clock
|
|||||||
import android.app.Application
|
import android.app.Application
|
||||||
import android.app.NotificationManager
|
import android.app.NotificationManager
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.os.Build
|
|
||||||
import android.os.CountDownTimer
|
import android.os.CountDownTimer
|
||||||
import android.os.Handler
|
import android.os.Handler
|
||||||
import android.os.Looper
|
import android.os.Looper
|
||||||
import androidx.annotation.RequiresApi
|
|
||||||
import androidx.lifecycle.Lifecycle
|
import androidx.lifecycle.Lifecycle
|
||||||
import androidx.lifecycle.LifecycleObserver
|
import androidx.lifecycle.LifecycleObserver
|
||||||
import androidx.lifecycle.OnLifecycleEvent
|
import androidx.lifecycle.OnLifecycleEvent
|
||||||
@ -44,7 +42,6 @@ class App : Application(), LifecycleObserver {
|
|||||||
super.onTerminate()
|
super.onTerminate()
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresApi(Build.VERSION_CODES.O)
|
|
||||||
@OnLifecycleEvent(Lifecycle.Event.ON_STOP)
|
@OnLifecycleEvent(Lifecycle.Event.ON_STOP)
|
||||||
private fun onAppBackgrounded() {
|
private fun onAppBackgrounded() {
|
||||||
timerHelper.getTimers { timers ->
|
timerHelper.getTimers { timers ->
|
||||||
|
@ -6,7 +6,10 @@ import android.content.Intent
|
|||||||
import android.media.AudioManager
|
import android.media.AudioManager
|
||||||
import android.media.MediaPlayer
|
import android.media.MediaPlayer
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.os.*
|
import android.os.Bundle
|
||||||
|
import android.os.Handler
|
||||||
|
import android.os.VibrationEffect
|
||||||
|
import android.os.Vibrator
|
||||||
import android.view.MotionEvent
|
import android.view.MotionEvent
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.view.animation.AnimationUtils
|
import android.view.animation.AnimationUtils
|
||||||
@ -162,11 +165,7 @@ class ReminderActivity : SimpleActivity() {
|
|||||||
if (doVibrate) {
|
if (doVibrate) {
|
||||||
val pattern = LongArray(2) { 500 }
|
val pattern = LongArray(2) { 500 }
|
||||||
vibrator = getSystemService(Context.VIBRATOR_SERVICE) as Vibrator
|
vibrator = getSystemService(Context.VIBRATOR_SERVICE) as Vibrator
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
vibrator?.vibrate(VibrationEffect.createWaveform(pattern, 0))
|
||||||
vibrator?.vibrate(VibrationEffect.createWaveform(pattern, 0))
|
|
||||||
} else {
|
|
||||||
vibrator?.vibrate(pattern, 0)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val soundUri = if (alarm != null) alarm!!.soundUri else config.timerSoundUri
|
val soundUri = if (alarm != null) alarm!!.soundUri else config.timerSoundUri
|
||||||
|
@ -29,7 +29,6 @@ class SettingsActivity : SimpleActivity() {
|
|||||||
setupAlarmMaxReminder()
|
setupAlarmMaxReminder()
|
||||||
setupUseSameSnooze()
|
setupUseSameSnooze()
|
||||||
setupSnoozeTime()
|
setupSnoozeTime()
|
||||||
setupVibrate()
|
|
||||||
setupTimerMaxReminder()
|
setupTimerMaxReminder()
|
||||||
setupIncreaseVolumeGradually()
|
setupIncreaseVolumeGradually()
|
||||||
setupCustomizeWidgetColors()
|
setupCustomizeWidgetColors()
|
||||||
@ -39,7 +38,6 @@ class SettingsActivity : SimpleActivity() {
|
|||||||
settings_color_customization_label,
|
settings_color_customization_label,
|
||||||
settings_general_settings_label,
|
settings_general_settings_label,
|
||||||
settings_alarm_tab_label,
|
settings_alarm_tab_label,
|
||||||
settings_stopwatch_tab_label,
|
|
||||||
settings_timer_tab_label,
|
settings_timer_tab_label,
|
||||||
).forEach {
|
).forEach {
|
||||||
it.setTextColor(getProperPrimaryColor())
|
it.setTextColor(getProperPrimaryColor())
|
||||||
@ -49,7 +47,6 @@ class SettingsActivity : SimpleActivity() {
|
|||||||
settings_color_customization_holder,
|
settings_color_customization_holder,
|
||||||
settings_general_settings_holder,
|
settings_general_settings_holder,
|
||||||
settings_alarm_tab_holder,
|
settings_alarm_tab_holder,
|
||||||
settings_stopwatch_tab_holder,
|
|
||||||
settings_timer_tab_holder,
|
settings_timer_tab_holder,
|
||||||
).forEach {
|
).forEach {
|
||||||
it.background.applyColorFilter(getProperBackgroundColor().getContrastColor())
|
it.background.applyColorFilter(getProperBackgroundColor().getContrastColor())
|
||||||
@ -149,14 +146,6 @@ 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 setupTimerMaxReminder() {
|
private fun setupTimerMaxReminder() {
|
||||||
updateTimerMaxReminderText()
|
updateTimerMaxReminderText()
|
||||||
settings_timer_max_reminder_holder.setOnClickListener {
|
settings_timer_max_reminder_holder.setOnClickListener {
|
||||||
|
@ -15,7 +15,6 @@ import com.google.gson.reflect.TypeToken
|
|||||||
import com.simplemobiletools.clock.R
|
import com.simplemobiletools.clock.R
|
||||||
import com.simplemobiletools.clock.activities.SimpleActivity
|
import com.simplemobiletools.clock.activities.SimpleActivity
|
||||||
import com.simplemobiletools.clock.adapters.StopwatchAdapter
|
import com.simplemobiletools.clock.adapters.StopwatchAdapter
|
||||||
import com.simplemobiletools.clock.extensions.config
|
|
||||||
import com.simplemobiletools.clock.extensions.formatStopwatchTime
|
import com.simplemobiletools.clock.extensions.formatStopwatchTime
|
||||||
import com.simplemobiletools.clock.helpers.SORT_BY_LAP
|
import com.simplemobiletools.clock.helpers.SORT_BY_LAP
|
||||||
import com.simplemobiletools.clock.helpers.SORT_BY_LAP_TIME
|
import com.simplemobiletools.clock.helpers.SORT_BY_LAP_TIME
|
||||||
@ -55,32 +54,26 @@ class StopwatchFragment : Fragment() {
|
|||||||
view = (inflater.inflate(R.layout.fragment_stopwatch, container, false) as ViewGroup).apply {
|
view = (inflater.inflate(R.layout.fragment_stopwatch, container, false) as ViewGroup).apply {
|
||||||
stopwatch_time.setOnClickListener {
|
stopwatch_time.setOnClickListener {
|
||||||
togglePlayPause()
|
togglePlayPause()
|
||||||
checkHaptic(this)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
stopwatch_play_pause.setOnClickListener {
|
stopwatch_play_pause.setOnClickListener {
|
||||||
togglePlayPause()
|
togglePlayPause()
|
||||||
checkHaptic(this)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
stopwatch_reset.setOnClickListener {
|
stopwatch_reset.setOnClickListener {
|
||||||
resetStopwatch()
|
resetStopwatch()
|
||||||
checkHaptic(this)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
stopwatch_sorting_indicator_1.setOnClickListener {
|
stopwatch_sorting_indicator_1.setOnClickListener {
|
||||||
changeSorting(SORT_BY_LAP)
|
changeSorting(SORT_BY_LAP)
|
||||||
checkHaptic(this)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
stopwatch_sorting_indicator_2.setOnClickListener {
|
stopwatch_sorting_indicator_2.setOnClickListener {
|
||||||
changeSorting(SORT_BY_LAP_TIME)
|
changeSorting(SORT_BY_LAP_TIME)
|
||||||
checkHaptic(this)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
stopwatch_sorting_indicator_3.setOnClickListener {
|
stopwatch_sorting_indicator_3.setOnClickListener {
|
||||||
changeSorting(SORT_BY_TOTAL_TIME)
|
changeSorting(SORT_BY_TOTAL_TIME)
|
||||||
checkHaptic(this)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
stopwatch_lap.setOnClickListener {
|
stopwatch_lap.setOnClickListener {
|
||||||
@ -100,7 +93,6 @@ class StopwatchFragment : Fragment() {
|
|||||||
laps.add(0, lap)
|
laps.add(0, lap)
|
||||||
lapTicks = 0
|
lapTicks = 0
|
||||||
updateLaps()
|
updateLaps()
|
||||||
checkHaptic(this)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
stopwatchAdapter = StopwatchAdapter(activity as SimpleActivity, ArrayList(), stopwatch_list) {
|
stopwatchAdapter = StopwatchAdapter(activity as SimpleActivity, ArrayList(), stopwatch_list) {
|
||||||
@ -292,12 +284,6 @@ class StopwatchFragment : Fragment() {
|
|||||||
stopwatchAdapter.updateItems(laps)
|
stopwatchAdapter.updateItems(laps)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun checkHaptic(view: View) {
|
|
||||||
if (requireContext().config.vibrateOnButtonPress) {
|
|
||||||
view.performHapticFeedback()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private val updateRunnable = object : Runnable {
|
private val updateRunnable = object : Runnable {
|
||||||
override fun run() {
|
override fun run() {
|
||||||
if (isRunning) {
|
if (isRunning) {
|
||||||
|
@ -235,38 +235,6 @@
|
|||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/settings_stopwatch_tab_label"
|
|
||||||
style="@style/SettingsSectionLabelStyle"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/stopwatch_tab" />
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/settings_stopwatch_tab_holder"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_margin="@dimen/medium_margin"
|
|
||||||
android:background="@drawable/section_holder_stroke"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<RelativeLayout
|
|
||||||
android:id="@+id/settings_vibrate_holder"
|
|
||||||
style="@style/SettingsHolderCheckboxStyle"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:background="@drawable/ripple_all_corners">
|
|
||||||
|
|
||||||
<com.simplemobiletools.commons.views.MyAppCompatCheckbox
|
|
||||||
android:id="@+id/settings_vibrate"
|
|
||||||
style="@style/SettingsCheckboxStyle"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/vibrate_on_button_press" />
|
|
||||||
|
|
||||||
</RelativeLayout>
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/settings_timer_tab_label"
|
android:id="@+id/settings_timer_tab_label"
|
||||||
style="@style/SettingsSectionLabelStyle"
|
style="@style/SettingsSectionLabelStyle"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user