mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-25 09:17:44 +00:00
Fix layout issue
This commit is contained in:
parent
7e6cd7c86f
commit
5761ce959b
@ -63,9 +63,7 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity() {
|
||||
|
||||
private fun setUpRecyclerView() {
|
||||
conversationRecyclerView.adapter = adapter
|
||||
val layoutManager = LinearLayoutManager(this)
|
||||
layoutManager.reverseLayout = true
|
||||
layoutManager.stackFromEnd = true
|
||||
val layoutManager = LinearLayoutManager(this, LinearLayoutManager.VERTICAL, true)
|
||||
conversationRecyclerView.layoutManager = layoutManager
|
||||
// Workaround for the fact that CursorRecyclerViewAdapter doesn't auto-update automatically (even though it says it will)
|
||||
LoaderManager.getInstance(this).restartLoader(0, null, object : LoaderManager.LoaderCallbacks<Cursor> {
|
||||
|
@ -63,7 +63,7 @@ class ConversationAdapter(context: Context, cursor: Cursor, private val onItemPr
|
||||
is VisibleMessageViewHolder -> {
|
||||
val view = viewHolder.view
|
||||
view.background = if (selectedItems.contains(message)) {
|
||||
ColorDrawable(context.resources.getColorWithID(R.color.red, context.theme))
|
||||
ColorDrawable(context.resources.getColorWithID(R.color.accent, context.theme))
|
||||
} else {
|
||||
null
|
||||
}
|
||||
@ -92,12 +92,16 @@ class ConversationAdapter(context: Context, cursor: Cursor, private val onItemPr
|
||||
}
|
||||
|
||||
private fun getMessageBefore(position: Int, cursor: Cursor): MessageRecord? {
|
||||
if (!cursor.moveToPosition(position - 1)) { return null }
|
||||
// The message that's visually before the current one is actually after the current
|
||||
// one for the cursor because the layout is reversed
|
||||
if (!cursor.moveToPosition(position + 1)) { return null }
|
||||
return messageDB.readerFor(cursor).current
|
||||
}
|
||||
|
||||
private fun getMessageAfter(position: Int, cursor: Cursor): MessageRecord? {
|
||||
if (!cursor.moveToPosition(position + 1)) { return null }
|
||||
// The message that's visually after the current one is actually before the current
|
||||
// one for the cursor because the layout is reversed
|
||||
if (!cursor.moveToPosition(position - 1)) { return null }
|
||||
return messageDB.readerFor(cursor).current
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user