forked from upstream-mirrors/quik
Migrate ConversationInfo to Controller
This commit is contained in:
@@ -79,7 +79,6 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
<activity android:name=".feature.settings.SettingsActivity" />
|
<activity android:name=".feature.settings.SettingsActivity" />
|
||||||
<activity android:name=".feature.themepicker.ThemePickerActivity" />
|
|
||||||
<activity android:name=".feature.plus.PlusActivity" />
|
<activity android:name=".feature.plus.PlusActivity" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".feature.gallery.GalleryActivity"
|
android:name=".feature.gallery.GalleryActivity"
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ import com.moez.QKSMS.feature.notificationprefs.NotificationPrefsActivity
|
|||||||
import com.moez.QKSMS.feature.plus.PlusActivity
|
import com.moez.QKSMS.feature.plus.PlusActivity
|
||||||
import com.moez.QKSMS.feature.scheduled.ScheduledActivity
|
import com.moez.QKSMS.feature.scheduled.ScheduledActivity
|
||||||
import com.moez.QKSMS.feature.settings.SettingsActivity
|
import com.moez.QKSMS.feature.settings.SettingsActivity
|
||||||
import com.moez.QKSMS.feature.themepicker.ThemePickerActivity
|
|
||||||
import com.moez.QKSMS.manager.AnalyticsManager
|
import com.moez.QKSMS.manager.AnalyticsManager
|
||||||
import com.moez.QKSMS.manager.NotificationManager
|
import com.moez.QKSMS.manager.NotificationManager
|
||||||
import com.moez.QKSMS.manager.PermissionManager
|
import com.moez.QKSMS.manager.PermissionManager
|
||||||
@@ -163,12 +162,6 @@ class Navigator @Inject constructor(
|
|||||||
startActivity(intent)
|
startActivity(intent)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun showThemePicker(threadId: Long = 0) {
|
|
||||||
val intent = Intent(context, ThemePickerActivity::class.java)
|
|
||||||
intent.putExtra("threadId", threadId)
|
|
||||||
startActivity(intent)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun makePhoneCall(address: String) {
|
fun makePhoneCall(address: String) {
|
||||||
val action = if (permissions.hasCalling()) Intent.ACTION_CALL else Intent.ACTION_DIAL
|
val action = if (permissions.hasCalling()) Intent.ACTION_CALL else Intent.ACTION_DIAL
|
||||||
val intent = Intent(action, Uri.parse("tel:$address"))
|
val intent = Intent(action, Uri.parse("tel:$address"))
|
||||||
|
|||||||
@@ -21,6 +21,9 @@ abstract class QkController<ViewContract : QkViewContract<State>, State, Present
|
|||||||
private val appCompatActivity: AppCompatActivity?
|
private val appCompatActivity: AppCompatActivity?
|
||||||
get() = activity as? AppCompatActivity
|
get() = activity as? AppCompatActivity
|
||||||
|
|
||||||
|
protected val themedActivity: QkThemedActivity?
|
||||||
|
get() = activity as? QkThemedActivity
|
||||||
|
|
||||||
override var containerView: View? = null
|
override var containerView: View? = null
|
||||||
|
|
||||||
@LayoutRes
|
@LayoutRes
|
||||||
|
|||||||
@@ -53,12 +53,12 @@ abstract class QkThemedActivity : QkActivity() {
|
|||||||
* In case the activity should be themed for a specific conversation, the selected conversation
|
* In case the activity should be themed for a specific conversation, the selected conversation
|
||||||
* can be changed by pushing the threadId to this subject
|
* can be changed by pushing the threadId to this subject
|
||||||
*/
|
*/
|
||||||
protected val threadId: Subject<Long> = BehaviorSubject.createDefault(0)
|
val threadId: Subject<Long> = BehaviorSubject.createDefault(0)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Switch the theme if the threadId changes
|
* Switch the theme if the threadId changes
|
||||||
*/
|
*/
|
||||||
protected val theme = threadId
|
val theme = threadId
|
||||||
.distinctUntilChanged()
|
.distinctUntilChanged()
|
||||||
.switchMap { threadId -> colors.themeObservable(threadId) }
|
.switchMap { threadId -> colors.themeObservable(threadId) }
|
||||||
|
|
||||||
|
|||||||
+14
-108
@@ -19,128 +19,34 @@
|
|||||||
package com.moez.QKSMS.feature.conversationinfo
|
package com.moez.QKSMS.feature.conversationinfo
|
||||||
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.text.InputFilter
|
import com.bluelinelabs.conductor.Conductor
|
||||||
import androidx.appcompat.app.AlertDialog
|
import com.bluelinelabs.conductor.Router
|
||||||
import androidx.lifecycle.ViewModelProvider
|
import com.bluelinelabs.conductor.RouterTransaction
|
||||||
import androidx.lifecycle.ViewModelProviders
|
|
||||||
import com.jakewharton.rxbinding2.view.clicks
|
|
||||||
import com.moez.QKSMS.R
|
import com.moez.QKSMS.R
|
||||||
import com.moez.QKSMS.common.Navigator
|
|
||||||
import com.moez.QKSMS.common.androidxcompat.scope
|
|
||||||
import com.moez.QKSMS.common.base.QkThemedActivity
|
import com.moez.QKSMS.common.base.QkThemedActivity
|
||||||
import com.moez.QKSMS.common.util.extensions.animateLayoutChanges
|
|
||||||
import com.moez.QKSMS.common.util.extensions.dpToPx
|
|
||||||
import com.moez.QKSMS.common.util.extensions.resolveThemeColor
|
|
||||||
import com.moez.QKSMS.common.util.extensions.scrapViews
|
|
||||||
import com.moez.QKSMS.common.util.extensions.setVisible
|
|
||||||
import com.moez.QKSMS.common.widget.QkEditText
|
|
||||||
import com.uber.autodispose.kotlin.autoDisposable
|
|
||||||
import dagger.android.AndroidInjection
|
import dagger.android.AndroidInjection
|
||||||
import io.reactivex.subjects.PublishSubject
|
import kotlinx.android.synthetic.main.container_activity.*
|
||||||
import io.reactivex.subjects.Subject
|
|
||||||
import kotlinx.android.synthetic.main.conversation_info_activity.*
|
|
||||||
import javax.inject.Inject
|
|
||||||
|
|
||||||
class ConversationInfoActivity : QkThemedActivity(), ConversationInfoView {
|
class ConversationInfoActivity : QkThemedActivity() {
|
||||||
|
|
||||||
@Inject lateinit var navigator: Navigator
|
private lateinit var router: Router
|
||||||
@Inject lateinit var recipientAdapter: ConversationRecipientAdapter
|
|
||||||
@Inject lateinit var mediaAdapter: ConversationMediaAdapter
|
|
||||||
@Inject lateinit var itemDecoration: GridSpacingItemDecoration
|
|
||||||
@Inject lateinit var viewModelFactory: ViewModelProvider.Factory
|
|
||||||
|
|
||||||
override val nameIntent by lazy { name.clicks() }
|
|
||||||
override val nameChangedIntent: Subject<String> = PublishSubject.create()
|
|
||||||
override val notificationsIntent by lazy { notifications.clicks() }
|
|
||||||
override val themeIntent by lazy { themePrefs.clicks() }
|
|
||||||
override val archiveIntent by lazy { archive.clicks() }
|
|
||||||
override val blockIntent by lazy { block.clicks() }
|
|
||||||
override val deleteIntent by lazy { delete.clicks() }
|
|
||||||
override val confirmDeleteIntent: PublishSubject<Unit> = PublishSubject.create()
|
|
||||||
|
|
||||||
private val viewModel by lazy { ViewModelProviders.of(this, viewModelFactory)[ConversationInfoViewModel::class.java] }
|
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
AndroidInjection.inject(this)
|
AndroidInjection.inject(this)
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
setContentView(R.layout.conversation_info_activity)
|
setContentView(R.layout.container_activity)
|
||||||
showBackButton(true)
|
|
||||||
viewModel.bindView(this)
|
|
||||||
setTitle(R.string.info_title)
|
|
||||||
|
|
||||||
items.postDelayed({ items.animateLayoutChanges = true }, 100)
|
router = Conductor.attachRouter(this, container, savedInstanceState)
|
||||||
|
if (!router.hasRootController()) {
|
||||||
mediaAdapter.thumbnailClicks
|
val threadId = intent.extras?.getLong("threadId") ?: 0L
|
||||||
.autoDisposable(scope())
|
router.setRoot(RouterTransaction.with(ConversationInfoController(threadId)))
|
||||||
.subscribe { view -> navigator.showImageAnimated(this, view) }
|
|
||||||
|
|
||||||
recipients.adapter = recipientAdapter
|
|
||||||
|
|
||||||
media.adapter = mediaAdapter
|
|
||||||
media.addItemDecoration(itemDecoration)
|
|
||||||
|
|
||||||
theme
|
|
||||||
.autoDisposable(scope())
|
|
||||||
.subscribe { recipients.scrapViews() }
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun render(state: ConversationInfoState) {
|
|
||||||
if (state.hasError) {
|
|
||||||
finish()
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
threadId.onNext(state.threadId)
|
|
||||||
recipientAdapter.threadId = state.threadId
|
|
||||||
recipientAdapter.updateData(state.recipients)
|
|
||||||
|
|
||||||
name.setVisible(state.recipients?.size ?: 0 >= 2)
|
|
||||||
name.summary = state.name
|
|
||||||
|
|
||||||
notifications.setVisible(!state.blocked)
|
|
||||||
|
|
||||||
archive.setVisible(!state.blocked)
|
|
||||||
archive.title = getString(when (state.archived) {
|
|
||||||
true -> R.string.info_unarchive
|
|
||||||
false -> R.string.info_archive
|
|
||||||
})
|
|
||||||
|
|
||||||
block.title = getString(when (state.blocked) {
|
|
||||||
true -> R.string.info_unblock
|
|
||||||
false -> R.string.info_block
|
|
||||||
})
|
|
||||||
|
|
||||||
mediaAdapter.updateData(state.media)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun showNameDialog(name: String) {
|
override fun onBackPressed() {
|
||||||
val editText = QkEditText(this).apply {
|
if (!router.handleBack()) {
|
||||||
val padding = 8.dpToPx(this@ConversationInfoActivity)
|
super.onBackPressed()
|
||||||
setPadding(padding * 3, padding, padding * 3, padding)
|
|
||||||
setSingleLine(true)
|
|
||||||
setHint(R.string.info_name_hint)
|
|
||||||
setText(name)
|
|
||||||
setHintTextColor(context.resolveThemeColor(android.R.attr.textColorTertiary))
|
|
||||||
setTextColor(context.resolveThemeColor(android.R.attr.textColorPrimary))
|
|
||||||
filters = arrayOf(InputFilter.LengthFilter(30))
|
|
||||||
background = null
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AlertDialog.Builder(this)
|
|
||||||
.setTitle(R.string.info_name)
|
|
||||||
.setView(editText)
|
|
||||||
.setPositiveButton(R.string.button_save) { _, _ -> nameChangedIntent.onNext(editText.text.toString()) }
|
|
||||||
.setNegativeButton(R.string.button_cancel, null)
|
|
||||||
.show()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun showDeleteDialog() {
|
|
||||||
AlertDialog.Builder(this)
|
|
||||||
.setTitle(R.string.dialog_delete_title)
|
|
||||||
.setMessage(resources.getQuantityString(R.plurals.dialog_delete_message, 1))
|
|
||||||
.setPositiveButton(R.string.button_delete) { _, _ -> confirmDeleteIntent.onNext(Unit) }
|
|
||||||
.setNegativeButton(R.string.button_cancel, null)
|
|
||||||
.show()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
+173
@@ -0,0 +1,173 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2017 Moez Bhatti <moez.bhatti@gmail.com>
|
||||||
|
*
|
||||||
|
* This file is part of QKSMS.
|
||||||
|
*
|
||||||
|
* QKSMS is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* QKSMS is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package com.moez.QKSMS.feature.conversationinfo
|
||||||
|
|
||||||
|
import android.text.InputFilter
|
||||||
|
import android.view.View
|
||||||
|
import androidx.appcompat.app.AlertDialog
|
||||||
|
import com.bluelinelabs.conductor.RouterTransaction
|
||||||
|
import com.bluelinelabs.conductor.changehandler.FadeChangeHandler
|
||||||
|
import com.jakewharton.rxbinding2.view.clicks
|
||||||
|
import com.moez.QKSMS.R
|
||||||
|
import com.moez.QKSMS.common.Navigator
|
||||||
|
import com.moez.QKSMS.common.base.QkController
|
||||||
|
import com.moez.QKSMS.common.util.extensions.animateLayoutChanges
|
||||||
|
import com.moez.QKSMS.common.util.extensions.dpToPx
|
||||||
|
import com.moez.QKSMS.common.util.extensions.resolveThemeColor
|
||||||
|
import com.moez.QKSMS.common.util.extensions.scrapViews
|
||||||
|
import com.moez.QKSMS.common.util.extensions.setVisible
|
||||||
|
import com.moez.QKSMS.common.widget.QkEditText
|
||||||
|
import com.moez.QKSMS.feature.conversationinfo.injection.ConversationInfoModule
|
||||||
|
import com.moez.QKSMS.feature.themepicker.ThemePickerController
|
||||||
|
import com.moez.QKSMS.injection.appComponent
|
||||||
|
import com.uber.autodispose.kotlin.autoDisposable
|
||||||
|
import io.reactivex.Observable
|
||||||
|
import io.reactivex.subjects.PublishSubject
|
||||||
|
import io.reactivex.subjects.Subject
|
||||||
|
import kotlinx.android.synthetic.main.conversation_info_controller.*
|
||||||
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
class ConversationInfoController(val threadId: Long = 0) : QkController<ConversationInfoView, ConversationInfoState, ConversationInfoPresenter>(), ConversationInfoView {
|
||||||
|
|
||||||
|
@Inject override lateinit var presenter: ConversationInfoPresenter
|
||||||
|
@Inject lateinit var navigator: Navigator
|
||||||
|
@Inject lateinit var recipientAdapter: ConversationRecipientAdapter
|
||||||
|
@Inject lateinit var mediaAdapter: ConversationMediaAdapter
|
||||||
|
@Inject lateinit var itemDecoration: GridSpacingItemDecoration
|
||||||
|
|
||||||
|
private val nameChangeSubject: Subject<String> = PublishSubject.create()
|
||||||
|
private val confirmDeleteSubject: Subject<Unit> = PublishSubject.create()
|
||||||
|
|
||||||
|
init {
|
||||||
|
appComponent
|
||||||
|
.conversationInfoBuilder()
|
||||||
|
.conversationInfoModule(ConversationInfoModule(this))
|
||||||
|
.build()
|
||||||
|
.inject(this)
|
||||||
|
|
||||||
|
layoutRes = R.layout.conversation_info_controller
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onViewCreated() {
|
||||||
|
items.postDelayed({ items.animateLayoutChanges = true }, 100)
|
||||||
|
|
||||||
|
mediaAdapter.thumbnailClicks
|
||||||
|
.autoDisposable(scope())
|
||||||
|
.subscribe { view -> navigator.showImageAnimated(activity!!, view) }
|
||||||
|
|
||||||
|
recipients.adapter = recipientAdapter
|
||||||
|
|
||||||
|
media.adapter = mediaAdapter
|
||||||
|
media.addItemDecoration(itemDecoration)
|
||||||
|
|
||||||
|
themedActivity
|
||||||
|
?.theme
|
||||||
|
?.autoDisposable(scope())
|
||||||
|
?.subscribe { recipients?.scrapViews() }
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onAttach(view: View) {
|
||||||
|
super.onAttach(view)
|
||||||
|
presenter.bindIntents(this)
|
||||||
|
setTitle(R.string.info_title)
|
||||||
|
showBackButton(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun nameClicks(): Observable<*> = name.clicks()
|
||||||
|
|
||||||
|
override fun nameChanges(): Observable<String> = nameChangeSubject
|
||||||
|
|
||||||
|
override fun notificationClicks(): Observable<*> = notifications.clicks()
|
||||||
|
|
||||||
|
override fun themeClicks(): Observable<*> = themePrefs.clicks()
|
||||||
|
|
||||||
|
override fun archiveClicks(): Observable<*> = archive.clicks()
|
||||||
|
|
||||||
|
override fun blockClicks(): Observable<*> = block.clicks()
|
||||||
|
|
||||||
|
override fun deleteClicks(): Observable<*> = delete.clicks()
|
||||||
|
|
||||||
|
override fun confirmDelete(): Observable<*> = confirmDeleteSubject
|
||||||
|
|
||||||
|
override fun render(state: ConversationInfoState) {
|
||||||
|
if (state.hasError) {
|
||||||
|
activity?.finish()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
themedActivity?.threadId?.onNext(state.threadId)
|
||||||
|
recipientAdapter.threadId = state.threadId
|
||||||
|
recipientAdapter.updateData(state.recipients)
|
||||||
|
|
||||||
|
name.setVisible(state.recipients?.size ?: 0 >= 2)
|
||||||
|
name.summary = state.name
|
||||||
|
|
||||||
|
notifications.setVisible(!state.blocked)
|
||||||
|
|
||||||
|
archive.setVisible(!state.blocked)
|
||||||
|
archive.title = activity?.getString(when (state.archived) {
|
||||||
|
true -> R.string.info_unarchive
|
||||||
|
false -> R.string.info_archive
|
||||||
|
})
|
||||||
|
|
||||||
|
block.title = activity?.getString(when (state.blocked) {
|
||||||
|
true -> R.string.info_unblock
|
||||||
|
false -> R.string.info_block
|
||||||
|
})
|
||||||
|
|
||||||
|
mediaAdapter.updateData(state.media)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun showNameDialog(name: String) {
|
||||||
|
val editText = QkEditText(activity!!).apply {
|
||||||
|
val padding = 8.dpToPx(activity!!)
|
||||||
|
setPadding(padding * 3, padding, padding * 3, padding)
|
||||||
|
setSingleLine(true)
|
||||||
|
setHint(R.string.info_name_hint)
|
||||||
|
setText(name)
|
||||||
|
setHintTextColor(context.resolveThemeColor(android.R.attr.textColorTertiary))
|
||||||
|
setTextColor(context.resolveThemeColor(android.R.attr.textColorPrimary))
|
||||||
|
filters = arrayOf(InputFilter.LengthFilter(30))
|
||||||
|
background = null
|
||||||
|
}
|
||||||
|
|
||||||
|
AlertDialog.Builder(activity!!)
|
||||||
|
.setTitle(R.string.info_name)
|
||||||
|
.setView(editText)
|
||||||
|
.setPositiveButton(R.string.button_save) { _, _ -> nameChangeSubject.onNext(editText.text.toString()) }
|
||||||
|
.setNegativeButton(R.string.button_cancel, null)
|
||||||
|
.show()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun showThemePicker(threadId: Long) {
|
||||||
|
router.pushController(RouterTransaction.with(ThemePickerController(threadId))
|
||||||
|
.pushChangeHandler(FadeChangeHandler(150))
|
||||||
|
.popChangeHandler(FadeChangeHandler(150)))
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun showDeleteDialog() {
|
||||||
|
AlertDialog.Builder(activity!!)
|
||||||
|
.setTitle(R.string.dialog_delete_title)
|
||||||
|
.setMessage(resources?.getQuantityString(R.plurals.dialog_delete_message, 1))
|
||||||
|
.setPositiveButton(R.string.button_delete) { _, _ -> confirmDeleteSubject.onNext(Unit) }
|
||||||
|
.setNegativeButton(R.string.button_cancel, null)
|
||||||
|
.show()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+14
-15
@@ -19,8 +19,7 @@
|
|||||||
package com.moez.QKSMS.feature.conversationinfo
|
package com.moez.QKSMS.feature.conversationinfo
|
||||||
|
|
||||||
import com.moez.QKSMS.common.Navigator
|
import com.moez.QKSMS.common.Navigator
|
||||||
import com.moez.QKSMS.common.androidxcompat.scope
|
import com.moez.QKSMS.common.base.QkPresenter
|
||||||
import com.moez.QKSMS.common.base.QkViewModel
|
|
||||||
import com.moez.QKSMS.extensions.asObservable
|
import com.moez.QKSMS.extensions.asObservable
|
||||||
import com.moez.QKSMS.interactor.DeleteConversations
|
import com.moez.QKSMS.interactor.DeleteConversations
|
||||||
import com.moez.QKSMS.interactor.MarkArchived
|
import com.moez.QKSMS.interactor.MarkArchived
|
||||||
@@ -38,7 +37,7 @@ import io.reactivex.subjects.Subject
|
|||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import javax.inject.Named
|
import javax.inject.Named
|
||||||
|
|
||||||
class ConversationInfoViewModel @Inject constructor(
|
class ConversationInfoPresenter @Inject constructor(
|
||||||
@Named("threadId") threadId: Long,
|
@Named("threadId") threadId: Long,
|
||||||
messageRepo: MessageRepository,
|
messageRepo: MessageRepository,
|
||||||
private val conversationRepo: ConversationRepository,
|
private val conversationRepo: ConversationRepository,
|
||||||
@@ -48,7 +47,7 @@ class ConversationInfoViewModel @Inject constructor(
|
|||||||
private val markBlocked: MarkBlocked,
|
private val markBlocked: MarkBlocked,
|
||||||
private val markUnblocked: MarkUnblocked,
|
private val markUnblocked: MarkUnblocked,
|
||||||
private val navigator: Navigator
|
private val navigator: Navigator
|
||||||
) : QkViewModel<ConversationInfoView, ConversationInfoState>(
|
) : QkPresenter<ConversationInfoView, ConversationInfoState>(
|
||||||
ConversationInfoState(threadId = threadId, media = messageRepo.getPartsForConversation(threadId))
|
ConversationInfoState(threadId = threadId, media = messageRepo.getPartsForConversation(threadId))
|
||||||
) {
|
) {
|
||||||
|
|
||||||
@@ -98,18 +97,18 @@ class ConversationInfoViewModel @Inject constructor(
|
|||||||
.subscribe { blocked -> newState { copy(blocked = blocked) } }
|
.subscribe { blocked -> newState { copy(blocked = blocked) } }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun bindView(view: ConversationInfoView) {
|
override fun bindIntents(view: ConversationInfoView) {
|
||||||
super.bindView(view)
|
super.bindIntents(view)
|
||||||
|
|
||||||
// Show the conversation title dialog
|
// Show the conversation title dialog
|
||||||
view.nameIntent
|
view.nameClicks()
|
||||||
.withLatestFrom(conversation) { _, conversation -> conversation }
|
.withLatestFrom(conversation) { _, conversation -> conversation }
|
||||||
.map { conversation -> conversation.name }
|
.map { conversation -> conversation.name }
|
||||||
.autoDisposable(view.scope())
|
.autoDisposable(view.scope())
|
||||||
.subscribe(view::showNameDialog)
|
.subscribe(view::showNameDialog)
|
||||||
|
|
||||||
// Set the conversation title
|
// Set the conversation title
|
||||||
view.nameChangedIntent
|
view.nameChanges()
|
||||||
.withLatestFrom(conversation) { name, conversation ->
|
.withLatestFrom(conversation) { name, conversation ->
|
||||||
conversationRepo.setConversationName(conversation.id, name)
|
conversationRepo.setConversationName(conversation.id, name)
|
||||||
}
|
}
|
||||||
@@ -117,19 +116,19 @@ class ConversationInfoViewModel @Inject constructor(
|
|||||||
.subscribe()
|
.subscribe()
|
||||||
|
|
||||||
// Show the notifications settings for the conversation
|
// Show the notifications settings for the conversation
|
||||||
view.notificationsIntent
|
view.notificationClicks()
|
||||||
.withLatestFrom(conversation) { _, conversation -> conversation }
|
.withLatestFrom(conversation) { _, conversation -> conversation }
|
||||||
.autoDisposable(view.scope())
|
.autoDisposable(view.scope())
|
||||||
.subscribe { conversation -> navigator.showNotificationSettings(conversation.id) }
|
.subscribe { conversation -> navigator.showNotificationSettings(conversation.id) }
|
||||||
|
|
||||||
// Show the theme settings for the conversation
|
// Show the theme settings for the conversation
|
||||||
view.themeIntent
|
view.themeClicks()
|
||||||
.withLatestFrom(conversation) { _, conversation -> conversation }
|
.withLatestFrom(conversation) { _, conversation -> conversation }
|
||||||
.autoDisposable(view.scope())
|
.autoDisposable(view.scope())
|
||||||
.subscribe { conversation -> navigator.showThemePicker(conversation.id) }
|
.subscribe { conversation -> view.showThemePicker(conversation.id) }
|
||||||
|
|
||||||
// Toggle the archived state of the conversation
|
// Toggle the archived state of the conversation
|
||||||
view.archiveIntent
|
view.archiveClicks()
|
||||||
.withLatestFrom(conversation) { _, conversation -> conversation }
|
.withLatestFrom(conversation) { _, conversation -> conversation }
|
||||||
.autoDisposable(view.scope())
|
.autoDisposable(view.scope())
|
||||||
.subscribe { conversation ->
|
.subscribe { conversation ->
|
||||||
@@ -140,7 +139,7 @@ class ConversationInfoViewModel @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Toggle the blocked state of the conversation
|
// Toggle the blocked state of the conversation
|
||||||
view.blockIntent
|
view.blockClicks()
|
||||||
.withLatestFrom(conversation) { _, conversation -> conversation }
|
.withLatestFrom(conversation) { _, conversation -> conversation }
|
||||||
.autoDisposable(view.scope())
|
.autoDisposable(view.scope())
|
||||||
.subscribe { conversation ->
|
.subscribe { conversation ->
|
||||||
@@ -151,12 +150,12 @@ class ConversationInfoViewModel @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Show the delete confirmation dialog
|
// Show the delete confirmation dialog
|
||||||
view.deleteIntent
|
view.deleteClicks()
|
||||||
.autoDisposable(view.scope())
|
.autoDisposable(view.scope())
|
||||||
.subscribe { view.showDeleteDialog() }
|
.subscribe { view.showDeleteDialog() }
|
||||||
|
|
||||||
// Delete the conversation
|
// Delete the conversation
|
||||||
view.confirmDeleteIntent
|
view.confirmDelete()
|
||||||
.withLatestFrom(conversation) { _, conversation -> conversation }
|
.withLatestFrom(conversation) { _, conversation -> conversation }
|
||||||
.autoDisposable(view.scope())
|
.autoDisposable(view.scope())
|
||||||
.subscribe { conversation -> deleteConversations.execute(listOf(conversation.id)) }
|
.subscribe { conversation -> deleteConversations.execute(listOf(conversation.id)) }
|
||||||
+11
-10
@@ -18,21 +18,22 @@
|
|||||||
*/
|
*/
|
||||||
package com.moez.QKSMS.feature.conversationinfo
|
package com.moez.QKSMS.feature.conversationinfo
|
||||||
|
|
||||||
import com.moez.QKSMS.common.base.QkView
|
import com.moez.QKSMS.common.base.QkViewContract
|
||||||
import io.reactivex.Observable
|
import io.reactivex.Observable
|
||||||
|
|
||||||
interface ConversationInfoView : QkView<ConversationInfoState> {
|
interface ConversationInfoView : QkViewContract<ConversationInfoState> {
|
||||||
|
|
||||||
val nameIntent: Observable<*>
|
fun nameClicks(): Observable<*>
|
||||||
val nameChangedIntent: Observable<String>
|
fun nameChanges(): Observable<String>
|
||||||
val notificationsIntent: Observable<Unit>
|
fun notificationClicks(): Observable<*>
|
||||||
val themeIntent: Observable<Unit>
|
fun themeClicks(): Observable<*>
|
||||||
val archiveIntent: Observable<Unit>
|
fun archiveClicks(): Observable<*>
|
||||||
val blockIntent: Observable<Unit>
|
fun blockClicks(): Observable<*>
|
||||||
val deleteIntent: Observable<Unit>
|
fun deleteClicks(): Observable<*>
|
||||||
val confirmDeleteIntent: Observable<Unit>
|
fun confirmDelete(): Observable<*>
|
||||||
|
|
||||||
fun showNameDialog(name: String)
|
fun showNameDialog(name: String)
|
||||||
|
fun showThemePicker(threadId: Long)
|
||||||
fun showDeleteDialog()
|
fun showDeleteDialog()
|
||||||
|
|
||||||
}
|
}
|
||||||
+37
@@ -0,0 +1,37 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2017 Moez Bhatti <moez.bhatti@gmail.com>
|
||||||
|
*
|
||||||
|
* This file is part of QKSMS.
|
||||||
|
*
|
||||||
|
* QKSMS is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* QKSMS is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package com.moez.QKSMS.feature.conversationinfo.injection
|
||||||
|
|
||||||
|
import com.moez.QKSMS.feature.conversationinfo.ConversationInfoController
|
||||||
|
import com.moez.QKSMS.injection.scope.ControllerScope
|
||||||
|
import dagger.Subcomponent
|
||||||
|
|
||||||
|
@ControllerScope
|
||||||
|
@Subcomponent(modules = [ConversationInfoModule::class])
|
||||||
|
interface ConversationInfoComponent {
|
||||||
|
|
||||||
|
fun inject(controller: ConversationInfoController)
|
||||||
|
|
||||||
|
@Subcomponent.Builder
|
||||||
|
interface Builder {
|
||||||
|
fun conversationInfoModule(module: ConversationInfoModule): Builder
|
||||||
|
fun build(): ConversationInfoComponent
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+6
-11
@@ -16,25 +16,20 @@
|
|||||||
* 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/>.
|
||||||
*/
|
*/
|
||||||
package com.moez.QKSMS.feature.conversationinfo
|
package com.moez.QKSMS.feature.conversationinfo.injection
|
||||||
|
|
||||||
import androidx.lifecycle.ViewModel
|
import com.moez.QKSMS.feature.conversationinfo.ConversationInfoController
|
||||||
import com.moez.QKSMS.injection.ViewModelKey
|
import com.moez.QKSMS.injection.scope.ControllerScope
|
||||||
import dagger.Module
|
import dagger.Module
|
||||||
import dagger.Provides
|
import dagger.Provides
|
||||||
import dagger.multibindings.IntoMap
|
|
||||||
import javax.inject.Named
|
import javax.inject.Named
|
||||||
|
|
||||||
@Module
|
@Module
|
||||||
class ConversationInfoActivityModule {
|
class ConversationInfoModule(private val controller: ConversationInfoController) {
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
|
@ControllerScope
|
||||||
@Named("threadId")
|
@Named("threadId")
|
||||||
fun provideIntent(activity: ConversationInfoActivity): Long = activity.intent.extras?.getLong("threadId") ?: 0L
|
fun provideThreadId(): Long = controller.threadId
|
||||||
|
|
||||||
@Provides
|
|
||||||
@IntoMap
|
|
||||||
@ViewModelKey(ConversationInfoViewModel::class)
|
|
||||||
fun provideConversationInfoViewModel(viewModel: ConversationInfoViewModel): ViewModel = viewModel
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2017 Moez Bhatti <moez.bhatti@gmail.com>
|
|
||||||
*
|
|
||||||
* This file is part of QKSMS.
|
|
||||||
*
|
|
||||||
* QKSMS is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* QKSMS is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package com.moez.QKSMS.feature.themepicker
|
|
||||||
|
|
||||||
import android.os.Bundle
|
|
||||||
import com.bluelinelabs.conductor.Conductor
|
|
||||||
import com.bluelinelabs.conductor.Router
|
|
||||||
import com.bluelinelabs.conductor.RouterTransaction
|
|
||||||
import com.moez.QKSMS.R
|
|
||||||
import com.moez.QKSMS.common.base.QkThemedActivity
|
|
||||||
import dagger.android.AndroidInjection
|
|
||||||
import kotlinx.android.synthetic.main.container_activity.*
|
|
||||||
|
|
||||||
class ThemePickerActivity : QkThemedActivity() {
|
|
||||||
|
|
||||||
private lateinit var router: Router
|
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
|
||||||
AndroidInjection.inject(this)
|
|
||||||
super.onCreate(savedInstanceState)
|
|
||||||
setContentView(R.layout.container_activity)
|
|
||||||
|
|
||||||
router = Conductor.attachRouter(this, container, savedInstanceState)
|
|
||||||
if (!router.hasRootController()) {
|
|
||||||
val threadId = intent.extras?.getLong("threadId") ?: 0L
|
|
||||||
router.setRoot(RouterTransaction.with(ThemePickerController(threadId)))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onBackPressed() {
|
|
||||||
if (!router.handleBack()) {
|
|
||||||
super.onBackPressed()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -27,6 +27,7 @@ import com.moez.QKSMS.common.widget.QkEditText
|
|||||||
import com.moez.QKSMS.common.widget.QkSwitch
|
import com.moez.QKSMS.common.widget.QkSwitch
|
||||||
import com.moez.QKSMS.common.widget.QkTextView
|
import com.moez.QKSMS.common.widget.QkTextView
|
||||||
import com.moez.QKSMS.feature.compose.DetailedChipView
|
import com.moez.QKSMS.feature.compose.DetailedChipView
|
||||||
|
import com.moez.QKSMS.feature.conversationinfo.injection.ConversationInfoComponent
|
||||||
import com.moez.QKSMS.feature.settings.SettingsController
|
import com.moez.QKSMS.feature.settings.SettingsController
|
||||||
import com.moez.QKSMS.feature.settings.about.AboutController
|
import com.moez.QKSMS.feature.settings.about.AboutController
|
||||||
import com.moez.QKSMS.feature.settings.swipe.SwipeActionsController
|
import com.moez.QKSMS.feature.settings.swipe.SwipeActionsController
|
||||||
@@ -49,6 +50,7 @@ import javax.inject.Singleton
|
|||||||
ServiceBuilderModule::class])
|
ServiceBuilderModule::class])
|
||||||
interface AppComponent {
|
interface AppComponent {
|
||||||
|
|
||||||
|
fun conversationInfoBuilder(): ConversationInfoComponent.Builder
|
||||||
fun themePickerBuilder(): ThemePickerComponent.Builder
|
fun themePickerBuilder(): ThemePickerComponent.Builder
|
||||||
|
|
||||||
fun inject(application: QKApplication)
|
fun inject(application: QKApplication)
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import androidx.lifecycle.ViewModelProvider
|
|||||||
import com.f2prateek.rx.preferences2.RxSharedPreferences
|
import com.f2prateek.rx.preferences2.RxSharedPreferences
|
||||||
import com.moez.QKSMS.common.ViewModelFactory
|
import com.moez.QKSMS.common.ViewModelFactory
|
||||||
import com.moez.QKSMS.common.util.NotificationManagerImpl
|
import com.moez.QKSMS.common.util.NotificationManagerImpl
|
||||||
|
import com.moez.QKSMS.feature.conversationinfo.injection.ConversationInfoComponent
|
||||||
import com.moez.QKSMS.feature.themepicker.injection.ThemePickerComponent
|
import com.moez.QKSMS.feature.themepicker.injection.ThemePickerComponent
|
||||||
import com.moez.QKSMS.manager.AlarmManager
|
import com.moez.QKSMS.manager.AlarmManager
|
||||||
import com.moez.QKSMS.manager.AlarmManagerImpl
|
import com.moez.QKSMS.manager.AlarmManagerImpl
|
||||||
@@ -68,7 +69,9 @@ import dagger.Module
|
|||||||
import dagger.Provides
|
import dagger.Provides
|
||||||
import javax.inject.Singleton
|
import javax.inject.Singleton
|
||||||
|
|
||||||
@Module(subcomponents = [ThemePickerComponent::class])
|
@Module(subcomponents = [
|
||||||
|
ConversationInfoComponent::class,
|
||||||
|
ThemePickerComponent::class])
|
||||||
class AppModule(private var application: Application) {
|
class AppModule(private var application: Application) {
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
|
|||||||
+1
-7
@@ -23,7 +23,6 @@ import com.moez.QKSMS.feature.blocked.BlockedActivityModule
|
|||||||
import com.moez.QKSMS.feature.compose.ComposeActivity
|
import com.moez.QKSMS.feature.compose.ComposeActivity
|
||||||
import com.moez.QKSMS.feature.compose.ComposeActivityModule
|
import com.moez.QKSMS.feature.compose.ComposeActivityModule
|
||||||
import com.moez.QKSMS.feature.conversationinfo.ConversationInfoActivity
|
import com.moez.QKSMS.feature.conversationinfo.ConversationInfoActivity
|
||||||
import com.moez.QKSMS.feature.conversationinfo.ConversationInfoActivityModule
|
|
||||||
import com.moez.QKSMS.feature.gallery.GalleryActivity
|
import com.moez.QKSMS.feature.gallery.GalleryActivity
|
||||||
import com.moez.QKSMS.feature.gallery.GalleryActivityModule
|
import com.moez.QKSMS.feature.gallery.GalleryActivityModule
|
||||||
import com.moez.QKSMS.feature.main.MainActivity
|
import com.moez.QKSMS.feature.main.MainActivity
|
||||||
@@ -37,7 +36,6 @@ import com.moez.QKSMS.feature.qkreply.QkReplyActivityModule
|
|||||||
import com.moez.QKSMS.feature.scheduled.ScheduledActivity
|
import com.moez.QKSMS.feature.scheduled.ScheduledActivity
|
||||||
import com.moez.QKSMS.feature.scheduled.ScheduledActivityModule
|
import com.moez.QKSMS.feature.scheduled.ScheduledActivityModule
|
||||||
import com.moez.QKSMS.feature.settings.SettingsActivity
|
import com.moez.QKSMS.feature.settings.SettingsActivity
|
||||||
import com.moez.QKSMS.feature.themepicker.ThemePickerActivity
|
|
||||||
import com.moez.QKSMS.injection.scope.ActivityScope
|
import com.moez.QKSMS.injection.scope.ActivityScope
|
||||||
import dagger.Module
|
import dagger.Module
|
||||||
import dagger.android.ContributesAndroidInjector
|
import dagger.android.ContributesAndroidInjector
|
||||||
@@ -58,7 +56,7 @@ abstract class ActivityBuilderModule {
|
|||||||
abstract fun bindComposeActivity(): ComposeActivity
|
abstract fun bindComposeActivity(): ComposeActivity
|
||||||
|
|
||||||
@ActivityScope
|
@ActivityScope
|
||||||
@ContributesAndroidInjector(modules = [ConversationInfoActivityModule::class])
|
@ContributesAndroidInjector(modules = [])
|
||||||
abstract fun bindConversationInfoActivity(): ConversationInfoActivity
|
abstract fun bindConversationInfoActivity(): ConversationInfoActivity
|
||||||
|
|
||||||
@ActivityScope
|
@ActivityScope
|
||||||
@@ -85,8 +83,4 @@ abstract class ActivityBuilderModule {
|
|||||||
@ContributesAndroidInjector(modules = [BlockedActivityModule::class])
|
@ContributesAndroidInjector(modules = [BlockedActivityModule::class])
|
||||||
abstract fun bindBlockedActivity(): BlockedActivity
|
abstract fun bindBlockedActivity(): BlockedActivity
|
||||||
|
|
||||||
@ActivityScope
|
|
||||||
@ContributesAndroidInjector(modules = [])
|
|
||||||
abstract fun bindThemePickerActivity(): ThemePickerActivity
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,141 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!--
|
|
||||||
~ Copyright (C) 2017 Moez Bhatti <moez.bhatti@gmail.com>
|
|
||||||
~
|
|
||||||
~ This file is part of QKSMS.
|
|
||||||
~
|
|
||||||
~ QKSMS is free software: you can redistribute it and/or modify
|
|
||||||
~ it under the terms of the GNU General Public License as published by
|
|
||||||
~ the Free Software Foundation, either version 3 of the License, or
|
|
||||||
~ (at your option) any later version.
|
|
||||||
~
|
|
||||||
~ QKSMS is distributed in the hope that it will be useful,
|
|
||||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
~ GNU General Public License for more details.
|
|
||||||
~
|
|
||||||
~ You should have received a copy of the GNU General Public License
|
|
||||||
~ along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
-->
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent">
|
|
||||||
|
|
||||||
<include
|
|
||||||
android:id="@+id/toolbar"
|
|
||||||
layout="@layout/toolbar"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
<androidx.core.widget.NestedScrollView
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
app:layoutManager="android.support.v7.widget.LinearLayoutManager"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/toolbar">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/items"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
|
||||||
android:id="@+id/recipients"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:paddingBottom="8dp"
|
|
||||||
android:paddingTop="8dp"
|
|
||||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
|
||||||
tools:layout_height="72dp"
|
|
||||||
tools:listitem="@layout/conversation_recipient_list_item" />
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="1dp"
|
|
||||||
android:layout_marginBottom="8dp"
|
|
||||||
android:background="?android:attr/divider" />
|
|
||||||
|
|
||||||
<com.moez.QKSMS.common.widget.PreferenceView
|
|
||||||
android:id="@+id/name"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:visibility="gone"
|
|
||||||
app:icon="@drawable/ic_people_black_24dp"
|
|
||||||
app:title="@string/info_name" />
|
|
||||||
|
|
||||||
<com.moez.QKSMS.common.widget.PreferenceView
|
|
||||||
android:id="@+id/notifications"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
app:icon="@drawable/ic_notifications_black_24dp"
|
|
||||||
app:title="@string/info_notifications" />
|
|
||||||
|
|
||||||
<com.moez.QKSMS.common.widget.PreferenceView
|
|
||||||
android:id="@+id/themePrefs"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
app:icon="@drawable/ic_palette_black_24dp"
|
|
||||||
app:title="@string/info_theme" />
|
|
||||||
|
|
||||||
<com.moez.QKSMS.common.widget.PreferenceView
|
|
||||||
android:id="@+id/archive"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
app:icon="@drawable/ic_archive_black_24dp"
|
|
||||||
app:title="@string/info_archive" />
|
|
||||||
|
|
||||||
<com.moez.QKSMS.common.widget.PreferenceView
|
|
||||||
android:id="@+id/block"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
app:icon="@drawable/ic_block_black_24dp"
|
|
||||||
app:title="@string/info_block" />
|
|
||||||
|
|
||||||
<com.moez.QKSMS.common.widget.PreferenceView
|
|
||||||
android:id="@+id/delete"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
app:icon="@drawable/ic_delete_white_24dp"
|
|
||||||
app:title="@string/info_delete" />
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="1dp"
|
|
||||||
android:layout_marginBottom="16dp"
|
|
||||||
android:layout_marginTop="8dp"
|
|
||||||
android:background="?android:attr/divider" />
|
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
|
||||||
android:id="@+id/media"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:nestedScrollingEnabled="false"
|
|
||||||
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
|
|
||||||
app:spanCount="3"
|
|
||||||
tools:listitem="@layout/conversation_media_list_item" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</androidx.core.widget.NestedScrollView>
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="8dp"
|
|
||||||
android:background="@drawable/ab_shadow"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/toolbar" />
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="1dp"
|
|
||||||
android:background="?android:attr/divider"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent" />
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
@@ -0,0 +1,115 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
~ Copyright (C) 2017 Moez Bhatti <moez.bhatti@gmail.com>
|
||||||
|
~
|
||||||
|
~ This file is part of QKSMS.
|
||||||
|
~
|
||||||
|
~ QKSMS is free software: you can redistribute it and/or modify
|
||||||
|
~ it under the terms of the GNU General Public License as published by
|
||||||
|
~ the Free Software Foundation, either version 3 of the License, or
|
||||||
|
~ (at your option) any later version.
|
||||||
|
~
|
||||||
|
~ QKSMS is distributed in the hope that it will be useful,
|
||||||
|
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
~ GNU General Public License for more details.
|
||||||
|
~
|
||||||
|
~ You should have received a copy of the GNU General Public License
|
||||||
|
~ along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
-->
|
||||||
|
<androidx.core.widget.NestedScrollView
|
||||||
|
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"
|
||||||
|
app:layoutManager="android.support.v7.widget.LinearLayoutManager"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/toolbar">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/items"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/recipients"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingBottom="8dp"
|
||||||
|
android:paddingTop="8dp"
|
||||||
|
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||||
|
tools:layout_height="72dp"
|
||||||
|
tools:listitem="@layout/conversation_recipient_list_item" />
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:layout_marginBottom="8dp"
|
||||||
|
android:background="?android:attr/divider" />
|
||||||
|
|
||||||
|
<com.moez.QKSMS.common.widget.PreferenceView
|
||||||
|
android:id="@+id/name"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:icon="@drawable/ic_people_black_24dp"
|
||||||
|
app:title="@string/info_name" />
|
||||||
|
|
||||||
|
<com.moez.QKSMS.common.widget.PreferenceView
|
||||||
|
android:id="@+id/notifications"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:icon="@drawable/ic_notifications_black_24dp"
|
||||||
|
app:title="@string/info_notifications" />
|
||||||
|
|
||||||
|
<com.moez.QKSMS.common.widget.PreferenceView
|
||||||
|
android:id="@+id/themePrefs"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:icon="@drawable/ic_palette_black_24dp"
|
||||||
|
app:title="@string/info_theme" />
|
||||||
|
|
||||||
|
<com.moez.QKSMS.common.widget.PreferenceView
|
||||||
|
android:id="@+id/archive"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:icon="@drawable/ic_archive_black_24dp"
|
||||||
|
app:title="@string/info_archive" />
|
||||||
|
|
||||||
|
<com.moez.QKSMS.common.widget.PreferenceView
|
||||||
|
android:id="@+id/block"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:icon="@drawable/ic_block_black_24dp"
|
||||||
|
app:title="@string/info_block" />
|
||||||
|
|
||||||
|
<com.moez.QKSMS.common.widget.PreferenceView
|
||||||
|
android:id="@+id/delete"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:icon="@drawable/ic_delete_white_24dp"
|
||||||
|
app:title="@string/info_delete" />
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:layout_marginBottom="16dp"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:background="?android:attr/divider" />
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/media"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:nestedScrollingEnabled="false"
|
||||||
|
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
|
||||||
|
app:spanCount="3"
|
||||||
|
tools:listitem="@layout/conversation_media_list_item" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</androidx.core.widget.NestedScrollView>
|
||||||
Reference in New Issue
Block a user