forked from upstream-mirrors/quik
Add automatic night mode support
This commit is contained in:
@@ -97,6 +97,7 @@
|
|||||||
<receiver android:name="presentation.receiver.MarkSeenReceiver" />
|
<receiver android:name="presentation.receiver.MarkSeenReceiver" />
|
||||||
<receiver android:name="presentation.receiver.MarkReadReceiver" />
|
<receiver android:name="presentation.receiver.MarkReadReceiver" />
|
||||||
<receiver android:name="presentation.receiver.RemoteMessagingReceiver" />
|
<receiver android:name="presentation.receiver.RemoteMessagingReceiver" />
|
||||||
|
<receiver android:name="presentation.receiver.NightModeReceiver" />
|
||||||
|
|
||||||
<service android:name="com.android.mms.transaction.TransactionService" />
|
<service android:name="com.android.mms.transaction.TransactionService" />
|
||||||
<service
|
<service
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import common.QKApplication
|
|||||||
import common.util.ContactImageLoader
|
import common.util.ContactImageLoader
|
||||||
import dagger.Component
|
import dagger.Component
|
||||||
import presentation.common.widget.*
|
import presentation.common.widget.*
|
||||||
|
import presentation.receiver.NightModeReceiver
|
||||||
import presentation.feature.compose.ComposeActivity
|
import presentation.feature.compose.ComposeActivity
|
||||||
import presentation.feature.compose.ComposeViewModel
|
import presentation.feature.compose.ComposeViewModel
|
||||||
import presentation.feature.compose.DetailedChipView
|
import presentation.feature.compose.DetailedChipView
|
||||||
@@ -60,6 +61,7 @@ interface AppComponent {
|
|||||||
fun inject(receiver: MmsReceivedReceiver)
|
fun inject(receiver: MmsReceivedReceiver)
|
||||||
fun inject(receiver: MmsSentReceiver)
|
fun inject(receiver: MmsSentReceiver)
|
||||||
fun inject(receiver: MmsUpdatedReceiver)
|
fun inject(receiver: MmsUpdatedReceiver)
|
||||||
|
fun inject(receiver: NightModeReceiver)
|
||||||
fun inject(receiver: RemoteMessagingReceiver)
|
fun inject(receiver: RemoteMessagingReceiver)
|
||||||
|
|
||||||
fun inject(view: AvatarView)
|
fun inject(view: AvatarView)
|
||||||
|
|||||||
@@ -64,60 +64,60 @@ class Colors @Inject constructor(private val context: Context, prefs: Preference
|
|||||||
val theme: Observable<Int> = prefs.theme.asObservable()
|
val theme: Observable<Int> = prefs.theme.asObservable()
|
||||||
.distinctUntilChanged()
|
.distinctUntilChanged()
|
||||||
|
|
||||||
val appThemeResources: Observable<Int> = prefs.dark.asObservable()
|
val appThemeResources: Observable<Int> = prefs.night.asObservable()
|
||||||
.map { dark -> if (dark) R.style.AppThemeDark else R.style.AppThemeLight }
|
.map { night -> if (night) R.style.AppThemeDark else R.style.AppThemeLight }
|
||||||
|
|
||||||
val popupThemeResource: Observable<Int> = prefs.dark.asObservable()
|
val popupThemeResource: Observable<Int> = prefs.night.asObservable()
|
||||||
.map { dark -> if (dark) R.style.PopupThemeDark else R.style.PopupThemeLight }
|
.map { night -> if (night) R.style.PopupThemeDark else R.style.PopupThemeLight }
|
||||||
|
|
||||||
@SuppressLint("InlinedApi")
|
@SuppressLint("InlinedApi")
|
||||||
val statusBarIcons: Observable<Int> = prefs.dark.asObservable()
|
val statusBarIcons: Observable<Int> = prefs.night.asObservable()
|
||||||
.map { dark -> dark || Build.VERSION.SDK_INT < Build.VERSION_CODES.M }
|
.map { night -> night || Build.VERSION.SDK_INT < Build.VERSION_CODES.M }
|
||||||
.map { lightIcons -> if (lightIcons) 0 else View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR }
|
.map { lightIcons -> if (lightIcons) 0 else View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR }
|
||||||
.distinctUntilChanged()
|
.distinctUntilChanged()
|
||||||
|
|
||||||
val statusBar: Observable<Int> = prefs.dark.asObservable()
|
val statusBar: Observable<Int> = prefs.night.asObservable()
|
||||||
.map { dark -> if (dark) R.color.statusBarDark else R.color.statusBarLight }
|
.map { night -> if (night) R.color.statusBarDark else R.color.statusBarLight }
|
||||||
.map { res -> getColor(res) }
|
.map { res -> getColor(res) }
|
||||||
.distinctUntilChanged()
|
.distinctUntilChanged()
|
||||||
|
|
||||||
val toolbarColor: Observable<Int> = prefs.dark.asObservable()
|
val toolbarColor: Observable<Int> = prefs.night.asObservable()
|
||||||
.map { dark -> if (dark) R.color.toolbarDark else R.color.toolbarLight }
|
.map { night -> if (night) R.color.toolbarDark else R.color.toolbarLight }
|
||||||
.map { res -> getColor(res) }
|
.map { res -> getColor(res) }
|
||||||
.distinctUntilChanged()
|
.distinctUntilChanged()
|
||||||
|
|
||||||
val background: Observable<Int> = prefs.dark.asObservable()
|
val background: Observable<Int> = prefs.night.asObservable()
|
||||||
.map { dark -> if (dark) R.color.backgroundDark else R.color.white }
|
.map { night -> if (night) R.color.backgroundDark else R.color.white }
|
||||||
.map { res -> getColor(res) }
|
.map { res -> getColor(res) }
|
||||||
.distinctUntilChanged()
|
.distinctUntilChanged()
|
||||||
|
|
||||||
val field: Observable<Int> = prefs.dark.asObservable()
|
val field: Observable<Int> = prefs.night.asObservable()
|
||||||
.map { dark -> if (dark) R.color.fieldDark else R.color.fieldLight }
|
.map { night -> if (night) R.color.fieldDark else R.color.fieldLight }
|
||||||
.map { res -> getColor(res) }
|
.map { res -> getColor(res) }
|
||||||
.distinctUntilChanged()
|
.distinctUntilChanged()
|
||||||
|
|
||||||
val composeBackground: Observable<Int> = prefs.dark.asObservable()
|
val composeBackground: Observable<Int> = prefs.night.asObservable()
|
||||||
.map { dark -> if (dark) R.color.backgroundDark else R.color.backgroundLight }
|
.map { night -> if (night) R.color.backgroundDark else R.color.backgroundLight }
|
||||||
.map { res -> getColor(res) }
|
.map { res -> getColor(res) }
|
||||||
.distinctUntilChanged()
|
.distinctUntilChanged()
|
||||||
|
|
||||||
val separator: Observable<Int> = prefs.dark.asObservable()
|
val separator: Observable<Int> = prefs.night.asObservable()
|
||||||
.map { dark -> if (dark) R.color.separatorDark else R.color.separatorLight }
|
.map { night -> if (night) R.color.separatorDark else R.color.separatorLight }
|
||||||
.map { res -> getColor(res) }
|
.map { res -> getColor(res) }
|
||||||
.distinctUntilChanged()
|
.distinctUntilChanged()
|
||||||
|
|
||||||
val textPrimary: Observable<Int> = prefs.dark.asObservable()
|
val textPrimary: Observable<Int> = prefs.night.asObservable()
|
||||||
.map { dark -> if (dark) R.color.textPrimaryDark else R.color.textPrimary }
|
.map { night -> if (night) R.color.textPrimaryDark else R.color.textPrimary }
|
||||||
.map { res -> getColor(res) }
|
.map { res -> getColor(res) }
|
||||||
.distinctUntilChanged()
|
.distinctUntilChanged()
|
||||||
|
|
||||||
val textSecondary: Observable<Int> = prefs.dark.asObservable()
|
val textSecondary: Observable<Int> = prefs.night.asObservable()
|
||||||
.map { dark -> if (dark) R.color.textSecondaryDark else R.color.textSecondary }
|
.map { night -> if (night) R.color.textSecondaryDark else R.color.textSecondary }
|
||||||
.map { res -> getColor(res) }
|
.map { res -> getColor(res) }
|
||||||
.distinctUntilChanged()
|
.distinctUntilChanged()
|
||||||
|
|
||||||
val textTertiary: Observable<Int> = prefs.dark.asObservable()
|
val textTertiary: Observable<Int> = prefs.night.asObservable()
|
||||||
.map { dark -> if (dark) R.color.textTertiaryDark else R.color.textTertiary }
|
.map { night -> if (night) R.color.textTertiaryDark else R.color.textTertiary }
|
||||||
.map { res -> getColor(res) }
|
.map { res -> getColor(res) }
|
||||||
.distinctUntilChanged()
|
.distinctUntilChanged()
|
||||||
|
|
||||||
@@ -145,28 +145,28 @@ class Colors @Inject constructor(private val context: Context, prefs: Preference
|
|||||||
.map { res -> getColor(res) }
|
.map { res -> getColor(res) }
|
||||||
.distinctUntilChanged()
|
.distinctUntilChanged()
|
||||||
|
|
||||||
val bubble: Observable<Int> = prefs.dark.asObservable()
|
val bubble: Observable<Int> = prefs.night.asObservable()
|
||||||
.map { dark -> if (dark) R.color.bubbleDark else R.color.bubbleLight }
|
.map { night -> if (night) R.color.bubbleDark else R.color.bubbleLight }
|
||||||
.map { res -> getColor(res) }
|
.map { res -> getColor(res) }
|
||||||
.distinctUntilChanged()
|
.distinctUntilChanged()
|
||||||
|
|
||||||
val switchThumbEnabled: Observable<Int> = prefs.dark.asObservable()
|
val switchThumbEnabled: Observable<Int> = prefs.night.asObservable()
|
||||||
.map { dark -> if (dark) R.color.switchThumbEnabledDark else R.color.switchThumbEnabledLight }
|
.map { night -> if (night) R.color.switchThumbEnabledDark else R.color.switchThumbEnabledLight }
|
||||||
.map { res -> getColor(res) }
|
.map { res -> getColor(res) }
|
||||||
.distinctUntilChanged()
|
.distinctUntilChanged()
|
||||||
|
|
||||||
val switchThumbDisabled: Observable<Int> = prefs.dark.asObservable()
|
val switchThumbDisabled: Observable<Int> = prefs.night.asObservable()
|
||||||
.map { dark -> if (dark) R.color.switchThumbDisabledDark else R.color.switchThumbDisabledLight }
|
.map { night -> if (night) R.color.switchThumbDisabledDark else R.color.switchThumbDisabledLight }
|
||||||
.map { res -> getColor(res) }
|
.map { res -> getColor(res) }
|
||||||
.distinctUntilChanged()
|
.distinctUntilChanged()
|
||||||
|
|
||||||
val switchTrackEnabled: Observable<Int> = prefs.dark.asObservable()
|
val switchTrackEnabled: Observable<Int> = prefs.night.asObservable()
|
||||||
.map { dark -> if (dark) R.color.switchTrackEnabledDark else R.color.switchTrackEnabledLight }
|
.map { night -> if (night) R.color.switchTrackEnabledDark else R.color.switchTrackEnabledLight }
|
||||||
.map { res -> getColor(res) }
|
.map { res -> getColor(res) }
|
||||||
.distinctUntilChanged()
|
.distinctUntilChanged()
|
||||||
|
|
||||||
val switchTrackDisabled: Observable<Int> = prefs.dark.asObservable()
|
val switchTrackDisabled: Observable<Int> = prefs.night.asObservable()
|
||||||
.map { dark -> if (dark) R.color.switchTrackDisabledDark else R.color.switchTrackDisabledLight }
|
.map { night -> if (night) R.color.switchTrackDisabledDark else R.color.switchTrackDisabledLight }
|
||||||
.map { res -> getColor(res) }
|
.map { res -> getColor(res) }
|
||||||
.distinctUntilChanged()
|
.distinctUntilChanged()
|
||||||
|
|
||||||
|
|||||||
@@ -71,4 +71,18 @@ class DateFormatter @Inject constructor(val context: Context) {
|
|||||||
}.format(date)
|
}.format(date)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun formatTime(hour: Int, minute: Int): String {
|
||||||
|
val calendar = Calendar.getInstance()
|
||||||
|
calendar.set(Calendar.HOUR_OF_DAY, hour)
|
||||||
|
calendar.set(Calendar.MINUTE, minute)
|
||||||
|
|
||||||
|
val simpleDateFormat = getFormatter("h:mm a")
|
||||||
|
return simpleDateFormat.format(calendar.time)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun parseTime(time: String): Calendar {
|
||||||
|
val simpleDateFormat = if (time.contains(" ")) getFormatter("h:mm a") else SimpleDateFormat("H:mm", Locale.US)
|
||||||
|
return Calendar.getInstance().apply { this.time = simpleDateFormat.parse(time) }
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2017 Moez Bhatti <moez.bhatti@gmail.com>
|
||||||
|
*
|
||||||
|
* This file is part of QKSMS.
|
||||||
|
*
|
||||||
|
* QKSMS is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* QKSMS is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package common.util
|
||||||
|
|
||||||
|
import android.app.AlarmManager
|
||||||
|
import android.app.PendingIntent
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.Intent
|
||||||
|
import presentation.receiver.NightModeReceiver
|
||||||
|
import java.util.*
|
||||||
|
import javax.inject.Inject
|
||||||
|
import javax.inject.Singleton
|
||||||
|
|
||||||
|
@Singleton
|
||||||
|
class NightModeManager @Inject constructor(
|
||||||
|
private val context: Context,
|
||||||
|
private val dateFormatter: DateFormatter,
|
||||||
|
private val prefs: Preferences) {
|
||||||
|
|
||||||
|
fun updateNightMode(mode: Int) {
|
||||||
|
prefs.nightMode.set(mode)
|
||||||
|
|
||||||
|
// If it's not on auto mode, set the appropriate night mode
|
||||||
|
if (mode != Preferences.NIGHT_MODE_AUTO) {
|
||||||
|
prefs.night.set(mode == Preferences.NIGHT_MODE_ON)
|
||||||
|
}
|
||||||
|
|
||||||
|
updateAlarms()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun updateAlarms() {
|
||||||
|
val dayCalendar = createCalendar(prefs.nightEnd.get())
|
||||||
|
val day = Intent(context, NightModeReceiver::class.java)
|
||||||
|
val dayIntent = PendingIntent.getBroadcast(context, 0, day, 0)
|
||||||
|
|
||||||
|
val nightCalendar = createCalendar(prefs.nightStart.get())
|
||||||
|
val night = Intent(context, NightModeReceiver::class.java)
|
||||||
|
val nightIntent = PendingIntent.getBroadcast(context, 1, night, 0)
|
||||||
|
|
||||||
|
context.sendBroadcast(day)
|
||||||
|
context.sendBroadcast(night)
|
||||||
|
|
||||||
|
val alarmManager = context.getSystemService(Context.ALARM_SERVICE) as AlarmManager
|
||||||
|
if (prefs.nightMode.get() == Preferences.NIGHT_MODE_AUTO) {
|
||||||
|
alarmManager.setInexactRepeating(AlarmManager.RTC_WAKEUP, dayCalendar.timeInMillis, AlarmManager.INTERVAL_DAY, dayIntent)
|
||||||
|
alarmManager.setInexactRepeating(AlarmManager.RTC_WAKEUP, nightCalendar.timeInMillis, AlarmManager.INTERVAL_DAY, nightIntent)
|
||||||
|
} else {
|
||||||
|
alarmManager.cancel(dayIntent)
|
||||||
|
alarmManager.cancel(nightIntent)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun createCalendar(time: String): Calendar {
|
||||||
|
val calendar = dateFormatter.parseTime(time)
|
||||||
|
|
||||||
|
return Calendar.getInstance().apply {
|
||||||
|
set(Calendar.HOUR_OF_DAY, calendar.get(Calendar.HOUR_OF_DAY))
|
||||||
|
set(Calendar.MINUTE, calendar.get(Calendar.MINUTE))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -26,9 +26,18 @@ import javax.inject.Singleton
|
|||||||
@Singleton
|
@Singleton
|
||||||
class Preferences @Inject constructor(rxPrefs: RxSharedPreferences) {
|
class Preferences @Inject constructor(rxPrefs: RxSharedPreferences) {
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
const val NIGHT_MODE_OFF = 0
|
||||||
|
const val NIGHT_MODE_ON = 1
|
||||||
|
const val NIGHT_MODE_AUTO = 2
|
||||||
|
}
|
||||||
|
|
||||||
val defaultSms = rxPrefs.getBoolean("defaultSms", false)
|
val defaultSms = rxPrefs.getBoolean("defaultSms", false)
|
||||||
val theme = rxPrefs.getInteger("theme", 0xFF008389.toInt())
|
val theme = rxPrefs.getInteger("theme", 0xFF008389.toInt())
|
||||||
val dark = rxPrefs.getBoolean("dark", false)
|
val night = rxPrefs.getBoolean("night", false)
|
||||||
|
val nightMode = rxPrefs.getInteger("nightModeSummary", NIGHT_MODE_OFF)
|
||||||
|
val nightStart = rxPrefs.getString("nightStart", "6:00 PM")
|
||||||
|
val nightEnd = rxPrefs.getString("nightEnd", "6:00 AM")
|
||||||
val autoEmoji = rxPrefs.getBoolean("autoEmoji", true)
|
val autoEmoji = rxPrefs.getBoolean("autoEmoji", true)
|
||||||
val notifications = rxPrefs.getBoolean("notifications", true)
|
val notifications = rxPrefs.getBoolean("notifications", true)
|
||||||
val vibration = rxPrefs.getBoolean("vibration", true)
|
val vibration = rxPrefs.getBoolean("vibration", true)
|
||||||
|
|||||||
@@ -18,6 +18,4 @@
|
|||||||
*/
|
*/
|
||||||
package data.model
|
package data.model
|
||||||
|
|
||||||
import android.support.annotation.StringRes
|
data class MenuItem(val title: String, val actionId: Int)
|
||||||
|
|
||||||
data class MenuItem(@StringRes val title: Int, val actionId: Int)
|
|
||||||
@@ -19,6 +19,7 @@
|
|||||||
package presentation.common
|
package presentation.common
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import android.support.annotation.ArrayRes
|
||||||
import android.support.v7.widget.RecyclerView
|
import android.support.v7.widget.RecyclerView
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
@@ -54,6 +55,13 @@ class MenuItemAdapter @Inject constructor(private val context: Context, private
|
|||||||
new.let { notifyItemChanged(it) }
|
new.let { notifyItemChanged(it) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun setData(@ArrayRes titles: Int, @ArrayRes values: Int = -1) {
|
||||||
|
val valueInts = if (values != -1) context.resources.getIntArray(values) else null
|
||||||
|
|
||||||
|
data = context.resources.getStringArray(titles)
|
||||||
|
.mapIndexed { index, title -> MenuItem(title, valueInts?.getOrNull(index) ?: index) }
|
||||||
|
}
|
||||||
|
|
||||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): QkViewHolder {
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): QkViewHolder {
|
||||||
val view = LayoutInflater.from(context).inflate(R.layout.menu_list_item, parent, false)
|
val view = LayoutInflater.from(context).inflate(R.layout.menu_list_item, parent, false)
|
||||||
|
|
||||||
@@ -69,7 +77,7 @@ class MenuItemAdapter @Inject constructor(private val context: Context, private
|
|||||||
|
|
||||||
view.clicks().subscribe { menuItemClicks.onNext(menuItem.actionId) }
|
view.clicks().subscribe { menuItemClicks.onNext(menuItem.actionId) }
|
||||||
|
|
||||||
view.title.setText(menuItem.title)
|
view.title.text = menuItem.title
|
||||||
view.check.setVisible(menuItem.actionId == selectedItem)
|
view.check.setVisible(menuItem.actionId == selectedItem)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -74,9 +74,9 @@ class MainViewModel : QkViewModel<MainView, MainState>(MainState()) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
private val menuArchive = MenuItem(R.string.menu_archive, 0)
|
private val menuArchive by lazy { MenuItem(context.getString(R.string.menu_archive), 0) }
|
||||||
private val menuUnarchive = MenuItem(R.string.menu_unarchive, 1)
|
private val menuUnarchive by lazy { MenuItem(context.getString(R.string.menu_unarchive), 1) }
|
||||||
private val menuDelete = MenuItem(R.string.menu_delete, 2)
|
private val menuDelete by lazy { MenuItem(context.getString(R.string.menu_delete), 2) }
|
||||||
|
|
||||||
init {
|
init {
|
||||||
appComponent.inject(this)
|
appComponent.inject(this)
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ package presentation.feature.settings
|
|||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
import android.app.AlertDialog
|
import android.app.AlertDialog
|
||||||
import android.app.ProgressDialog
|
import android.app.ProgressDialog
|
||||||
|
import android.app.TimePickerDialog
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.media.RingtoneManager
|
import android.media.RingtoneManager
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
@@ -33,9 +34,9 @@ import com.moez.QKSMS.R
|
|||||||
import com.uber.autodispose.android.lifecycle.scope
|
import com.uber.autodispose.android.lifecycle.scope
|
||||||
import com.uber.autodispose.kotlin.autoDisposable
|
import com.uber.autodispose.kotlin.autoDisposable
|
||||||
import common.di.appComponent
|
import common.di.appComponent
|
||||||
|
import common.util.Preferences
|
||||||
import common.util.extensions.dpToPx
|
import common.util.extensions.dpToPx
|
||||||
import common.util.extensions.setVisible
|
import common.util.extensions.setVisible
|
||||||
import data.model.MenuItem
|
|
||||||
import io.reactivex.subjects.PublishSubject
|
import io.reactivex.subjects.PublishSubject
|
||||||
import io.reactivex.subjects.Subject
|
import io.reactivex.subjects.Subject
|
||||||
import kotlinx.android.synthetic.main.settings_activity.*
|
import kotlinx.android.synthetic.main.settings_activity.*
|
||||||
@@ -47,12 +48,16 @@ import javax.inject.Inject
|
|||||||
|
|
||||||
class SettingsActivity : QkActivity<SettingsViewModel>(), SettingsView {
|
class SettingsActivity : QkActivity<SettingsViewModel>(), SettingsView {
|
||||||
|
|
||||||
@Inject lateinit var menuItemAdapter: MenuItemAdapter
|
@Inject lateinit var nightModeAdapter: MenuItemAdapter
|
||||||
|
@Inject lateinit var mmsSizeAdapter: MenuItemAdapter
|
||||||
|
|
||||||
override val viewModelClass = SettingsViewModel::class
|
override val viewModelClass = SettingsViewModel::class
|
||||||
override val preferenceClickIntent: Subject<PreferenceView> = PublishSubject.create()
|
override val preferenceClickIntent: Subject<PreferenceView> = PublishSubject.create()
|
||||||
|
override val nightModeSelectedIntent by lazy { nightModeAdapter.menuItemClicks }
|
||||||
|
override val startTimeSelectedIntent: Subject<Pair<Int, Int>> = PublishSubject.create()
|
||||||
|
override val endTimeSelectedIntent: Subject<Pair<Int, Int>> = PublishSubject.create()
|
||||||
override val ringtoneSelectedIntent: Subject<String> = PublishSubject.create()
|
override val ringtoneSelectedIntent: Subject<String> = PublishSubject.create()
|
||||||
override val mmsSizeSelectedIntent: Subject<Int> by lazy { menuItemAdapter.menuItemClicks }
|
override val mmsSizeSelectedIntent: Subject<Int> by lazy { mmsSizeAdapter.menuItemClicks }
|
||||||
|
|
||||||
// TODO remove this
|
// TODO remove this
|
||||||
private val progressDialog by lazy {
|
private val progressDialog by lazy {
|
||||||
@@ -63,26 +68,8 @@ class SettingsActivity : QkActivity<SettingsViewModel>(), SettingsView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private val mmsSizeDialog by lazy {
|
private var nightModeDialog: AlertDialog? = null
|
||||||
menuItemAdapter.data = arrayListOf(
|
private var mmsSizeDialog: AlertDialog? = null
|
||||||
MenuItem(R.string.menu_mms_size_100kb, 100),
|
|
||||||
MenuItem(R.string.menu_mms_size_200kb, 200),
|
|
||||||
MenuItem(R.string.menu_mms_size_300kb, 300),
|
|
||||||
MenuItem(R.string.menu_mms_size_600kb, 600),
|
|
||||||
MenuItem(R.string.menu_mms_size_1000kb, 1000),
|
|
||||||
MenuItem(R.string.menu_mms_size_no_limit, 0))
|
|
||||||
|
|
||||||
val recyclerView = RecyclerView(this)
|
|
||||||
recyclerView.layoutManager = LinearLayoutManager(this)
|
|
||||||
recyclerView.adapter = menuItemAdapter
|
|
||||||
recyclerView.setPadding(0, 8.dpToPx(this), 0, 8.dpToPx(this))
|
|
||||||
AlertDialog.Builder(this)
|
|
||||||
.setTitle(R.string.settings_mms_size_title)
|
|
||||||
.setMessage(R.string.settings_mms_size_summary)
|
|
||||||
.setNegativeButton(R.string.button_cancel, null)
|
|
||||||
.setView(recyclerView)
|
|
||||||
.create()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
appComponent.inject(this)
|
appComponent.inject(this)
|
||||||
@@ -98,6 +85,9 @@ class SettingsActivity : QkActivity<SettingsViewModel>(), SettingsView {
|
|||||||
vibration.setVisible(!supportsNotificationChannels)
|
vibration.setVisible(!supportsNotificationChannels)
|
||||||
ringtone.setVisible(!supportsNotificationChannels)
|
ringtone.setVisible(!supportsNotificationChannels)
|
||||||
|
|
||||||
|
nightModeAdapter.setData(R.array.night_modes)
|
||||||
|
mmsSizeAdapter.setData(R.array.mms_sizes, R.array.mms_sizes_ids)
|
||||||
|
|
||||||
colors.background
|
colors.background
|
||||||
.autoDisposable(scope())
|
.autoDisposable(scope())
|
||||||
.subscribe { color -> window.decorView.setBackgroundColor(color) }
|
.subscribe { color -> window.decorView.setBackgroundColor(color) }
|
||||||
@@ -122,21 +112,50 @@ class SettingsActivity : QkActivity<SettingsViewModel>(), SettingsView {
|
|||||||
else -> R.string.settings_default_sms_summary_false
|
else -> R.string.settings_default_sms_summary_false
|
||||||
})
|
})
|
||||||
|
|
||||||
dark.checkbox.isChecked = state.darkModeEnabled
|
night.summary = state.nightModeSummary
|
||||||
|
nightStart.setVisible(state.nightModeId == Preferences.NIGHT_MODE_AUTO)
|
||||||
|
nightStart.summary = state.nightStart
|
||||||
|
nightEnd.setVisible(state.nightModeId == Preferences.NIGHT_MODE_AUTO)
|
||||||
|
nightEnd.summary = state.nightEnd
|
||||||
|
|
||||||
autoEmoji.checkbox.isChecked = state.autoEmojiEnabled
|
autoEmoji.checkbox.isChecked = state.autoEmojiEnabled
|
||||||
|
|
||||||
notifications.checkbox.isChecked = state.notificationsEnabled
|
notifications.checkbox.isChecked = state.notificationsEnabled
|
||||||
|
|
||||||
vibration.checkbox.isChecked = state.vibrationEnabled
|
vibration.checkbox.isChecked = state.vibrationEnabled
|
||||||
|
|
||||||
delivery.checkbox.isChecked = state.deliveryEnabled
|
delivery.checkbox.isChecked = state.deliveryEnabled
|
||||||
|
|
||||||
unicode.checkbox.isChecked = state.stripUnicodeEnabled
|
unicode.checkbox.isChecked = state.stripUnicodeEnabled
|
||||||
|
|
||||||
mms.checkbox.isChecked = state.mmsEnabled
|
mms.checkbox.isChecked = state.mmsEnabled
|
||||||
|
|
||||||
menuItemAdapter.selectedItem = state.maxMmsSize
|
mmsSize.summary = state.maxMmsSizeSummary
|
||||||
|
mmsSizeAdapter.selectedItem = state.maxMmsSizeId
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO change this to a PopupWindow
|
||||||
|
override fun showNightModeDialog() {
|
||||||
|
val recyclerView = RecyclerView(this)
|
||||||
|
recyclerView.layoutManager = LinearLayoutManager(this)
|
||||||
|
recyclerView.adapter = nightModeAdapter
|
||||||
|
recyclerView.setPadding(0, 8.dpToPx(this), 0, 8.dpToPx(this))
|
||||||
|
nightModeDialog = AlertDialog.Builder(this)
|
||||||
|
.setTitle(R.string.settings_night_title)
|
||||||
|
.setView(recyclerView)
|
||||||
|
.create().apply { show() }
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun dismissNightModeDialog() {
|
||||||
|
nightModeDialog?.dismiss()
|
||||||
|
nightModeDialog = null
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun showStartTimePicker(hour: Int, minute: Int) {
|
||||||
|
TimePickerDialog(this, TimePickerDialog.OnTimeSetListener { _, hour, minute ->
|
||||||
|
startTimeSelectedIntent.onNext(Pair(hour, minute))
|
||||||
|
}, hour, minute, false).show()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun showEndTimePicker(hour: Int, minute: Int) {
|
||||||
|
TimePickerDialog(this, TimePickerDialog.OnTimeSetListener { _, hour, minute ->
|
||||||
|
endTimeSelectedIntent.onNext(Pair(hour, minute))
|
||||||
|
}, hour, minute, false).show()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun showRingtonePicker(default: Uri) {
|
override fun showRingtonePicker(default: Uri) {
|
||||||
@@ -148,9 +167,22 @@ class SettingsActivity : QkActivity<SettingsViewModel>(), SettingsView {
|
|||||||
startActivityForResult(intent, 123)
|
startActivityForResult(intent, 123)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun showMmsSizePicker() = mmsSizeDialog.show()
|
override fun showMmsSizePicker() {
|
||||||
|
val recyclerView = RecyclerView(this)
|
||||||
|
recyclerView.layoutManager = LinearLayoutManager(this)
|
||||||
|
recyclerView.adapter = mmsSizeAdapter
|
||||||
|
recyclerView.setPadding(0, 8.dpToPx(this), 0, 8.dpToPx(this))
|
||||||
|
mmsSizeDialog = AlertDialog.Builder(this)
|
||||||
|
.setTitle(R.string.settings_mms_size_title)
|
||||||
|
.setNegativeButton(R.string.button_cancel, null)
|
||||||
|
.setView(recyclerView)
|
||||||
|
.create().apply { show() }
|
||||||
|
}
|
||||||
|
|
||||||
override fun dismissMmsSizePicker() = mmsSizeDialog.dismiss()
|
override fun dismissMmsSizePicker() {
|
||||||
|
mmsSizeDialog?.dismiss()
|
||||||
|
mmsSizeDialog = null
|
||||||
|
}
|
||||||
|
|
||||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||||
super.onActivityResult(requestCode, resultCode, data)
|
super.onActivityResult(requestCode, resultCode, data)
|
||||||
|
|||||||
@@ -18,11 +18,16 @@
|
|||||||
*/
|
*/
|
||||||
package presentation.feature.settings
|
package presentation.feature.settings
|
||||||
|
|
||||||
|
import common.util.Preferences
|
||||||
|
|
||||||
data class SettingsState(
|
data class SettingsState(
|
||||||
val syncing: Boolean = false,
|
val syncing: Boolean = false,
|
||||||
|
|
||||||
val isDefaultSmsApp: Boolean = false,
|
val isDefaultSmsApp: Boolean = false,
|
||||||
val darkModeEnabled: Boolean = false,
|
val nightModeSummary: String = "",
|
||||||
|
val nightModeId: Int = Preferences.NIGHT_MODE_OFF,
|
||||||
|
val nightStart: String = "",
|
||||||
|
val nightEnd: String = "",
|
||||||
val autoEmojiEnabled: Boolean = true,
|
val autoEmojiEnabled: Boolean = true,
|
||||||
val notificationsEnabled: Boolean = true,
|
val notificationsEnabled: Boolean = true,
|
||||||
val vibrationEnabled: Boolean = true,
|
val vibrationEnabled: Boolean = true,
|
||||||
@@ -30,5 +35,6 @@ data class SettingsState(
|
|||||||
val splitSmsEnabled: Boolean = false,
|
val splitSmsEnabled: Boolean = false,
|
||||||
val stripUnicodeEnabled: Boolean = false,
|
val stripUnicodeEnabled: Boolean = false,
|
||||||
val mmsEnabled: Boolean = true,
|
val mmsEnabled: Boolean = true,
|
||||||
val maxMmsSize: Int = 100
|
val maxMmsSizeSummary: String = "100KB",
|
||||||
|
val maxMmsSizeId: Int = 100
|
||||||
)
|
)
|
||||||
@@ -27,9 +27,16 @@ import presentation.common.widget.PreferenceView
|
|||||||
interface SettingsView : QkView<SettingsState> {
|
interface SettingsView : QkView<SettingsState> {
|
||||||
|
|
||||||
val preferenceClickIntent: Subject<PreferenceView>
|
val preferenceClickIntent: Subject<PreferenceView>
|
||||||
|
val nightModeSelectedIntent: Observable<Int>
|
||||||
|
val startTimeSelectedIntent: Subject<Pair<Int, Int>>
|
||||||
|
val endTimeSelectedIntent: Subject<Pair<Int, Int>>
|
||||||
val ringtoneSelectedIntent: Observable<String>
|
val ringtoneSelectedIntent: Observable<String>
|
||||||
val mmsSizeSelectedIntent: Observable<Int>
|
val mmsSizeSelectedIntent: Observable<Int>
|
||||||
|
|
||||||
|
fun showNightModeDialog()
|
||||||
|
fun dismissNightModeDialog()
|
||||||
|
fun showStartTimePicker(hour: Int, minute: Int)
|
||||||
|
fun showEndTimePicker(hour: Int, minute: Int)
|
||||||
fun showRingtonePicker(default: Uri)
|
fun showRingtonePicker(default: Uri)
|
||||||
fun showMmsSizePicker()
|
fun showMmsSizePicker()
|
||||||
fun dismissMmsSizePicker()
|
fun dismissMmsSizePicker()
|
||||||
|
|||||||
@@ -24,18 +24,23 @@ import com.moez.QKSMS.R
|
|||||||
import com.uber.autodispose.android.lifecycle.scope
|
import com.uber.autodispose.android.lifecycle.scope
|
||||||
import com.uber.autodispose.kotlin.autoDisposable
|
import com.uber.autodispose.kotlin.autoDisposable
|
||||||
import common.di.appComponent
|
import common.di.appComponent
|
||||||
|
import common.util.DateFormatter
|
||||||
|
import common.util.NightModeManager
|
||||||
import common.util.Preferences
|
import common.util.Preferences
|
||||||
import interactor.FullSync
|
import interactor.FullSync
|
||||||
import io.reactivex.rxkotlin.plusAssign
|
import io.reactivex.rxkotlin.plusAssign
|
||||||
import presentation.common.Navigator
|
import presentation.common.Navigator
|
||||||
import presentation.common.base.QkViewModel
|
import presentation.common.base.QkViewModel
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
|
import java.util.*
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class SettingsViewModel : QkViewModel<SettingsView, SettingsState>(SettingsState()) {
|
class SettingsViewModel : QkViewModel<SettingsView, SettingsState>(SettingsState()) {
|
||||||
|
|
||||||
@Inject lateinit var context: Context
|
@Inject lateinit var context: Context
|
||||||
|
@Inject lateinit var dateFormatter: DateFormatter
|
||||||
@Inject lateinit var navigator: Navigator
|
@Inject lateinit var navigator: Navigator
|
||||||
|
@Inject lateinit var nightModeManager: NightModeManager
|
||||||
@Inject lateinit var prefs: Preferences
|
@Inject lateinit var prefs: Preferences
|
||||||
@Inject lateinit var fullSync: FullSync
|
@Inject lateinit var fullSync: FullSync
|
||||||
|
|
||||||
@@ -48,8 +53,17 @@ class SettingsViewModel : QkViewModel<SettingsView, SettingsState>(SettingsState
|
|||||||
newState { it.copy(isDefaultSmsApp = isDefaultSmsApp) }
|
newState { it.copy(isDefaultSmsApp = isDefaultSmsApp) }
|
||||||
}
|
}
|
||||||
|
|
||||||
disposables += prefs.dark.asObservable().subscribe { darkModeEnabled ->
|
val nightModeLabels = context.resources.getStringArray(R.array.night_modes)
|
||||||
newState { it.copy(darkModeEnabled = darkModeEnabled) }
|
disposables += prefs.nightMode.asObservable().subscribe { nightMode ->
|
||||||
|
newState { it.copy(nightModeSummary = nightModeLabels[nightMode], nightModeId = nightMode) }
|
||||||
|
}
|
||||||
|
|
||||||
|
disposables += prefs.nightStart.asObservable().subscribe { nightStart ->
|
||||||
|
newState { it.copy(nightStart = nightStart) }
|
||||||
|
}
|
||||||
|
|
||||||
|
disposables += prefs.nightEnd.asObservable().subscribe { nightEnd ->
|
||||||
|
newState { it.copy(nightEnd = nightEnd) }
|
||||||
}
|
}
|
||||||
|
|
||||||
disposables += prefs.autoEmoji.asObservable().subscribe { autoEmojiEnabled ->
|
disposables += prefs.autoEmoji.asObservable().subscribe { autoEmojiEnabled ->
|
||||||
@@ -76,8 +90,11 @@ class SettingsViewModel : QkViewModel<SettingsView, SettingsState>(SettingsState
|
|||||||
newState { it.copy(mmsEnabled = mmsEnabled) }
|
newState { it.copy(mmsEnabled = mmsEnabled) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val mmsSizeLabels = context.resources.getStringArray(R.array.mms_sizes)
|
||||||
|
val mmsSizeIds = context.resources.getIntArray(R.array.mms_sizes_ids)
|
||||||
disposables += prefs.mmsSize.asObservable().subscribe { maxMmsSize ->
|
disposables += prefs.mmsSize.asObservable().subscribe { maxMmsSize ->
|
||||||
newState { it.copy(maxMmsSize = maxMmsSize) }
|
val index = mmsSizeIds.indexOf(maxMmsSize)
|
||||||
|
newState { it.copy(maxMmsSizeSummary = mmsSizeLabels[index], maxMmsSizeId = maxMmsSize) }
|
||||||
}
|
}
|
||||||
|
|
||||||
disposables += fullSync
|
disposables += fullSync
|
||||||
@@ -96,7 +113,17 @@ class SettingsViewModel : QkViewModel<SettingsView, SettingsState>(SettingsState
|
|||||||
|
|
||||||
R.id.theme -> navigator.showThemePicker()
|
R.id.theme -> navigator.showThemePicker()
|
||||||
|
|
||||||
R.id.dark -> prefs.dark.set(!prefs.dark.get())
|
R.id.night -> view.showNightModeDialog()
|
||||||
|
|
||||||
|
R.id.nightStart -> {
|
||||||
|
val date = dateFormatter.parseTime(prefs.nightStart.get())
|
||||||
|
view.showStartTimePicker(date.get(Calendar.HOUR_OF_DAY), date.get(Calendar.MINUTE))
|
||||||
|
}
|
||||||
|
|
||||||
|
R.id.nightEnd -> {
|
||||||
|
val date = dateFormatter.parseTime(prefs.nightEnd.get())
|
||||||
|
view.showEndTimePicker(date.get(Calendar.HOUR_OF_DAY), date.get(Calendar.MINUTE))
|
||||||
|
}
|
||||||
|
|
||||||
R.id.autoEmoji -> prefs.autoEmoji.set(!prefs.autoEmoji.get())
|
R.id.autoEmoji -> prefs.autoEmoji.set(!prefs.autoEmoji.get())
|
||||||
|
|
||||||
@@ -125,6 +152,23 @@ class SettingsViewModel : QkViewModel<SettingsView, SettingsState>(SettingsState
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
view.nightModeSelectedIntent
|
||||||
|
.doOnNext { view.dismissNightModeDialog() }
|
||||||
|
.autoDisposable(view.scope())
|
||||||
|
.subscribe { nightMode -> nightModeManager.updateNightMode(nightMode) }
|
||||||
|
|
||||||
|
view.startTimeSelectedIntent
|
||||||
|
.doOnNext { nightModeManager.updateAlarms() }
|
||||||
|
.map { dateFormatter.formatTime(it.first, it.second) }
|
||||||
|
.autoDisposable(view.scope())
|
||||||
|
.subscribe { prefs.nightStart.set(it) }
|
||||||
|
|
||||||
|
view.endTimeSelectedIntent
|
||||||
|
.doOnNext { nightModeManager.updateAlarms() }
|
||||||
|
.map { dateFormatter.formatTime(it.first, it.second) }
|
||||||
|
.autoDisposable(view.scope())
|
||||||
|
.subscribe { prefs.nightEnd.set(it) }
|
||||||
|
|
||||||
view.ringtoneSelectedIntent
|
view.ringtoneSelectedIntent
|
||||||
.autoDisposable(view.scope())
|
.autoDisposable(view.scope())
|
||||||
.subscribe { ringtone -> prefs.ringtone.set(ringtone) }
|
.subscribe { ringtone -> prefs.ringtone.set(ringtone) }
|
||||||
|
|||||||
@@ -0,0 +1,56 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2017 Moez Bhatti <moez.bhatti@gmail.com>
|
||||||
|
*
|
||||||
|
* This file is part of QKSMS.
|
||||||
|
*
|
||||||
|
* QKSMS is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* QKSMS is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package presentation.receiver
|
||||||
|
|
||||||
|
import android.content.BroadcastReceiver
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.Intent
|
||||||
|
import common.di.appComponent
|
||||||
|
import common.util.DateFormatter
|
||||||
|
import common.util.Preferences
|
||||||
|
import timber.log.Timber
|
||||||
|
import java.util.concurrent.TimeUnit
|
||||||
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
class NightModeReceiver : BroadcastReceiver() {
|
||||||
|
|
||||||
|
@Inject lateinit var dateFormatter: DateFormatter
|
||||||
|
@Inject lateinit var prefs: Preferences
|
||||||
|
|
||||||
|
init {
|
||||||
|
appComponent.inject(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onReceive(context: Context, intent: Intent) {
|
||||||
|
Timber.v("onReceive")
|
||||||
|
|
||||||
|
// If night mode is not on auto, then there's nothing to do here
|
||||||
|
if (prefs.nightMode.get() != Preferences.NIGHT_MODE_AUTO) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
val dayMs = TimeUnit.DAYS.toMillis(1)
|
||||||
|
|
||||||
|
val currentTime = (System.currentTimeMillis() + TimeUnit.MINUTES.toMillis(10)) % dayMs // add 10 mins in case receiver is called early
|
||||||
|
val nightEndTime = dateFormatter.parseTime(prefs.nightEnd.get()).timeInMillis % dayMs
|
||||||
|
val nightStartTime = dateFormatter.parseTime(prefs.nightStart.get()).timeInMillis % dayMs
|
||||||
|
|
||||||
|
prefs.night.set(currentTime in nightStartTime..nightEndTime)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -19,6 +19,7 @@
|
|||||||
-->
|
-->
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
@@ -36,6 +37,7 @@
|
|||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/preferences"
|
android:id="@+id/preferences"
|
||||||
|
android:animateLayoutChanges="true"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
@@ -53,11 +55,25 @@
|
|||||||
app:title="@string/settings_theme_title" />
|
app:title="@string/settings_theme_title" />
|
||||||
|
|
||||||
<presentation.common.widget.PreferenceView
|
<presentation.common.widget.PreferenceView
|
||||||
android:id="@+id/dark"
|
android:id="@+id/night"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:title="@string/settings_dark_title"
|
app:title="@string/settings_night_title"
|
||||||
app:widget="@layout/settings_switch_widget" />
|
tools:summary="Automatic" />
|
||||||
|
|
||||||
|
<presentation.common.widget.PreferenceView
|
||||||
|
android:id="@+id/nightStart"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:title="@string/settings_night_start_title"
|
||||||
|
tools:summary="6:00PM" />
|
||||||
|
|
||||||
|
<presentation.common.widget.PreferenceView
|
||||||
|
android:id="@+id/nightEnd"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:title="@string/settings_night_end_title"
|
||||||
|
tools:summary="9:00AM" />
|
||||||
|
|
||||||
<presentation.common.widget.PreferenceView
|
<presentation.common.widget.PreferenceView
|
||||||
android:id="@+id/autoEmoji"
|
android:id="@+id/autoEmoji"
|
||||||
@@ -123,8 +139,8 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:visibility="visible"
|
android:visibility="visible"
|
||||||
app:summary="@string/settings_mms_size_summary"
|
app:title="@string/settings_mms_size_title"
|
||||||
app:title="@string/settings_mms_size_title" />
|
tools:summary="100KB" />
|
||||||
|
|
||||||
<presentation.common.widget.PreferenceView
|
<presentation.common.widget.PreferenceView
|
||||||
android:id="@+id/sync"
|
android:id="@+id/sync"
|
||||||
|
|||||||
@@ -39,12 +39,6 @@
|
|||||||
<string name="menu_archive">Archive conversation</string>
|
<string name="menu_archive">Archive conversation</string>
|
||||||
<string name="menu_unarchive">Remove from archive</string>
|
<string name="menu_unarchive">Remove from archive</string>
|
||||||
<string name="menu_delete">Delete</string>
|
<string name="menu_delete">Delete</string>
|
||||||
<string name="menu_mms_size_no_limit">No limit</string>
|
|
||||||
<string name="menu_mms_size_100kb">100KB</string>
|
|
||||||
<string name="menu_mms_size_200kb">200KB</string>
|
|
||||||
<string name="menu_mms_size_300kb">300KB</string>
|
|
||||||
<string name="menu_mms_size_600kb">600KB</string>
|
|
||||||
<string name="menu_mms_size_1000kb">1000KB</string>
|
|
||||||
|
|
||||||
<string name="main_syncing">Optimizing database, this might take a minute…</string>
|
<string name="main_syncing">Optimizing database, this might take a minute…</string>
|
||||||
|
|
||||||
@@ -72,7 +66,9 @@
|
|||||||
<string name="settings_default_sms_summary_true">QKSMS is your default SMS app</string>
|
<string name="settings_default_sms_summary_true">QKSMS is your default SMS app</string>
|
||||||
<string name="settings_default_sms_summary_false">Set QKSMS as your default SMS app</string>
|
<string name="settings_default_sms_summary_false">Set QKSMS as your default SMS app</string>
|
||||||
<string name="settings_theme_title">Theme</string>
|
<string name="settings_theme_title">Theme</string>
|
||||||
<string name="settings_dark_title">Dark mode</string>
|
<string name="settings_night_title">Night mode</string>
|
||||||
|
<string name="settings_night_start_title">Start time</string>
|
||||||
|
<string name="settings_night_end_title">End time</string>
|
||||||
<string name="settings_auto_emoji_title">Automatic emoji</string>
|
<string name="settings_auto_emoji_title">Automatic emoji</string>
|
||||||
<string name="settings_auto_emoji_summary">Convert text like :) to an emoji like 🙂</string>
|
<string name="settings_auto_emoji_summary">Convert text like :) to an emoji like 🙂</string>
|
||||||
<string name="settings_notifications_title">Notifications</string>
|
<string name="settings_notifications_title">Notifications</string>
|
||||||
@@ -84,7 +80,6 @@
|
|||||||
<string name="settings_unicode_summary">Remove accents from characters in outgoing SMS messages</string>
|
<string name="settings_unicode_summary">Remove accents from characters in outgoing SMS messages</string>
|
||||||
<string name="settings_mms_title">MMS enabled</string>
|
<string name="settings_mms_title">MMS enabled</string>
|
||||||
<string name="settings_mms_size_title">Max MMS attachment size</string>
|
<string name="settings_mms_size_title">Max MMS attachment size</string>
|
||||||
<string name="settings_mms_size_summary">Compress the attachments in an MMS message</string>
|
|
||||||
<string name="settings_sync_title">Sync messages</string>
|
<string name="settings_sync_title">Sync messages</string>
|
||||||
<string name="settings_sync_summary">Re-sync your messages with the native Android SMS database</string>
|
<string name="settings_sync_summary">Re-sync your messages with the native Android SMS database</string>
|
||||||
|
|
||||||
@@ -136,4 +131,34 @@
|
|||||||
<item>Delete</item>
|
<item>Delete</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
|
<string-array name="night_modes">
|
||||||
|
<item>Disabled</item>
|
||||||
|
<item>Always on</item>
|
||||||
|
<item>Automatic</item>
|
||||||
|
</string-array>
|
||||||
|
<string name="menu_mms_size_no_limit">No limit</string>
|
||||||
|
<string name="menu_mms_size_100kb">100KB</string>
|
||||||
|
<string name="menu_mms_size_200kb">200KB</string>
|
||||||
|
<string name="menu_mms_size_300kb">300KB</string>
|
||||||
|
<string name="menu_mms_size_600kb">600KB</string>
|
||||||
|
<string name="menu_mms_size_1000kb">1000KB</string>
|
||||||
|
|
||||||
|
<string-array name="mms_sizes">
|
||||||
|
<item>100KB</item>
|
||||||
|
<item>200KB</item>
|
||||||
|
<item>300KB</item>
|
||||||
|
<item>600KB</item>
|
||||||
|
<item>1000KB</item>
|
||||||
|
<item>No limit</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
|
<integer-array name="mms_sizes_ids">
|
||||||
|
<item>100</item>
|
||||||
|
<item>200</item>
|
||||||
|
<item>300</item>
|
||||||
|
<item>600</item>
|
||||||
|
<item>1000</item>
|
||||||
|
<item>0</item>
|
||||||
|
</integer-array>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
Reference in New Issue
Block a user