mirror of
				https://github.com/oxen-io/session-android.git
				synced 2025-11-04 11:11:40 +00:00 
			
		
		
		
	Fix layout issue
This commit is contained in:
		@@ -63,9 +63,7 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    private fun setUpRecyclerView() {
 | 
					    private fun setUpRecyclerView() {
 | 
				
			||||||
        conversationRecyclerView.adapter = adapter
 | 
					        conversationRecyclerView.adapter = adapter
 | 
				
			||||||
        val layoutManager = LinearLayoutManager(this)
 | 
					        val layoutManager = LinearLayoutManager(this, LinearLayoutManager.VERTICAL, true)
 | 
				
			||||||
        layoutManager.reverseLayout = true
 | 
					 | 
				
			||||||
        layoutManager.stackFromEnd = true
 | 
					 | 
				
			||||||
        conversationRecyclerView.layoutManager = layoutManager
 | 
					        conversationRecyclerView.layoutManager = layoutManager
 | 
				
			||||||
        // Workaround for the fact that CursorRecyclerViewAdapter doesn't auto-update automatically (even though it says it will)
 | 
					        // 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> {
 | 
					        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 -> {
 | 
					            is VisibleMessageViewHolder -> {
 | 
				
			||||||
                val view = viewHolder.view
 | 
					                val view = viewHolder.view
 | 
				
			||||||
                view.background = if (selectedItems.contains(message)) {
 | 
					                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 {
 | 
					                } else {
 | 
				
			||||||
                    null
 | 
					                    null
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
@@ -92,12 +92,16 @@ class ConversationAdapter(context: Context, cursor: Cursor, private val onItemPr
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private fun getMessageBefore(position: Int, cursor: Cursor): MessageRecord? {
 | 
					    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
 | 
					        return messageDB.readerFor(cursor).current
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private fun getMessageAfter(position: Int, cursor: Cursor): MessageRecord? {
 | 
					    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
 | 
					        return messageDB.readerFor(cursor).current
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user