Add inset dividers in conversation list

Closes #7074
This commit is contained in:
Moxie Marlinspike 2017-11-13 15:54:38 -08:00
parent 6b94d0679c
commit 03573df00f
7 changed files with 16 additions and 47 deletions

View File

@ -1,13 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item> <item android:left="83dp">
<shape android:shape="rectangle"> <shape android:shape="rectangle">
<solid android:color="@color/conversation_list_item_background_read_light" /> <solid android:color="@color/gray27" />
</shape>
</item>
<item android:left="83dp" android:right="10dp">
<shape android:shape="rectangle">
<solid android:color="@color/conversation_list_divider_light" />
<size android:height="1px" /> <size android:height="1px" />
</shape> </shape>
</item> </item>

View File

@ -1,13 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item> <item android:left="83dp">
<shape android:shape="rectangle"> <shape android:shape="rectangle">
<solid android:color="@color/conversation_list_item_background_read_dark" /> <solid android:color="#33ffffff" />
</shape>
</item>
<item android:left="83dp" android:right="10dp">
<shape android:shape="rectangle">
<solid android:color="@color/conversation_list_divider_dark" />
<size android:height="1px" /> <size android:height="1px" />
</shape> </shape>
</item> </item>

View File

@ -1,13 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="@color/conversation_list_item_background_read_light" />
</shape>
</item>
<item android:left="73dp" android:right="10dp">
<shape android:shape="rectangle">
<solid android:color="@color/conversation_list_divider_light" />
</shape>
</item>
</layer-list>

View File

@ -1,13 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="@color/conversation_list_item_background_read_dark" />
</shape>
</item>
<item android:left="73dp" android:right="10dp">
<shape android:shape="rectangle">
<solid android:color="@color/conversation_list_divider_dark" />
</shape>
</item>
</layer-list>

View File

@ -32,8 +32,8 @@
<color name="conversation_list_item_background_read_dark">#ff000000</color> <color name="conversation_list_item_background_read_dark">#ff000000</color>
<color name="conversation_list_item_background_unread_dark">#ff333333</color> <color name="conversation_list_item_background_unread_dark">#ff333333</color>
<color name="conversation_list_divider_light">#15000000</color> <!--<color name="conversation_list_divider_light">#15000000</color>-->
<color name="conversation_list_divider_dark">#22ffffff</color> <!--<color name="conversation_list_divider_dark">#22ffffff</color>-->
<color name="textsecure_holo_blue_light">#ff33b5e5</color> <color name="textsecure_holo_blue_light">#ff33b5e5</color>

View File

@ -124,8 +124,6 @@
<item name="conversation_list_item_date_color">#ff999999</item> <item name="conversation_list_item_date_color">#ff999999</item>
<item name="conversation_list_item_divider">@drawable/conversation_list_divider_shape</item> <item name="conversation_list_item_divider">@drawable/conversation_list_divider_shape</item>
<item name="share_list_item_divider">@drawable/share_list_divider_shape</item>
<item name="fab_color">@color/textsecure_primary</item> <item name="fab_color">@color/textsecure_primary</item>
<item name="lower_right_divet">@drawable/divet_lower_right_dark</item> <item name="lower_right_divet">@drawable/divet_lower_right_dark</item>
@ -251,8 +249,6 @@
<item name="conversation_list_item_date_color">#ffdddddd</item> <item name="conversation_list_item_date_color">#ffdddddd</item>
<item name="conversation_list_item_divider">@drawable/conversation_list_divider_shape_dark</item> <item name="conversation_list_item_divider">@drawable/conversation_list_divider_shape_dark</item>
<item name="share_list_item_divider">@drawable/share_list_divider_shape_dark</item>
<item name="conversation_group_member_name">#99ffffff</item> <item name="conversation_group_member_name">#99ffffff</item>
<item name="conversation_item_bubble_background">#ff333333</item> <item name="conversation_item_bubble_background">#ff333333</item>

View File

@ -27,6 +27,7 @@ import android.graphics.BitmapFactory;
import android.graphics.Canvas; import android.graphics.Canvas;
import android.graphics.Color; import android.graphics.Color;
import android.graphics.Paint; import android.graphics.Paint;
import android.graphics.drawable.Drawable;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
@ -38,6 +39,7 @@ import android.support.v4.content.Loader;
import android.support.v7.app.AlertDialog; import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import android.support.v7.view.ActionMode; import android.support.v7.view.ActionMode;
import android.support.v7.widget.DividerItemDecoration;
import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.helper.ItemTouchHelper; import android.support.v7.widget.helper.ItemTouchHelper;
@ -125,6 +127,13 @@ public class ConversationListFragment extends Fragment
list.setLayoutManager(new LinearLayoutManager(getActivity())); list.setLayoutManager(new LinearLayoutManager(getActivity()));
list.setItemAnimator(new DeleteItemAnimator()); list.setItemAnimator(new DeleteItemAnimator());
TypedArray typedArray = getContext().obtainStyledAttributes(new int[]{R.attr.conversation_list_item_divider});
Drawable itemDrawable = typedArray.getDrawable(0);
DividerItemDecoration itemDecoration = new DividerItemDecoration(getActivity(), LinearLayoutManager.VERTICAL);
itemDecoration.setDrawable(itemDrawable);
list.addItemDecoration(itemDecoration);
typedArray.recycle();
new ItemTouchHelper(new ArchiveListenerCallback()).attachToRecyclerView(list); new ItemTouchHelper(new ArchiveListenerCallback()).attachToRecyclerView(list);
return view; return view;
@ -551,7 +560,7 @@ public class ConversationListFragment extends Fragment
} }
} }
} }
} }