mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-16 19:18:52 +01:00
#967 - Swipe conversation actions
This commit is contained in:
@@ -52,6 +52,12 @@ class Preferences @Inject constructor(private val rxPrefs: RxSharedPreferences)
|
||||
const val SEND_DELAY_SHORT = 1
|
||||
const val SEND_DELAY_MEDIUM = 2
|
||||
const val SEND_DELAY_LONG = 3
|
||||
|
||||
const val SWIPE_ACTION_NONE = 0
|
||||
const val SWIPE_ACTION_ARCHIVE = 1
|
||||
const val SWIPE_ACTION_DELETE = 2
|
||||
const val SWIPE_ACTION_CALL = 3
|
||||
const val SWIPE_ACTION_READ = 4
|
||||
}
|
||||
|
||||
// Internal
|
||||
@@ -63,17 +69,19 @@ class Preferences @Inject constructor(private val rxPrefs: RxSharedPreferences)
|
||||
val nightStart = rxPrefs.getString("nightStart", "18:00")
|
||||
val nightEnd = rxPrefs.getString("nightEnd", "6:00")
|
||||
val black = rxPrefs.getBoolean("black", false)
|
||||
val sia = rxPrefs.getBoolean("sia", false)
|
||||
val sendDelay = rxPrefs.getInteger("sendDelay", SEND_DELAY_NONE)
|
||||
val autoEmoji = rxPrefs.getBoolean("autoEmoji", true)
|
||||
val delivery = rxPrefs.getBoolean("delivery", false)
|
||||
val systemFont = rxPrefs.getBoolean("systemFont", false)
|
||||
val textSize = rxPrefs.getInteger("textSize", TEXT_SIZE_NORMAL)
|
||||
val notifAction1 = rxPrefs.getInteger("notifAction1", 1)
|
||||
val notifAction2 = rxPrefs.getInteger("notifAction2", 2)
|
||||
val notifAction3 = rxPrefs.getInteger("notifAction3", 0)
|
||||
val sia = rxPrefs.getBoolean("sia", false)
|
||||
val notifAction1 = rxPrefs.getInteger("notifAction1", NOTIFICATION_ACTION_READ)
|
||||
val notifAction2 = rxPrefs.getInteger("notifAction2", NOTIFICATION_ACTION_REPLY)
|
||||
val notifAction3 = rxPrefs.getInteger("notifAction3", NOTIFICATION_ACTION_NONE)
|
||||
val qkreply = rxPrefs.getBoolean("qkreply", Build.VERSION.SDK_INT < Build.VERSION_CODES.N)
|
||||
val qkreplyTapDismiss = rxPrefs.getBoolean("qkreplyTapDismiss", true)
|
||||
val sendDelay = rxPrefs.getInteger("sendDelay", SEND_DELAY_NONE)
|
||||
val swipeRight = rxPrefs.getInteger("swipeRight", SWIPE_ACTION_ARCHIVE)
|
||||
val swipeLeft = rxPrefs.getInteger("swipeLeft", SWIPE_ACTION_ARCHIVE)
|
||||
val autoEmoji = rxPrefs.getBoolean("autoEmoji", true)
|
||||
val delivery = rxPrefs.getBoolean("delivery", false)
|
||||
val unicode = rxPrefs.getBoolean("unicode", false)
|
||||
val mmsSize = rxPrefs.getInteger("mmsSize", 300)
|
||||
|
||||
|
||||
+67
-24
@@ -23,37 +23,60 @@ import android.graphics.Bitmap
|
||||
import android.graphics.Canvas
|
||||
import android.graphics.Paint
|
||||
import androidx.core.graphics.drawable.toBitmap
|
||||
import androidx.lifecycle.Lifecycle
|
||||
import androidx.recyclerview.widget.ItemTouchHelper
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.moez.QKSMS.R
|
||||
import com.moez.QKSMS.common.androidxcompat.scope
|
||||
import com.moez.QKSMS.common.util.Colors
|
||||
import com.moez.QKSMS.common.util.extensions.dpToPx
|
||||
import com.moez.QKSMS.util.Preferences
|
||||
import com.uber.autodispose.kotlin.autoDisposable
|
||||
import io.reactivex.rxkotlin.Observables
|
||||
import io.reactivex.subjects.PublishSubject
|
||||
import io.reactivex.subjects.Subject
|
||||
import javax.inject.Inject
|
||||
|
||||
|
||||
class ConversationItemTouchCallback @Inject constructor(private val context: Context) : ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.LEFT or ItemTouchHelper.RIGHT) {
|
||||
class ConversationItemTouchCallback @Inject constructor(
|
||||
colors: Colors,
|
||||
lifecycle: Lifecycle,
|
||||
prefs: Preferences,
|
||||
private val context: Context
|
||||
) : ItemTouchHelper.SimpleCallback(0, 0) {
|
||||
|
||||
val swipes: Subject<Long> = PublishSubject.create()
|
||||
val swipes: Subject<Pair<Long, Int>> = PublishSubject.create()
|
||||
|
||||
private var paint = Paint()
|
||||
private lateinit var icon: Bitmap
|
||||
/**
|
||||
* Setting the adapter allows us to animate back to the original position
|
||||
*/
|
||||
var adapter: RecyclerView.Adapter<*>? = null
|
||||
|
||||
private var iconLength = 24.dpToPx(context)
|
||||
private val paint = Paint()
|
||||
private var rightAction = 0
|
||||
private var rightIcon: Bitmap? = null
|
||||
private var leftAction = 0
|
||||
private var leftIcon: Bitmap? = null
|
||||
|
||||
var color: Int = 0
|
||||
set(value) {
|
||||
field = value
|
||||
paint.color = value
|
||||
}
|
||||
private val iconLength = 24.dpToPx(context)
|
||||
|
||||
var iconColor: Int = 0
|
||||
set(value) {
|
||||
field = value
|
||||
icon = context.resources.getDrawable(R.drawable.ic_archive_black_24dp)
|
||||
.apply { setTint(value) }
|
||||
.toBitmap(iconLength, iconLength)
|
||||
}
|
||||
init {
|
||||
colors.themeObservable()
|
||||
.autoDisposable(lifecycle.scope())
|
||||
.subscribe { theme -> paint.color = theme.theme }
|
||||
|
||||
Observables
|
||||
.combineLatest(prefs.swipeRight.asObservable(), prefs.swipeLeft.asObservable(), colors.themeObservable()) { right, left, theme ->
|
||||
rightAction = right
|
||||
rightIcon = iconForAction(right, theme.textPrimary)
|
||||
leftAction = left
|
||||
leftIcon = iconForAction(left, theme.textPrimary)
|
||||
setDefaultSwipeDirs((if (right == Preferences.SWIPE_ACTION_NONE) 0 else ItemTouchHelper.RIGHT)
|
||||
or (if (left == Preferences.SWIPE_ACTION_NONE) 0 else ItemTouchHelper.LEFT))
|
||||
}
|
||||
.autoDisposable(lifecycle.scope())
|
||||
.subscribe()
|
||||
}
|
||||
|
||||
override fun onMove(recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, target: RecyclerView.ViewHolder): Boolean {
|
||||
return false
|
||||
@@ -65,14 +88,14 @@ class ConversationItemTouchCallback @Inject constructor(private val context: Con
|
||||
|
||||
if (dX > 0) {
|
||||
c.drawRect(itemView.left.toFloat(), itemView.top.toFloat(), dX, itemView.bottom.toFloat(), paint)
|
||||
c.drawBitmap(icon, itemView.left.toFloat() + iconLength,
|
||||
itemView.top.toFloat() + (itemView.bottom.toFloat() - itemView.top.toFloat() - icon.height) / 2,
|
||||
paint)
|
||||
c.drawBitmap(rightIcon, itemView.left.toFloat() + iconLength,
|
||||
itemView.top.toFloat() + (itemView.bottom.toFloat() - itemView.top.toFloat() - (rightIcon?.height
|
||||
?: 0)) / 2, paint)
|
||||
} else if (dX < 0) {
|
||||
c.drawRect(itemView.right.toFloat() + dX, itemView.top.toFloat(), itemView.right.toFloat(), itemView.bottom.toFloat(), paint)
|
||||
c.drawBitmap(icon, itemView.right.toFloat() - iconLength - icon.width,
|
||||
itemView.top.toFloat() + (itemView.bottom.toFloat() - itemView.top.toFloat() - icon.height) / 2,
|
||||
paint)
|
||||
c.drawBitmap(leftIcon, itemView.right.toFloat() - iconLength - (leftIcon?.width ?: 0),
|
||||
itemView.top.toFloat() + (itemView.bottom.toFloat() - itemView.top.toFloat() - (leftIcon?.height
|
||||
?: 0)) / 2, paint)
|
||||
}
|
||||
|
||||
super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive)
|
||||
@@ -80,7 +103,27 @@ class ConversationItemTouchCallback @Inject constructor(private val context: Con
|
||||
}
|
||||
|
||||
override fun onSwiped(viewHolder: RecyclerView.ViewHolder, direction: Int) {
|
||||
swipes.onNext(viewHolder.itemId)
|
||||
swipes.onNext(Pair(viewHolder.itemId, direction))
|
||||
|
||||
// This will trigger the animation back to neutral state
|
||||
val action = if (direction == ItemTouchHelper.RIGHT) rightAction else leftAction
|
||||
if (action != Preferences.SWIPE_ACTION_ARCHIVE && action != Preferences.SWIPE_ACTION_READ) {
|
||||
adapter?.notifyItemChanged(viewHolder.adapterPosition)
|
||||
}
|
||||
}
|
||||
|
||||
private fun iconForAction(action: Int, tint: Int): Bitmap? {
|
||||
val res = when (action) {
|
||||
Preferences.SWIPE_ACTION_ARCHIVE -> R.drawable.ic_archive_black_24dp
|
||||
Preferences.SWIPE_ACTION_DELETE -> R.drawable.ic_delete_white_24dp
|
||||
Preferences.SWIPE_ACTION_CALL -> R.drawable.ic_call_white_24dp
|
||||
Preferences.SWIPE_ACTION_READ -> R.drawable.ic_check_white_24dp
|
||||
else -> null
|
||||
}
|
||||
|
||||
return res?.let(context.resources::getDrawable)
|
||||
?.apply { setTint(tint) }
|
||||
?.toBitmap(iconLength, iconLength)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -95,7 +95,7 @@ class MainActivity : QkThemedActivity(), MainView {
|
||||
override val conversationsSelectedIntent by lazy { conversationsAdapter.selectionChanges }
|
||||
override val confirmDeleteIntent: Subject<Unit> = PublishSubject.create()
|
||||
override val swipeConversationIntent by lazy { itemTouchCallback.swipes }
|
||||
override val undoSwipeConversationIntent: Subject<Unit> = PublishSubject.create()
|
||||
override val undoArchiveIntent: Subject<Unit> = PublishSubject.create()
|
||||
override val snackbarButtonIntent by lazy { snackbarButton.clicks() }
|
||||
override val backPressedIntent: Subject<Unit> = PublishSubject.create()
|
||||
|
||||
@@ -103,8 +103,8 @@ class MainActivity : QkThemedActivity(), MainView {
|
||||
private val toggle by lazy { ActionBarDrawerToggle(this, drawerLayout, toolbar, R.string.main_drawer_open_cd, 0) }
|
||||
private val itemTouchHelper by lazy { ItemTouchHelper(itemTouchCallback) }
|
||||
private val archiveSnackbar by lazy {
|
||||
Snackbar.make(drawerLayout, R.string.toast_archived, Snackbar.LENGTH_INDEFINITE).apply {
|
||||
setAction(R.string.button_undo) { undoSwipeConversationIntent.onNext(Unit) }
|
||||
Snackbar.make(drawerLayout, R.string.toast_archived, Snackbar.LENGTH_LONG).apply {
|
||||
setAction(R.string.button_undo) { undoArchiveIntent.onNext(Unit) }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,7 +129,8 @@ class MainActivity : QkThemedActivity(), MainView {
|
||||
// Set the theme color tint to the recyclerView, progressbar, and FAB
|
||||
colors.themeObservable()
|
||||
.doOnNext { recyclerView.scrapViews() }
|
||||
.doOnNext { theme ->
|
||||
.autoDisposable(scope())
|
||||
.subscribe { theme ->
|
||||
// Set the color for the drawer icons
|
||||
val states = arrayOf(intArrayOf(android.R.attr.state_selected), intArrayOf(-android.R.attr.state_selected))
|
||||
resolveThemeColor(android.R.attr.textColorSecondary)
|
||||
@@ -138,26 +139,21 @@ class MainActivity : QkThemedActivity(), MainView {
|
||||
inboxIcon.imageTintList = tintList
|
||||
archivedIcon.imageTintList = tintList
|
||||
}
|
||||
}
|
||||
.doOnNext { theme ->
|
||||
|
||||
// Miscellaneous views
|
||||
syncingProgress.indeterminateTintList = ColorStateList.valueOf(theme.theme)
|
||||
itemTouchCallback.color = theme.theme
|
||||
plusIcon.setTint(theme.theme)
|
||||
rateIcon.setTint(theme.theme)
|
||||
compose.setBackgroundTint(theme.theme)
|
||||
}
|
||||
.doOnNext { theme ->
|
||||
|
||||
// Set the FAB compose icon color
|
||||
compose.setTint(theme.textPrimary)
|
||||
itemTouchCallback.iconColor = theme.textPrimary
|
||||
}
|
||||
.autoDisposable(scope())
|
||||
.subscribe()
|
||||
|
||||
// Set the hamburger icon color
|
||||
toggle.drawerArrowDrawable.color = resolveThemeColor(android.R.attr.textColorSecondary)
|
||||
|
||||
itemTouchCallback.adapter = conversationsAdapter
|
||||
conversationsAdapter.autoScrollToStart(recyclerView)
|
||||
}
|
||||
|
||||
@@ -235,11 +231,6 @@ class MainActivity : QkThemedActivity(), MainView {
|
||||
}
|
||||
}
|
||||
|
||||
when (state.page is Inbox && state.page.showArchivedSnackbar) {
|
||||
true -> archiveSnackbar.show()
|
||||
false -> archiveSnackbar.dismiss()
|
||||
}
|
||||
|
||||
inbox.isSelected = state.page is Inbox
|
||||
archived.isSelected = state.page is Archived
|
||||
|
||||
@@ -302,6 +293,10 @@ class MainActivity : QkThemedActivity(), MainView {
|
||||
.show()
|
||||
}
|
||||
|
||||
override fun showArchivedSnackbar() {
|
||||
archiveSnackbar.show()
|
||||
}
|
||||
|
||||
override fun onCreateOptionsMenu(menu: Menu?): Boolean {
|
||||
menuInflater.inflate(R.menu.main, menu)
|
||||
return super.onCreateOptionsMenu(menu)
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
*/
|
||||
package com.moez.QKSMS.feature.main
|
||||
|
||||
import androidx.lifecycle.Lifecycle
|
||||
import androidx.lifecycle.ViewModel
|
||||
import com.moez.QKSMS.injection.ViewModelKey
|
||||
import dagger.Module
|
||||
@@ -27,6 +28,9 @@ import dagger.multibindings.IntoMap
|
||||
@Module
|
||||
class MainActivityModule {
|
||||
|
||||
@Provides
|
||||
fun provideLifecycle(activity: MainActivity): Lifecycle = activity.lifecycle
|
||||
|
||||
@Provides
|
||||
@IntoMap
|
||||
@ViewModelKey(MainViewModel::class)
|
||||
|
||||
@@ -42,8 +42,7 @@ data class Inbox(
|
||||
val markPinned: Boolean = true,
|
||||
val markRead: Boolean = false,
|
||||
val data: RealmResults<Conversation>? = null,
|
||||
val selected: Int = 0,
|
||||
val showArchivedSnackbar: Boolean = false) : MainPage()
|
||||
val selected: Int = 0) : MainPage()
|
||||
|
||||
data class Searching(
|
||||
val loading: Boolean = false,
|
||||
|
||||
@@ -35,8 +35,8 @@ interface MainView : QkView<MainState> {
|
||||
val rateIntent: Observable<*>
|
||||
val conversationsSelectedIntent: Observable<List<Long>>
|
||||
val confirmDeleteIntent: Observable<Unit>
|
||||
val swipeConversationIntent: Observable<Long>
|
||||
val undoSwipeConversationIntent: Observable<Unit>
|
||||
val swipeConversationIntent: Observable<Pair<Long, Int>>
|
||||
val undoArchiveIntent: Observable<Unit>
|
||||
val snackbarButtonIntent: Observable<Unit>
|
||||
val backPressedIntent: Observable<Unit>
|
||||
|
||||
@@ -44,6 +44,7 @@ interface MainView : QkView<MainState> {
|
||||
fun clearSearch()
|
||||
fun clearSelection()
|
||||
fun showDeleteDialog(count: Int)
|
||||
fun showArchivedSnackbar()
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
*/
|
||||
package com.moez.QKSMS.feature.main
|
||||
|
||||
import androidx.recyclerview.widget.ItemTouchHelper
|
||||
import com.moez.QKSMS.R
|
||||
import com.moez.QKSMS.common.Navigator
|
||||
import com.moez.QKSMS.common.androidxcompat.scope
|
||||
@@ -40,6 +41,7 @@ import com.moez.QKSMS.manager.RatingManager
|
||||
import com.moez.QKSMS.model.SyncLog
|
||||
import com.moez.QKSMS.repository.ConversationRepository
|
||||
import com.moez.QKSMS.repository.SyncRepository
|
||||
import com.moez.QKSMS.util.Preferences
|
||||
import com.uber.autodispose.kotlin.autoDisposable
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
@@ -67,6 +69,7 @@ class MainViewModel @Inject constructor(
|
||||
private val markUnread: MarkUnread,
|
||||
private val navigator: Navigator,
|
||||
private val permissionManager: PermissionManager,
|
||||
private val prefs: Preferences,
|
||||
private val ratingManager: RatingManager,
|
||||
private val syncMessages: SyncMessages
|
||||
) : QkViewModel<MainView, MainState>(MainState(page = Inbox(data = conversationRepo.getConversations()))) {
|
||||
@@ -296,7 +299,10 @@ class MainViewModel @Inject constructor(
|
||||
|
||||
// Delete the conversation
|
||||
view.confirmDeleteIntent
|
||||
.withLatestFrom(view.conversationsSelectedIntent) { _, conversations -> conversations }
|
||||
.withLatestFrom(view.conversationsSelectedIntent, view.swipeConversationIntent) { _, conversations, swipe ->
|
||||
// If conversations are selected, use those. Otherwise, this was triggered by a swipe-to-delete
|
||||
conversations.takeIf { it.isNotEmpty() } ?: listOf(swipe.first)
|
||||
}
|
||||
.autoDisposable(view.scope())
|
||||
.subscribe { conversations ->
|
||||
deleteConversations.execute(conversations)
|
||||
@@ -304,28 +310,19 @@ class MainViewModel @Inject constructor(
|
||||
}
|
||||
|
||||
view.swipeConversationIntent
|
||||
.withLatestFrom(state) { threadId, state ->
|
||||
markArchived.execute(listOf(threadId)) {
|
||||
if (state.page is Inbox) {
|
||||
val page = state.page.copy(showArchivedSnackbar = true)
|
||||
newState { copy(page = page) }
|
||||
}
|
||||
}
|
||||
}
|
||||
.switchMap { Observable.timer(2750, TimeUnit.MILLISECONDS) }
|
||||
.withLatestFrom(state) { threadId, state ->
|
||||
markArchived.execute(listOf(threadId)) {
|
||||
if (state.page is Inbox) {
|
||||
val page = state.page.copy(showArchivedSnackbar = false)
|
||||
newState { copy(page = page) }
|
||||
}
|
||||
}
|
||||
}
|
||||
.autoDisposable(view.scope())
|
||||
.subscribe()
|
||||
.subscribe { (threadId, direction) ->
|
||||
val action = if (direction == ItemTouchHelper.RIGHT) prefs.swipeRight.get() else prefs.swipeLeft.get()
|
||||
when (action) {
|
||||
Preferences.SWIPE_ACTION_ARCHIVE -> markArchived.execute(listOf(threadId)) { view.showArchivedSnackbar() }
|
||||
Preferences.SWIPE_ACTION_DELETE -> view.showDeleteDialog(1)
|
||||
Preferences.SWIPE_ACTION_CALL -> conversationRepo.getConversation(threadId)?.recipients?.firstOrNull()?.address?.let(navigator::makePhoneCall)
|
||||
Preferences.SWIPE_ACTION_READ -> markRead.execute(listOf(threadId))
|
||||
}
|
||||
}
|
||||
|
||||
view.undoSwipeConversationIntent
|
||||
.withLatestFrom(view.swipeConversationIntent) { _, threadId -> threadId }
|
||||
view.undoArchiveIntent
|
||||
.withLatestFrom(view.swipeConversationIntent) { _, pair -> pair.first }
|
||||
.autoDisposable(view.scope())
|
||||
.subscribe { threadId -> markUnarchived.execute(listOf(threadId)) }
|
||||
|
||||
|
||||
@@ -4,9 +4,7 @@ import android.app.ProgressDialog
|
||||
import android.app.TimePickerDialog
|
||||
import android.content.Context
|
||||
import android.text.format.DateFormat
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import com.bluelinelabs.conductor.RouterTransaction
|
||||
import com.bluelinelabs.conductor.changehandler.FadeChangeHandler
|
||||
import com.google.android.material.snackbar.Snackbar
|
||||
@@ -21,6 +19,7 @@ import com.moez.QKSMS.common.util.extensions.setBackgroundTint
|
||||
import com.moez.QKSMS.common.util.extensions.setVisible
|
||||
import com.moez.QKSMS.common.widget.PreferenceView
|
||||
import com.moez.QKSMS.feature.settings.about.AboutController
|
||||
import com.moez.QKSMS.feature.settings.swipe.SwipeActionsController
|
||||
import com.moez.QKSMS.feature.themepicker.ThemePickerController
|
||||
import com.moez.QKSMS.injection.appComponent
|
||||
import com.moez.QKSMS.util.Preferences
|
||||
@@ -28,8 +27,8 @@ import com.uber.autodispose.kotlin.autoDisposable
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.subjects.PublishSubject
|
||||
import io.reactivex.subjects.Subject
|
||||
import kotlinx.android.synthetic.main.settings_activity.*
|
||||
import kotlinx.android.synthetic.main.settings_activity.view.*
|
||||
import kotlinx.android.synthetic.main.settings_controller.*
|
||||
import kotlinx.android.synthetic.main.settings_controller.view.*
|
||||
import kotlinx.android.synthetic.main.settings_switch_widget.view.*
|
||||
import kotlinx.android.synthetic.main.settings_theme_widget.*
|
||||
import javax.inject.Inject
|
||||
@@ -61,7 +60,7 @@ class SettingsController : QkController<SettingsView, SettingsState, SettingsPre
|
||||
init {
|
||||
appComponent.inject(this)
|
||||
retainViewMode = RetainViewMode.RETAIN_DETACH
|
||||
layoutRes = R.layout.settings_activity
|
||||
layoutRes = R.layout.settings_controller
|
||||
|
||||
colors.themeObservable()
|
||||
.autoDisposable(scope())
|
||||
@@ -166,6 +165,12 @@ class SettingsController : QkController<SettingsView, SettingsState, SettingsPre
|
||||
|
||||
override fun showMmsSizePicker() = mmsSizeDialog.show(activity!!)
|
||||
|
||||
override fun showSwipeActions() {
|
||||
router.pushController(RouterTransaction.with(SwipeActionsController())
|
||||
.pushChangeHandler(FadeChangeHandler(150))
|
||||
.popChangeHandler(FadeChangeHandler(150)))
|
||||
}
|
||||
|
||||
override fun showThemePicker() {
|
||||
router.pushController(RouterTransaction.with(ThemePickerController())
|
||||
.pushChangeHandler(FadeChangeHandler(150))
|
||||
|
||||
@@ -117,6 +117,8 @@ class SettingsPresenter @Inject constructor(
|
||||
|
||||
R.id.notifications -> navigator.showNotificationSettings()
|
||||
|
||||
R.id.swipeActions -> view.showSwipeActions()
|
||||
|
||||
R.id.delayed -> view.showDelayDurationDialog()
|
||||
|
||||
R.id.delivery -> prefs.delivery.set(!prefs.delivery.get())
|
||||
|
||||
@@ -39,6 +39,7 @@ interface SettingsView : QkViewContract<SettingsState> {
|
||||
fun showTextSizePicker()
|
||||
fun showDelayDurationDialog()
|
||||
fun showMmsSizePicker()
|
||||
fun showSwipeActions()
|
||||
fun showThemePicker()
|
||||
fun showAbout()
|
||||
}
|
||||
|
||||
+99
@@ -0,0 +1,99 @@
|
||||
/*
|
||||
* 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.swipe
|
||||
|
||||
import android.view.View
|
||||
import androidx.core.view.isVisible
|
||||
import com.jakewharton.rxbinding2.view.clicks
|
||||
import com.moez.QKSMS.R
|
||||
import com.moez.QKSMS.common.QkDialog
|
||||
import com.moez.QKSMS.common.base.QkController
|
||||
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.setTint
|
||||
import com.moez.QKSMS.injection.appComponent
|
||||
import com.uber.autodispose.kotlin.autoDisposable
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.subjects.PublishSubject
|
||||
import io.reactivex.subjects.Subject
|
||||
import kotlinx.android.synthetic.main.swipe_actions_controller.*
|
||||
import javax.inject.Inject
|
||||
|
||||
class SwipeActionsController : QkController<SwipeActionsView, SwipeActionsState, SwipeActionsPresenter>(), SwipeActionsView {
|
||||
|
||||
@Inject override lateinit var presenter: SwipeActionsPresenter
|
||||
@Inject lateinit var actionsDialog: QkDialog
|
||||
@Inject lateinit var colors: Colors
|
||||
|
||||
/**
|
||||
* Allows us to subscribe to [actionClicks] more than once
|
||||
*/
|
||||
private val actionClicks: Subject<SwipeActionsView.Action> = PublishSubject.create()
|
||||
|
||||
init {
|
||||
appComponent.inject(this)
|
||||
layoutRes = R.layout.swipe_actions_controller
|
||||
|
||||
actionsDialog.adapter.setData(R.array.settings_swipe_actions)
|
||||
}
|
||||
|
||||
override fun onAttach(view: View) {
|
||||
super.onAttach(view)
|
||||
presenter.bindIntents(this)
|
||||
setTitle(R.string.settings_swipe_actions)
|
||||
showBackButton(true)
|
||||
|
||||
colors.theme().let { theme ->
|
||||
rightIcon.setBackgroundTint(theme.theme)
|
||||
rightIcon.setTint(theme.textPrimary)
|
||||
leftIcon.setBackgroundTint(theme.theme)
|
||||
leftIcon.setTint(theme.textPrimary)
|
||||
}
|
||||
|
||||
right.postDelayed({ right.animateLayoutChanges = true }, 100)
|
||||
left.postDelayed({ left.animateLayoutChanges = true }, 100)
|
||||
|
||||
Observable.merge(
|
||||
right.clicks().map { SwipeActionsView.Action.RIGHT },
|
||||
left.clicks().map { SwipeActionsView.Action.LEFT })
|
||||
.autoDisposable(scope())
|
||||
.subscribe(actionClicks)
|
||||
}
|
||||
|
||||
override fun actionClicks(): Observable<SwipeActionsView.Action> = actionClicks
|
||||
|
||||
override fun actionSelected(): Observable<Int> = actionsDialog.adapter.menuItemClicks
|
||||
|
||||
override fun showSwipeActions(selected: Int) {
|
||||
actionsDialog.adapter.selectedItem = selected
|
||||
activity?.let(actionsDialog::show)
|
||||
}
|
||||
|
||||
override fun render(state: SwipeActionsState) {
|
||||
rightIcon.isVisible = state.rightIcon != 0
|
||||
rightIcon.setImageResource(state.rightIcon)
|
||||
rightLabel.text = state.rightLabel
|
||||
|
||||
leftIcon.isVisible = state.leftIcon != 0
|
||||
leftIcon.setImageResource(state.leftIcon)
|
||||
leftLabel.text = state.leftLabel
|
||||
}
|
||||
|
||||
}
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* 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.swipe
|
||||
|
||||
import android.content.Context
|
||||
import androidx.annotation.DrawableRes
|
||||
import com.moez.QKSMS.R
|
||||
import com.moez.QKSMS.common.base.QkPresenter
|
||||
import com.moez.QKSMS.util.Preferences
|
||||
import com.uber.autodispose.kotlin.autoDisposable
|
||||
import io.reactivex.rxkotlin.plusAssign
|
||||
import io.reactivex.rxkotlin.withLatestFrom
|
||||
import javax.inject.Inject
|
||||
|
||||
class SwipeActionsPresenter @Inject constructor(
|
||||
context: Context,
|
||||
private val prefs: Preferences
|
||||
) : QkPresenter<SwipeActionsView, SwipeActionsState>(SwipeActionsState()) {
|
||||
|
||||
init {
|
||||
val actionLabels = context.resources.getStringArray(R.array.settings_swipe_actions)
|
||||
|
||||
disposables += prefs.swipeRight.asObservable()
|
||||
.subscribe { action -> newState { copy(rightLabel = actionLabels[action], rightIcon = iconForAction(action)) } }
|
||||
|
||||
disposables += prefs.swipeLeft.asObservable()
|
||||
.subscribe { action -> newState { copy(leftLabel = actionLabels[action], leftIcon = iconForAction(action)) } }
|
||||
}
|
||||
|
||||
override fun bindIntents(view: SwipeActionsView) {
|
||||
super.bindIntents(view)
|
||||
|
||||
view.actionClicks()
|
||||
.map { action ->
|
||||
when (action) {
|
||||
SwipeActionsView.Action.RIGHT -> prefs.swipeRight.get()
|
||||
SwipeActionsView.Action.LEFT -> prefs.swipeLeft.get()
|
||||
}
|
||||
}
|
||||
.autoDisposable(view.scope())
|
||||
.subscribe(view::showSwipeActions)
|
||||
|
||||
view.actionSelected()
|
||||
.withLatestFrom(view.actionClicks()) { actionId, action ->
|
||||
when (action) {
|
||||
SwipeActionsView.Action.RIGHT -> prefs.swipeRight.set(actionId)
|
||||
SwipeActionsView.Action.LEFT -> prefs.swipeLeft.set(actionId)
|
||||
}
|
||||
}
|
||||
.autoDisposable(view.scope())
|
||||
.subscribe()
|
||||
}
|
||||
|
||||
@DrawableRes
|
||||
private fun iconForAction(action: Int) = when (action) {
|
||||
Preferences.SWIPE_ACTION_ARCHIVE -> R.drawable.ic_archive_black_24dp
|
||||
Preferences.SWIPE_ACTION_DELETE -> R.drawable.ic_delete_white_24dp
|
||||
Preferences.SWIPE_ACTION_CALL -> R.drawable.ic_call_white_24dp
|
||||
Preferences.SWIPE_ACTION_READ -> R.drawable.ic_check_white_24dp
|
||||
else -> 0
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* 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.swipe
|
||||
|
||||
import androidx.annotation.DrawableRes
|
||||
import com.moez.QKSMS.R
|
||||
|
||||
data class SwipeActionsState(
|
||||
@DrawableRes val rightIcon: Int = R.drawable.ic_archive_black_24dp,
|
||||
val rightLabel: String = "",
|
||||
|
||||
@DrawableRes val leftIcon: Int = R.drawable.ic_archive_black_24dp,
|
||||
val leftLabel: String = ""
|
||||
)
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* 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.swipe
|
||||
|
||||
import com.moez.QKSMS.common.base.QkViewContract
|
||||
import io.reactivex.Observable
|
||||
|
||||
interface SwipeActionsView : QkViewContract<SwipeActionsState> {
|
||||
|
||||
enum class Action { LEFT, RIGHT }
|
||||
|
||||
fun actionClicks(): Observable<Action>
|
||||
fun actionSelected(): Observable<Int>
|
||||
|
||||
fun showSwipeActions(selected: Int)
|
||||
|
||||
}
|
||||
@@ -29,6 +29,7 @@ import com.moez.QKSMS.common.widget.QkTextView
|
||||
import com.moez.QKSMS.feature.compose.DetailedChipView
|
||||
import com.moez.QKSMS.feature.settings.SettingsController
|
||||
import com.moez.QKSMS.feature.settings.about.AboutController
|
||||
import com.moez.QKSMS.feature.settings.swipe.SwipeActionsController
|
||||
import com.moez.QKSMS.feature.themepicker.injection.ThemePickerComponent
|
||||
import com.moez.QKSMS.feature.widget.WidgetAdapter
|
||||
import com.moez.QKSMS.injection.android.ActivityBuilderModule
|
||||
@@ -54,6 +55,7 @@ interface AppComponent {
|
||||
|
||||
fun inject(controller: AboutController)
|
||||
fun inject(controller: SettingsController)
|
||||
fun inject(controller: SwipeActionsController)
|
||||
|
||||
fun inject(dialog: QkDialog)
|
||||
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
<!--
|
||||
~ 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/>.
|
||||
-->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M5,13h14v-2L5,11v2zM3,17h14v-2L3,15v2zM7,7v2h14L21,7L7,7z"/>
|
||||
</vector>
|
||||
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ 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/>.
|
||||
-->
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@color/white" />
|
||||
<corners
|
||||
android:bottomLeftRadius="4dp"
|
||||
android:topLeftRadius="4dp" />
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
||||
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ 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/>.
|
||||
-->
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@android:color/transparent" />
|
||||
<stroke
|
||||
android:width="1dp"
|
||||
android:color="@color/white" />
|
||||
<corners android:radius="4dp" />
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
||||
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ 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/>.
|
||||
-->
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@color/white" />
|
||||
<corners
|
||||
android:bottomRightRadius="4dp"
|
||||
android:topRightRadius="4dp" />
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
||||
+9
@@ -149,6 +149,15 @@
|
||||
app:title="@string/settings_delayed_title"
|
||||
tools:summary="No delay" />
|
||||
|
||||
<com.moez.QKSMS.common.widget.PreferenceView
|
||||
android:id="@+id/swipeActions"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="visible"
|
||||
app:icon="@drawable/ic_clear_all_black_24dp"
|
||||
app:summary="@string/settings_swipe_actions_summary"
|
||||
app:title="@string/settings_swipe_actions" />
|
||||
|
||||
<com.moez.QKSMS.common.widget.PreferenceView
|
||||
android:id="@+id/delivery"
|
||||
android:layout_width="match_parent"
|
||||
@@ -0,0 +1,308 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ 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/>.
|
||||
-->
|
||||
<androidx.constraintlayout.widget.ConstraintLayout 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:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
style="@style/Toolbar"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<com.moez.QKSMS.common.widget.QkTextView
|
||||
android:id="@+id/toolbarTitle"
|
||||
style="@style/ToolbarText"
|
||||
tools:text="Swipe actions" />
|
||||
|
||||
</androidx.appcompat.widget.Toolbar>
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/scrollView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/toolbar">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/right"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:foreground="?attr/selectableItemBackground">
|
||||
|
||||
<com.moez.QKSMS.common.widget.QkTextView
|
||||
android:id="@+id/rightTitle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginStart="24dp"
|
||||
android:layout_marginTop="24dp"
|
||||
android:text="@string/settings_swipe_actions_right"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
app:layout_constraintEnd_toStartOf="@id/rightChange"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:textSize="primary" />
|
||||
|
||||
<com.moez.QKSMS.common.widget.QkTextView
|
||||
android:id="@+id/rightLabel"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="2dp"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
app:layout_constraintEnd_toEndOf="@id/rightTitle"
|
||||
app:layout_constraintStart_toStartOf="@id/rightTitle"
|
||||
app:layout_constraintTop_toBottomOf="@id/rightTitle"
|
||||
app:textSize="secondary"
|
||||
tools:text="Archive" />
|
||||
|
||||
<com.moez.QKSMS.common.widget.QkTextView
|
||||
android:id="@+id/rightChange"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="24dp"
|
||||
android:text="@string/settings_swipe_actions_change"
|
||||
android:textAllCaps="true"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/rightTitle"
|
||||
app:textSize="secondary" />
|
||||
|
||||
<View
|
||||
android:id="@+id/rightBackground"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="84dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:alpha="0.1"
|
||||
android:background="@drawable/rounded_rectangle_outline_4dp"
|
||||
android:backgroundTint="?android:attr/textColorPrimary"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/rightLabel" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/rightIcon"
|
||||
android:layout_width="96dp"
|
||||
android:layout_height="84dp"
|
||||
android:background="@drawable/rounded_rectangle_left_4dp"
|
||||
android:paddingBottom="30dp"
|
||||
android:paddingEnd="48dp"
|
||||
android:paddingStart="24dp"
|
||||
android:paddingTop="30dp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/rightBackground"
|
||||
app:layout_constraintStart_toStartOf="@id/rightBackground"
|
||||
app:layout_constraintTop_toTopOf="@id/rightBackground"
|
||||
tools:backgroundTint="@color/tools_theme"
|
||||
tools:src="@drawable/ic_archive_black_24dp"
|
||||
tools:tint="@color/textPrimaryDark" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/rightAvatar"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:background="@drawable/circle"
|
||||
android:backgroundTint="?android:attr/divider"
|
||||
android:padding="8dp"
|
||||
android:src="@drawable/ic_person_black_24dp"
|
||||
android:tint="?android:attr/textColorTertiary"
|
||||
app:layout_constraintBottom_toBottomOf="@id/rightBackground"
|
||||
app:layout_constraintStart_toEndOf="@id/rightIcon"
|
||||
app:layout_constraintTop_toTopOf="@id/rightBackground" />
|
||||
|
||||
<View
|
||||
android:id="@+id/rightTitleRect"
|
||||
android:layout_width="128dp"
|
||||
android:layout_height="8dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:background="@drawable/rounded_rectangle_2dp"
|
||||
android:backgroundTint="?android:attr/textColorTertiary"
|
||||
app:layout_constraintBottom_toTopOf="@id/rightSummaryRect"
|
||||
app:layout_constraintStart_toEndOf="@id/rightAvatar"
|
||||
app:layout_constraintTop_toTopOf="@id/rightBackground"
|
||||
app:layout_constraintVertical_chainStyle="packed" />
|
||||
|
||||
<View
|
||||
android:id="@+id/rightSummaryRect"
|
||||
android:layout_width="96dp"
|
||||
android:layout_height="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:background="@drawable/rounded_rectangle_2dp"
|
||||
android:backgroundTint="?android:attr/divider"
|
||||
app:layout_constraintBottom_toBottomOf="@id/rightBackground"
|
||||
app:layout_constraintStart_toStartOf="@id/rightTitleRect"
|
||||
app:layout_constraintTop_toBottomOf="@id/rightTitleRect" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?android:attr/divider" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/left"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:foreground="?attr/selectableItemBackground">
|
||||
|
||||
<com.moez.QKSMS.common.widget.QkTextView
|
||||
android:id="@+id/leftTitle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginStart="24dp"
|
||||
android:layout_marginTop="24dp"
|
||||
android:text="@string/settings_swipe_actions_left"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
app:layout_constraintEnd_toStartOf="@id/leftChange"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:textSize="primary" />
|
||||
|
||||
<com.moez.QKSMS.common.widget.QkTextView
|
||||
android:id="@+id/leftLabel"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="2dp"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
app:layout_constraintEnd_toEndOf="@id/leftTitle"
|
||||
app:layout_constraintStart_toStartOf="@id/leftTitle"
|
||||
app:layout_constraintTop_toBottomOf="@id/leftTitle"
|
||||
app:textSize="secondary"
|
||||
tools:text="Archive" />
|
||||
|
||||
<com.moez.QKSMS.common.widget.QkTextView
|
||||
android:id="@+id/leftChange"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="24dp"
|
||||
android:text="@string/settings_swipe_actions_change"
|
||||
android:textAllCaps="true"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/leftTitle"
|
||||
app:textSize="secondary" />
|
||||
|
||||
<View
|
||||
android:id="@+id/leftBackground"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="84dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:alpha="0.1"
|
||||
android:background="@drawable/rounded_rectangle_outline_4dp"
|
||||
android:backgroundTint="?android:attr/textColorPrimary"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/leftLabel" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/leftIcon"
|
||||
android:layout_width="96dp"
|
||||
android:layout_height="84dp"
|
||||
android:background="@drawable/rounded_rectangle_right_4dp"
|
||||
android:paddingBottom="30dp"
|
||||
android:paddingEnd="24dp"
|
||||
android:paddingStart="48dp"
|
||||
android:paddingTop="30dp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/leftBackground"
|
||||
app:layout_constraintEnd_toEndOf="@id/leftBackground"
|
||||
app:layout_constraintTop_toTopOf="@id/leftBackground"
|
||||
tools:backgroundTint="@color/tools_theme"
|
||||
tools:src="@drawable/ic_archive_black_24dp"
|
||||
tools:tint="@color/textPrimaryDark" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/leftAvatar"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:background="@drawable/circle"
|
||||
android:backgroundTint="?android:attr/divider"
|
||||
android:padding="8dp"
|
||||
android:src="@drawable/ic_person_black_24dp"
|
||||
android:tint="?android:attr/textColorTertiary"
|
||||
app:layout_constraintBottom_toBottomOf="@id/leftBackground"
|
||||
app:layout_constraintStart_toStartOf="@id/leftBackground"
|
||||
app:layout_constraintTop_toTopOf="@id/leftBackground" />
|
||||
|
||||
<View
|
||||
android:id="@+id/leftTitleRect"
|
||||
android:layout_width="128dp"
|
||||
android:layout_height="8dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:background="@drawable/rounded_rectangle_2dp"
|
||||
android:backgroundTint="?android:attr/textColorTertiary"
|
||||
app:layout_constraintBottom_toTopOf="@id/leftSummaryRect"
|
||||
app:layout_constraintStart_toEndOf="@id/leftAvatar"
|
||||
app:layout_constraintTop_toTopOf="@id/leftBackground"
|
||||
app:layout_constraintVertical_chainStyle="packed" />
|
||||
|
||||
<View
|
||||
android:id="@+id/leftSummaryRect"
|
||||
android:layout_width="96dp"
|
||||
android:layout_height="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:background="@drawable/rounded_rectangle_2dp"
|
||||
android:backgroundTint="?android:attr/divider"
|
||||
app:layout_constraintBottom_toBottomOf="@id/leftBackground"
|
||||
app:layout_constraintStart_toStartOf="@id/leftTitleRect"
|
||||
app:layout_constraintTop_toBottomOf="@id/leftTitleRect" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="8dp"
|
||||
android:background="@drawable/ab_shadow"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/toolbar" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?android:attr/divider"
|
||||
app:layout_constraintBottom_toBottomOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -187,6 +187,18 @@
|
||||
<string name="settings_should_i_answer_title">Should I Answer?</string>
|
||||
<string name="settings_should_i_answer_summary">Automatically filter messages from unsolicited numbers by using the \"Should I Answer\" app</string>
|
||||
<string name="settings_delayed_title">Delayed sending</string>
|
||||
<string name="settings_swipe_actions">Swipe actions</string>
|
||||
<string name="settings_swipe_actions_summary">Configure swipe actions for conversations</string>
|
||||
<string name="settings_swipe_actions_right">Right swipe</string>
|
||||
<string name="settings_swipe_actions_left">Left swipe</string>
|
||||
<string name="settings_swipe_actions_change">CHANGE</string>
|
||||
<string-array name="settings_swipe_actions">
|
||||
<item>None</item>
|
||||
<item>Archive</item>
|
||||
<item>Delete</item>
|
||||
<item>Call</item>
|
||||
<item>Mark read</item>
|
||||
</string-array>
|
||||
<string name="settings_delivery_title">Delivery confirmations</string>
|
||||
<string name="settings_delivery_summary">Confirm that messages were sent successfully</string>
|
||||
<string name="settings_unicode_title">Strip accents</string>
|
||||
|
||||
Reference in New Issue
Block a user