mirror of
				https://github.com/pierre42100/ComunicAndroid
				synced 2025-11-04 11:34:06 +00:00 
			
		
		
		
	Conversations message auto-scroll
This commit is contained in:
		@@ -72,6 +72,11 @@ public class ConversationFragment extends Fragment
 | 
			
		||||
     */
 | 
			
		||||
    private ConversationRefreshRunnable refreshRunnable;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Converstion message listView
 | 
			
		||||
     */
 | 
			
		||||
    private ListView convMessListView;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Conversation messages helper
 | 
			
		||||
     */
 | 
			
		||||
@@ -121,7 +126,7 @@ public class ConversationFragment extends Fragment
 | 
			
		||||
        super.onViewCreated(view, savedInstanceState);
 | 
			
		||||
 | 
			
		||||
        //Conversation messages listView
 | 
			
		||||
        ListView convMessListView = view.findViewById(R.id.fragment_conversation_messageslist);
 | 
			
		||||
        convMessListView = view.findViewById(R.id.fragment_conversation_messageslist);
 | 
			
		||||
 | 
			
		||||
        //Need user ID
 | 
			
		||||
        int userID = new AccountUtils(getActivity()).get_current_user_id();
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,25 @@
 | 
			
		||||
<?xml version="1.0" encoding="utf-8"?>
 | 
			
		||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
 | 
			
		||||
    <item android:state_pressed="true" >
 | 
			
		||||
        <shape
 | 
			
		||||
            android:shape="rectangle" >
 | 
			
		||||
 | 
			
		||||
            <solid android:color="#3949ab" >
 | 
			
		||||
            </solid>
 | 
			
		||||
 | 
			
		||||
            <corners android:radius="5dp" >
 | 
			
		||||
            </corners>
 | 
			
		||||
        </shape>
 | 
			
		||||
    </item>
 | 
			
		||||
    <item>
 | 
			
		||||
        <shape
 | 
			
		||||
            android:shape="rectangle" >
 | 
			
		||||
 | 
			
		||||
            <solid android:color="@color/conversation_user_messages_background">
 | 
			
		||||
            </solid>
 | 
			
		||||
 | 
			
		||||
            <corners android:radius="5dp" >
 | 
			
		||||
            </corners>
 | 
			
		||||
        </shape>
 | 
			
		||||
    </item>
 | 
			
		||||
</selector>
 | 
			
		||||
@@ -0,0 +1,25 @@
 | 
			
		||||
<?xml version="1.0" encoding="utf-8"?>
 | 
			
		||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
 | 
			
		||||
    <item android:state_pressed="true" >
 | 
			
		||||
        <shape
 | 
			
		||||
            android:shape="rectangle" >
 | 
			
		||||
 | 
			
		||||
            <solid android:color="#C0C0C0" >
 | 
			
		||||
            </solid>
 | 
			
		||||
 | 
			
		||||
            <corners android:radius="5dp" >
 | 
			
		||||
            </corners>
 | 
			
		||||
        </shape>
 | 
			
		||||
    </item>
 | 
			
		||||
    <item>
 | 
			
		||||
        <shape
 | 
			
		||||
            android:shape="rectangle" >
 | 
			
		||||
 | 
			
		||||
            <solid android:color="@color/conversation_otheruser_messages_background">
 | 
			
		||||
            </solid>
 | 
			
		||||
 | 
			
		||||
            <corners android:radius="5dp" >
 | 
			
		||||
            </corners>
 | 
			
		||||
        </shape>
 | 
			
		||||
    </item>
 | 
			
		||||
</selector>
 | 
			
		||||
@@ -9,6 +9,8 @@
 | 
			
		||||
        android:layout_height="0dp"
 | 
			
		||||
        android:layout_weight="1"
 | 
			
		||||
        android:divider="@null"
 | 
			
		||||
        android:stackFromBottom="true"
 | 
			
		||||
        android:transcriptMode="alwaysScroll"
 | 
			
		||||
        />
 | 
			
		||||
 | 
			
		||||
</LinearLayout>
 | 
			
		||||
@@ -34,7 +34,8 @@
 | 
			
		||||
                android:layout_height="26dp"
 | 
			
		||||
                android:layout_gravity="center"
 | 
			
		||||
                android:layout_marginEnd="5dp"
 | 
			
		||||
                android:src="@drawable/default_account_image" />
 | 
			
		||||
                android:src="@drawable/default_account_image"
 | 
			
		||||
                android:contentDescription="@string/user_image_description"/>
 | 
			
		||||
 | 
			
		||||
            <TextView
 | 
			
		||||
                android:id="@+id/fragment_conversation_message_item_content"
 | 
			
		||||
@@ -42,11 +43,11 @@
 | 
			
		||||
                android:layout_height="wrap_content"
 | 
			
		||||
                android:layout_gravity="center"
 | 
			
		||||
                android:layout_toEndOf="@id/fragment_conversation_message_item_accountimage"
 | 
			
		||||
                android:background="@color/conversation_otheruser_messages_background"
 | 
			
		||||
                android:padding="5dp"
 | 
			
		||||
                android:paddingEnd="15dp"
 | 
			
		||||
                android:paddingStart="15dp"
 | 
			
		||||
                android:textColor="@color/conversation_otheruser_messages_textColor"
 | 
			
		||||
                android:background="@drawable/fragment_conversation_message_otheruser_bg"
 | 
			
		||||
                tools:text="A message" />
 | 
			
		||||
 | 
			
		||||
        </RelativeLayout>
 | 
			
		||||
@@ -67,6 +68,7 @@
 | 
			
		||||
            android:layout_alignParentEnd="true"
 | 
			
		||||
            android:layout_gravity="end"
 | 
			
		||||
            android:layout_marginStart="5dp"
 | 
			
		||||
            android:contentDescription="@string/user_image_description"
 | 
			
		||||
            android:src="@drawable/default_account_image" />
 | 
			
		||||
 | 
			
		||||
        <TextView
 | 
			
		||||
@@ -75,7 +77,7 @@
 | 
			
		||||
            android:layout_height="wrap_content"
 | 
			
		||||
            android:layout_gravity="center"
 | 
			
		||||
            android:layout_toStartOf="@id/fragment_conversation_message_item_accountimage_right"
 | 
			
		||||
            android:background="@color/conversation_user_messages_background"
 | 
			
		||||
            android:background="@drawable/fragment_conversation_message_currentuser_bg"
 | 
			
		||||
            android:padding="5dp"
 | 
			
		||||
            android:paddingEnd="15dp"
 | 
			
		||||
            android:paddingStart="15dp"
 | 
			
		||||
 
 | 
			
		||||
@@ -12,6 +12,6 @@
 | 
			
		||||
    <!-- Conversation messages -->
 | 
			
		||||
    <color name="conversation_user_messages_background">#3F51B5</color>
 | 
			
		||||
    <color name="conversation_user_messages_textColor">#FFFFFF</color>
 | 
			
		||||
    <color name="conversation_otheruser_messages_background">#aaa</color>
 | 
			
		||||
    <color name="conversation_otheruser_messages_background">#D8D8D8</color>
 | 
			
		||||
    <color name="conversation_otheruser_messages_textColor">#000000</color>
 | 
			
		||||
</resources>
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user