forked from upstream-mirrors/quik
Make it easier to view entire conversation in QK Reply
This commit is contained in:
@@ -23,6 +23,14 @@ import androidx.recyclerview.widget.RecyclerView
|
||||
|
||||
fun RecyclerView.Adapter<*>.autoScrollToStart(recyclerView: RecyclerView) {
|
||||
registerAdapterDataObserver(object : RecyclerView.AdapterDataObserver() {
|
||||
override fun onChanged() {
|
||||
val layoutManager = recyclerView.layoutManager as? LinearLayoutManager ?: return
|
||||
|
||||
if (layoutManager.stackFromEnd) {
|
||||
recyclerView.scrollToPosition(itemCount - 1)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onItemRangeInserted(positionStart: Int, itemCount: Int) {
|
||||
val layoutManager = recyclerView.layoutManager as? LinearLayoutManager ?: return
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@ import android.view.Window
|
||||
import android.view.WindowManager
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.ViewModelProviders
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.jakewharton.rxbinding2.view.clicks
|
||||
import com.jakewharton.rxbinding2.widget.textChanges
|
||||
import com.moez.QKSMS.R
|
||||
@@ -68,10 +67,8 @@ class QkReplyActivity : QkThemedActivity(), QkReplyView {
|
||||
|
||||
toolbar.clipToOutline = true
|
||||
|
||||
adapter.autoScrollToStart(messages)
|
||||
|
||||
messages.layoutManager = LinearLayoutManager(this).apply { stackFromEnd = true }
|
||||
messages.adapter = adapter
|
||||
messages.adapter?.autoScrollToStart(messages)
|
||||
|
||||
// These theme attributes don't apply themselves on API 21
|
||||
if (Build.VERSION.SDK_INT <= 22) {
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
<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="M7.41,18.59L8.83,20 12,16.83 15.17,20l1.41,-1.41L12,14l-4.59,4.59zM16.59,5.41L15.17,4 12,7.17 8.83,4 7.41,5.41 12,10l4.59,-4.59z"/>
|
||||
</vector>
|
||||
@@ -0,0 +1,9 @@
|
||||
<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="M12,5.83L15.17,9l1.41,-1.41L12,3 7.41,7.59 8.83,9 12,5.83zM12,18.17L8.83,15l-1.41,1.41L12,21l4.59,-4.59L15.17,15 12,18.17z"/>
|
||||
</vector>
|
||||
@@ -41,12 +41,14 @@
|
||||
android:clipToPadding="false"
|
||||
android:paddingBottom="8dp"
|
||||
android:paddingTop="8dp"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||
app:layout_constrainedHeight="true"
|
||||
app:layout_constraintBottom_toBottomOf="@id/composeBackground"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHeight_max="220dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/toolbar"
|
||||
app:stackFromEnd="true"
|
||||
tools:listitem="@layout/message_list_item_in" />
|
||||
|
||||
<View
|
||||
|
||||
@@ -25,18 +25,22 @@
|
||||
android:title="@string/qkreply_menu_read"
|
||||
app:showAsAction="ifRoom" />
|
||||
|
||||
<item
|
||||
android:id="@+id/call"
|
||||
android:title="@string/qkreply_menu_call" />
|
||||
|
||||
<item
|
||||
android:id="@+id/expand"
|
||||
android:title="@string/qkreply_menu_expand" />
|
||||
android:icon="@drawable/ic_unfold_more_black_24dp"
|
||||
android:title="@string/qkreply_menu_expand"
|
||||
app:showAsAction="ifRoom" />
|
||||
|
||||
<item
|
||||
android:id="@+id/collapse"
|
||||
android:icon="@drawable/ic_unfold_less_black_24dp"
|
||||
android:title="@string/qkreply_menu_collapse"
|
||||
android:visible="false" />
|
||||
android:visible="false"
|
||||
app:showAsAction="ifRoom" />
|
||||
|
||||
<item
|
||||
android:id="@+id/call"
|
||||
android:title="@string/qkreply_menu_call" />
|
||||
|
||||
<item
|
||||
android:id="@+id/view"
|
||||
|
||||
Reference in New Issue
Block a user