updating commons and some libraries
This commit is contained in:
parent
deba1c77d6
commit
6daddd310a
|
@ -67,16 +67,17 @@ android {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'com.github.SimpleMobileTools:Simple-Commons:eee4809d37'
|
implementation 'com.github.SimpleMobileTools:Simple-Commons:d5e1100f27'
|
||||||
implementation 'com.facebook.stetho:stetho:1.5.0'
|
implementation 'com.facebook.stetho:stetho:1.5.0'
|
||||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
|
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
|
||||||
implementation 'com.shawnlin:number-picker:2.4.6'
|
implementation 'com.shawnlin:number-picker:2.4.6'
|
||||||
implementation "androidx.preference:preference-ktx:1.1.1"
|
implementation "androidx.preference:preference-ktx:1.2.0"
|
||||||
implementation "androidx.work:work-runtime-ktx:2.6.0"
|
implementation "androidx.work:work-runtime-ktx:2.7.1"
|
||||||
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.0'
|
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.0'
|
||||||
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.1'
|
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.4.1'
|
||||||
implementation 'org.greenrobot:eventbus:3.2.0'
|
implementation 'org.greenrobot:eventbus:3.3.1'
|
||||||
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
|
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
|
||||||
implementation 'androidx.room:room-runtime:2.3.0'
|
|
||||||
kapt 'androidx.room:room-compiler:2.3.0'
|
implementation 'androidx.room:room-runtime:2.4.2'
|
||||||
|
kapt 'androidx.room:room-compiler:2.4.2'
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
<uses-permission android:name="android.permission.VIBRATE" />
|
<uses-permission android:name="android.permission.VIBRATE" />
|
||||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||||
<uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT" />
|
<uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT" />
|
||||||
|
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />
|
||||||
|
|
||||||
<uses-permission
|
<uses-permission
|
||||||
android:name="android.permission.ACCESS_NETWORK_STATE"
|
android:name="android.permission.ACCESS_NETWORK_STATE"
|
||||||
|
|
|
@ -42,22 +42,22 @@ class MainActivity : SimpleActivity() {
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
val configTextColor = config.textColor
|
val configTextColor = getProperTextColor()
|
||||||
if (storedTextColor != configTextColor) {
|
if (storedTextColor != configTextColor) {
|
||||||
getInactiveTabIndexes(view_pager.currentItem).forEach {
|
getInactiveTabIndexes(view_pager.currentItem).forEach {
|
||||||
main_tabs_holder.getTabAt(it)?.icon?.applyColorFilter(configTextColor)
|
main_tabs_holder.getTabAt(it)?.icon?.applyColorFilter(configTextColor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val configBackgroundColor = config.backgroundColor
|
val configBackgroundColor = getProperBackgroundColor()
|
||||||
if (storedBackgroundColor != configBackgroundColor) {
|
if (storedBackgroundColor != configBackgroundColor) {
|
||||||
main_tabs_holder.background = ColorDrawable(configBackgroundColor)
|
main_tabs_holder.background = ColorDrawable(configBackgroundColor)
|
||||||
}
|
}
|
||||||
|
|
||||||
val configPrimaryColor = config.primaryColor
|
val configPrimaryColor = getProperPrimaryColor()
|
||||||
if (storedPrimaryColor != configPrimaryColor) {
|
if (storedPrimaryColor != configPrimaryColor) {
|
||||||
main_tabs_holder.setSelectedTabIndicatorColor(getAdjustedPrimaryColor())
|
main_tabs_holder.setSelectedTabIndicatorColor(getProperPrimaryColor())
|
||||||
main_tabs_holder.getTabAt(view_pager.currentItem)?.icon?.applyColorFilter(getAdjustedPrimaryColor())
|
main_tabs_holder.getTabAt(view_pager.currentItem)?.icon?.applyColorFilter(getProperPrimaryColor())
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.preventPhoneFromSleeping) {
|
if (config.preventPhoneFromSleeping) {
|
||||||
|
@ -107,11 +107,9 @@ class MainActivity : SimpleActivity() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun storeStateVariables() {
|
private fun storeStateVariables() {
|
||||||
config.apply {
|
storedTextColor = getProperTextColor()
|
||||||
storedTextColor = textColor
|
storedBackgroundColor = getProperBackgroundColor()
|
||||||
storedBackgroundColor = backgroundColor
|
storedPrimaryColor = getProperPrimaryColor()
|
||||||
storedPrimaryColor = primaryColor
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onActivityResult(requestCode: Int, resultCode: Int, resultData: Intent?) {
|
override fun onActivityResult(requestCode: Int, resultCode: Int, resultData: Intent?) {
|
||||||
|
@ -154,11 +152,11 @@ class MainActivity : SimpleActivity() {
|
||||||
view_pager.offscreenPageLimit = TABS_COUNT - 1
|
view_pager.offscreenPageLimit = TABS_COUNT - 1
|
||||||
main_tabs_holder.onTabSelectionChanged(
|
main_tabs_holder.onTabSelectionChanged(
|
||||||
tabUnselectedAction = {
|
tabUnselectedAction = {
|
||||||
it.icon?.applyColorFilter(config.textColor)
|
it.icon?.applyColorFilter(getProperTextColor())
|
||||||
},
|
},
|
||||||
tabSelectedAction = {
|
tabSelectedAction = {
|
||||||
view_pager.currentItem = it.position
|
view_pager.currentItem = it.position
|
||||||
it.icon?.applyColorFilter(getAdjustedPrimaryColor())
|
it.icon?.applyColorFilter(getProperPrimaryColor())
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -167,15 +165,15 @@ class MainActivity : SimpleActivity() {
|
||||||
|
|
||||||
private fun setupTabColors(lastUsedTab: Int) {
|
private fun setupTabColors(lastUsedTab: Int) {
|
||||||
main_tabs_holder.apply {
|
main_tabs_holder.apply {
|
||||||
background = ColorDrawable(config.backgroundColor)
|
background = ColorDrawable(getProperBackgroundColor())
|
||||||
setSelectedTabIndicatorColor(getAdjustedPrimaryColor())
|
setSelectedTabIndicatorColor(getProperPrimaryColor())
|
||||||
getTabAt(lastUsedTab)?.apply {
|
getTabAt(lastUsedTab)?.apply {
|
||||||
select()
|
select()
|
||||||
icon?.applyColorFilter(getAdjustedPrimaryColor())
|
icon?.applyColorFilter(getProperPrimaryColor())
|
||||||
}
|
}
|
||||||
|
|
||||||
getInactiveTabIndexes(lastUsedTab).forEach {
|
getInactiveTabIndexes(lastUsedTab).forEach {
|
||||||
getTabAt(it)?.icon?.applyColorFilter(config.textColor)
|
getTabAt(it)?.icon?.applyColorFilter(getProperTextColor())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,11 +81,12 @@ class ReminderActivity : SimpleActivity() {
|
||||||
private fun setupAlarmButtons() {
|
private fun setupAlarmButtons() {
|
||||||
reminder_stop.beGone()
|
reminder_stop.beGone()
|
||||||
reminder_draggable_background.startAnimation(AnimationUtils.loadAnimation(this, R.anim.pulsing_animation))
|
reminder_draggable_background.startAnimation(AnimationUtils.loadAnimation(this, R.anim.pulsing_animation))
|
||||||
reminder_draggable_background.applyColorFilter(getAdjustedPrimaryColor())
|
reminder_draggable_background.applyColorFilter(getProperPrimaryColor())
|
||||||
|
|
||||||
reminder_dismiss.applyColorFilter(config.textColor)
|
val textColor = getProperTextColor()
|
||||||
reminder_draggable.applyColorFilter(config.textColor)
|
reminder_dismiss.applyColorFilter(textColor)
|
||||||
reminder_snooze.applyColorFilter(config.textColor)
|
reminder_draggable.applyColorFilter(textColor)
|
||||||
|
reminder_snooze.applyColorFilter(textColor)
|
||||||
|
|
||||||
var minDragX = 0f
|
var minDragX = 0f
|
||||||
var maxDragX = 0f
|
var maxDragX = 0f
|
||||||
|
@ -147,7 +148,7 @@ class ReminderActivity : SimpleActivity() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupTimerButtons() {
|
private fun setupTimerButtons() {
|
||||||
reminder_stop.background = resources.getColoredDrawableWithColor(R.drawable.circle_background_filled, getAdjustedPrimaryColor())
|
reminder_stop.background = resources.getColoredDrawableWithColor(R.drawable.circle_background_filled, getProperPrimaryColor())
|
||||||
arrayOf(reminder_snooze, reminder_draggable_background, reminder_draggable, reminder_dismiss).forEach {
|
arrayOf(reminder_snooze, reminder_draggable_background, reminder_draggable, reminder_dismiss).forEach {
|
||||||
it.beGone()
|
it.beGone()
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ class SettingsActivity : SimpleActivity() {
|
||||||
settings_timer_tab_label,
|
settings_timer_tab_label,
|
||||||
settings_widgets_label
|
settings_widgets_label
|
||||||
).forEach {
|
).forEach {
|
||||||
it.setTextColor(getAdjustedPrimaryColor())
|
it.setTextColor(getProperPrimaryColor())
|
||||||
}
|
}
|
||||||
|
|
||||||
arrayOf(
|
arrayOf(
|
||||||
|
@ -60,7 +60,7 @@ class SettingsActivity : SimpleActivity() {
|
||||||
settings_timer_tab_holder,
|
settings_timer_tab_holder,
|
||||||
settings_widgets_holder
|
settings_widgets_holder
|
||||||
).forEach {
|
).forEach {
|
||||||
it.background.applyColorFilter(baseConfig.backgroundColor.getContrastColor())
|
it.background.applyColorFilter(getProperBackgroundColor().getContrastColor())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@ import com.simplemobiletools.clock.helpers.getPassedSeconds
|
||||||
import com.simplemobiletools.commons.dialogs.ColorPickerDialog
|
import com.simplemobiletools.commons.dialogs.ColorPickerDialog
|
||||||
import com.simplemobiletools.commons.extensions.adjustAlpha
|
import com.simplemobiletools.commons.extensions.adjustAlpha
|
||||||
import com.simplemobiletools.commons.extensions.applyColorFilter
|
import com.simplemobiletools.commons.extensions.applyColorFilter
|
||||||
|
import com.simplemobiletools.commons.extensions.getProperPrimaryColor
|
||||||
import com.simplemobiletools.commons.extensions.setFillWithStroke
|
import com.simplemobiletools.commons.extensions.setFillWithStroke
|
||||||
import com.simplemobiletools.commons.helpers.IS_CUSTOMIZING_COLORS
|
import com.simplemobiletools.commons.helpers.IS_CUSTOMIZING_COLORS
|
||||||
import kotlinx.android.synthetic.main.widget_config_date_time.*
|
import kotlinx.android.synthetic.main.widget_config_date_time.*
|
||||||
|
@ -45,7 +46,7 @@ class WidgetDateTimeConfigureActivity : SimpleActivity() {
|
||||||
config_bg_color.setOnClickListener { pickBackgroundColor() }
|
config_bg_color.setOnClickListener { pickBackgroundColor() }
|
||||||
config_text_color.setOnClickListener { pickTextColor() }
|
config_text_color.setOnClickListener { pickTextColor() }
|
||||||
|
|
||||||
val primaryColor = config.primaryColor
|
val primaryColor = getProperPrimaryColor()
|
||||||
config_bg_seekbar.setColors(mTextColor, primaryColor, primaryColor)
|
config_bg_seekbar.setColors(mTextColor, primaryColor, primaryColor)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -102,7 +102,7 @@ class AlarmsAdapter(
|
||||||
alarm_label.beVisibleIf(alarm.label.isNotEmpty())
|
alarm_label.beVisibleIf(alarm.label.isNotEmpty())
|
||||||
|
|
||||||
alarm_switch.isChecked = alarm.isEnabled
|
alarm_switch.isChecked = alarm.isEnabled
|
||||||
alarm_switch.setColors(textColor, adjustedPrimaryColor, backgroundColor)
|
alarm_switch.setColors(textColor, properPrimaryColor, backgroundColor)
|
||||||
alarm_switch.setOnClickListener {
|
alarm_switch.setOnClickListener {
|
||||||
if (alarm.days > 0) {
|
if (alarm.days > 0) {
|
||||||
if (activity.config.wasAlarmWarningShown) {
|
if (activity.config.wasAlarmWarningShown) {
|
||||||
|
|
|
@ -7,15 +7,16 @@ import com.simplemobiletools.clock.R
|
||||||
import com.simplemobiletools.clock.activities.SimpleActivity
|
import com.simplemobiletools.clock.activities.SimpleActivity
|
||||||
import com.simplemobiletools.clock.extensions.config
|
import com.simplemobiletools.clock.extensions.config
|
||||||
import com.simplemobiletools.clock.models.MyTimeZone
|
import com.simplemobiletools.clock.models.MyTimeZone
|
||||||
import com.simplemobiletools.commons.extensions.getAdjustedPrimaryColor
|
import com.simplemobiletools.commons.extensions.getProperBackgroundColor
|
||||||
|
import com.simplemobiletools.commons.extensions.getProperPrimaryColor
|
||||||
|
import com.simplemobiletools.commons.extensions.getProperTextColor
|
||||||
import kotlinx.android.synthetic.main.item_add_time_zone.view.*
|
import kotlinx.android.synthetic.main.item_add_time_zone.view.*
|
||||||
import java.util.*
|
|
||||||
|
|
||||||
class SelectTimeZonesAdapter(val activity: SimpleActivity, val timeZones: ArrayList<MyTimeZone>) : RecyclerView.Adapter<SelectTimeZonesAdapter.ViewHolder>() {
|
class SelectTimeZonesAdapter(val activity: SimpleActivity, val timeZones: ArrayList<MyTimeZone>) : RecyclerView.Adapter<SelectTimeZonesAdapter.ViewHolder>() {
|
||||||
private val config = activity.config
|
private val config = activity.config
|
||||||
private val textColor = config.textColor
|
private val textColor = activity.getProperTextColor()
|
||||||
private val backgroundColor = config.backgroundColor
|
private val backgroundColor = activity.getProperBackgroundColor()
|
||||||
private val primaryColor = activity.getAdjustedPrimaryColor()
|
private val primaryColor = activity.getProperPrimaryColor()
|
||||||
var selectedKeys = HashSet<Int>()
|
var selectedKeys = HashSet<Int>()
|
||||||
|
|
||||||
init {
|
init {
|
||||||
|
|
|
@ -19,11 +19,10 @@ import com.simplemobiletools.commons.dialogs.SelectAlarmSoundDialog
|
||||||
import com.simplemobiletools.commons.extensions.*
|
import com.simplemobiletools.commons.extensions.*
|
||||||
import com.simplemobiletools.commons.models.AlarmSound
|
import com.simplemobiletools.commons.models.AlarmSound
|
||||||
import kotlinx.android.synthetic.main.dialog_edit_alarm.view.*
|
import kotlinx.android.synthetic.main.dialog_edit_alarm.view.*
|
||||||
import java.util.*
|
|
||||||
|
|
||||||
class EditAlarmDialog(val activity: SimpleActivity, val alarm: Alarm, val callback: (alarmId: Int) -> Unit) {
|
class EditAlarmDialog(val activity: SimpleActivity, val alarm: Alarm, val callback: (alarmId: Int) -> Unit) {
|
||||||
private val view = activity.layoutInflater.inflate(R.layout.dialog_edit_alarm, null)
|
private val view = activity.layoutInflater.inflate(R.layout.dialog_edit_alarm, null)
|
||||||
private val textColor = activity.config.textColor
|
private val textColor = activity.getProperTextColor()
|
||||||
|
|
||||||
init {
|
init {
|
||||||
restoreLastAlarm()
|
restoreLastAlarm()
|
||||||
|
@ -33,7 +32,7 @@ class EditAlarmDialog(val activity: SimpleActivity, val alarm: Alarm, val callba
|
||||||
edit_alarm_time.setOnClickListener {
|
edit_alarm_time.setOnClickListener {
|
||||||
TimePickerDialog(
|
TimePickerDialog(
|
||||||
context,
|
context,
|
||||||
context.getDialogTheme(),
|
context.getTimePickerDialogTheme(),
|
||||||
timeSetListener,
|
timeSetListener,
|
||||||
alarm.timeInMinutes / 60,
|
alarm.timeInMinutes / 60,
|
||||||
alarm.timeInMinutes % 60,
|
alarm.timeInMinutes % 60,
|
||||||
|
@ -82,7 +81,7 @@ class EditAlarmDialog(val activity: SimpleActivity, val alarm: Alarm, val callba
|
||||||
val isDayChecked = alarm.days > 0 && alarm.days and pow != 0
|
val isDayChecked = alarm.days > 0 && alarm.days and pow != 0
|
||||||
day.background = getProperDayDrawable(isDayChecked)
|
day.background = getProperDayDrawable(isDayChecked)
|
||||||
|
|
||||||
day.setTextColor(if (isDayChecked) context.config.backgroundColor else textColor)
|
day.setTextColor(if (isDayChecked) context.getProperBackgroundColor() else textColor)
|
||||||
day.setOnClickListener {
|
day.setOnClickListener {
|
||||||
if (alarm.days < 0) {
|
if (alarm.days < 0) {
|
||||||
alarm.days = 0
|
alarm.days = 0
|
||||||
|
@ -95,7 +94,7 @@ class EditAlarmDialog(val activity: SimpleActivity, val alarm: Alarm, val callba
|
||||||
alarm.days = alarm.days.removeBit(pow)
|
alarm.days = alarm.days.removeBit(pow)
|
||||||
}
|
}
|
||||||
day.background = getProperDayDrawable(selectDay)
|
day.background = getProperDayDrawable(selectDay)
|
||||||
day.setTextColor(if (selectDay) context.config.backgroundColor else textColor)
|
day.setTextColor(if (selectDay) context.getProperBackgroundColor() else textColor)
|
||||||
checkDaylessAlarm()
|
checkDaylessAlarm()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ import kotlinx.android.synthetic.main.dialog_edit_timer.view.*
|
||||||
|
|
||||||
class EditTimerDialog(val activity: SimpleActivity, val timer: Timer, val callback: () -> Unit) {
|
class EditTimerDialog(val activity: SimpleActivity, val timer: Timer, val callback: () -> Unit) {
|
||||||
private val view = activity.layoutInflater.inflate(R.layout.dialog_edit_timer, null)
|
private val view = activity.layoutInflater.inflate(R.layout.dialog_edit_timer, null)
|
||||||
private val textColor = activity.config.textColor
|
private val textColor = activity.getProperTextColor()
|
||||||
|
|
||||||
init {
|
init {
|
||||||
restoreLastAlarm()
|
restoreLastAlarm()
|
||||||
|
|
|
@ -3,7 +3,7 @@ package com.simplemobiletools.clock.dialogs
|
||||||
import androidx.appcompat.app.AlertDialog
|
import androidx.appcompat.app.AlertDialog
|
||||||
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.extensions.config
|
import com.simplemobiletools.commons.extensions.getProperTextColor
|
||||||
import com.simplemobiletools.commons.extensions.setupDialogStuff
|
import com.simplemobiletools.commons.extensions.setupDialogStuff
|
||||||
import kotlinx.android.synthetic.main.dialog_my_time_picker.view.*
|
import kotlinx.android.synthetic.main.dialog_my_time_picker.view.*
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ class MyTimePickerDialogDialog(val activity: SimpleActivity, val initialSeconds:
|
||||||
|
|
||||||
init {
|
init {
|
||||||
view.apply {
|
view.apply {
|
||||||
val textColor = activity.config.textColor
|
val textColor = activity.getProperTextColor()
|
||||||
arrayOf(my_time_picker_hours, my_time_picker_minutes, my_time_picker_seconds).forEach {
|
arrayOf(my_time_picker_hours, my_time_picker_minutes, my_time_picker_seconds).forEach {
|
||||||
it.textColor = textColor
|
it.textColor = textColor
|
||||||
it.selectedTextColor = textColor
|
it.selectedTextColor = textColor
|
||||||
|
@ -25,7 +25,7 @@ class MyTimePickerDialogDialog(val activity: SimpleActivity, val initialSeconds:
|
||||||
}
|
}
|
||||||
|
|
||||||
AlertDialog.Builder(activity)
|
AlertDialog.Builder(activity)
|
||||||
.setPositiveButton(R.string.ok, { dialog, which -> dialogConfirmed() })
|
.setPositiveButton(R.string.ok) { dialog, which -> dialogConfirmed() }
|
||||||
.setNegativeButton(R.string.cancel, null)
|
.setNegativeButton(R.string.cancel, null)
|
||||||
.create().apply {
|
.create().apply {
|
||||||
activity.setupDialogStuff(view, this)
|
activity.setupDialogStuff(view, this)
|
||||||
|
|
|
@ -140,20 +140,20 @@ fun Context.setupAlarmClock(alarm: Alarm, triggerInSeconds: Int) {
|
||||||
fun Context.getOpenAlarmTabIntent(): PendingIntent {
|
fun Context.getOpenAlarmTabIntent(): PendingIntent {
|
||||||
val intent = getLaunchIntent() ?: Intent(this, SplashActivity::class.java)
|
val intent = getLaunchIntent() ?: Intent(this, SplashActivity::class.java)
|
||||||
intent.putExtra(OPEN_TAB, TAB_ALARM)
|
intent.putExtra(OPEN_TAB, TAB_ALARM)
|
||||||
return PendingIntent.getActivity(this, OPEN_ALARMS_TAB_INTENT_ID, intent, PendingIntent.FLAG_UPDATE_CURRENT)
|
return PendingIntent.getActivity(this, OPEN_ALARMS_TAB_INTENT_ID, intent, PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Context.getOpenTimerTabIntent(timerId: Int): PendingIntent {
|
fun Context.getOpenTimerTabIntent(timerId: Int): PendingIntent {
|
||||||
val intent = getLaunchIntent() ?: Intent(this, SplashActivity::class.java)
|
val intent = getLaunchIntent() ?: Intent(this, SplashActivity::class.java)
|
||||||
intent.putExtra(OPEN_TAB, TAB_TIMER)
|
intent.putExtra(OPEN_TAB, TAB_TIMER)
|
||||||
intent.putExtra(TIMER_ID, timerId)
|
intent.putExtra(TIMER_ID, timerId)
|
||||||
return PendingIntent.getActivity(this, timerId, intent, PendingIntent.FLAG_UPDATE_CURRENT)
|
return PendingIntent.getActivity(this, timerId, intent, PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Context.getAlarmIntent(alarm: Alarm): PendingIntent {
|
fun Context.getAlarmIntent(alarm: Alarm): PendingIntent {
|
||||||
val intent = Intent(this, AlarmReceiver::class.java)
|
val intent = Intent(this, AlarmReceiver::class.java)
|
||||||
intent.putExtra(ALARM_ID, alarm.id)
|
intent.putExtra(ALARM_ID, alarm.id)
|
||||||
return PendingIntent.getBroadcast(this, alarm.id, intent, PendingIntent.FLAG_UPDATE_CURRENT)
|
return PendingIntent.getBroadcast(this, alarm.id, intent, PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Context.cancelAlarmClock(alarm: Alarm) {
|
fun Context.cancelAlarmClock(alarm: Alarm) {
|
||||||
|
@ -189,7 +189,7 @@ fun Context.scheduleNextWidgetUpdate() {
|
||||||
}
|
}
|
||||||
|
|
||||||
val intent = Intent(this, DateTimeWidgetUpdateReceiver::class.java)
|
val intent = Intent(this, DateTimeWidgetUpdateReceiver::class.java)
|
||||||
val pendingIntent = PendingIntent.getBroadcast(this, UPDATE_WIDGET_INTENT_ID, intent, PendingIntent.FLAG_UPDATE_CURRENT)
|
val pendingIntent = PendingIntent.getBroadcast(this, UPDATE_WIDGET_INTENT_ID, intent, PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE)
|
||||||
|
|
||||||
val alarmManager = getSystemService(Context.ALARM_SERVICE) as AlarmManager
|
val alarmManager = getSystemService(Context.ALARM_SERVICE) as AlarmManager
|
||||||
val triggerAtMillis = System.currentTimeMillis() + getMSTillNextMinute()
|
val triggerAtMillis = System.currentTimeMillis() + getMSTillNextMinute()
|
||||||
|
@ -294,7 +294,7 @@ fun Context.getTimerNotification(timer: Timer, pendingIntent: PendingIntent, add
|
||||||
NotificationChannel(channelId, name, importance).apply {
|
NotificationChannel(channelId, name, importance).apply {
|
||||||
setBypassDnd(true)
|
setBypassDnd(true)
|
||||||
enableLights(true)
|
enableLights(true)
|
||||||
lightColor = getAdjustedPrimaryColor()
|
lightColor = getProperPrimaryColor()
|
||||||
setSound(Uri.parse(soundUri), audioAttributes)
|
setSound(Uri.parse(soundUri), audioAttributes)
|
||||||
|
|
||||||
if (!timer.vibrate) {
|
if (!timer.vibrate) {
|
||||||
|
@ -339,13 +339,13 @@ fun Context.getTimerNotification(timer: Timer, pendingIntent: PendingIntent, add
|
||||||
fun Context.getHideTimerPendingIntent(timerId: Int): PendingIntent {
|
fun Context.getHideTimerPendingIntent(timerId: Int): PendingIntent {
|
||||||
val intent = Intent(this, HideTimerReceiver::class.java)
|
val intent = Intent(this, HideTimerReceiver::class.java)
|
||||||
intent.putExtra(TIMER_ID, timerId)
|
intent.putExtra(TIMER_ID, timerId)
|
||||||
return PendingIntent.getBroadcast(this, timerId, intent, PendingIntent.FLAG_UPDATE_CURRENT)
|
return PendingIntent.getBroadcast(this, timerId, intent, PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Context.getHideAlarmPendingIntent(alarm: Alarm): PendingIntent {
|
fun Context.getHideAlarmPendingIntent(alarm: Alarm): PendingIntent {
|
||||||
val intent = Intent(this, HideAlarmReceiver::class.java)
|
val intent = Intent(this, HideAlarmReceiver::class.java)
|
||||||
intent.putExtra(ALARM_ID, alarm.id)
|
intent.putExtra(ALARM_ID, alarm.id)
|
||||||
return PendingIntent.getBroadcast(this, alarm.id, intent, PendingIntent.FLAG_UPDATE_CURRENT)
|
return PendingIntent.getBroadcast(this, alarm.id, intent, PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Context.getAlarmNotification(pendingIntent: PendingIntent, alarm: Alarm): Notification {
|
fun Context.getAlarmNotification(pendingIntent: PendingIntent, alarm: Alarm): Notification {
|
||||||
|
@ -369,7 +369,7 @@ fun Context.getAlarmNotification(pendingIntent: PendingIntent, alarm: Alarm): No
|
||||||
NotificationChannel(channelId, label, importance).apply {
|
NotificationChannel(channelId, label, importance).apply {
|
||||||
setBypassDnd(true)
|
setBypassDnd(true)
|
||||||
enableLights(true)
|
enableLights(true)
|
||||||
lightColor = getAdjustedPrimaryColor()
|
lightColor = getProperPrimaryColor()
|
||||||
enableVibration(alarm.vibrate)
|
enableVibration(alarm.vibrate)
|
||||||
setSound(Uri.parse(soundUri), audioAttributes)
|
setSound(Uri.parse(soundUri), audioAttributes)
|
||||||
notificationManager.createNotificationChannel(this)
|
notificationManager.createNotificationChannel(this)
|
||||||
|
@ -411,15 +411,15 @@ fun Context.getSnoozePendingIntent(alarm: Alarm): PendingIntent {
|
||||||
val intent = Intent(this, snoozeClass).setAction("Snooze")
|
val intent = Intent(this, snoozeClass).setAction("Snooze")
|
||||||
intent.putExtra(ALARM_ID, alarm.id)
|
intent.putExtra(ALARM_ID, alarm.id)
|
||||||
return if (config.useSameSnooze) {
|
return if (config.useSameSnooze) {
|
||||||
PendingIntent.getService(this, alarm.id, intent, PendingIntent.FLAG_UPDATE_CURRENT)
|
PendingIntent.getService(this, alarm.id, intent, PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE)
|
||||||
} else {
|
} else {
|
||||||
PendingIntent.getActivity(this, alarm.id, intent, PendingIntent.FLAG_UPDATE_CURRENT)
|
PendingIntent.getActivity(this, alarm.id, intent, PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Context.getReminderActivityIntent(): PendingIntent {
|
fun Context.getReminderActivityIntent(): PendingIntent {
|
||||||
val intent = Intent(this, ReminderActivity::class.java)
|
val intent = Intent(this, ReminderActivity::class.java)
|
||||||
return PendingIntent.getActivity(this, REMINDER_ACTIVITY_INTENT_ID, intent, PendingIntent.FLAG_UPDATE_CURRENT)
|
return PendingIntent.getActivity(this, REMINDER_ACTIVITY_INTENT_ID, intent, PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Context.checkAlarmsWithDeletedSoundUri(uri: String) {
|
fun Context.checkAlarmsWithDeletedSoundUri(uri: String) {
|
||||||
|
|
|
@ -15,12 +15,12 @@ import com.simplemobiletools.clock.extensions.*
|
||||||
import com.simplemobiletools.clock.helpers.*
|
import com.simplemobiletools.clock.helpers.*
|
||||||
import com.simplemobiletools.clock.interfaces.ToggleAlarmInterface
|
import com.simplemobiletools.clock.interfaces.ToggleAlarmInterface
|
||||||
import com.simplemobiletools.clock.models.Alarm
|
import com.simplemobiletools.clock.models.Alarm
|
||||||
|
import com.simplemobiletools.commons.extensions.getProperTextColor
|
||||||
import com.simplemobiletools.commons.extensions.toast
|
import com.simplemobiletools.commons.extensions.toast
|
||||||
import com.simplemobiletools.commons.extensions.updateTextColors
|
import com.simplemobiletools.commons.extensions.updateTextColors
|
||||||
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
|
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
|
||||||
import com.simplemobiletools.commons.models.AlarmSound
|
import com.simplemobiletools.commons.models.AlarmSound
|
||||||
import kotlinx.android.synthetic.main.fragment_alarm.view.*
|
import kotlinx.android.synthetic.main.fragment_alarm.view.*
|
||||||
import java.util.*
|
|
||||||
|
|
||||||
class AlarmFragment : Fragment(), ToggleAlarmInterface {
|
class AlarmFragment : Fragment(), ToggleAlarmInterface {
|
||||||
private var alarms = ArrayList<Alarm>()
|
private var alarms = ArrayList<Alarm>()
|
||||||
|
@ -40,7 +40,7 @@ class AlarmFragment : Fragment(), ToggleAlarmInterface {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
setupViews()
|
setupViews()
|
||||||
|
|
||||||
val configTextColor = requireContext().config.textColor
|
val configTextColor = requireContext().getProperTextColor()
|
||||||
if (storedTextColor != configTextColor) {
|
if (storedTextColor != configTextColor) {
|
||||||
(view.alarms_list.adapter as AlarmsAdapter).updateTextColor(configTextColor)
|
(view.alarms_list.adapter as AlarmsAdapter).updateTextColor(configTextColor)
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ class AlarmFragment : Fragment(), ToggleAlarmInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun storeStateVariables() {
|
private fun storeStateVariables() {
|
||||||
storedTextColor = requireContext().config.textColor
|
storedTextColor = requireContext().getProperTextColor()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupViews() {
|
private fun setupViews() {
|
||||||
|
|
|
@ -15,6 +15,7 @@ import com.simplemobiletools.clock.extensions.*
|
||||||
import com.simplemobiletools.clock.helpers.getPassedSeconds
|
import com.simplemobiletools.clock.helpers.getPassedSeconds
|
||||||
import com.simplemobiletools.clock.models.MyTimeZone
|
import com.simplemobiletools.clock.models.MyTimeZone
|
||||||
import com.simplemobiletools.commons.extensions.beVisibleIf
|
import com.simplemobiletools.commons.extensions.beVisibleIf
|
||||||
|
import com.simplemobiletools.commons.extensions.getProperTextColor
|
||||||
import com.simplemobiletools.commons.extensions.updateTextColors
|
import com.simplemobiletools.commons.extensions.updateTextColors
|
||||||
import kotlinx.android.synthetic.main.fragment_clock.view.*
|
import kotlinx.android.synthetic.main.fragment_clock.view.*
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
@ -40,7 +41,7 @@ class ClockFragment : Fragment() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
setupDateTime()
|
setupDateTime()
|
||||||
|
|
||||||
val configTextColor = requireContext().config.textColor
|
val configTextColor = requireContext().getProperTextColor()
|
||||||
if (storedTextColor != configTextColor) {
|
if (storedTextColor != configTextColor) {
|
||||||
(view.time_zones_list.adapter as? TimeZonesAdapter)?.updateTextColor(configTextColor)
|
(view.time_zones_list.adapter as? TimeZonesAdapter)?.updateTextColor(configTextColor)
|
||||||
}
|
}
|
||||||
|
@ -53,7 +54,7 @@ class ClockFragment : Fragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun storeStateVariables() {
|
private fun storeStateVariables() {
|
||||||
storedTextColor = requireContext().config.textColor
|
storedTextColor = requireContext().getProperTextColor()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupDateTime() {
|
private fun setupDateTime() {
|
||||||
|
@ -112,7 +113,7 @@ class ClockFragment : Fragment() {
|
||||||
val nextAlarm = requireContext().getNextAlarm()
|
val nextAlarm = requireContext().getNextAlarm()
|
||||||
clock_alarm.beVisibleIf(nextAlarm.isNotEmpty())
|
clock_alarm.beVisibleIf(nextAlarm.isNotEmpty())
|
||||||
clock_alarm.text = nextAlarm
|
clock_alarm.text = nextAlarm
|
||||||
clock_alarm.colorCompoundDrawable(requireContext().config.textColor)
|
clock_alarm.colorCompoundDrawable(requireContext().getProperTextColor())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -120,7 +120,7 @@ class StopwatchFragment : Fragment() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
setupViews()
|
setupViews()
|
||||||
|
|
||||||
val configTextColor = requireContext().config.textColor
|
val configTextColor = requireContext().getProperTextColor()
|
||||||
if (storedTextColor != configTextColor) {
|
if (storedTextColor != configTextColor) {
|
||||||
stopwatchAdapter.updateTextColor(configTextColor)
|
stopwatchAdapter.updateTextColor(configTextColor)
|
||||||
}
|
}
|
||||||
|
@ -141,7 +141,7 @@ class StopwatchFragment : Fragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun storeStateVariables() {
|
private fun storeStateVariables() {
|
||||||
storedTextColor = requireContext().config.textColor
|
storedTextColor = requireContext().getProperTextColor()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onSaveInstanceState(outState: Bundle) {
|
override fun onSaveInstanceState(outState: Bundle) {
|
||||||
|
@ -183,11 +183,11 @@ class StopwatchFragment : Fragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupViews() {
|
private fun setupViews() {
|
||||||
val adjustedPrimaryColor = requireContext().getAdjustedPrimaryColor()
|
val properPrimaryColor = requireContext().getProperPrimaryColor()
|
||||||
view.apply {
|
view.apply {
|
||||||
requireContext().updateTextColors(stopwatch_fragment)
|
requireContext().updateTextColors(stopwatch_fragment)
|
||||||
stopwatch_play_pause.background = resources.getColoredDrawableWithColor(R.drawable.circle_background_filled, adjustedPrimaryColor)
|
stopwatch_play_pause.background = resources.getColoredDrawableWithColor(R.drawable.circle_background_filled, properPrimaryColor)
|
||||||
stopwatch_reset.applyColorFilter(requireContext().config.textColor)
|
stopwatch_reset.applyColorFilter(requireContext().getProperTextColor())
|
||||||
}
|
}
|
||||||
|
|
||||||
updateIcons()
|
updateIcons()
|
||||||
|
@ -196,7 +196,7 @@ class StopwatchFragment : Fragment() {
|
||||||
|
|
||||||
private fun updateIcons() {
|
private fun updateIcons() {
|
||||||
val drawableId = if (isRunning) R.drawable.ic_pause_vector else R.drawable.ic_play_vector
|
val drawableId = if (isRunning) R.drawable.ic_pause_vector else R.drawable.ic_play_vector
|
||||||
val iconColor = if (requireContext().getAdjustedPrimaryColor() == Color.WHITE) Color.BLACK else Color.WHITE
|
val iconColor = if (requireContext().getProperPrimaryColor() == Color.WHITE) Color.BLACK else Color.WHITE
|
||||||
view.stopwatch_play_pause.setImageDrawable(resources.getColoredDrawableWithColor(drawableId, iconColor))
|
view.stopwatch_play_pause.setImageDrawable(resources.getColoredDrawableWithColor(drawableId, iconColor))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -267,7 +267,7 @@ class StopwatchFragment : Fragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateSortingIndicators() {
|
private fun updateSortingIndicators() {
|
||||||
var bitmap = requireContext().resources.getColoredBitmap(R.drawable.ic_sorting_triangle_vector, requireContext().getAdjustedPrimaryColor())
|
var bitmap = requireContext().resources.getColoredBitmap(R.drawable.ic_sorting_triangle_vector, requireContext().getProperPrimaryColor())
|
||||||
view.apply {
|
view.apply {
|
||||||
stopwatch_sorting_indicator_1.beInvisibleIf(sorting and SORT_BY_LAP == 0)
|
stopwatch_sorting_indicator_1.beInvisibleIf(sorting and SORT_BY_LAP == 0)
|
||||||
stopwatch_sorting_indicator_2.beInvisibleIf(sorting and SORT_BY_LAP_TIME == 0)
|
stopwatch_sorting_indicator_2.beInvisibleIf(sorting and SORT_BY_LAP_TIME == 0)
|
||||||
|
|
|
@ -17,6 +17,7 @@ import com.simplemobiletools.clock.extensions.timerHelper
|
||||||
import com.simplemobiletools.clock.helpers.DisabledItemChangeAnimator
|
import com.simplemobiletools.clock.helpers.DisabledItemChangeAnimator
|
||||||
import com.simplemobiletools.clock.models.Timer
|
import com.simplemobiletools.clock.models.Timer
|
||||||
import com.simplemobiletools.clock.models.TimerEvent
|
import com.simplemobiletools.clock.models.TimerEvent
|
||||||
|
import com.simplemobiletools.commons.extensions.getProperTextColor
|
||||||
import com.simplemobiletools.commons.extensions.hideKeyboard
|
import com.simplemobiletools.commons.extensions.hideKeyboard
|
||||||
import com.simplemobiletools.commons.extensions.updateTextColors
|
import com.simplemobiletools.commons.extensions.updateTextColors
|
||||||
import com.simplemobiletools.commons.models.AlarmSound
|
import com.simplemobiletools.commons.models.AlarmSound
|
||||||
|
@ -77,7 +78,7 @@ class TimerFragment : Fragment() {
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
requireContext().updateTextColors(timer_fragment)
|
requireContext().updateTextColors(timer_fragment)
|
||||||
val configTextColor = requireContext().config.textColor
|
val configTextColor = requireContext().getProperTextColor()
|
||||||
if (storedTextColor != configTextColor) {
|
if (storedTextColor != configTextColor) {
|
||||||
initAdapter()
|
initAdapter()
|
||||||
timerAdapter.updateTextColor(configTextColor)
|
timerAdapter.updateTextColor(configTextColor)
|
||||||
|
@ -108,7 +109,7 @@ class TimerFragment : Fragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun storeStateVariables() {
|
private fun storeStateVariables() {
|
||||||
storedTextColor = requireContext().config.textColor
|
storedTextColor = requireContext().getProperTextColor()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
|
|
|
@ -90,7 +90,7 @@ class MyWidgetDateTimeProvider : AppWidgetProvider() {
|
||||||
private fun setupAppOpenIntent(context: Context, views: RemoteViews) {
|
private fun setupAppOpenIntent(context: Context, views: RemoteViews) {
|
||||||
(context.getLaunchIntent() ?: Intent(context, SplashActivity::class.java)).apply {
|
(context.getLaunchIntent() ?: Intent(context, SplashActivity::class.java)).apply {
|
||||||
putExtra(OPEN_TAB, TAB_CLOCK)
|
putExtra(OPEN_TAB, TAB_CLOCK)
|
||||||
val pendingIntent = PendingIntent.getActivity(context, OPEN_APP_INTENT_ID, this, PendingIntent.FLAG_UPDATE_CURRENT)
|
val pendingIntent = PendingIntent.getActivity(context, OPEN_APP_INTENT_ID, this, PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE)
|
||||||
views.setOnClickPendingIntent(R.id.widget_date_time_holder, pendingIntent)
|
views.setOnClickPendingIntent(R.id.widget_date_time_holder, pendingIntent)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ class AlarmReceiver : BroadcastReceiver() {
|
||||||
val pendingIntent = PendingIntent.getActivity(context, 0, Intent(context, ReminderActivity::class.java).apply {
|
val pendingIntent = PendingIntent.getActivity(context, 0, Intent(context, ReminderActivity::class.java).apply {
|
||||||
addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||||
putExtra(ALARM_ID, id)
|
putExtra(ALARM_ID, id)
|
||||||
}, PendingIntent.FLAG_UPDATE_CURRENT)
|
}, PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE)
|
||||||
|
|
||||||
val builder = NotificationCompat.Builder(context, "Alarm")
|
val builder = NotificationCompat.Builder(context, "Alarm")
|
||||||
.setSmallIcon(R.drawable.ic_alarm_vector)
|
.setSmallIcon(R.drawable.ic_alarm_vector)
|
||||||
|
|
Loading…
Reference in New Issue