removing the stopwatch vibrating related setting

This commit is contained in:
tibbi 2022-04-21 15:01:11 +02:00
parent 2fc937d25d
commit 15c0a30ff3
5 changed files with 5 additions and 66 deletions

View File

@ -3,11 +3,9 @@ package com.simplemobiletools.clock
import android.app.Application
import android.app.NotificationManager
import android.content.Context
import android.os.Build
import android.os.CountDownTimer
import android.os.Handler
import android.os.Looper
import androidx.annotation.RequiresApi
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleObserver
import androidx.lifecycle.OnLifecycleEvent
@ -44,7 +42,6 @@ class App : Application(), LifecycleObserver {
super.onTerminate()
}
@RequiresApi(Build.VERSION_CODES.O)
@OnLifecycleEvent(Lifecycle.Event.ON_STOP)
private fun onAppBackgrounded() {
timerHelper.getTimers { timers ->

View File

@ -6,7 +6,10 @@ import android.content.Intent
import android.media.AudioManager
import android.media.MediaPlayer
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.ViewGroup
import android.view.animation.AnimationUtils
@ -162,11 +165,7 @@ class ReminderActivity : SimpleActivity() {
if (doVibrate) {
val pattern = LongArray(2) { 500 }
vibrator = getSystemService(Context.VIBRATOR_SERVICE) as Vibrator
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
vibrator?.vibrate(VibrationEffect.createWaveform(pattern, 0))
} else {
vibrator?.vibrate(pattern, 0)
}
vibrator?.vibrate(VibrationEffect.createWaveform(pattern, 0))
}
val soundUri = if (alarm != null) alarm!!.soundUri else config.timerSoundUri

View File

@ -29,7 +29,6 @@ class SettingsActivity : SimpleActivity() {
setupAlarmMaxReminder()
setupUseSameSnooze()
setupSnoozeTime()
setupVibrate()
setupTimerMaxReminder()
setupIncreaseVolumeGradually()
setupCustomizeWidgetColors()
@ -39,7 +38,6 @@ class SettingsActivity : SimpleActivity() {
settings_color_customization_label,
settings_general_settings_label,
settings_alarm_tab_label,
settings_stopwatch_tab_label,
settings_timer_tab_label,
).forEach {
it.setTextColor(getProperPrimaryColor())
@ -49,7 +47,6 @@ class SettingsActivity : SimpleActivity() {
settings_color_customization_holder,
settings_general_settings_holder,
settings_alarm_tab_holder,
settings_stopwatch_tab_holder,
settings_timer_tab_holder,
).forEach {
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() {
updateTimerMaxReminderText()
settings_timer_max_reminder_holder.setOnClickListener {

View File

@ -15,7 +15,6 @@ import com.google.gson.reflect.TypeToken
import com.simplemobiletools.clock.R
import com.simplemobiletools.clock.activities.SimpleActivity
import com.simplemobiletools.clock.adapters.StopwatchAdapter
import com.simplemobiletools.clock.extensions.config
import com.simplemobiletools.clock.extensions.formatStopwatchTime
import com.simplemobiletools.clock.helpers.SORT_BY_LAP
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 {
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 {
@ -100,7 +93,6 @@ class StopwatchFragment : Fragment() {
laps.add(0, lap)
lapTicks = 0
updateLaps()
checkHaptic(this)
}
stopwatchAdapter = StopwatchAdapter(activity as SimpleActivity, ArrayList(), stopwatch_list) {
@ -292,12 +284,6 @@ class StopwatchFragment : Fragment() {
stopwatchAdapter.updateItems(laps)
}
private fun checkHaptic(view: View) {
if (requireContext().config.vibrateOnButtonPress) {
view.performHapticFeedback()
}
}
private val updateRunnable = object : Runnable {
override fun run() {
if (isRunning) {

View File

@ -235,38 +235,6 @@
</RelativeLayout>
</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
android:id="@+id/settings_timer_tab_label"
style="@style/SettingsSectionLabelStyle"