Merge branch 'auto-delete'

Closes #119
This commit is contained in:
Moez Bhatti
2020-12-28 01:03:17 -05:00
23 changed files with 369 additions and 22 deletions
@@ -18,6 +18,7 @@
*/
package com.moez.QKSMS.common.util.extensions
import android.app.job.JobScheduler
import android.content.Context
import android.content.res.ColorStateList
import android.graphics.Color
@@ -25,6 +26,7 @@ import android.util.TypedValue
import android.widget.Toast
import androidx.annotation.StringRes
import androidx.core.content.ContextCompat
import androidx.core.content.getSystemService
import com.moez.QKSMS.util.tryOrNull
fun Context.getColorCompat(colorRes: Int): Int {
@@ -84,3 +86,6 @@ fun Context.isInstalled(packageName: String): Boolean {
val Context.versionCode: Int
get() = packageManager.getPackageInfo(packageName, 0).versionCode
val Context.jobScheduler: JobScheduler
get() = getSystemService()!!
@@ -66,8 +66,11 @@ import java.io.File
import java.io.FileNotFoundException
import java.io.FileOutputStream
import java.io.IOException
import java.util.*
import java.util.concurrent.TimeUnit
import javax.inject.Inject
import javax.inject.Singleton
import kotlin.collections.ArrayList
import kotlin.math.sqrt
@Singleton
@@ -724,4 +727,27 @@ class MessageRepositoryImpl @Inject constructor(
}
}
}
override fun getOldMessageCounts(maxAgeDays: Int): Map<Long, Int> {
return Realm.getDefaultInstance().use { realm ->
realm.where(Message::class.java)
.lessThan("date", now() - TimeUnit.DAYS.toMillis(maxAgeDays.toLong()))
.findAll()
.groupingBy { message -> message.threadId }
.eachCount()
}
}
override fun deleteOldMessages(maxAgeDays: Int) {
return Realm.getDefaultInstance().use { realm ->
val messages = realm.where(Message::class.java)
.lessThan("date", now() - TimeUnit.DAYS.toMillis(maxAgeDays.toLong()))
.findAll()
val uris = messages.map { it.getUri() }
realm.executeTransaction { messages.deleteAllFromRealm() }
uris.forEach { uri -> context.contentResolver.delete(uri, null, null) }
}
}
}
@@ -0,0 +1,62 @@
package com.moez.QKSMS.service
import android.annotation.SuppressLint
import android.app.job.JobInfo
import android.app.job.JobParameters
import android.app.job.JobService
import android.content.ComponentName
import android.content.Context
import androidx.core.content.getSystemService
import com.moez.QKSMS.common.util.extensions.jobScheduler
import com.moez.QKSMS.interactor.DeleteOldMessages
import dagger.android.AndroidInjection
import io.reactivex.disposables.CompositeDisposable
import io.reactivex.rxkotlin.plusAssign
import kotlinx.coroutines.Job
import timber.log.Timber
import java.util.concurrent.TimeUnit
import javax.inject.Inject
class AutoDeleteService : JobService() {
companion object {
private const val JobId = 8120235
@SuppressLint("MissingPermission") // Added in [presentation]'s AndroidManifest.xml
fun scheduleJob(context: Context) {
Timber.i("Scheduling job")
val serviceComponent = ComponentName(context, AutoDeleteService::class.java)
val periodicJob = JobInfo.Builder(JobId, serviceComponent)
.setPeriodic(TimeUnit.DAYS.toMillis(1))
.setPersisted(true)
.build()
context.jobScheduler.schedule(periodicJob)
}
fun cancelJob(context: Context) {
Timber.i("Canceling job")
context.jobScheduler.cancel(JobId)
}
}
@Inject lateinit var deleteOldMessages: DeleteOldMessages
private val disposables = CompositeDisposable()
override fun onStartJob(params: JobParameters?): Boolean {
Timber.i("onStartJob")
AndroidInjection.inject(this)
disposables += deleteOldMessages
deleteOldMessages.execute(Unit) {
jobFinished(params, false)
}
return true
}
override fun onStopJob(params: JobParameters?): Boolean {
Timber.i("onStopJob")
disposables.dispose()
return true
}
}
@@ -0,0 +1,44 @@
/*
* 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 com.moez.QKSMS.interactor
import com.moez.QKSMS.repository.ConversationRepository
import com.moez.QKSMS.repository.MessageRepository
import com.moez.QKSMS.util.Preferences
import io.reactivex.Flowable
import timber.log.Timber
import javax.inject.Inject
class DeleteOldMessages @Inject constructor(
private val conversationRepo: ConversationRepository,
private val messageRepo: MessageRepository,
private val prefs: Preferences
) : Interactor<Unit>() {
override fun buildObservable(params: Unit): Flowable<*> = Flowable.fromCallable {
val maxAge = prefs.autoDelete.get().takeIf { it > 0 } ?: return@fromCallable
val counts = messageRepo.getOldMessageCounts(maxAge)
val threadIds = counts.keys.toLongArray()
Timber.d("Deleting ${counts.values.sum()} old messages from ${threadIds.size} conversations")
messageRepo.deleteOldMessages(maxAge)
conversationRepo.updateConversations(*threadIds)
}
}
@@ -91,4 +91,4 @@ interface ConversationRepository {
fun deleteConversations(vararg threadIds: Long)
}
}
@@ -102,4 +102,14 @@ interface MessageRepository {
fun deleteMessages(vararg messageIds: Long)
/**
* Returns the number of messages older than [maxAgeDays] per conversation
*/
fun getOldMessageCounts(maxAgeDays: Int): Map<Long, Int>
/**
* Deletes all messages older than [maxAgeDays]
*/
fun deleteOldMessages(maxAgeDays: Int)
}
@@ -113,6 +113,7 @@ class Preferences @Inject constructor(
val signature = rxPrefs.getString("signature", "")
val unicode = rxPrefs.getBoolean("unicode", false)
val mobileOnly = rxPrefs.getBoolean("mobileOnly", false)
val autoDelete = rxPrefs.getInteger("autoDelete", 0)
val longAsMms = rxPrefs.getBoolean("longAsMms", false)
val mmsSize = rxPrefs.getInteger("mmsSize", 300)
val logging = rxPrefs.getBoolean("logging", false)
+1 -1
View File
@@ -23,7 +23,7 @@ apply plugin: 'kotlin-kapt'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
buildToolsVersion "29.0.3"
flavorDimensions "analytics"
defaultConfig {
@@ -184,6 +184,9 @@
<service
android:name=".feature.widget.WidgetService"
android:permission="android.permission.BIND_REMOTEVIEWS" />
<service
android:name=".service.AutoDeleteService"
android:permission="android.permission.BIND_JOB_SERVICE" />
<service
android:name=".service.HeadlessSmsSendService"
android:exported="true"
@@ -53,7 +53,7 @@ class FileLoggingTree @Inject constructor(private val prefs: Preferences) : Timb
}
// Format the log to be written to the file
val log = "$timestamp $priorityString/$tag: $message ${Log.getStackTraceString(t)}<br>".toByteArray()
val log = "$timestamp $priorityString/$tag: $message ${Log.getStackTraceString(t)}\n".toByteArray()
// Ensure that only one thread is writing to the file at a time
synchronized(fileLock) {
@@ -62,7 +62,7 @@ class FileLoggingTree @Inject constructor(private val prefs: Preferences) : Timb
val dir = File(Environment.getExternalStorageDirectory(), "QKSMS/Logs").apply { mkdirs() }
// Create the file
val file = File(dir, "${SimpleDateFormat("yyyy-MM-dd", Locale.getDefault()).format(System.currentTimeMillis())}.html")
val file = File(dir, "${SimpleDateFormat("yyyy-MM-dd", Locale.getDefault()).format(System.currentTimeMillis())}.log")
// Write the log to the file
FileOutputStream(file, true).use { fileOutputStream -> fileOutputStream.write(log) }
@@ -22,11 +22,11 @@ import android.app.Activity
import android.content.DialogInterface
import androidx.appcompat.app.AlertDialog
import com.moez.QKSMS.R
import com.moez.QKSMS.databinding.FieldDialogBinding
import com.moez.QKSMS.databinding.TextInputDialogBinding
class FieldDialog(context: Activity, hint: String, listener: (String) -> Unit) : AlertDialog(context) {
class TextInputDialog(context: Activity, hint: String, listener: (String) -> Unit) : AlertDialog(context) {
private val binding = FieldDialogBinding.inflate(context.layoutInflater)
private val binding = TextInputDialogBinding.inflate(context.layoutInflater)
init {
binding.field.hint = hint
@@ -39,7 +39,7 @@ class FieldDialog(context: Activity, hint: String, listener: (String) -> Unit) :
}
}
fun setText(text: String): FieldDialog {
fun setText(text: String): TextInputDialog {
binding.field.setText(text)
return this
}
@@ -27,7 +27,7 @@ import com.moez.QKSMS.common.Navigator
import com.moez.QKSMS.common.QkChangeHandler
import com.moez.QKSMS.common.base.QkController
import com.moez.QKSMS.common.util.extensions.scrapViews
import com.moez.QKSMS.common.widget.FieldDialog
import com.moez.QKSMS.common.widget.TextInputDialog
import com.moez.QKSMS.databinding.ConversationInfoControllerBinding
import com.moez.QKSMS.feature.blocking.BlockingDialog
import com.moez.QKSMS.feature.conversationinfo.injection.ConversationInfoModule
@@ -50,8 +50,8 @@ class ConversationInfoController(
@Inject lateinit var navigator: Navigator
@Inject lateinit var adapter: ConversationInfoAdapter
private val nameDialog: FieldDialog by lazy {
FieldDialog(activity!!, activity!!.getString(R.string.info_name), nameChangeSubject::onNext)
private val nameDialog: TextInputDialog by lazy {
TextInputDialog(activity!!, activity!!.getString(R.string.info_name), nameChangeSubject::onNext)
}
private val nameChangeSubject: Subject<String> = PublishSubject.create()
@@ -24,6 +24,7 @@ import android.content.Context
import android.os.Build
import android.text.format.DateFormat
import android.view.View
import androidx.appcompat.app.AlertDialog
import androidx.core.view.isVisible
import com.bluelinelabs.conductor.RouterTransaction
import com.google.android.material.snackbar.Snackbar
@@ -39,11 +40,12 @@ import com.moez.QKSMS.common.util.Colors
import com.moez.QKSMS.common.util.extensions.animateLayoutChanges
import com.moez.QKSMS.common.util.extensions.setBackgroundTint
import com.moez.QKSMS.common.util.extensions.setVisible
import com.moez.QKSMS.common.widget.FieldDialog
import com.moez.QKSMS.common.widget.PreferenceView
import com.moez.QKSMS.common.widget.QkSwitch
import com.moez.QKSMS.common.widget.TextInputDialog
import com.moez.QKSMS.databinding.SettingsControllerBinding
import com.moez.QKSMS.feature.settings.about.AboutController
import com.moez.QKSMS.feature.settings.autodelete.AutoDeleteDialog
import com.moez.QKSMS.feature.settings.swipe.SwipeActionsController
import com.moez.QKSMS.feature.themepicker.ThemePickerController
import com.moez.QKSMS.injection.appComponent
@@ -54,7 +56,11 @@ import com.uber.autodispose.autoDisposable
import io.reactivex.Observable
import io.reactivex.subjects.PublishSubject
import io.reactivex.subjects.Subject
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.suspendCancellableCoroutine
import kotlinx.coroutines.withContext
import javax.inject.Inject
import kotlin.coroutines.resume
class SettingsController : QkController<SettingsView, SettingsState, SettingsPresenter, SettingsControllerBinding>(
SettingsControllerBinding::inflate
@@ -69,14 +75,18 @@ class SettingsController : QkController<SettingsView, SettingsState, SettingsPre
@Inject override lateinit var presenter: SettingsPresenter
private val signatureDialog: FieldDialog by lazy {
FieldDialog(activity!!, context.getString(R.string.settings_signature_title), signatureSubject::onNext)
private val signatureDialog: TextInputDialog by lazy {
TextInputDialog(activity!!, context.getString(R.string.settings_signature_title), signatureSubject::onNext)
}
private val autoDeleteDialog: AutoDeleteDialog by lazy {
AutoDeleteDialog(activity!!, autoDeleteSubject::onNext)
}
private val viewQksmsPlusSubject: Subject<Unit> = PublishSubject.create()
private val startTimeSelectedSubject: Subject<Pair<Int, Int>> = PublishSubject.create()
private val endTimeSelectedSubject: Subject<Pair<Int, Int>> = PublishSubject.create()
private val signatureSubject: Subject<String> = PublishSubject.create()
private val autoDeleteSubject: Subject<Int> = PublishSubject.create()
private val progressAnimator by lazy { ObjectAnimator.ofInt(binding.syncingProgress, "progress", 0, 0) }
@@ -132,7 +142,9 @@ class SettingsController : QkController<SettingsView, SettingsState, SettingsPre
override fun sendDelaySelected(): Observable<Int> = sendDelayDialog.adapter.menuItemClicks
override fun signatureSet(): Observable<String> = signatureSubject
override fun signatureChanged(): Observable<String> = signatureSubject
override fun autoDeleteChanged(): Observable<Int> = autoDeleteSubject
override fun mmsSizeSelected(): Observable<Int> = mmsSizeDialog.adapter.menuItemClicks
@@ -167,6 +179,13 @@ class SettingsController : QkController<SettingsView, SettingsState, SettingsPre
binding.unicode.widget<QkSwitch>().isChecked = state.stripUnicodeEnabled
binding.mobileOnly.widget<QkSwitch>().isChecked = state.mobileOnly
binding.autoDelete.summary = when (state.autoDelete) {
0 -> context.getString(R.string.settings_auto_delete_never)
else -> context.resources.getQuantityString(
R.plurals.settings_auto_delete_summary, state.autoDelete, state.autoDelete)
}
binding.longAsMms.widget<QkSwitch>().isChecked = state.longAsMms
binding.mmsSize.summary = state.maxMmsSizeSummary
@@ -178,7 +197,8 @@ class SettingsController : QkController<SettingsView, SettingsState, SettingsPre
is SyncRepository.SyncProgress.Running -> {
binding.syncingProgress.isVisible = true
binding.syncingProgress.max = state.syncProgress.max
progressAnimator.apply { setIntValues(binding.syncingProgress.progress, state.syncProgress.progress) }.start()
progressAnimator.apply { setIntValues(binding.syncingProgress.progress, state.syncProgress.progress) }
.start()
binding.syncingProgress.isIndeterminate = state.syncProgress.indeterminate
}
}
@@ -198,13 +218,13 @@ class SettingsController : QkController<SettingsView, SettingsState, SettingsPre
override fun showNightModeDialog() = nightModeDialog.show(activity!!)
override fun showStartTimePicker(hour: Int, minute: Int) {
TimePickerDialog(activity, TimePickerDialog.OnTimeSetListener { _, newHour, newMinute ->
TimePickerDialog(activity, { _, newHour, newMinute ->
startTimeSelectedSubject.onNext(Pair(newHour, newMinute))
}, hour, minute, DateFormat.is24HourFormat(activity)).show()
}
override fun showEndTimePicker(hour: Int, minute: Int) {
TimePickerDialog(activity, TimePickerDialog.OnTimeSetListener { _, newHour, newMinute ->
TimePickerDialog(activity, { _, newHour, newMinute ->
endTimeSelectedSubject.onNext(Pair(newHour, newMinute))
}, hour, minute, DateFormat.is24HourFormat(activity)).show()
}
@@ -215,6 +235,20 @@ class SettingsController : QkController<SettingsView, SettingsState, SettingsPre
override fun showSignatureDialog(signature: String) = signatureDialog.setText(signature).show()
override fun showAutoDeleteDialog(days: Int) = autoDeleteDialog.setExpiry(days).show()
override suspend fun showAutoDeleteWarningDialog(messages: Int): Boolean = withContext(Dispatchers.Main) {
suspendCancellableCoroutine<Boolean> { cont ->
AlertDialog.Builder(activity!!)
.setTitle(R.string.settings_auto_delete_warning)
.setMessage(context.resources.getString(R.string.settings_auto_delete_warning_message, messages))
.setOnCancelListener { cont.resume(false) }
.setNegativeButton(R.string.button_cancel) { _, _ -> cont.resume(false) }
.setPositiveButton(R.string.button_yes) { _, _ -> cont.resume(true) }
.show()
}
}
override fun showMmsSizePicker() = mmsSizeDialog.show(activity!!)
override fun showSwipeActions() {
@@ -26,15 +26,20 @@ import com.moez.QKSMS.common.util.BillingManager
import com.moez.QKSMS.common.util.Colors
import com.moez.QKSMS.common.util.DateFormatter
import com.moez.QKSMS.common.util.extensions.makeToast
import com.moez.QKSMS.interactor.DeleteOldMessages
import com.moez.QKSMS.interactor.SyncMessages
import com.moez.QKSMS.manager.AnalyticsManager
import com.moez.QKSMS.repository.MessageRepository
import com.moez.QKSMS.repository.SyncRepository
import com.moez.QKSMS.service.AutoDeleteService
import com.moez.QKSMS.util.NightModeManager
import com.moez.QKSMS.util.Preferences
import com.uber.autodispose.android.lifecycle.scope
import com.uber.autodispose.autoDisposable
import io.reactivex.rxkotlin.plusAssign
import io.reactivex.rxkotlin.withLatestFrom
import io.reactivex.schedulers.Schedulers
import kotlinx.coroutines.runBlocking
import timber.log.Timber
import java.util.*
import java.util.concurrent.TimeUnit
@@ -47,6 +52,8 @@ class SettingsPresenter @Inject constructor(
private val context: Context,
private val billingManager: BillingManager,
private val dateFormatter: DateFormatter,
private val deleteOldMessages: DeleteOldMessages,
private val messageRepo: MessageRepository,
private val navigator: Navigator,
private val nightModeManager: NightModeManager,
private val prefs: Preferences,
@@ -114,6 +121,9 @@ class SettingsPresenter @Inject constructor(
disposables += prefs.mobileOnly.asObservable()
.subscribe { enabled -> newState { copy(mobileOnly = enabled) } }
disposables += prefs.autoDelete.asObservable()
.subscribe { autoDelete -> newState { copy(autoDelete = autoDelete) } }
disposables += prefs.longAsMms.asObservable()
.subscribe { enabled -> newState { copy(longAsMms = enabled) } }
@@ -183,6 +193,8 @@ class SettingsPresenter @Inject constructor(
R.id.mobileOnly -> prefs.mobileOnly.set(!prefs.mobileOnly.get())
R.id.autoDelete -> view.showAutoDeleteDialog(prefs.autoDelete.get())
R.id.longAsMms -> prefs.longAsMms.set(!prefs.longAsMms.get())
R.id.mmsSize -> view.showMmsSizePicker()
@@ -242,11 +254,38 @@ class SettingsPresenter @Inject constructor(
.autoDisposable(view.scope())
.subscribe()
view.signatureSet()
view.signatureChanged()
.doOnNext(prefs.signature::set)
.autoDisposable(view.scope())
.subscribe()
view.autoDeleteChanged()
.observeOn(Schedulers.io())
.filter { maxAge ->
if (maxAge == 0) {
return@filter true
}
val counts = messageRepo.getOldMessageCounts(maxAge)
if (counts.values.sum() == 0) {
return@filter true
}
runBlocking { view.showAutoDeleteWarningDialog(counts.values.sum()) }
}
.doOnNext { maxAge ->
when (maxAge == 0) {
true -> AutoDeleteService.cancelJob(context)
false -> {
AutoDeleteService.scheduleJob(context)
deleteOldMessages.execute(Unit)
}
}
}
.doOnNext(prefs.autoDelete::set)
.autoDisposable(view.scope())
.subscribe()
view.mmsSizeSelected()
.autoDisposable(view.scope())
.subscribe(prefs.mmsSize::set)
@@ -41,6 +41,7 @@ data class SettingsState(
val splitSmsEnabled: Boolean = false,
val stripUnicodeEnabled: Boolean = false,
val mobileOnly: Boolean = false,
val autoDelete: Int = 0,
val longAsMms: Boolean = false,
val maxMmsSizeSummary: String = "100KB",
val maxMmsSizeId: Int = 100,
@@ -31,7 +31,8 @@ interface SettingsView : QkViewContract<SettingsState> {
fun nightEndSelected(): Observable<Pair<Int, Int>>
fun textSizeSelected(): Observable<Int>
fun sendDelaySelected(): Observable<Int>
fun signatureSet(): Observable<String>
fun signatureChanged(): Observable<String>
fun autoDeleteChanged(): Observable<Int>
fun mmsSizeSelected(): Observable<Int>
fun showQksmsPlusSnackbar()
@@ -41,6 +42,8 @@ interface SettingsView : QkViewContract<SettingsState> {
fun showTextSizePicker()
fun showDelayDurationDialog()
fun showSignatureDialog(signature: String)
fun showAutoDeleteDialog(days: Int)
suspend fun showAutoDeleteWarningDialog(messages: Int): Boolean
fun showMmsSizePicker()
fun showSwipeActions()
fun showThemePicker()
@@ -0,0 +1,50 @@
/*
* 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 com.moez.QKSMS.feature.settings.autodelete
import android.app.Activity
import android.content.DialogInterface
import androidx.appcompat.app.AlertDialog
import com.moez.QKSMS.R
import com.moez.QKSMS.databinding.SettingsAutoDeleteDialogBinding
class AutoDeleteDialog(context: Activity, listener: (Int) -> Unit) : AlertDialog(context) {
private val binding = SettingsAutoDeleteDialogBinding.inflate(context.layoutInflater)
init {
setView(binding.root)
setTitle(R.string.settings_auto_delete)
setMessage(context.getString(R.string.settings_auto_delete_dialog_message))
setButton(DialogInterface.BUTTON_NEUTRAL, context.getString(R.string.button_cancel)) { _, _ -> }
setButton(DialogInterface.BUTTON_NEGATIVE, context.getString(R.string.settings_auto_delete_never)) { _, _ -> listener(0) }
setButton(DialogInterface.BUTTON_POSITIVE, context.getString(R.string.button_save)) { _, _ ->
listener(binding.field.text.toString().toIntOrNull() ?: 0)
}
}
fun setExpiry(days: Int): AutoDeleteDialog {
when (days) {
0 -> binding.field.text = null
else -> binding.field.setText(days.toString())
}
return this
}
}
@@ -22,12 +22,17 @@ import com.moez.QKSMS.feature.backup.RestoreBackupService
import com.moez.QKSMS.injection.scope.ActivityScope
import com.moez.QKSMS.service.HeadlessSmsSendService
import com.moez.QKSMS.receiver.SendSmsReceiver
import com.moez.QKSMS.service.AutoDeleteService
import dagger.Module
import dagger.android.ContributesAndroidInjector
@Module
abstract class ServiceBuilderModule {
@ActivityScope
@ContributesAndroidInjector()
abstract fun bindAutoDeleteService(): AutoDeleteService
@ActivityScope
@ContributesAndroidInjector()
abstract fun bindHeadlessSmsSendService(): HeadlessSmsSendService
@@ -40,4 +45,4 @@ abstract class ServiceBuilderModule {
@ContributesAndroidInjector()
abstract fun bindSendSmsReceiver(): SendSmsReceiver
}
}
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M15.1,19.37l1,1.74c-0.96,0.44 -2.01,0.73 -3.1,0.84v-2.02C13.74,19.84 14.44,19.65 15.1,19.37zM4.07,13H2.05c0.11,1.1 0.4,2.14 0.84,3.1l1.74,-1C4.35,14.44 4.16,13.74 4.07,13zM15.1,4.63l1,-1.74C15.14,2.45 14.1,2.16 13,2.05v2.02C13.74,4.16 14.44,4.35 15.1,4.63zM19.93,11h2.02c-0.11,-1.1 -0.4,-2.14 -0.84,-3.1l-1.74,1C19.65,9.56 19.84,10.26 19.93,11zM8.9,19.37l-1,1.74c0.96,0.44 2.01,0.73 3.1,0.84v-2.02C10.26,19.84 9.56,19.65 8.9,19.37zM11,4.07V2.05c-1.1,0.11 -2.14,0.4 -3.1,0.84l1,1.74C9.56,4.35 10.26,4.16 11,4.07zM18.36,7.17l1.74,-1.01c-0.63,-0.87 -1.4,-1.64 -2.27,-2.27l-1.01,1.74C17.41,6.08 17.92,6.59 18.36,7.17zM4.63,8.9l-1.74,-1C2.45,8.86 2.16,9.9 2.05,11h2.02C4.16,10.26 4.35,9.56 4.63,8.9zM19.93,13c-0.09,0.74 -0.28,1.44 -0.56,2.1l1.74,1c0.44,-0.96 0.73,-2.01 0.84,-3.1H19.93zM16.83,18.36l1.01,1.74c0.87,-0.63 1.64,-1.4 2.27,-2.27l-1.74,-1.01C17.92,17.41 17.41,17.92 16.83,18.36zM7.17,5.64L6.17,3.89C5.29,4.53 4.53,5.29 3.9,6.17l1.74,1.01C6.08,6.59 6.59,6.08 7.17,5.64zM5.64,16.83L3.9,17.83c0.63,0.87 1.4,1.64 2.27,2.27l1.01,-1.74C6.59,17.92 6.08,17.41 5.64,16.83zM13,7h-2v5.41l4.29,4.29l1.41,-1.41L13,11.59V7z"/>
</vector>
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2019 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/>.
-->
<com.moez.QKSMS.common.widget.QkEditText xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/field"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@null"
android:hint="@string/settings_auto_delete_dialog_hint"
android:inputType="number"
android:lines="1"
android:maxLength="3"
android:padding="24dp"
android:singleLine="true"
android:textStyle="bold"
app:textSize="dialog"
tools:hint="Enter something" />
@@ -177,6 +177,14 @@
app:title="@string/settings_mobile_title"
app:widget="@layout/settings_switch_widget" />
<com.moez.QKSMS.common.widget.PreferenceView
android:id="@+id/autoDelete"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:icon="@drawable/ic_baseline_history_toggle_off_24"
app:title="@string/settings_auto_delete"
tools:summary="Never" />
<com.moez.QKSMS.common.widget.PreferenceView
android:id="@+id/longAsMms"
android:layout_width="match_parent"
@@ -258,6 +258,17 @@
<string name="settings_unicode_summary">Remove accents from characters in outgoing SMS messages</string>
<string name="settings_mobile_title">Mobile numbers only</string>
<string name="settings_mobile_summary">When composing a message, only show mobile numbers</string>
<string name="settings_auto_delete">Delete old messages automatically</string>
<string name="settings_auto_delete_dialog_message">Messages will be deleted after the specified number of days</string>
<string name="settings_auto_delete_dialog_hint">Number of days</string>
<string name="settings_auto_delete_never">Never</string>
<string name="settings_auto_delete_warning">Delete old messages automatically?</string>
<string name="settings_auto_delete_warning_message">If you proceed, %1$d messages will be deleted now</string>
<plurals name="settings_auto_delete_summary">
<item quantity="zero">Never</item>
<item quantity="one">After 1 day</item>
<item quantity="other">After %d days</item>
</plurals>
<string name="settings_long_as_mms_title">Send long messages as MMS</string>
<string name="settings_long_as_mms_summary">If your longer text messages are failing to send, or sending in the wrong order, you can send them as MMS messages instead. Additional charges may apply</string>
<string name="settings_mms_size_title">Auto-compress MMS attachments</string>