forked from upstream-mirrors/quik
Move conversation menu options to ConversationInfoActivity
This commit is contained in:
@@ -65,6 +65,7 @@
|
|||||||
<activity
|
<activity
|
||||||
android:name="presentation.feature.gallery.GalleryActivity"
|
android:name="presentation.feature.gallery.GalleryActivity"
|
||||||
android:theme="@style/AppThemeBlack" />
|
android:theme="@style/AppThemeBlack" />
|
||||||
|
<activity android:name="presentation.feature.conversationinfo.ConversationInfoActivity" />
|
||||||
|
|
||||||
<receiver android:name="presentation.receiver.DefaultSmsChangedReceiver">
|
<receiver android:name="presentation.receiver.DefaultSmsChangedReceiver">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ import presentation.common.widget.*
|
|||||||
import presentation.feature.compose.ComposeActivity
|
import presentation.feature.compose.ComposeActivity
|
||||||
import presentation.feature.compose.ComposeViewModel
|
import presentation.feature.compose.ComposeViewModel
|
||||||
import presentation.feature.compose.DetailedChipView
|
import presentation.feature.compose.DetailedChipView
|
||||||
|
import presentation.feature.conversationinfo.ConversationInfoActivity
|
||||||
|
import presentation.feature.conversationinfo.ConversationInfoViewModel
|
||||||
import presentation.feature.gallery.GalleryActivity
|
import presentation.feature.gallery.GalleryActivity
|
||||||
import presentation.feature.gallery.GalleryViewModel
|
import presentation.feature.gallery.GalleryViewModel
|
||||||
import presentation.feature.main.MainActivity
|
import presentation.feature.main.MainActivity
|
||||||
@@ -49,6 +51,7 @@ interface AppComponent {
|
|||||||
fun inject(activity: MainActivity)
|
fun inject(activity: MainActivity)
|
||||||
fun inject(activity: SetupActivity)
|
fun inject(activity: SetupActivity)
|
||||||
fun inject(activity: ComposeActivity)
|
fun inject(activity: ComposeActivity)
|
||||||
|
fun inject(activity: ConversationInfoActivity)
|
||||||
fun inject(activity: GalleryActivity)
|
fun inject(activity: GalleryActivity)
|
||||||
fun inject(activity: PlusActivity)
|
fun inject(activity: PlusActivity)
|
||||||
fun inject(activity: SettingsActivity)
|
fun inject(activity: SettingsActivity)
|
||||||
@@ -79,6 +82,7 @@ interface AppComponent {
|
|||||||
fun inject(viewModel: MainViewModel)
|
fun inject(viewModel: MainViewModel)
|
||||||
fun inject(viewModel: SetupViewModel)
|
fun inject(viewModel: SetupViewModel)
|
||||||
fun inject(viewModel: ComposeViewModel)
|
fun inject(viewModel: ComposeViewModel)
|
||||||
|
fun inject(viewModel: ConversationInfoViewModel)
|
||||||
fun inject(viewModel: GalleryViewModel)
|
fun inject(viewModel: GalleryViewModel)
|
||||||
fun inject(viewModel: PlusViewModel)
|
fun inject(viewModel: PlusViewModel)
|
||||||
fun inject(viewModel: SettingsViewModel)
|
fun inject(viewModel: SettingsViewModel)
|
||||||
|
|||||||
@@ -31,6 +31,8 @@ import android.provider.Telephony
|
|||||||
import common.util.NotificationManager
|
import common.util.NotificationManager
|
||||||
import presentation.feature.compose.ComposeActivity
|
import presentation.feature.compose.ComposeActivity
|
||||||
import presentation.feature.compose.ComposeViewModel
|
import presentation.feature.compose.ComposeViewModel
|
||||||
|
import presentation.feature.conversationinfo.ConversationInfoActivity
|
||||||
|
import presentation.feature.conversationinfo.ConversationInfoViewModel
|
||||||
import presentation.feature.gallery.GalleryActivity
|
import presentation.feature.gallery.GalleryActivity
|
||||||
import presentation.feature.gallery.GalleryViewModel
|
import presentation.feature.gallery.GalleryViewModel
|
||||||
import presentation.feature.main.MainViewModel
|
import presentation.feature.main.MainViewModel
|
||||||
@@ -91,6 +93,12 @@ class Navigator @Inject constructor(val context: Context) {
|
|||||||
startActivity(intent)
|
startActivity(intent)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun showConversationInfo(threadId: Long) {
|
||||||
|
val intent = Intent(context, ConversationInfoActivity::class.java)
|
||||||
|
intent.putExtra("threadId", threadId)
|
||||||
|
startActivity(intent)
|
||||||
|
}
|
||||||
|
|
||||||
fun showImage(partId: Long) {
|
fun showImage(partId: Long) {
|
||||||
val intent = Intent(context, GalleryActivity::class.java)
|
val intent = Intent(context, GalleryActivity::class.java)
|
||||||
intent.putExtra("partId", partId)
|
intent.putExtra("partId", partId)
|
||||||
@@ -142,6 +150,7 @@ class Navigator @Inject constructor(val context: Context) {
|
|||||||
PlusViewModel::class.java -> PlusViewModel()
|
PlusViewModel::class.java -> PlusViewModel()
|
||||||
SetupViewModel::class.java -> SetupViewModel()
|
SetupViewModel::class.java -> SetupViewModel()
|
||||||
ComposeViewModel::class.java -> ComposeViewModel(intent)
|
ComposeViewModel::class.java -> ComposeViewModel(intent)
|
||||||
|
ConversationInfoViewModel::class.java -> ConversationInfoViewModel(intent)
|
||||||
GalleryViewModel::class.java -> GalleryViewModel(intent)
|
GalleryViewModel::class.java -> GalleryViewModel(intent)
|
||||||
SettingsViewModel::class.java -> SettingsViewModel()
|
SettingsViewModel::class.java -> SettingsViewModel()
|
||||||
ThemePickerViewModel::class.java -> ThemePickerViewModel()
|
ThemePickerViewModel::class.java -> ThemePickerViewModel()
|
||||||
|
|||||||
@@ -62,8 +62,7 @@ class ComposeActivity : QkThemedActivity<ComposeViewModel>(), ComposeView {
|
|||||||
override val chipDeletedIntent: Subject<Contact> by lazy { chipsAdapter.chipDeleted }
|
override val chipDeletedIntent: Subject<Contact> by lazy { chipsAdapter.chipDeleted }
|
||||||
override val menuReadyIntent: Observable<Unit> = menu.map { Unit }
|
override val menuReadyIntent: Observable<Unit> = menu.map { Unit }
|
||||||
override val callIntent: Subject<Unit> = PublishSubject.create()
|
override val callIntent: Subject<Unit> = PublishSubject.create()
|
||||||
override val archiveIntent: Subject<Unit> = PublishSubject.create()
|
override val infoIntent: Subject<Unit> = PublishSubject.create()
|
||||||
override val deleteIntent: Subject<Unit> = PublishSubject.create()
|
|
||||||
override val copyTextIntent: Subject<Message> = PublishSubject.create()
|
override val copyTextIntent: Subject<Message> = PublishSubject.create()
|
||||||
override val forwardMessageIntent: Subject<Message> = PublishSubject.create()
|
override val forwardMessageIntent: Subject<Message> = PublishSubject.create()
|
||||||
override val deleteMessageIntent: Subject<Message> = PublishSubject.create()
|
override val deleteMessageIntent: Subject<Message> = PublishSubject.create()
|
||||||
@@ -194,18 +193,8 @@ class ComposeActivity : QkThemedActivity<ComposeViewModel>(), ComposeView {
|
|||||||
if (state.editingMode && chips.adapter == null) chips.adapter = chipsAdapter
|
if (state.editingMode && chips.adapter == null) chips.adapter = chipsAdapter
|
||||||
if (state.editingMode && contacts.adapter == null) contacts.adapter = contactsAdapter
|
if (state.editingMode && contacts.adapter == null) contacts.adapter = contactsAdapter
|
||||||
|
|
||||||
toolbar.menu.findItem(R.id.call)?.run {
|
toolbar.menu.findItem(R.id.call)?.isVisible = !state.editingMode
|
||||||
isVisible = !state.editingMode
|
toolbar.menu.findItem(R.id.info)?.isVisible = !state.editingMode
|
||||||
}
|
|
||||||
|
|
||||||
toolbar.menu.findItem(R.id.archive)?.run {
|
|
||||||
isVisible = !state.editingMode
|
|
||||||
setTitle(if (state.archived) R.string.menu_unarchive else R.string.menu_archive)
|
|
||||||
}
|
|
||||||
|
|
||||||
toolbar.menu.findItem(R.id.delete)?.run {
|
|
||||||
isVisible = !state.editingMode
|
|
||||||
}
|
|
||||||
|
|
||||||
if (chipsAdapter.data.isEmpty() && state.selectedContacts.isNotEmpty()) {
|
if (chipsAdapter.data.isEmpty() && state.selectedContacts.isNotEmpty()) {
|
||||||
message.showKeyboard()
|
message.showKeyboard()
|
||||||
@@ -246,8 +235,7 @@ class ComposeActivity : QkThemedActivity<ComposeViewModel>(), ComposeView {
|
|||||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||||
when (item.itemId) {
|
when (item.itemId) {
|
||||||
R.id.call -> callIntent.onNext(Unit)
|
R.id.call -> callIntent.onNext(Unit)
|
||||||
R.id.archive -> archiveIntent.onNext(Unit)
|
R.id.info -> infoIntent.onNext(Unit)
|
||||||
R.id.delete -> deleteIntent.onNext(Unit)
|
|
||||||
else -> return super.onOptionsItemSelected(item)
|
else -> return super.onOptionsItemSelected(item)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,8 +36,7 @@ interface ComposeView : QkView<ComposeState> {
|
|||||||
val chipDeletedIntent: Subject<Contact>
|
val chipDeletedIntent: Subject<Contact>
|
||||||
val menuReadyIntent: Observable<Unit>
|
val menuReadyIntent: Observable<Unit>
|
||||||
val callIntent: Subject<Unit>
|
val callIntent: Subject<Unit>
|
||||||
val archiveIntent: Subject<Unit>
|
val infoIntent: Subject<Unit>
|
||||||
val deleteIntent: Subject<Unit>
|
|
||||||
val copyTextIntent: Subject<Message>
|
val copyTextIntent: Subject<Message>
|
||||||
val forwardMessageIntent: Subject<Message>
|
val forwardMessageIntent: Subject<Message>
|
||||||
val deleteMessageIntent: Subject<Message>
|
val deleteMessageIntent: Subject<Message>
|
||||||
|
|||||||
@@ -64,9 +64,6 @@ class ComposeViewModel(intent: Intent) : QkViewModel<ComposeView, ComposeState>(
|
|||||||
@Inject lateinit var messageRepo: MessageRepository
|
@Inject lateinit var messageRepo: MessageRepository
|
||||||
@Inject lateinit var navigator: Navigator
|
@Inject lateinit var navigator: Navigator
|
||||||
@Inject lateinit var syncContacts: ContactSync
|
@Inject lateinit var syncContacts: ContactSync
|
||||||
@Inject lateinit var markArchived: MarkArchived
|
|
||||||
@Inject lateinit var markUnarchived: MarkUnarchived
|
|
||||||
@Inject lateinit var deleteConversation: DeleteConversation
|
|
||||||
@Inject lateinit var sendMessage: SendMessage
|
@Inject lateinit var sendMessage: SendMessage
|
||||||
@Inject lateinit var retrySending: RetrySending
|
@Inject lateinit var retrySending: RetrySending
|
||||||
@Inject lateinit var markRead: MarkRead
|
@Inject lateinit var markRead: MarkRead
|
||||||
@@ -159,9 +156,6 @@ class ComposeViewModel(intent: Intent) : QkViewModel<ComposeView, ComposeState>(
|
|||||||
|
|
||||||
disposables += sendMessage
|
disposables += sendMessage
|
||||||
disposables += markRead
|
disposables += markRead
|
||||||
disposables += markArchived
|
|
||||||
disposables += markUnarchived
|
|
||||||
disposables += deleteConversation
|
|
||||||
disposables += conversation.subscribe()
|
disposables += conversation.subscribe()
|
||||||
disposables += messages.subscribe()
|
disposables += messages.subscribe()
|
||||||
disposables += attachments.subscribe { attachments -> newState { it.copy(attachments = attachments) } }
|
disposables += attachments.subscribe { attachments -> newState { it.copy(attachments = attachments) } }
|
||||||
@@ -269,22 +263,11 @@ class ComposeViewModel(intent: Intent) : QkViewModel<ComposeView, ComposeState>(
|
|||||||
.autoDisposable(view.scope())
|
.autoDisposable(view.scope())
|
||||||
.subscribe { address -> navigator.makePhoneCall(address) }
|
.subscribe { address -> navigator.makePhoneCall(address) }
|
||||||
|
|
||||||
// Toggle the archived state of the conversation
|
// Open the conversation settings if info button is clicked
|
||||||
view.archiveIntent
|
view.infoIntent
|
||||||
.withLatestFrom(conversation, { _, conversation -> conversation })
|
.withLatestFrom(conversation, { _, conversation -> conversation })
|
||||||
.autoDisposable(view.scope())
|
.autoDisposable(view.scope())
|
||||||
.subscribe { conversation ->
|
.subscribe { conversation -> navigator.showConversationInfo(conversation.id) }
|
||||||
when (conversation.archived) {
|
|
||||||
true -> markUnarchived.execute(conversation.id, { context.makeToast(R.string.toast_unarchived) })
|
|
||||||
false -> markArchived.execute(conversation.id, { context.makeToast(R.string.toast_archived) })
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Delete the conversation
|
|
||||||
view.deleteIntent
|
|
||||||
.withLatestFrom(conversation, { _, conversation -> conversation })
|
|
||||||
.autoDisposable(view.scope())
|
|
||||||
.subscribe { conversation -> deleteConversation.execute(conversation.id) }
|
|
||||||
|
|
||||||
view.messageClickIntent
|
view.messageClickIntent
|
||||||
.filter { message -> message.isFailedMessage() }
|
.filter { message -> message.isFailedMessage() }
|
||||||
|
|||||||
@@ -0,0 +1,64 @@
|
|||||||
|
/*
|
||||||
|
* 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 presentation.feature.conversationinfo
|
||||||
|
|
||||||
|
import android.os.Bundle
|
||||||
|
import com.jakewharton.rxbinding2.view.clicks
|
||||||
|
import com.moez.QKSMS.R
|
||||||
|
import com.uber.autodispose.android.lifecycle.scope
|
||||||
|
import com.uber.autodispose.kotlin.autoDisposable
|
||||||
|
import common.di.appComponent
|
||||||
|
import kotlinx.android.synthetic.main.conversation_info_activity.*
|
||||||
|
import presentation.common.base.QkThemedActivity
|
||||||
|
|
||||||
|
class ConversationInfoActivity : QkThemedActivity<ConversationInfoViewModel>(), ConversationInfoView {
|
||||||
|
|
||||||
|
override val viewModelClass = ConversationInfoViewModel::class
|
||||||
|
override val archiveIntent by lazy { archive.clicks() }
|
||||||
|
override val deleteIntent by lazy { delete.clicks() }
|
||||||
|
|
||||||
|
init {
|
||||||
|
appComponent.inject(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
setContentView(R.layout.conversation_info_activity)
|
||||||
|
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
||||||
|
viewModel.bindView(this)
|
||||||
|
setTitle(R.string.info_title)
|
||||||
|
|
||||||
|
colors.background
|
||||||
|
.autoDisposable(scope())
|
||||||
|
.subscribe { color -> window.decorView.setBackgroundColor(color) }
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun render(state: ConversationInfoState) {
|
||||||
|
if (state.hasError) {
|
||||||
|
finish()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
archive.title = getString(when(state.archived) {
|
||||||
|
true -> R.string.info_unarchive
|
||||||
|
false -> R.string.info_archive
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
/*
|
||||||
|
* 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 presentation.feature.conversationinfo
|
||||||
|
|
||||||
|
data class ConversationInfoState(
|
||||||
|
val archived: Boolean = false,
|
||||||
|
val hasError: Boolean = false
|
||||||
|
)
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* 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 presentation.feature.conversationinfo
|
||||||
|
|
||||||
|
import io.reactivex.Observable
|
||||||
|
import presentation.common.base.QkView
|
||||||
|
|
||||||
|
interface ConversationInfoView : QkView<ConversationInfoState> {
|
||||||
|
|
||||||
|
val archiveIntent: Observable<Unit>
|
||||||
|
val deleteIntent: Observable<Unit>
|
||||||
|
|
||||||
|
}
|
||||||
+98
@@ -0,0 +1,98 @@
|
|||||||
|
/*
|
||||||
|
* 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 presentation.feature.conversationinfo
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.Intent
|
||||||
|
import com.moez.QKSMS.R
|
||||||
|
import com.uber.autodispose.android.lifecycle.scope
|
||||||
|
import com.uber.autodispose.kotlin.autoDisposable
|
||||||
|
import common.di.appComponent
|
||||||
|
import common.util.extensions.asObservable
|
||||||
|
import common.util.extensions.makeToast
|
||||||
|
import data.model.Conversation
|
||||||
|
import data.repository.MessageRepository
|
||||||
|
import interactor.DeleteConversation
|
||||||
|
import interactor.MarkArchived
|
||||||
|
import interactor.MarkUnarchived
|
||||||
|
import io.reactivex.Observable
|
||||||
|
import io.reactivex.rxkotlin.plusAssign
|
||||||
|
import io.reactivex.rxkotlin.withLatestFrom
|
||||||
|
import presentation.common.base.QkViewModel
|
||||||
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
class ConversationInfoViewModel(intent: Intent) : QkViewModel<ConversationInfoView,
|
||||||
|
ConversationInfoState>(ConversationInfoState()) {
|
||||||
|
|
||||||
|
@Inject lateinit var context: Context
|
||||||
|
@Inject lateinit var messageRepo: MessageRepository
|
||||||
|
@Inject lateinit var markArchived: MarkArchived
|
||||||
|
@Inject lateinit var markUnarchived: MarkUnarchived
|
||||||
|
@Inject lateinit var deleteConversation: DeleteConversation
|
||||||
|
|
||||||
|
private val conversation: Observable<Conversation>
|
||||||
|
|
||||||
|
init {
|
||||||
|
appComponent.inject(this)
|
||||||
|
val threadId = intent.extras?.getLong("threadId") ?: 0L
|
||||||
|
|
||||||
|
conversation = messageRepo.getConversationAsync(threadId)
|
||||||
|
.asObservable<Conversation>()
|
||||||
|
.filter { conversation -> conversation.isLoaded }
|
||||||
|
.doOnNext { conversation ->
|
||||||
|
if (!conversation.isValid) {
|
||||||
|
newState { it.copy(hasError = true) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.filter { conversation -> conversation.isValid }
|
||||||
|
.filter { conversation -> conversation.id != 0L }
|
||||||
|
|
||||||
|
disposables += markArchived
|
||||||
|
disposables += markUnarchived
|
||||||
|
disposables += deleteConversation
|
||||||
|
|
||||||
|
// Update the view's archived state whenever it changes
|
||||||
|
disposables += conversation
|
||||||
|
.map { conversation -> conversation.archived }
|
||||||
|
.distinctUntilChanged()
|
||||||
|
.subscribe { archived -> newState { it.copy(archived = archived) } }
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun bindView(view: ConversationInfoView) {
|
||||||
|
super.bindView(view)
|
||||||
|
|
||||||
|
// Toggle the archived state of the conversation
|
||||||
|
view.archiveIntent
|
||||||
|
.withLatestFrom(conversation, { _, conversation -> conversation })
|
||||||
|
.autoDisposable(view.scope())
|
||||||
|
.subscribe { conversation ->
|
||||||
|
when (conversation.archived) {
|
||||||
|
true -> markUnarchived.execute(conversation.id, { context.makeToast(R.string.toast_unarchived) })
|
||||||
|
false -> markArchived.execute(conversation.id, { context.makeToast(R.string.toast_archived) })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete the conversation
|
||||||
|
view.deleteIntent
|
||||||
|
.withLatestFrom(conversation, { _, conversation -> conversation })
|
||||||
|
.autoDisposable(view.scope())
|
||||||
|
.subscribe { conversation -> deleteConversation.execute(conversation.id) }
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -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="M6,19c0,1.1 0.9,2 2,2h8c1.1,0 2,-0.9 2,-2V7H6v12zM19,4h-3.5l-1,-1h-5l-1,1H5v2h14V4z"/>
|
||||||
|
</vector>
|
||||||
@@ -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="M11,17h2v-6h-2v6zM12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.41,0 -8,-3.59 -8,-8s3.59,-8 8,-8 8,3.59 8,8 -3.59,8 -8,8zM11,9h2L13,7h-2v2z"/>
|
||||||
|
</vector>
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
<?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/>.
|
||||||
|
-->
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<include layout="@layout/toolbar" />
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="1">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingBottom="8dp"
|
||||||
|
android:paddingTop="8dp">
|
||||||
|
|
||||||
|
<presentation.common.widget.PreferenceView
|
||||||
|
android:id="@+id/archive"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:icon="@drawable/ic_folder_black_24dp"
|
||||||
|
app:title="@string/info_archive" />
|
||||||
|
|
||||||
|
<presentation.common.widget.PreferenceView
|
||||||
|
android:id="@+id/delete"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:icon="@drawable/ic_delete_black_24dp"
|
||||||
|
app:title="@string/info_delete" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="8dp"
|
||||||
|
android:background="@drawable/ab_shadow" />
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
@@ -28,15 +28,10 @@
|
|||||||
app:showAsAction="always" />
|
app:showAsAction="always" />
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/archive"
|
android:id="@+id/info"
|
||||||
android:title="@string/menu_archive"
|
android:icon="@drawable/ic_info_outline_black_24dp"
|
||||||
|
android:title="@string/menu_info"
|
||||||
android:visible="false"
|
android:visible="false"
|
||||||
app:showAsAction="never" />
|
app:showAsAction="always" />
|
||||||
|
|
||||||
<item
|
|
||||||
android:id="@+id/delete"
|
|
||||||
android:title="@string/menu_delete"
|
|
||||||
android:visible="false"
|
|
||||||
app:showAsAction="never" />
|
|
||||||
|
|
||||||
</menu>
|
</menu>
|
||||||
@@ -36,6 +36,7 @@
|
|||||||
|
|
||||||
<string name="menu_clear">Clear</string>
|
<string name="menu_clear">Clear</string>
|
||||||
<string name="menu_call">Call</string>
|
<string name="menu_call">Call</string>
|
||||||
|
<string name="menu_info">Details</string>
|
||||||
<string name="menu_archive">Archive conversation</string>
|
<string name="menu_archive">Archive conversation</string>
|
||||||
<string name="menu_unarchive">Remove from archive</string>
|
<string name="menu_unarchive">Remove from archive</string>
|
||||||
<string name="menu_delete">Delete</string>
|
<string name="menu_delete">Delete</string>
|
||||||
@@ -62,6 +63,11 @@
|
|||||||
<string name="scheduled_empty_text">Your scheduled messages will appear here</string>
|
<string name="scheduled_empty_text">Your scheduled messages will appear here</string>
|
||||||
<string name="blocked_empty_text">Your blocked senders will appear here</string>
|
<string name="blocked_empty_text">Your blocked senders will appear here</string>
|
||||||
|
|
||||||
|
<string name="info_title">Details</string>
|
||||||
|
<string name="info_archive">Archive</string>
|
||||||
|
<string name="info_unarchive">Unarchive</string>
|
||||||
|
<string name="info_delete">Delete conversation</string>
|
||||||
|
|
||||||
<string name="settings_default_sms_title">Default SMS app</string>
|
<string name="settings_default_sms_title">Default SMS app</string>
|
||||||
<string name="settings_default_sms_summary_true">QKSMS is your default SMS app</string>
|
<string name="settings_default_sms_summary_true">QKSMS is your default SMS app</string>
|
||||||
<string name="settings_default_sms_summary_false">Set QKSMS as your default SMS app</string>
|
<string name="settings_default_sms_summary_false">Set QKSMS as your default SMS app</string>
|
||||||
|
|||||||
Reference in New Issue
Block a user