diff --git a/data/src/main/java/com/moez/QKSMS/util/NightModeManager.kt b/data/src/main/java/com/moez/QKSMS/util/NightModeManager.kt index 243bfb53cd23ea530543bb6dec77fd84aad334cb..94370420158bcc244eaef5a9c6ac01ee8ea09f32 100644 --- a/data/src/main/java/com/moez/QKSMS/util/NightModeManager.kt +++ b/data/src/main/java/com/moez/QKSMS/util/NightModeManager.kt @@ -39,93 +39,14 @@ class NightModeManager @Inject constructor( ) { fun updateCurrentTheme() { - when (prefs.nightMode.get()) { - Preferences.NIGHT_MODE_SYSTEM -> { - AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM) - } - - Preferences.NIGHT_MODE_OFF -> { - AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO) - } - - Preferences.NIGHT_MODE_ON -> { - AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES) - } - - Preferences.NIGHT_MODE_AUTO -> { - val nightStartTime = getPreviousInstanceOfTime(prefs.nightStart.get()) - val nightEndTime = getPreviousInstanceOfTime(prefs.nightEnd.get()) - - // If the last nightStart was more recent than the last nightEnd, then it's night time - val night = nightStartTime > nightEndTime - prefs.night.set(night) - AppCompatDelegate.setDefaultNightMode(when (night) { - true -> AppCompatDelegate.MODE_NIGHT_YES - false -> AppCompatDelegate.MODE_NIGHT_NO - }) - widgetManager.updateTheme() - } - } + AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM) } 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) - AppCompatDelegate.setDefaultNightMode(when (mode) { - Preferences.NIGHT_MODE_OFF -> AppCompatDelegate.MODE_NIGHT_NO - Preferences.NIGHT_MODE_ON -> AppCompatDelegate.MODE_NIGHT_YES - Preferences.NIGHT_MODE_SYSTEM -> AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM - else -> AppCompatDelegate.MODE_NIGHT_NO - }) + prefs.nightMode.set(Preferences.NIGHT_MODE_SYSTEM) + prefs.night.set(false) + AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM) widgetManager.updateTheme() - } - - updateAlarms() - } - - fun setNightStart(hour: Int, minute: Int) { - prefs.nightStart.set("$hour:$minute") - updateAlarms() - } - - fun setNightEnd(hour: Int, minute: Int) { - prefs.nightEnd.set("$hour:$minute") - updateAlarms() - } - - private 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 { diff --git a/domain/src/main/java/com/moez/QKSMS/util/Preferences.kt b/domain/src/main/java/com/moez/QKSMS/util/Preferences.kt index e907f32c2daa88c999e11e3d7b781481fc959580..16dfe84d86786c542d881daf44afa389efefa694 100644 --- a/domain/src/main/java/com/moez/QKSMS/util/Preferences.kt +++ b/domain/src/main/java/com/moez/QKSMS/util/Preferences.kt @@ -82,10 +82,7 @@ class Preferences @Inject constructor(private val context: Context, private val val sia = rxPrefs.getBoolean("sia", false) // User configurable - val nightMode = rxPrefs.getInteger("nightMode", when (Build.VERSION.SDK_INT >= 29) { - true -> NIGHT_MODE_SYSTEM - false -> NIGHT_MODE_OFF - }) + val nightMode = rxPrefs.getInteger("nightMode", NIGHT_MODE_SYSTEM) val nightStart = rxPrefs.getString("nightStart", "18:00") val nightEnd = rxPrefs.getString("nightEnd", "6:00") val black = rxPrefs.getBoolean("black", false) @@ -113,12 +110,7 @@ class Preferences @Inject constructor(private val context: Context, private val // Migrate from old night mode preference to new one, now that we support android Q night mode val nightModeSummary = rxPrefs.getInteger("nightModeSummary") if (nightModeSummary.isSet) { - nightMode.set(when (nightModeSummary.get()) { - 0 -> NIGHT_MODE_OFF - 1 -> NIGHT_MODE_ON - 2 -> NIGHT_MODE_AUTO - else -> NIGHT_MODE_OFF - }) + nightMode.set(NIGHT_MODE_SYSTEM) nightModeSummary.delete() } } diff --git a/e-ui-sdk.jar b/e-ui-sdk.jar index 7b2c401fc84e6dc90e63c9fd8402e924511e52a9..0395ffbdfe015ff21c747bd566800f69f2439fcb 100644 Binary files a/e-ui-sdk.jar and b/e-ui-sdk.jar differ diff --git a/presentation/src/main/java/com/moez/QKSMS/common/QkDialog.kt b/presentation/src/main/java/com/moez/QKSMS/common/QkDialog.kt index bba43ab2970aee05dbfa96c2bc9c742c54dc7795..18af535997f2e8fe1cdf1572c46c9b247ad1ed83 100644 --- a/presentation/src/main/java/com/moez/QKSMS/common/QkDialog.kt +++ b/presentation/src/main/java/com/moez/QKSMS/common/QkDialog.kt @@ -24,6 +24,7 @@ import androidx.annotation.StringRes import androidx.appcompat.app.AlertDialog import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView +import com.moez.QKSMS.R import com.moez.QKSMS.common.util.extensions.dpToPx import com.moez.QKSMS.common.util.extensions.setPadding import com.moez.QKSMS.injection.appComponent @@ -46,7 +47,7 @@ class QkDialog @Inject constructor(private val context: Context, val adapter: Me recyclerView.adapter = adapter recyclerView.setPadding(top = 8.dpToPx(context), bottom = 8.dpToPx(context)) - val dialog = AlertDialog.Builder(activity) + val dialog = AlertDialog.Builder(activity, R.style.customAlertDialog) .setTitle(title) .setView(recyclerView) .create() diff --git a/presentation/src/main/java/com/moez/QKSMS/common/base/QkThemedActivity.kt b/presentation/src/main/java/com/moez/QKSMS/common/base/QkThemedActivity.kt index d2843e820b998c79d6062d2d5502a70c845763b8..81c0e2cb580622c8d0434930fc869e225455e5fc 100644 --- a/presentation/src/main/java/com/moez/QKSMS/common/base/QkThemedActivity.kt +++ b/presentation/src/main/java/com/moez/QKSMS/common/base/QkThemedActivity.kt @@ -24,6 +24,7 @@ import android.graphics.BitmapFactory import android.os.Build import android.os.Bundle import android.view.View +import androidx.core.content.ContextCompat import androidx.core.view.iterator import androidx.lifecycle.Lifecycle import com.moez.QKSMS.R @@ -63,7 +64,7 @@ abstract class QkThemedActivity : QkActivity() { @SuppressLint("InlinedApi") override fun onCreate(savedInstanceState: Bundle?) { - setTheme(getActivityThemeRes(prefs.black.get())) + setTheme(R.style.AppTheme) super.onCreate(savedInstanceState) // When certain preferences change, we need to recreate the activity @@ -81,11 +82,6 @@ abstract class QkThemedActivity : QkActivity() { View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR or View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR } - // Some devices don't let you modify android.R.attr.navigationBarColor - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - window.navigationBarColor = resolveThemeColor(android.R.attr.windowBackground) - } - // Set the color for the recent apps title val toolbarColor = resolveThemeColor(R.attr.colorPrimary) val icon = BitmapFactory.decodeResource(resources, R.mipmap.ic_launcher) @@ -97,20 +93,11 @@ abstract class QkThemedActivity : QkActivity() { super.onPostCreate(savedInstanceState) // Set the color for the overflow and navigation icon - val textSecondary = resolveThemeColor(android.R.attr.textColorSecondary) + val textSecondary = ContextCompat.getColor(this, R.color.colorAccent) toolbar?.overflowIcon = toolbar?.overflowIcon?.apply { setTint(textSecondary) } } open fun getColoredMenuItems(): List { return listOf() } - - /** - * This can be overridden in case an activity does not want to use the default themes - */ - open fun getActivityThemeRes(black: Boolean) = when { - black -> R.style.AppTheme_Black - else -> R.style.AppTheme - } - } \ No newline at end of file diff --git a/presentation/src/main/java/com/moez/QKSMS/common/widget/FieldDialog.kt b/presentation/src/main/java/com/moez/QKSMS/common/widget/FieldDialog.kt index 1649edf68f18aef8ae1d02341d1d6b665b36de88..00240f02af62b1bfd7bdd297673d480d2c8b6b2c 100644 --- a/presentation/src/main/java/com/moez/QKSMS/common/widget/FieldDialog.kt +++ b/presentation/src/main/java/com/moez/QKSMS/common/widget/FieldDialog.kt @@ -25,7 +25,7 @@ import androidx.appcompat.app.AlertDialog import com.moez.QKSMS.R import kotlinx.android.synthetic.main.field_dialog.view.* -class FieldDialog(context: Activity, hint: String, listener: (String) -> Unit) : AlertDialog(context) { +class FieldDialog(context: Activity, hint: String, listener: (String) -> Unit) : AlertDialog(context, R.style.customAlertDialog) { private val layout = LayoutInflater.from(context).inflate(R.layout.field_dialog, null) diff --git a/presentation/src/main/java/com/moez/QKSMS/common/widget/QkSwitch.kt b/presentation/src/main/java/com/moez/QKSMS/common/widget/QkSwitch.kt index 76e2ace5973314dbaff75166f0e8684860ab764d..c27e6af8decb41b9b8348a2e2724946f3df7d3d3 100644 --- a/presentation/src/main/java/com/moez/QKSMS/common/widget/QkSwitch.kt +++ b/presentation/src/main/java/com/moez/QKSMS/common/widget/QkSwitch.kt @@ -19,13 +19,9 @@ package com.moez.QKSMS.common.widget import android.content.Context -import android.content.res.ColorStateList import android.util.AttributeSet import android.widget.Switch -import com.moez.QKSMS.R import com.moez.QKSMS.common.util.Colors -import com.moez.QKSMS.common.util.extensions.resolveThemeColor -import com.moez.QKSMS.common.util.extensions.withAlpha import com.moez.QKSMS.injection.appComponent import com.moez.QKSMS.util.Preferences import javax.inject.Inject diff --git a/presentation/src/main/java/com/moez/QKSMS/common/widget/RadioPreferenceView.kt b/presentation/src/main/java/com/moez/QKSMS/common/widget/RadioPreferenceView.kt index b98ad0904ca8eef10398c5f0fbe815042fc4ecf0..bf8bafb630384ec228f8540523bb60c257da809f 100644 --- a/presentation/src/main/java/com/moez/QKSMS/common/widget/RadioPreferenceView.kt +++ b/presentation/src/main/java/com/moez/QKSMS/common/widget/RadioPreferenceView.kt @@ -79,10 +79,7 @@ class RadioPreferenceView @JvmOverloads constructor( intArrayOf(android.R.attr.state_checked), intArrayOf(-android.R.attr.state_checked)) - val themeColor = when (isInEditMode) { - true -> context.resources.getColor(R.color.tools_theme) - false -> R.color.tools_theme - } + val themeColor = context.resources.getColor(R.color.tools_theme) val textSecondary = context.resolveThemeColor(android.R.attr.textColorTertiary) radioButton.buttonTintList = ColorStateList(states, intArrayOf(themeColor, textSecondary)) radioButton.forwardTouches(this) diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/backup/BackupController.kt b/presentation/src/main/java/com/moez/QKSMS/feature/backup/BackupController.kt index 3d1caaaa341043f75f7c15169fceffde1ae9f7c4..491f27e303d763e2c0199741e56be44cb2a87f7d 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/backup/BackupController.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/backup/BackupController.kt @@ -25,6 +25,7 @@ import android.graphics.Typeface import android.view.View import androidx.appcompat.app.AlertDialog import androidx.core.app.ActivityCompat +import androidx.core.content.ContextCompat import androidx.core.view.children import androidx.core.view.isVisible import com.jakewharton.rxbinding2.view.clicks @@ -66,14 +67,14 @@ class BackupController : QkController( val view = View.inflate(activity, R.layout.backup_list_dialog, null) .apply { files.adapter = adapter.apply { emptyView = empty } } - AlertDialog.Builder(activity!!) + AlertDialog.Builder(activity!!, R.style.customAlertDialog) .setView(view) .setCancelable(true) .create() } private val confirmRestoreDialog by lazy { - AlertDialog.Builder(activity!!) + AlertDialog.Builder(activity!!, R.style.customAlertDialog) .setTitle(R.string.backup_restore_confirm_title) .setMessage(R.string.backup_restore_confirm_message) .setPositiveButton(R.string.backup_restore_title, confirmRestoreSubject) @@ -82,7 +83,7 @@ class BackupController : QkController( } private val stopRestoreDialog by lazy { - AlertDialog.Builder(activity!!) + AlertDialog.Builder(activity!!, R.style.customAlertDialog) .setTitle(R.string.backup_restore_stop_title) .setMessage(R.string.backup_restore_stop_message) .setPositiveButton(R.string.button_stop, stopRestoreSubject) @@ -105,11 +106,10 @@ class BackupController : QkController( override fun onViewCreated() { super.onViewCreated() - progressBar.indeterminateTintList = ColorStateList.valueOf(progressBar.context.getColor(R.color.tools_theme)) - progressBar.progressTintList = ColorStateList.valueOf(progressBar.context.getColor(R.color.tools_theme)) - fab.setBackgroundTint(fab.context.getColor(R.color.white)) - fabIcon.setTint(fabIcon.context.getColor(R.color.tools_theme)) - fabLabel.setTextColor(fabIcon.context.getColor(R.color.tools_theme)) + progressBar.indeterminateTintList = ColorStateList.valueOf(ContextCompat.getColor(progressBar.context, R.color.tools_theme)) + progressBar.progressTintList = ColorStateList.valueOf(ContextCompat.getColor(progressBar.context, R.color.tools_theme)) + fabIcon.setTint(ContextCompat.getColor(fabIcon.context, R.color.tools_theme)) + fabLabel.setTextColor(ContextCompat.getColor(fabIcon.context, R.color.tools_theme)) // Make the list titles bold diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/blocking/BlockingDialog.kt b/presentation/src/main/java/com/moez/QKSMS/feature/blocking/BlockingDialog.kt index 04d6daa59b95059ed3adb5523cf1ad9bfe882a04..ef544f6266a0e168d0893ec812d57905b44f6389 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/blocking/BlockingDialog.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/blocking/BlockingDialog.kt @@ -101,7 +101,7 @@ class BlockingDialog @Inject constructor( // Otherwise, show a dialog asking the user if they want to be directed to the external // blocking manager - AlertDialog.Builder(activity) + AlertDialog.Builder(activity, R.style.customAlertDialog) .setTitle(when (block) { true -> R.string.blocking_block_title false -> R.string.blocking_unblock_title diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/blocking/manager/BlockingManagerController.kt b/presentation/src/main/java/com/moez/QKSMS/feature/blocking/manager/BlockingManagerController.kt index ed64b1d5cf363db4fc5556e640143c4d664ae84c..a7d096208439fb9d7ffe49af34a0db6266d14b04 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/blocking/manager/BlockingManagerController.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/blocking/manager/BlockingManagerController.kt @@ -57,7 +57,7 @@ class BlockingManagerController : QkController = shouldIAnswer.clicks() override fun showCopyDialog(manager: String): Single = Single.create { emitter -> - AlertDialog.Builder(activity) + AlertDialog.Builder(activity, R.style.customAlertDialog) .setTitle(R.string.blocking_manager_copy_title) .setMessage(resources?.getString(R.string.blocking_manager_copy_summary, manager)) .setPositiveButton(R.string.button_continue) { _, _ -> emitter.onSuccess(true) } diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/blocking/messages/BlockedMessagesController.kt b/presentation/src/main/java/com/moez/QKSMS/feature/blocking/messages/BlockedMessagesController.kt index 92dfcac39f936b83bde2c2d9a6da7a64c4867a39..cbceb1909c9e48cb1aa2740c11a130b7d89719dd 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/blocking/messages/BlockedMessagesController.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/blocking/messages/BlockedMessagesController.kt @@ -107,7 +107,7 @@ class BlockedMessagesController : QkController) { val count = conversations.size - AlertDialog.Builder(activity) + AlertDialog.Builder(activity, R.style.customAlertDialog) .setTitle(R.string.dialog_delete_title) .setMessage(resources?.getQuantityString(R.plurals.dialog_delete_message, count, count)) .setPositiveButton(R.string.button_delete) { _, _ -> confirmDeleteIntent.onNext(conversations) } diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/blocking/numbers/BlockedNumbersController.kt b/presentation/src/main/java/com/moez/QKSMS/feature/blocking/numbers/BlockedNumbersController.kt index 90c18fcaf2fdf4a3dc83135d7ba675776d9875cc..7b1cbb93ca35273320619a88359d3a39691f203c 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/blocking/numbers/BlockedNumbersController.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/blocking/numbers/BlockedNumbersController.kt @@ -21,6 +21,7 @@ package com.moez.QKSMS.feature.blocking.numbers import android.view.LayoutInflater import android.view.View import androidx.appcompat.app.AlertDialog +import androidx.core.content.ContextCompat import com.jakewharton.rxbinding2.view.clicks import com.moez.QKSMS.R import com.moez.QKSMS.common.base.QkController @@ -61,8 +62,6 @@ class BlockedNumbersController : QkController saveAddressSubject.onNext(layout.input.text.toString()) diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/changelog/ChangelogDialog.kt b/presentation/src/main/java/com/moez/QKSMS/feature/changelog/ChangelogDialog.kt index 04dc1d4ce00391204325a827e69483e51b76d976..e888acb39a97a888ffcb195794f8956ebf72431c 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/changelog/ChangelogDialog.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/changelog/ChangelogDialog.kt @@ -38,7 +38,7 @@ class ChangelogDialog(activity: MainActivity) { init { val layout = LayoutInflater.from(activity).inflate(R.layout.changelog_dialog, null) - dialog = AlertDialog.Builder(activity) + dialog = AlertDialog.Builder(activity, com.moez.QKSMS.R.style.customAlertDialog) .setCancelable(true) .setView(layout) .create() diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeActivity.kt b/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeActivity.kt index 21160ef30842b6fdd70d646eba1438182a377add..5b8c309806a5a6cd760e35f76afdee9a9c158264 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeActivity.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeActivity.kt @@ -272,7 +272,7 @@ class ComposeActivity : QkThemedActivity(), ComposeView { override fun clearSelection() = messageAdapter.clearSelection() override fun showDetails(details: String) { - AlertDialog.Builder(this) + AlertDialog.Builder(this, R.style.customAlertDialog) .setTitle(R.string.compose_details_title) .setMessage(details) .setCancelable(true) @@ -295,8 +295,8 @@ class ComposeActivity : QkThemedActivity(), ComposeView { override fun requestDatePicker() { val calendar = Calendar.getInstance() - DatePickerDialog(this, DatePickerDialog.OnDateSetListener { _, year, month, day -> - TimePickerDialog(this, TimePickerDialog.OnTimeSetListener { _, hour, minute -> + DatePickerDialog(this, R.style.customAlertDialog, DatePickerDialog.OnDateSetListener { _, year, month, day -> + TimePickerDialog(this, R.style.customAlertDialog, TimePickerDialog.OnTimeSetListener { _, hour, minute -> calendar.set(Calendar.YEAR, year) calendar.set(Calendar.MONTH, month) calendar.set(Calendar.DAY_OF_MONTH, day) diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/conversationinfo/ConversationInfoController.kt b/presentation/src/main/java/com/moez/QKSMS/feature/conversationinfo/ConversationInfoController.kt index acb18950e00ae906b71f215f6fb2099daedc2a31..100fd5e395cd2f726641b372437ad670e81c0e67 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/conversationinfo/ConversationInfoController.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/conversationinfo/ConversationInfoController.kt @@ -148,7 +148,7 @@ class ConversationInfoController( } override fun showDeleteDialog() { - AlertDialog.Builder(activity!!) + AlertDialog.Builder(activity!!, R.style.customAlertDialog) .setTitle(R.string.dialog_delete_title) .setMessage(resources?.getQuantityString(R.plurals.dialog_delete_message, 1)) .setPositiveButton(R.string.button_delete) { _, _ -> confirmDeleteSubject.onNext(Unit) } diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/conversations/ConversationItemTouchCallback.kt b/presentation/src/main/java/com/moez/QKSMS/feature/conversations/ConversationItemTouchCallback.kt index 9cc133f742fa3bb681b4d97d373d092bddc556f1..40c481ba3186462d497ad9c5570c3dbe9a9f009b 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/conversations/ConversationItemTouchCallback.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/conversations/ConversationItemTouchCallback.kt @@ -23,6 +23,7 @@ import android.graphics.Bitmap import android.graphics.Canvas import android.graphics.Paint import android.graphics.Rect +import androidx.core.content.ContextCompat import androidx.core.graphics.drawable.toBitmap import androidx.recyclerview.widget.ItemTouchHelper import androidx.recyclerview.widget.RecyclerView @@ -41,10 +42,10 @@ import kotlin.math.max import kotlin.math.min class ConversationItemTouchCallback @Inject constructor( - colors: Colors, - disposables: CompositeDisposable, - prefs: Preferences, - private val context: Context + colors: Colors, + disposables: CompositeDisposable, + prefs: Preferences, + private val context: Context ) : ItemTouchHelper.SimpleCallback(0, 0) { val swipes: Subject> = PublishSubject.create() @@ -63,14 +64,15 @@ class ConversationItemTouchCallback @Inject constructor( private val iconLength = 24.dpToPx(context) init { + backgroundPaint.color = ContextCompat.getColor(context, R.color.selection_color) disposables += Observables .combineLatest(prefs.swipeRight.asObservable(), prefs.swipeLeft.asObservable() ) { right, left -> rightAction = right - swipeRightIcon = iconForAction(right, context.getColor(R.color.textPrimary)) + swipeRightIcon = iconForAction(right, ContextCompat.getColor(context, R.color.tools_theme)) leftAction = left - swipeLeftIcon = iconForAction(left, context.getColor(R.color.textPrimary)) + swipeLeftIcon = iconForAction(left, ContextCompat.getColor(context, R.color.tools_theme)) setDefaultSwipeDirs((if (right == Preferences.SWIPE_ACTION_NONE) 0 else ItemTouchHelper.RIGHT) or (if (left == Preferences.SWIPE_ACTION_NONE) 0 else ItemTouchHelper.LEFT)) } @@ -79,21 +81,21 @@ class ConversationItemTouchCallback @Inject constructor( } override fun onMove( - recyclerView: RecyclerView, - viewHolder: RecyclerView.ViewHolder, - target: RecyclerView.ViewHolder + recyclerView: RecyclerView, + viewHolder: RecyclerView.ViewHolder, + target: RecyclerView.ViewHolder ): Boolean { return false } override fun onChildDraw( - c: Canvas, - recyclerView: RecyclerView, - viewHolder: RecyclerView.ViewHolder, - dX: Float, - dY: Float, - actionState: Int, - isCurrentlyActive: Boolean + c: Canvas, + recyclerView: RecyclerView, + viewHolder: RecyclerView.ViewHolder, + dX: Float, + dY: Float, + actionState: Int, + isCurrentlyActive: Boolean ) { if (actionState == ItemTouchHelper.ACTION_STATE_SWIPE) { val itemView = viewHolder.itemView diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/main/MainActivity.kt b/presentation/src/main/java/com/moez/QKSMS/feature/main/MainActivity.kt index 2abca4e51d6293db6f96e495df95857e8a461fe5..f04b789fa3d8ef085669c18e57da765512153863 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/main/MainActivity.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/main/MainActivity.kt @@ -361,7 +361,7 @@ class MainActivity : QkThemedActivity(), MainView { override fun showDeleteDialog(conversations: List) { val count = conversations.size - AlertDialog.Builder(this) + AlertDialog.Builder(this, R.style.customAlertDialog) .setTitle(R.string.dialog_delete_title) .setMessage(resources.getQuantityString(R.plurals.dialog_delete_message, count, count)) .setPositiveButton(R.string.button_delete) { _, _ -> confirmDeleteIntent.onNext(conversations) } diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/plus/PlusViewModel.kt b/presentation/src/main/java/com/moez/QKSMS/feature/plus/PlusViewModel.kt index a3475822d169e41b2080a944ed34a596f855ea06..95876ae580f8251924459276b220e9e3846115df 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/plus/PlusViewModel.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/plus/PlusViewModel.kt @@ -78,10 +78,6 @@ class PlusViewModel @Inject constructor( view.delayedClicks .autoDisposable(view.scope()) .subscribe { navigator.showSettings() } - - view.nightClicks - .autoDisposable(view.scope()) - .subscribe { navigator.showSettings() } } } \ No newline at end of file diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/qkreply/QkReplyActivity.kt b/presentation/src/main/java/com/moez/QKSMS/feature/qkreply/QkReplyActivity.kt index ead2fe26e95b5654f0a74d321f21d0f76fee9f73..8270c501e48f52dcbee775686c028a1b738e37ba 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/qkreply/QkReplyActivity.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/qkreply/QkReplyActivity.kt @@ -123,9 +123,4 @@ class QkReplyActivity : QkThemedActivity(), QkReplyView { return true } - override fun getActivityThemeRes(black: Boolean) = when { - black -> R.style.AppThemeDialog_Black - else -> R.style.AppThemeDialog - } - } \ No newline at end of file diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/scheduled/ScheduledActivity.kt b/presentation/src/main/java/com/moez/QKSMS/feature/scheduled/ScheduledActivity.kt index a8f6d4366c6515cff9a524188273d55279dbde83..4aa113e186a119af1269e446014510d7d87411fe 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/scheduled/ScheduledActivity.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/scheduled/ScheduledActivity.kt @@ -20,7 +20,7 @@ package com.moez.QKSMS.feature.scheduled import android.graphics.Typeface import android.os.Bundle -import androidx.core.view.isVisible +import androidx.core.content.ContextCompat import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.ViewModelProviders import com.jakewharton.rxbinding2.view.clicks @@ -40,10 +40,13 @@ class ScheduledActivity : QkThemedActivity(), ScheduledView { @Inject lateinit var dialog: QkDialog + @Inject lateinit var fontProvider: FontProvider + @Inject lateinit var messageAdapter: ScheduledMessageAdapter + @Inject lateinit var viewModelFactory: ViewModelProvider.Factory @@ -75,10 +78,10 @@ class ScheduledActivity : QkThemedActivity(), ScheduledView { messageAdapter.emptyView = empty messages.adapter = messageAdapter - sampleMessage.setBackgroundTint(getColor(R.color.tools_theme)) - sampleMessage.setTextColor(getColor(R.color.textPrimary)) - compose.setTint(getColor(R.color.tools_theme)) - compose.setBackgroundTint(getColor(R.color.white)) + sampleMessage.setBackgroundTint(ContextCompat.getColor(this, R.color.tools_theme)) + sampleMessage.setTextColor(ContextCompat.getColor(this, R.color.white)) + compose.setTint(ContextCompat.getColor(this, R.color.tools_theme)) + compose.setBackgroundTint(ContextCompat.getColor(this, R.color.colorPrimaryDark)) } diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/settings/SettingsController.kt b/presentation/src/main/java/com/moez/QKSMS/feature/settings/SettingsController.kt index 7d5eeab18baee1159935144efe8932724c0b60e5..7c4d41d7cbbaafe181cb178caf5d83d109e0a459 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/settings/SettingsController.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/settings/SettingsController.kt @@ -134,13 +134,6 @@ class SettingsController : QkController + TimePickerDialog(activity, R.style.customAlertDialog, TimePickerDialog.OnTimeSetListener { _, 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, R.style.customAlertDialog, TimePickerDialog.OnTimeSetListener { _, newHour, newMinute -> endTimeSelectedSubject.onNext(Pair(newHour, newMinute)) }, hour, minute, DateFormat.is24HourFormat(activity)).show() } diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/settings/SettingsPresenter.kt b/presentation/src/main/java/com/moez/QKSMS/feature/settings/SettingsPresenter.kt index 854dbba09d5ef73352f8e2266e27499011a71924..15b4955c103b2261389ca25e04b1902c7a2db148 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/settings/SettingsPresenter.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/settings/SettingsPresenter.kt @@ -142,22 +142,6 @@ class SettingsPresenter @Inject constructor( when (it.id) { - R.id.night -> view.showNightModeDialog() - - R.id.nightStart -> { - val date = nightModeManager.parseTime(prefs.nightStart.get()) - view.showStartTimePicker(date.get(Calendar.HOUR_OF_DAY), - date.get(Calendar.MINUTE)) - } - - R.id.nightEnd -> { - val date = nightModeManager.parseTime(prefs.nightEnd.get()) - view.showEndTimePicker(date.get(Calendar.HOUR_OF_DAY), - date.get(Calendar.MINUTE)) - } - - R.id.black -> prefs.black.set(!prefs.black.get()) - R.id.autoEmoji -> prefs.autoEmoji.set(!prefs.autoEmoji.get()) R.id.notifications -> navigator.showNotificationSettings() @@ -197,18 +181,6 @@ class SettingsPresenter @Inject constructor( }) } - view.nightModeSelected() - .autoDisposable(view.scope()) - .subscribe { mode -> nightModeManager.updateNightMode(mode) } - - view.nightStartSelected() - .autoDisposable(view.scope()) - .subscribe { nightModeManager.setNightStart(it.first, it.second) } - - view.nightEndSelected() - .autoDisposable(view.scope()) - .subscribe { nightModeManager.setNightEnd(it.first, it.second) } - view.textSizeSelected() .autoDisposable(view.scope()) .subscribe(prefs.textSize::set) diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/settings/swipe/SwipeActionsController.kt b/presentation/src/main/java/com/moez/QKSMS/feature/settings/swipe/SwipeActionsController.kt index a6187d839761ea6eddb21fda0afe38d5f1a4a65e..ab2b6fcd9a9dff2842a1f3429236c79a3330ebd9 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/settings/swipe/SwipeActionsController.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/settings/swipe/SwipeActionsController.kt @@ -19,6 +19,7 @@ package com.moez.QKSMS.feature.settings.swipe import android.view.View +import androidx.core.content.ContextCompat import androidx.core.view.isVisible import com.google.android.material.color.MaterialColors.getColor import com.jakewharton.rxbinding2.view.clicks @@ -61,10 +62,10 @@ class SwipeActionsController : QkController - + - + diff --git a/presentation/src/main/res/drawable/ic_arrow_back.xml b/presentation/src/main/res/drawable/ic_arrow_back.xml new file mode 100644 index 0000000000000000000000000000000000000000..a5dc4cf35e2c24bba35d0220524b8b6291eef3c5 --- /dev/null +++ b/presentation/src/main/res/drawable/ic_arrow_back.xml @@ -0,0 +1,10 @@ + + + diff --git a/presentation/src/main/res/drawable/ic_cancel_black_24dp.xml b/presentation/src/main/res/drawable/ic_cancel_black_24dp.xml index b05db58ddd3f667afb8f52b43941943a166ba913..87a7aaf02e7e0bf0aa139394793d223a5f31f5dc 100755 --- a/presentation/src/main/res/drawable/ic_cancel_black_24dp.xml +++ b/presentation/src/main/res/drawable/ic_cancel_black_24dp.xml @@ -20,8 +20,9 @@ android:width="24dp" android:height="24dp" android:viewportWidth="24.0" - android:viewportHeight="24.0"> + android:viewportHeight="24.0" + android:tint="@color/colorAccent"> diff --git a/presentation/src/main/res/drawable/ic_edittext_handle.xml b/presentation/src/main/res/drawable/ic_edittext_handle.xml new file mode 100644 index 0000000000000000000000000000000000000000..661b04db43e16596a5f5af9743986dc1f0df0054 --- /dev/null +++ b/presentation/src/main/res/drawable/ic_edittext_handle.xml @@ -0,0 +1,4 @@ + + + diff --git a/presentation/src/main/res/drawable/ic_edittext_handle_left.xml b/presentation/src/main/res/drawable/ic_edittext_handle_left.xml new file mode 100644 index 0000000000000000000000000000000000000000..a19eb8b80c9b548b1b13ef4f2a0740a68c319b19 --- /dev/null +++ b/presentation/src/main/res/drawable/ic_edittext_handle_left.xml @@ -0,0 +1,4 @@ + + + diff --git a/presentation/src/main/res/drawable/ic_edittext_handle_right.xml b/presentation/src/main/res/drawable/ic_edittext_handle_right.xml new file mode 100644 index 0000000000000000000000000000000000000000..73c67f8151fe7708b8bc368e14a8dfb2021de173 --- /dev/null +++ b/presentation/src/main/res/drawable/ic_edittext_handle_right.xml @@ -0,0 +1,4 @@ + + + diff --git a/presentation/src/main/res/drawable/ic_send_black_24dp.xml b/presentation/src/main/res/drawable/ic_send_black_24dp.xml index 7cbdd66bfadece39fcb4a0610b845c8e3f37f5a6..438fa129ed6ca4916f631dbd5e4c15f9dc6e2ba8 100644 --- a/presentation/src/main/res/drawable/ic_send_black_24dp.xml +++ b/presentation/src/main/res/drawable/ic_send_black_24dp.xml @@ -20,8 +20,9 @@ android:width="24dp" android:height="24dp" android:viewportWidth="24.0" - android:viewportHeight="24.0"> + android:viewportHeight="24.0" + android:tint="@color/colorAccent"> diff --git a/presentation/src/main/res/drawable/ic_sim_card_black_24dp.xml b/presentation/src/main/res/drawable/ic_sim_card_black_24dp.xml index 862ac6a965ab358d43ae9dd9a194e8b6cc1fcc36..cd0cdae16c4d477686c5223ee00523fc29db9732 100644 --- a/presentation/src/main/res/drawable/ic_sim_card_black_24dp.xml +++ b/presentation/src/main/res/drawable/ic_sim_card_black_24dp.xml @@ -20,8 +20,9 @@ android:width="24dp" android:height="24dp" android:viewportWidth="24.0" - android:viewportHeight="24.0"> + android:viewportHeight="24.0" +android:tint="@color/colorAccent"> diff --git a/presentation/src/main/res/drawable/message_only.xml b/presentation/src/main/res/drawable/message_only.xml index a3d8663583fb9a98386c197addecd08055cf3ed7..90da41ae5ac62d0f134c73b90fe799fef5cc24ef 100644 --- a/presentation/src/main/res/drawable/message_only.xml +++ b/presentation/src/main/res/drawable/message_only.xml @@ -21,7 +21,7 @@ android:shape="rectangle"> - + - + diff --git a/presentation/src/main/res/drawable/rounded_rectangle_outline_22dp.xml b/presentation/src/main/res/drawable/rounded_rectangle_outline_22dp.xml index 95c404d8f7188fa2a75f22b7af03e3aa51206971..58d28a9aa90da9c03187391c68feda04a03c24ff 100755 --- a/presentation/src/main/res/drawable/rounded_rectangle_outline_22dp.xml +++ b/presentation/src/main/res/drawable/rounded_rectangle_outline_22dp.xml @@ -20,7 +20,7 @@ - + diff --git a/presentation/src/main/res/layout/backup_controller.xml b/presentation/src/main/res/layout/backup_controller.xml index 42ddcb06a7fe8235563141189fdc0610fc558d91..23de4cf7704cdbf29a033517583a81688b958414 100644 --- a/presentation/src/main/res/layout/backup_controller.xml +++ b/presentation/src/main/res/layout/backup_controller.xml @@ -159,7 +159,7 @@ android:background="@drawable/rounded_rectangle_24dp" android:elevation="4dp" android:gravity="center" - tools:backgroundTint="@color/white"> + tools:backgroundTint="@color/selection_color"> + android:tint="@color/tools_theme" + tools:backgroundTint="@color/colorPrimaryDark" /> \ No newline at end of file diff --git a/presentation/src/main/res/layout/compose_activity.xml b/presentation/src/main/res/layout/compose_activity.xml index b4b792950c3dd11531a0b58ee857be407366ac18..3a52e42976e1dffcdad66ea9e32c977ce394eacb 100644 --- a/presentation/src/main/res/layout/compose_activity.xml +++ b/presentation/src/main/res/layout/compose_activity.xml @@ -226,7 +226,6 @@ android:elevation="4dp" android:padding="10dp" android:src="@drawable/ic_cancel_black_24dp" - android:tint="?android:attr/textColorSecondary" app:layout_constraintBottom_toTopOf="@id/scheduledSeparator" app:layout_constraintEnd_toEndOf="@id/messageBackground" /> @@ -287,7 +286,6 @@ android:elevation="4dp" android:padding="10dp" android:src="@drawable/ic_sim_card_black_24dp" - android:tint="?android:attr/textColorSecondary" android:visibility="gone" app:layout_constraintBottom_toBottomOf="@id/messageBackground" app:layout_constraintEnd_toStartOf="@id/send" /> @@ -298,7 +296,7 @@ android:layout_height="0dp" android:elevation="4dp" android:gravity="center" - android:textColor="?android:attr/textColorPrimaryInverse" + android:textColor="@android:color/white" android:textSize="14dp" android:textStyle="bold" app:layout_constraintBottom_toBottomOf="@id/sim" @@ -337,10 +335,8 @@ android:elevation="4dp" android:padding="10dp" android:src="@drawable/ic_send_black_24dp" - android:tint="?android:textColorSecondary" app:layout_constraintBottom_toBottomOf="@id/messageBackground" - app:layout_constraintEnd_toEndOf="@id/messageBackground" - tools:backgroundTint="@color/tools_theme" /> + app:layout_constraintEnd_toEndOf="@id/messageBackground" /> diff --git a/presentation/src/main/res/layout/message_list_item_in.xml b/presentation/src/main/res/layout/message_list_item_in.xml index 2201260d82af6ac38b44c219debad113c40d75ba..0e92ee0616eab1b3ab4b6055db2d4df76d11037a 100644 --- a/presentation/src/main/res/layout/message_list_item_in.xml +++ b/presentation/src/main/res/layout/message_list_item_in.xml @@ -43,7 +43,6 @@ android:layout_height="16dp" android:layout_marginEnd="2dp" android:src="@drawable/ic_sim_card_black_24dp" - android:tint="?android:attr/textColorSecondary" app:layout_constraintBottom_toBottomOf="@id/timestamp" app:layout_constraintEnd_toStartOf="@id/simIndex" app:layout_constraintStart_toEndOf="@id/timestamp" @@ -53,7 +52,7 @@ android:id="@+id/simIndex" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:textColor="?android:attr/textColorSecondary" + android:textColor="@android:color/white" app:layout_constraintBottom_toBottomOf="@id/timestamp" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toEndOf="@id/sim" @@ -89,6 +88,7 @@ @@ -120,7 +119,7 @@ android:layout_height="0dp" android:elevation="4dp" android:gravity="center" - android:textColor="?android:attr/textColorPrimaryInverse" + android:textColor="@android:color/white" android:textSize="14dp" android:textStyle="bold" app:layout_constraintBottom_toBottomOf="@id/sim" diff --git a/presentation/src/main/res/layout/scheduled_activity.xml b/presentation/src/main/res/layout/scheduled_activity.xml index 6cf71ceaa60c09d7cb404b60738a2798846e17a9..37cbd78c88b3ad385fae580aa11277b1801bb224 100644 --- a/presentation/src/main/res/layout/scheduled_activity.xml +++ b/presentation/src/main/res/layout/scheduled_activity.xml @@ -66,7 +66,7 @@ android:background="@drawable/rounded_rectangle_22dp" android:text="@string/scheduled_empty_message_2" tools:backgroundTint="@color/tools_theme" - tools:textColor="@color/textPrimaryDark" /> + tools:textColor="@color/white" /> + android:tint="@color/selection_color" + tools:backgroundTint="@color/colorPrimaryDark"/> @color/separatorDark - @color/backgroundDark + @color/colorPrimaryDark @color/toolbarSearchBackgroundDark @color/statusBarDark @color/text_primary @@ -41,7 +41,9 @@ @color/switchThumbDisabledDark @color/switchTrackEnabledDark @color/switchTrackDisabledDark + @drawable/ic_arrow_back false + @drawable/cursor diff --git a/presentation/src/main/res/values-v27/themes.xml b/presentation/src/main/res/values-v27/themes.xml index 6acad9c94216da846b72f886ec2718acf5fffdd8..3c37e9b56a2f91cc3cc951c037b1120b68918630 100644 --- a/presentation/src/main/res/values-v27/themes.xml +++ b/presentation/src/main/res/values-v27/themes.xml @@ -21,7 +21,7 @@ @@ -50,7 +50,7 @@ - ?attr/colorPrimary + @color/colorPrimaryDark center_vertical @@ -61,8 +61,13 @@ end start|center_vertical 1 - ?android:attr/textColorPrimary + @color/textPrimary toolbar + @drawable/cursor + @color/colorAccent + @drawable/ic_edittext_handle + @drawable/ic_edittext_handle_left + @drawable/ic_edittext_handle_right @@ -126,4 +131,18 @@ 32dp + + + diff --git a/presentation/src/main/res/values/themes.xml b/presentation/src/main/res/values/themes.xml index d1ad8df1a3f7c6cbd2b65248d5fc75eeb7779963..74f5114d620d8558e3949f62a57902d5418a8dce 100644 --- a/presentation/src/main/res/values/themes.xml +++ b/presentation/src/main/res/values/themes.xml @@ -26,9 +26,12 @@ @@ -83,5 +94,4 @@