Further preparations for chat archive screen

parent d0adc426
......@@ -32,6 +32,8 @@ import de.kuschku.quasseldroid.ui.chat.add.join.ChannelJoinActivity
import de.kuschku.quasseldroid.ui.chat.add.join.ChannelJoinFragmentProvider
import de.kuschku.quasseldroid.ui.chat.add.query.QueryCreateActivity
import de.kuschku.quasseldroid.ui.chat.add.query.QueryCreateFragmentProvider
import de.kuschku.quasseldroid.ui.chat.archive.ArchiveActivity
import de.kuschku.quasseldroid.ui.chat.archive.ArchiveFragmentProvider
import de.kuschku.quasseldroid.ui.chat.topic.TopicActivity
import de.kuschku.quasseldroid.ui.chat.topic.TopicFragmentProvider
import de.kuschku.quasseldroid.ui.clientsettings.about.AboutActivity
......@@ -105,6 +107,10 @@ abstract class ActivityModule {
@ContributesAndroidInjector(modules = [ChatActivityModule::class, ChatFragmentProvider::class, SettingsModule::class, DatabaseModule::class, ActivityBaseModule::class])
abstract fun bindChatActivity(): ChatActivity
@ActivityScope
@ContributesAndroidInjector(modules = [ArchiveFragmentProvider::class, SettingsModule::class, DatabaseModule::class, ActivityBaseModule::class])
abstract fun bindArchiveActivity(): ArchiveActivity
// Info
@ActivityScope
......
......@@ -23,21 +23,37 @@ import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.RecyclerView
import butterknife.BindView
import butterknife.ButterKnife
import de.kuschku.quasseldroid.R
import de.kuschku.quasseldroid.util.helper.toLiveData
import de.kuschku.quasseldroid.util.service.ServiceBoundFragment
import de.kuschku.quasseldroid.viewmodel.helper.QuasselViewModelHelper
import javax.inject.Inject
class ArchiveFragment : ServiceBoundFragment() {
@BindView(R.id.list_temporary)
lateinit var listTemporary: RecyclerView
@BindView(R.id.list_permanently)
lateinit var listPermanently: RecyclerView
@Inject
lateinit var modelHelper: QuasselViewModelHelper
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?): View? {
val view = inflater.inflate(R.layout.add_join, container, false)
val view = inflater.inflate(R.layout.chat_archive, container, false)
ButterKnife.bind(this, view)
val chatlistId = arguments?.getInt("chatlist_id", -1)
val chatlist = modelHelper.bufferViewConfigMap.map {
it[chatlistId]
}
return view
}
}
......@@ -63,6 +63,7 @@ import de.kuschku.quasseldroid.ui.chat.ChatActivity
import de.kuschku.quasseldroid.ui.chat.add.create.ChannelCreateActivity
import de.kuschku.quasseldroid.ui.chat.add.join.ChannelJoinActivity
import de.kuschku.quasseldroid.ui.chat.add.query.QueryCreateActivity
import de.kuschku.quasseldroid.ui.chat.archive.ArchiveActivity
import de.kuschku.quasseldroid.ui.coresettings.network.NetworkEditActivity
import de.kuschku.quasseldroid.ui.info.channellist.ChannelListActivity
import de.kuschku.quasseldroid.util.ColorContext
......@@ -488,6 +489,10 @@ class BufferViewConfigFragment : ServiceBoundFragment() {
chatListToolbar.menu.findItem(R.id.action_search).isChecked = modelHelper.chat.bufferSearchTemporarilyVisible.value
chatListToolbar.setOnMenuItemClickListener { item ->
when (item.itemId) {
R.id.action_archived_chats -> {
ArchiveActivity.launch(requireContext(), chatlistId = modelHelper.chat.bufferViewConfigId.value)
true
}
R.id.action_search -> {
item.isChecked = !item.isChecked
modelHelper.chat.bufferSearchTemporarilyVisible.onNext(item.isChecked)
......
......@@ -50,6 +50,7 @@
android:text="@string/label_temporarily_archived_long" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/list_temporary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:listitem="@layout/widget_buffer_reorder" />
......@@ -74,6 +75,7 @@
android:text="@string/label_permanently_archived_long" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/list_permanently"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:listitem="@layout/widget_buffer_reorder" />
......
......@@ -18,6 +18,9 @@
-->
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/action_archived_chats"
android:title="@string/label_archived_chats" />
<item
android:id="@+id/action_search"
android:checkable="true"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment