forked from upstream-mirrors/quik
Add empty state for messages
This commit is contained in:
@@ -94,6 +94,7 @@ class ComposeActivity : QkThemedActivity<ComposeViewModel>(), ComposeView {
|
||||
val layoutManager = LinearLayoutManager(this).apply { stackFromEnd = true }
|
||||
|
||||
messageAdapter.autoScrollToStart(messageList)
|
||||
messageAdapter.emptyView = messagesEmpty
|
||||
messageAdapter.longClicks.subscribe { message ->
|
||||
AlertDialog.Builder(this)
|
||||
.setItems(R.array.message_options, { _, row ->
|
||||
|
||||
@@ -27,6 +27,7 @@ import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import com.jakewharton.rxbinding2.view.RxView
|
||||
import com.moez.QKSMS.R
|
||||
import common.base.QkRealmAdapter
|
||||
import common.base.QkViewHolder
|
||||
import common.util.Colors
|
||||
import common.util.DateFormatter
|
||||
@@ -38,7 +39,6 @@ import io.reactivex.disposables.CompositeDisposable
|
||||
import io.reactivex.rxkotlin.plusAssign
|
||||
import io.reactivex.subjects.PublishSubject
|
||||
import io.reactivex.subjects.Subject
|
||||
import io.realm.RealmRecyclerViewAdapter
|
||||
import io.realm.RealmResults
|
||||
import kotlinx.android.synthetic.main.message_list_item_in.view.*
|
||||
import model.Conversation
|
||||
@@ -52,7 +52,7 @@ class MessagesAdapter @Inject constructor(
|
||||
private val context: Context,
|
||||
private val colors: Colors,
|
||||
private val dateFormatter: DateFormatter
|
||||
) : RealmRecyclerViewAdapter<Message, QkViewHolder>(null, true) {
|
||||
) : QkRealmAdapter<Message>() {
|
||||
|
||||
companion object {
|
||||
private const val VIEW_TYPE_MESSAGE_IN = 0
|
||||
|
||||
@@ -26,31 +26,6 @@
|
||||
android:orientation="vertical"
|
||||
tools:background="@color/backgroundLight">
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
style="@style/Toolbar"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:background="@color/toolbarLight">
|
||||
|
||||
<common.widget.QkTextView
|
||||
android:id="@+id/toolbarTitle"
|
||||
style="@style/ToolbarText" />
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/chips"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="4dp"
|
||||
android:layout_marginTop="4dp"
|
||||
tools:visibility="gone" />
|
||||
|
||||
</android.support.v7.widget.Toolbar>
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/messageList"
|
||||
android:layout_width="0dp"
|
||||
@@ -65,6 +40,20 @@
|
||||
app:layout_constraintTop_toBottomOf="@id/toolbar"
|
||||
tools:listitem="@layout/message_list_item_in" />
|
||||
|
||||
<common.widget.QkTextView
|
||||
android:id="@+id/messagesEmpty"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="56dp"
|
||||
android:layout_marginStart="56dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/compose_messages_empty"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintTop_toBottomOf="@id/toolbar"
|
||||
app:textColor="tertiary"
|
||||
app:textSize="secondary" />
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/contacts"
|
||||
android:layout_width="0dp"
|
||||
@@ -199,6 +188,31 @@
|
||||
tools:backgroundTint="@color/tools_theme"
|
||||
tools:tint="@color/textPrimaryDark" />
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
style="@style/Toolbar"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:background="@color/toolbarLight">
|
||||
|
||||
<common.widget.QkTextView
|
||||
android:id="@+id/toolbarTitle"
|
||||
style="@style/ToolbarText" />
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/chips"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="4dp"
|
||||
android:layout_marginTop="4dp"
|
||||
tools:visibility="gone" />
|
||||
|
||||
</android.support.v7.widget.Toolbar>
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="8dp"
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
<string name="main_syncing">Optimizing database, this might take a minute…</string>
|
||||
<string name="main_sender_you">You: %s</string>
|
||||
|
||||
<string name="compose_messages_empty">This is the start of your conversation. Say something nice!</string>
|
||||
<string name="compose_hint">Write a message…</string>
|
||||
|
||||
<string name="message_status_sending">Sending…</string>
|
||||
|
||||
Reference in New Issue
Block a user