changes to make scheduled messages activity ui compliant with the rest of the app message listing activities. now allows sending and deleting multiple scheduled messages at once

This commit is contained in:
gavine99
2025-02-19 18:51:36 +11:00
parent 302dadd077
commit d7c5b1b71e
13 changed files with 430 additions and 241 deletions
@@ -69,6 +69,10 @@ class ScheduledMessageRepositoryImpl @Inject constructor() : ScheduledMessageRep
disposables.add(subscription) disposables.add(subscription)
} }
override fun deleteScheduledMessages(ids: List<Long>) {
ids.forEach { deleteScheduledMessage(it) }
}
// Ensure to clear disposables when the repository is no longer needed // Ensure to clear disposables when the repository is no longer needed
fun clearDisposables() { fun clearDisposables() {
disposables.clear() disposables.clear()
@@ -50,4 +50,7 @@ interface ScheduledMessageRepository {
*/ */
fun deleteScheduledMessage(id: Long) fun deleteScheduledMessage(id: Long)
// delete multiple scheduled messages by id list
fun deleteScheduledMessages(ids: List<Long>)
} }
@@ -52,13 +52,28 @@ abstract class QkRealmAdapter<T : RealmModel> : RealmRecyclerViewAdapter<T, QkVi
private var selection = listOf<Long>() private var selection = listOf<Long>()
/**
* Mark this message as highlighted
*/
var highlight: Long = -1L
set(value) {
if (field == value) return
field = value
notifyDataSetChanged()
}
/** /**
* Toggles the selected state for a particular view * Toggles the selected state for a particular view
* *
* If we are currently in selection mode (we have an active selection), then the state will * If we are currently in selection mode (we have an active selection), then the state will
* toggle. If we are not in selection mode, then we will only toggle if [force] * toggle. If we are not in selection mode, then we will only toggle if [force]
*/ */
protected fun toggleSelection(id: Long, force: Boolean = true): Boolean { protected fun toggleSelection(
id: Long,
force: Boolean = true,
useChangeEvent: Boolean = true
): Boolean {
if (!force && selection.isEmpty()) return false if (!force && selection.isEmpty()) return false
selection = when (selection.contains(id)) { selection = when (selection.contains(id)) {
@@ -66,7 +81,8 @@ abstract class QkRealmAdapter<T : RealmModel> : RealmRecyclerViewAdapter<T, QkVi
false -> selection + id false -> selection + id
} }
selectionChanges.onNext(selection) if (useChangeEvent)
selectionChanges.onNext(selection)
return true return true
} }
@@ -80,6 +96,33 @@ abstract class QkRealmAdapter<T : RealmModel> : RealmRecyclerViewAdapter<T, QkVi
notifyDataSetChanged() notifyDataSetChanged()
} }
fun toggleSelectAll() {
var needToSelectAll = false
// if a non-selected item is found, then we need to select all, otherwise deselect all
for (position in 0 until itemCount)
if (!isSelected(getItemId(position))) {
needToSelectAll = true
break
}
// select or deselect item based on if toggling all selected of deselected
for (position in 0 until itemCount) {
val messageId = getItemId(position)
// if deselecting all then toggle selection (we know all items are selected)
if (!needToSelectAll)
toggleSelection(messageId, useChangeEvent = false)
// else, selecting all, toggle if not already selected
else if (!isSelected(messageId))
toggleSelection(messageId, useChangeEvent = false)
}
// fire a single change event now
selectionChanges.onNext(selection)
notifyDataSetChanged()
}
override fun getItem(index: Int): T? { override fun getItem(index: Int): T? {
if (index < 0) { if (index < 0) {
Timber.w("Only indexes >= 0 are allowed. Input was: $index") Timber.w("Only indexes >= 0 are allowed. Input was: $index")
@@ -132,17 +132,6 @@ class MessagesAdapter @Inject constructor(
private val conversation: Conversation? private val conversation: Conversation?
get() = data?.first?.takeIf { it.isValid } get() = data?.first?.takeIf { it.isValid }
/**
* Mark this message as highlighted
*/
var highlight: Long = -1L
set(value) {
if (field == value) return
field = value
notifyDataSetChanged()
}
private val contactCache = ContactCache() private val contactCache = ContactCache()
private val expanded = HashMap<Long, Boolean>() private val expanded = HashMap<Long, Boolean>()
private val subs = subscriptionManager.activeSubscriptionInfoList private val subs = subscriptionManager.activeSubscriptionInfoList
@@ -405,30 +394,6 @@ class MessagesAdapter @Inject constructor(
} }
} }
fun toggleSelectAll() {
var needToSelectAll = false
// if a non-selected item is found, then we need to select all, otherwise deselect all
for (position in 0 until itemCount)
if (!isSelected(getItemId(position))) {
needToSelectAll = true
break
}
// select or deselect item based on if toggling all selected of deselected
for (position in 0 until itemCount) {
val messageId = getItemId(position)
// if deselecting all then toggle selection (we know all items are selected)
if (!needToSelectAll)
toggleSelection(messageId)
// else, selecting all, toggle if not already selected
else if (!isSelected(messageId))
toggleSelection(messageId)
}
notifyDataSetChanged()
}
fun expandMessages(messageIds: List<Long>, expand: Boolean) { fun expandMessages(messageIds: List<Long>, expand: Boolean) {
messageIds.forEach { messageId -> expanded[messageId] = expand } messageIds.forEach { messageId -> expanded[messageId] = expand }
notifyDataSetChanged() notifyDataSetChanged()
@@ -131,27 +131,4 @@ class ConversationsAdapter @Inject constructor(
return if (getItem(position)?.unread == false) 0 else 1 return if (getItem(position)?.unread == false) 0 else 1
} }
fun toggleSelectAll() {
var needToSelectAll = false
// if a non-selected item is found, then we need to select all, otherwise deselect all
for (position in 0 until itemCount)
if (!isSelected(getItemId(position))) {
needToSelectAll = true
break
}
// select or deselect item based on if toggling all selected of deselected
for (position in 0 until itemCount) {
val threadId = getItemId(position)
// if deselecting all then toggle selection (we know all items are selected)
if (!needToSelectAll)
toggleSelection(threadId)
// else, selecting all, toggle if not already selected
else if (!isSelected(threadId))
toggleSelection(threadId)
}
notifyDataSetChanged()
}
} }
@@ -20,33 +20,36 @@ package dev.octoshrimpy.quik.feature.scheduled
import android.graphics.Typeface import android.graphics.Typeface
import android.os.Bundle import android.os.Bundle
import android.view.Menu
import android.view.MenuItem
import androidx.core.view.isVisible import androidx.core.view.isVisible
import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.ViewModelProviders import androidx.lifecycle.ViewModelProviders
import com.jakewharton.rxbinding2.view.clicks import com.jakewharton.rxbinding2.view.clicks
import dev.octoshrimpy.quik.R import dev.octoshrimpy.quik.R
import dev.octoshrimpy.quik.common.QkDialog
import dev.octoshrimpy.quik.common.base.QkThemedActivity import dev.octoshrimpy.quik.common.base.QkThemedActivity
import dev.octoshrimpy.quik.common.util.FontProvider
import dev.octoshrimpy.quik.common.util.extensions.setBackgroundTint import dev.octoshrimpy.quik.common.util.extensions.setBackgroundTint
import dev.octoshrimpy.quik.common.util.extensions.setTint import dev.octoshrimpy.quik.common.util.extensions.setTint
import dagger.android.AndroidInjection import dagger.android.AndroidInjection
import kotlinx.android.synthetic.main.collapsing_toolbar.* import io.reactivex.subjects.PublishSubject
import io.reactivex.subjects.Subject
import kotlinx.android.synthetic.main.main_activity.toolbar
import kotlinx.android.synthetic.main.scheduled_activity.* import kotlinx.android.synthetic.main.scheduled_activity.*
import javax.inject.Inject import javax.inject.Inject
class ScheduledActivity : QkThemedActivity(), ScheduledView { class ScheduledActivity : QkThemedActivity(), ScheduledView {
@Inject lateinit var dialog: QkDialog @Inject lateinit var scheduledMessageAdapter: ScheduledMessageAdapter
@Inject lateinit var fontProvider: FontProvider
@Inject lateinit var messageAdapter: ScheduledMessageAdapter
@Inject lateinit var viewModelFactory: ViewModelProvider.Factory @Inject lateinit var viewModelFactory: ViewModelProvider.Factory
override val messageClickIntent by lazy { messageAdapter.clicks }
override val messageMenuIntent by lazy { dialog.adapter.menuItemClicks }
override val composeIntent by lazy { compose.clicks() } override val composeIntent by lazy { compose.clicks() }
override val upgradeIntent by lazy { upgrade.clicks() } override val upgradeIntent by lazy { upgrade.clicks() }
override val messagesSelectedIntent by lazy { scheduledMessageAdapter.selectionChanges }
override val optionsItemIntent: Subject<Int> = PublishSubject.create()
override val deleteScheduledMessages: Subject<List<Long>> = PublishSubject.create()
override val sendScheduledMessages: Subject<List<Long>> = PublishSubject.create()
override val backPressedIntent: Subject<Unit> = PublishSubject.create()
private val viewModel by lazy { ViewModelProviders.of(this, viewModelFactory)[ScheduledViewModel::class.java] } private val viewModel by lazy { ViewModelProviders.of(this, viewModelFactory)[ScheduledViewModel::class.java] }
@@ -58,19 +61,8 @@ class ScheduledActivity : QkThemedActivity(), ScheduledView {
showBackButton(true) showBackButton(true)
viewModel.bindView(this) viewModel.bindView(this)
if (!prefs.systemFont.get()) { scheduledMessageAdapter.emptyView = empty
fontProvider.getLato { lato -> messages.adapter = scheduledMessageAdapter
val typeface = Typeface.create(lato, Typeface.BOLD)
collapsingToolbar.setCollapsedTitleTypeface(typeface)
collapsingToolbar.setExpandedTitleTypeface(typeface)
}
}
dialog.title = getString(R.string.scheduled_options_title)
dialog.adapter.setData(R.array.scheduled_options)
messageAdapter.emptyView = empty
messages.adapter = messageAdapter
colors.theme().let { theme -> colors.theme().let { theme ->
sampleMessage.setBackgroundTint(theme.theme) sampleMessage.setBackgroundTint(theme.theme)
@@ -84,14 +76,65 @@ class ScheduledActivity : QkThemedActivity(), ScheduledView {
} }
override fun render(state: ScheduledState) { override fun render(state: ScheduledState) {
messageAdapter.updateData(state.scheduledMessages) scheduledMessageAdapter.updateData(state.scheduledMessages)
setTitle(when {
(state.selectedMessages > 0) ->
getString(R.string.compose_title_selected, state.selectedMessages)
else -> getString(R.string.scheduled_title)
})
// show/hide menu items
toolbar.menu.findItem(R.id.delete)?.isVisible =
((scheduledMessageAdapter.itemCount != 0) && (state.selectedMessages != 0))
toolbar.menu.findItem(R.id.select_all)?.isVisible =
((scheduledMessageAdapter.itemCount > 1) && (state.selectedMessages != 0))
toolbar.menu.findItem(R.id.copy)?.isVisible = (state.selectedMessages != 0)
toolbar.menu.findItem(R.id.send_now)?.isVisible = (state.selectedMessages != 0)
// show compose button
compose.isVisible = state.upgraded compose.isVisible = state.upgraded
upgrade.isVisible = !state.upgraded upgrade.isVisible = !state.upgraded
} }
override fun showMessageOptions() { override fun onBackPressed() = backPressedIntent.onNext(Unit)
dialog.show(this)
override fun clearSelection() = scheduledMessageAdapter.clearSelection()
override fun toggleSelectAll() = scheduledMessageAdapter.toggleSelectAll()
override fun showDeleteDialog(messages: List<Long>) {
val count = messages.size
android.app.AlertDialog.Builder(this)
.setTitle(R.string.dialog_delete_title)
.setMessage(resources.getQuantityString(R.plurals.dialog_delete_chat, count, count))
.setPositiveButton(R.string.button_delete) { _, _ -> deleteScheduledMessages.onNext(messages) }
.setNegativeButton(R.string.button_cancel, null)
.show()
}
override fun showSendNowDialog(messages: List<Long>) {
val count = messages.size
android.app.AlertDialog.Builder(this)
.setTitle(R.string.dialog_delete_title)
.setMessage(resources.getQuantityString(R.plurals.dialog_send_now, count, count))
.setPositiveButton(R.string.main_menu_send_now) { _, _ -> sendScheduledMessages.onNext(messages) }
.setNegativeButton(R.string.button_cancel, null)
.show()
}
override fun onCreateOptionsMenu(menu: Menu?): Boolean {
menuInflater.inflate(R.menu.scheduled_messages, menu)
return super.onCreateOptionsMenu(menu)
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {
optionsItemIntent.onNext(item.itemId)
return true
}
override fun finishActivity() {
finish()
} }
} }
@@ -61,7 +61,13 @@ class ScheduledMessageAdapter @Inject constructor(
return QkViewHolder(view).apply { return QkViewHolder(view).apply {
view.setOnClickListener { view.setOnClickListener {
val message = getItem(adapterPosition) ?: return@setOnClickListener val message = getItem(adapterPosition) ?: return@setOnClickListener
clicks.onNext(message.id) if (toggleSelection(message.id, false))
view.isActivated = isSelected(message.id)
}
view.setOnClickListener {
val message = getItem(adapterPosition) ?: return@setOnClickListener
toggleSelection(message.id)
view.isActivated = isSelected(message.id)
} }
} }
} }
@@ -79,11 +85,18 @@ class ScheduledMessageAdapter @Inject constructor(
holder.date.text = dateFormatter.getScheduledTimestamp(message.date) holder.date.text = dateFormatter.getScheduledTimestamp(message.date)
holder.body.text = message.body holder.body.text = message.body
// update the selected/highlighted state
holder.containerView.isActivated = isSelected(message.id) || highlight == message.id
val adapter = holder.attachments.adapter as ScheduledMessageAttachmentAdapter val adapter = holder.attachments.adapter as ScheduledMessageAttachmentAdapter
adapter.data = message.attachments.map(Uri::parse) adapter.data = message.attachments.map(Uri::parse)
holder.attachments.isVisible = message.attachments.isNotEmpty() holder.attachments.isVisible = message.attachments.isNotEmpty()
} }
override fun getItemId(position: Int): Long {
return getItem(position)?.id ?: -1
}
/** /**
* Cache the contacts in a map by the address, because the messages we're binding don't have * Cache the contacts in a map by the address, because the messages we're binding don't have
* a reference to the contact. * a reference to the contact.
@@ -23,5 +23,6 @@ import io.realm.RealmResults
data class ScheduledState( data class ScheduledState(
val scheduledMessages: RealmResults<ScheduledMessage>? = null, val scheduledMessages: RealmResults<ScheduledMessage>? = null,
val upgraded: Boolean = true val upgraded: Boolean = true,
val selectedMessages: Int = 0,
) )
@@ -23,11 +23,18 @@ import io.reactivex.Observable
interface ScheduledView : QkView<ScheduledState> { interface ScheduledView : QkView<ScheduledState> {
val messageClickIntent: Observable<Long>
val messageMenuIntent: Observable<Int>
val composeIntent: Observable<*> val composeIntent: Observable<*>
val upgradeIntent: Observable<*> val upgradeIntent: Observable<*>
val messagesSelectedIntent: Observable<List<Long>>
val optionsItemIntent: Observable<Int>
val deleteScheduledMessages: Observable<List<Long>>
val sendScheduledMessages: Observable<List<Long>>
val backPressedIntent: Observable<Unit>
fun showMessageOptions() fun clearSelection()
fun toggleSelectAll()
fun showDeleteDialog(messages: List<Long>)
fun showSendNowDialog(messages: List<Long>)
fun finishActivity()
} }
@@ -4,14 +4,12 @@ import android.content.Context
import dev.octoshrimpy.quik.R import dev.octoshrimpy.quik.R
import dev.octoshrimpy.quik.common.Navigator import dev.octoshrimpy.quik.common.Navigator
import dev.octoshrimpy.quik.common.base.QkViewModel import dev.octoshrimpy.quik.common.base.QkViewModel
import dev.octoshrimpy.quik.common.util.ClipboardUtils
import dev.octoshrimpy.quik.common.util.extensions.makeToast
import dev.octoshrimpy.quik.interactor.SendScheduledMessage import dev.octoshrimpy.quik.interactor.SendScheduledMessage
import dev.octoshrimpy.quik.manager.BillingManager import dev.octoshrimpy.quik.manager.BillingManager
import dev.octoshrimpy.quik.repository.ScheduledMessageRepository import dev.octoshrimpy.quik.repository.ScheduledMessageRepository
import com.uber.autodispose.android.lifecycle.scope import com.uber.autodispose.android.lifecycle.scope
import com.uber.autodispose.autoDisposable import com.uber.autodispose.autoDisposable
import io.reactivex.Observable import dev.octoshrimpy.quik.common.util.ClipboardUtils
import io.reactivex.android.schedulers.AndroidSchedulers import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.rxkotlin.plusAssign import io.reactivex.rxkotlin.plusAssign
import io.reactivex.rxkotlin.withLatestFrom import io.reactivex.rxkotlin.withLatestFrom
@@ -23,7 +21,7 @@ class ScheduledViewModel @Inject constructor(
private val context: Context, private val context: Context,
private val navigator: Navigator, private val navigator: Navigator,
private val scheduledMessageRepo: ScheduledMessageRepository, private val scheduledMessageRepo: ScheduledMessageRepository,
private val sendScheduledMessage: SendScheduledMessage private val sendScheduledMessageInteractor: SendScheduledMessage,
) : QkViewModel<ScheduledView, ScheduledState>(ScheduledState( ) : QkViewModel<ScheduledView, ScheduledState>(ScheduledState(
scheduledMessages = scheduledMessageRepo.getScheduledMessages() scheduledMessages = scheduledMessageRepo.getScheduledMessages()
)) { )) {
@@ -36,41 +34,93 @@ class ScheduledViewModel @Inject constructor(
override fun bindView(view: ScheduledView) { override fun bindView(view: ScheduledView) {
super.bindView(view) super.bindView(view)
view.messageClickIntent // update the state when the message selected count changes
view.messagesSelectedIntent
.map { selection -> selection.size }
.autoDisposable(view.scope()) .autoDisposable(view.scope())
.subscribe { view.showMessageOptions() } .subscribe { newState { copy(selectedMessages = it) } }
view.messageMenuIntent // toggle select all / select none
.withLatestFrom(view.messageClickIntent) { itemId, messageId -> view.optionsItemIntent
when (itemId) { .filter { it == R.id.select_all }
0 -> sendScheduledMessage.execute(messageId) .autoDisposable(view.scope())
1 -> scheduledMessageRepo.getScheduledMessage(messageId)?.let { message -> .subscribe { view.toggleSelectAll() }
ClipboardUtils.copy(context, message.body)
context.makeToast(R.string.toast_copied)
}
2 -> {
val deleteSubscription = Observable.fromCallable {
scheduledMessageRepo.deleteScheduledMessage(messageId)
}
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({
// Handle completion, e.g., log success or update UI
}, {
// Handle error, e.g., log or show error message
})
disposables += deleteSubscription // show the delete message dialog if one or more messages selected
view.optionsItemIntent
.filter { it == R.id.delete }
.withLatestFrom(view.messagesSelectedIntent) { _, selectedMessages -> selectedMessages }
.autoDisposable(view.scope())
.subscribe { view.showDeleteDialog(it) }
// copy the selected message text to the clipboard
view.optionsItemIntent
.filter { it == R.id.copy }
.withLatestFrom(view.messagesSelectedIntent) { _, selectedMessages -> selectedMessages }
.autoDisposable(view.scope())
.subscribe {
val messages = it
.mapNotNull(scheduledMessageRepo::getScheduledMessage)
.sortedBy { it.date } // same order as messages on screen
val text = when (messages.size) {
1 -> messages.first().body
else -> messages.fold(StringBuilder()) { acc, message ->
if (acc.isNotEmpty() && message.body.isNotEmpty())
acc.append("\n\n")
acc.append(message.body)
} }
} }
Unit
ClipboardUtils.copy(context, text.toString())
} }
// send the messages now menu item selected
view.optionsItemIntent
.filter { it == R.id.send_now }
.withLatestFrom(view.messagesSelectedIntent) { _, selectedMessages -> selectedMessages }
.autoDisposable(view.scope()) .autoDisposable(view.scope())
.subscribe() .subscribe { view.showSendNowDialog(it) }
// delete message(s) (fired after the confirmation dialog has been shown)
view.deleteScheduledMessages
.observeOn(AndroidSchedulers.mainThread())
.subscribeOn(Schedulers.io())
.autoDisposable(view.scope())
.subscribe {
scheduledMessageRepo.deleteScheduledMessages(it)
view.clearSelection()
}
// send message(s) now (fired after the confirmation dialog has been shown)
view.sendScheduledMessages
.observeOn(AndroidSchedulers.mainThread())
.subscribeOn(Schedulers.io())
.autoDisposable(view.scope())
.subscribe {
it.forEach { sendScheduledMessageInteractor.execute(it) }
view.clearSelection()
}
// navigate back or unselect
view.optionsItemIntent
.filter { it == android.R.id.home }
.map { Unit }
.mergeWith(view.backPressedIntent)
.withLatestFrom(state) { _, state -> state }
.autoDisposable(view.scope())
.subscribe {
when {
(it.selectedMessages > 0) -> view.clearSelection()
else -> view.finishActivity()
}
}
view.composeIntent view.composeIntent
.autoDisposable(view.scope()) .autoDisposable(view.scope())
.subscribe { navigator.showCompose(mode = "scheduling") } .subscribe {
navigator.showCompose(mode = "scheduling")
view.clearSelection()
}
view.upgradeIntent view.upgradeIntent
.autoDisposable(view.scope()) .autoDisposable(view.scope())
@@ -17,145 +17,177 @@
~ You should have received a copy of the GNU General Public License ~ You should have received a copy of the GNU General Public License
~ along with QKSMS. If not, see <http://www.gnu.org/licenses/>. ~ along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
--> -->
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent"
android:orientation="vertical">
<androidx.core.widget.NestedScrollView <androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
style="@style/Toolbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="wrap_content"
app:layout_behavior="@string/appbar_scrolling_view_behavior"> android:gravity="center_vertical"
app:layout_constrainedHeight="true"
app:layout_constraintHeight_max="140dp"
app:layout_constraintTop_toTopOf="parent">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:animateLayoutChanges="true" android:gravity="center_vertical"
android:orientation="vertical"> android:orientation="vertical">
<LinearLayout <dev.octoshrimpy.quik.common.widget.QkTextView
android:id="@+id/empty" android:id="@+id/toolbarTitle"
android:layout_width="match_parent" style="@style/ToolbarText"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:textDirection="ltr"
android:paddingStart="24dp" tools:text="Moez Bhatti" />
android:paddingEnd="24dp">
<dev.octoshrimpy.quik.common.widget.QkTextView
style="@style/TextPrimary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="@string/scheduled_empty_description"
android:textColor="?android:attr/textColorSecondary" />
<Space
android:layout_width="match_parent"
android:layout_height="56dp" />
<dev.octoshrimpy.quik.common.widget.TightTextView
style="@style/ScheduledSampleTextStyle"
android:layout_gravity="end"
android:text="@string/scheduled_empty_message_1" />
<dev.octoshrimpy.quik.common.widget.TightTextView
android:id="@+id/sampleMessage"
style="@style/ScheduledSampleTextStyle"
android:layout_marginTop="16dp"
android:background="@drawable/rounded_rectangle_22dp"
android:text="@string/scheduled_empty_message_2"
tools:backgroundTint="@color/tools_theme"
tools:textColor="@color/textPrimaryDark" />
<dev.octoshrimpy.quik.common.widget.TightTextView
style="@style/ScheduledSampleTextStyle"
android:layout_gravity="end"
android:layout_marginTop="16dp"
android:text="@string/scheduled_empty_message_3" />
<dev.octoshrimpy.quik.common.widget.QkTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:gravity="end"
android:text="@string/scheduled_empty_message_3_timestamp"
android:textColor="?android:attr/textColorSecondary"
android:textStyle="italic"
app:textSize="secondary" />
<Space
android:layout_width="match_parent"
android:layout_height="56dp" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/messages"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="8dp"
android:paddingBottom="8dp"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:listitem="@layout/scheduled_message_list_item" />
</LinearLayout> </LinearLayout>
</androidx.core.widget.NestedScrollView> </androidx.appcompat.widget.Toolbar>
<com.google.android.material.floatingactionbutton.FloatingActionButton <androidx.coordinatorlayout.widget.CoordinatorLayout
android:id="@+id/compose" android:layout_width="match_parent"
android:layout_width="wrap_content" android:layout_height="match_parent">
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="16dp"
android:contentDescription="@string/scheduled_compose_cd"
android:src="@drawable/ic_schedule_send_black_24dp"
android:tint="@color/white"
android:visibility="visible"
tools:backgroundTint="@color/tools_theme" />
<LinearLayout <androidx.core.widget.NestedScrollView
android:id="@+id/upgrade" android:layout_width="match_parent"
android:layout_width="wrap_content" android:layout_height="match_parent"
android:layout_height="48dp" app:layout_behavior="@string/appbar_scrolling_view_behavior">
android:layout_gravity="bottom|end"
android:layout_margin="16dp"
android:background="@drawable/rounded_rectangle_24dp"
android:elevation="4dp"
android:gravity="center"
android:visibility="gone"
tools:backgroundTint="@color/tools_theme">
<ImageView <LinearLayout
android:id="@+id/upgradeIcon" android:layout_width="match_parent"
android:layout_width="24dp" android:layout_height="wrap_content"
android:layout_height="24dp" android:animateLayoutChanges="true"
android:layout_marginStart="12dp" android:orientation="vertical">
android:src="@drawable/ic_star_black_24dp"
tools:tint="@color/textPrimaryDark" />
<dev.octoshrimpy.quik.common.widget.QkTextView <LinearLayout
android:id="@+id/upgradeLabel" android:id="@+id/empty"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingStart="24dp"
android:paddingEnd="24dp">
<dev.octoshrimpy.quik.common.widget.QkTextView
style="@style/TextPrimary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="@string/scheduled_empty_description"
android:textColor="?android:attr/textColorSecondary" />
<Space
android:layout_width="match_parent"
android:layout_height="56dp" />
<dev.octoshrimpy.quik.common.widget.TightTextView
style="@style/ScheduledSampleTextStyle"
android:layout_gravity="end"
android:text="@string/scheduled_empty_message_1" />
<dev.octoshrimpy.quik.common.widget.TightTextView
android:id="@+id/sampleMessage"
style="@style/ScheduledSampleTextStyle"
android:layout_marginTop="16dp"
android:background="@drawable/rounded_rectangle_22dp"
android:text="@string/scheduled_empty_message_2"
tools:backgroundTint="@color/tools_theme"
tools:textColor="@color/textPrimaryDark" />
<dev.octoshrimpy.quik.common.widget.TightTextView
style="@style/ScheduledSampleTextStyle"
android:layout_gravity="end"
android:layout_marginTop="16dp"
android:text="@string/scheduled_empty_message_3" />
<dev.octoshrimpy.quik.common.widget.QkTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:gravity="end"
android:text="@string/scheduled_empty_message_3_timestamp"
android:textColor="?android:attr/textColorSecondary"
android:textStyle="italic"
app:textSize="secondary" />
<Space
android:layout_width="match_parent"
android:layout_height="56dp" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/messages"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="8dp"
android:paddingBottom="8dp"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:listitem="@layout/scheduled_message_list_item" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/compose"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="16dp" android:layout_gravity="bottom|end"
android:layout_marginEnd="16dp" android:layout_margin="16dp"
android:text="@string/title_qksms_plus" android:contentDescription="@string/scheduled_compose_cd"
android:textColor="@color/textPrimaryDark" android:src="@drawable/ic_schedule_send_black_24dp"
android:textStyle="bold" android:tint="@color/white"
app:textSize="primary" /> android:visibility="visible"
tools:backgroundTint="@color/tools_theme" />
</LinearLayout> <LinearLayout
android:id="@+id/upgrade"
android:layout_width="wrap_content"
android:layout_height="48dp"
android:layout_gravity="bottom|end"
android:layout_margin="16dp"
android:background="@drawable/rounded_rectangle_24dp"
android:elevation="4dp"
android:gravity="center"
android:visibility="gone"
tools:backgroundTint="@color/tools_theme">
<include layout="@layout/collapsing_toolbar" /> <ImageView
android:id="@+id/upgradeIcon"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginStart="12dp"
android:src="@drawable/ic_star_black_24dp"
tools:tint="@color/textPrimaryDark" />
<View <dev.octoshrimpy.quik.common.widget.QkTextView
android:layout_width="match_parent" android:id="@+id/upgradeLabel"
android:layout_height="1dp" android:layout_width="wrap_content"
android:layout_gravity="bottom" android:layout_height="wrap_content"
android:background="?android:attr/divider" /> android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:text="@string/title_qksms_plus"
android:textColor="@color/textPrimaryDark"
android:textStyle="bold"
app:textSize="primary" />
</androidx.coordinatorlayout.widget.CoordinatorLayout> </LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_gravity="bottom"
android:background="?android:attr/divider" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</LinearLayout>
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2025
~
~ This file is part of QUIK.
~
~ QUIK 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.
~
~ QUIK 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 QUIK. If not, see <http://www.gnu.org/licenses/>.
-->
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/select_all"
android:icon="?attr/actionModeSelectAllDrawable"
android:title="@string/main_menu_select_all"
android:visible="false"
app:showAsAction="ifRoom" />
<item
android:id="@+id/delete"
android:icon="@drawable/ic_delete_white_24dp"
android:title="@string/main_menu_delete"
android:visible="false"
app:showAsAction="ifRoom" />
<item
android:id="@+id/copy"
android:icon="@drawable/ic_content_copy_black_24dp"
android:title="@string/compose_menu_copy"
android:visible="false"
app:showAsAction="never" />
<item
android:id="@+id/send_now"
android:icon="@drawable/ic_send_black_24dp"
android:title="@string/main_menu_send_now"
android:visible="false"
app:showAsAction="never" />
</menu>
+5 -5
View File
@@ -57,6 +57,7 @@
<string name="main_menu_read">Mark read</string> <string name="main_menu_read">Mark read</string>
<string name="main_menu_unread">Mark unread</string> <string name="main_menu_unread">Mark unread</string>
<string name="main_menu_block">Block</string> <string name="main_menu_block">Block</string>
<string name="main_menu_send_now">Send now</string>
<string name="main_menu_rename_conversation">Rename conversation</string> <string name="main_menu_rename_conversation">Rename conversation</string>
<string name="main_syncing">Syncing messages…</string> <string name="main_syncing">Syncing messages…</string>
<string name="main_sender_you">You: %s</string> <string name="main_sender_you">You: %s</string>
@@ -102,6 +103,10 @@
<item quantity="one">Are you sure you would like to delete this message?</item> <item quantity="one">Are you sure you would like to delete this message?</item>
<item quantity="other">Are you sure you would like to delete %d messages?</item> <item quantity="other">Are you sure you would like to delete %d messages?</item>
</plurals> </plurals>
<plurals name="dialog_send_now">
<item quantity="one">Are you sure you would like to send this message now?</item>
<item quantity="other">Are you sure you would like to send %d messages now?</item>
</plurals>
<string name="dialog_clear_compose_title">Clear message</string> <string name="dialog_clear_compose_title">Clear message</string>
<string name="dialog_clear_compose">Clear the message? This action can\'t be undone.</string> <string name="dialog_clear_compose">Clear the message? This action can\'t be undone.</string>
@@ -234,11 +239,6 @@
<string name="scheduled_compose_cd">Schedule a message</string> <string name="scheduled_compose_cd">Schedule a message</string>
<string name="scheduled_options_title">Scheduled message</string> <string name="scheduled_options_title">Scheduled message</string>
<string name="attachment_missing">Missing</string> <string name="attachment_missing">Missing</string>
<string-array name="scheduled_options">
<item>Send now</item>
<item>Copy text</item>
<item>Delete</item>
</string-array>
<string name="settings_category_appearance">Appearance</string> <string name="settings_category_appearance">Appearance</string>
<string name="settings_category_general">General</string> <string name="settings_category_general">General</string>