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)
}
override fun deleteScheduledMessages(ids: List<Long>) {
ids.forEach { deleteScheduledMessage(it) }
}
// Ensure to clear disposables when the repository is no longer needed
fun clearDisposables() {
disposables.clear()
@@ -50,4 +50,7 @@ interface ScheduledMessageRepository {
*/
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>()
/**
* 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
*
* 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]
*/
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
selection = when (selection.contains(id)) {
@@ -66,7 +81,8 @@ abstract class QkRealmAdapter<T : RealmModel> : RealmRecyclerViewAdapter<T, QkVi
false -> selection + id
}
selectionChanges.onNext(selection)
if (useChangeEvent)
selectionChanges.onNext(selection)
return true
}
@@ -80,6 +96,33 @@ abstract class QkRealmAdapter<T : RealmModel> : RealmRecyclerViewAdapter<T, QkVi
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? {
if (index < 0) {
Timber.w("Only indexes >= 0 are allowed. Input was: $index")
@@ -132,17 +132,6 @@ class MessagesAdapter @Inject constructor(
private val conversation: Conversation?
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 expanded = HashMap<Long, Boolean>()
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) {
messageIds.forEach { messageId -> expanded[messageId] = expand }
notifyDataSetChanged()
@@ -131,27 +131,4 @@ class ConversationsAdapter @Inject constructor(
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.os.Bundle
import android.view.Menu
import android.view.MenuItem
import androidx.core.view.isVisible
import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.ViewModelProviders
import com.jakewharton.rxbinding2.view.clicks
import dev.octoshrimpy.quik.R
import dev.octoshrimpy.quik.common.QkDialog
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.setTint
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 javax.inject.Inject
class ScheduledActivity : QkThemedActivity(), ScheduledView {
@Inject lateinit var dialog: QkDialog
@Inject lateinit var fontProvider: FontProvider
@Inject lateinit var messageAdapter: ScheduledMessageAdapter
@Inject lateinit var scheduledMessageAdapter: ScheduledMessageAdapter
@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 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] }
@@ -58,19 +61,8 @@ class ScheduledActivity : QkThemedActivity(), ScheduledView {
showBackButton(true)
viewModel.bindView(this)
if (!prefs.systemFont.get()) {
fontProvider.getLato { lato ->
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
scheduledMessageAdapter.emptyView = empty
messages.adapter = scheduledMessageAdapter
colors.theme().let { theme ->
sampleMessage.setBackgroundTint(theme.theme)
@@ -84,14 +76,65 @@ class ScheduledActivity : QkThemedActivity(), ScheduledView {
}
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
upgrade.isVisible = !state.upgraded
}
override fun showMessageOptions() {
dialog.show(this)
override fun onBackPressed() = backPressedIntent.onNext(Unit)
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 {
view.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.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
adapter.data = message.attachments.map(Uri::parse)
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
* a reference to the contact.
@@ -23,5 +23,6 @@ import io.realm.RealmResults
data class ScheduledState(
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> {
val messageClickIntent: Observable<Long>
val messageMenuIntent: Observable<Int>
val composeIntent: 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.common.Navigator
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.manager.BillingManager
import dev.octoshrimpy.quik.repository.ScheduledMessageRepository
import com.uber.autodispose.android.lifecycle.scope
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.rxkotlin.plusAssign
import io.reactivex.rxkotlin.withLatestFrom
@@ -23,7 +21,7 @@ class ScheduledViewModel @Inject constructor(
private val context: Context,
private val navigator: Navigator,
private val scheduledMessageRepo: ScheduledMessageRepository,
private val sendScheduledMessage: SendScheduledMessage
private val sendScheduledMessageInteractor: SendScheduledMessage,
) : QkViewModel<ScheduledView, ScheduledState>(ScheduledState(
scheduledMessages = scheduledMessageRepo.getScheduledMessages()
)) {
@@ -36,41 +34,93 @@ class ScheduledViewModel @Inject constructor(
override fun bindView(view: ScheduledView) {
super.bindView(view)
view.messageClickIntent
// update the state when the message selected count changes
view.messagesSelectedIntent
.map { selection -> selection.size }
.autoDisposable(view.scope())
.subscribe { view.showMessageOptions() }
.subscribe { newState { copy(selectedMessages = it) } }
view.messageMenuIntent
.withLatestFrom(view.messageClickIntent) { itemId, messageId ->
when (itemId) {
0 -> sendScheduledMessage.execute(messageId)
1 -> scheduledMessageRepo.getScheduledMessage(messageId)?.let { message ->
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
})
// toggle select all / select none
view.optionsItemIntent
.filter { it == R.id.select_all }
.autoDisposable(view.scope())
.subscribe { view.toggleSelectAll() }
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())
.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
.autoDisposable(view.scope())
.subscribe { navigator.showCompose(mode = "scheduling") }
.subscribe {
navigator.showCompose(mode = "scheduling")
view.clearSelection()
}
view.upgradeIntent
.autoDisposable(view.scope())
@@ -17,145 +17,177 @@
~ You should have received a copy of the GNU General Public License
~ 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:tools="http://schemas.android.com/tools"
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_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
android:layout_height="wrap_content"
android:gravity="center_vertical"
app:layout_constrainedHeight="true"
app:layout_constraintHeight_max="140dp"
app:layout_constraintTop_toTopOf="parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:animateLayoutChanges="true"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:orientation="vertical">
<LinearLayout
android:id="@+id/empty"
android:layout_width="match_parent"
<dev.octoshrimpy.quik.common.widget.QkTextView
android:id="@+id/toolbarTitle"
style="@style/ToolbarText"
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" />
android:textDirection="ltr"
tools:text="Moez Bhatti" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</androidx.appcompat.widget.Toolbar>
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/compose"
android:layout_width="wrap_content"
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" />
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<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">
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<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" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:animateLayoutChanges="true"
android:orientation="vertical">
<dev.octoshrimpy.quik.common.widget.QkTextView
android:id="@+id/upgradeLabel"
<LinearLayout
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_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:text="@string/title_qksms_plus"
android:textColor="@color/textPrimaryDark"
android:textStyle="bold"
app:textSize="primary" />
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>
<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
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_gravity="bottom"
android:background="?android:attr/divider" />
<dev.octoshrimpy.quik.common.widget.QkTextView
android:id="@+id/upgradeLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
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_unread">Mark unread</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_syncing">Syncing messages…</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="other">Are you sure you would like to delete %d messages?</item>
</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">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_options_title">Scheduled message</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_general">General</string>