mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-17 21:47:28 +00:00
Avoid green background on item below archived conversation list item
This commit is contained in:
parent
80042ae3aa
commit
d3c72fa697
@ -91,9 +91,11 @@ import java.util.Set;
|
|||||||
public class ConversationListFragment extends Fragment
|
public class ConversationListFragment extends Fragment
|
||||||
implements LoaderManager.LoaderCallbacks<Cursor>, ActionMode.Callback, ItemClickListener
|
implements LoaderManager.LoaderCallbacks<Cursor>, ActionMode.Callback, ItemClickListener
|
||||||
{
|
{
|
||||||
|
|
||||||
public static final String ARCHIVE = "archive";
|
public static final String ARCHIVE = "archive";
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
private static final String TAG = ConversationListFragment.class.getSimpleName();
|
||||||
|
|
||||||
private MasterSecret masterSecret;
|
private MasterSecret masterSecret;
|
||||||
private ActionMode actionMode;
|
private ActionMode actionMode;
|
||||||
private RecyclerView list;
|
private RecyclerView list;
|
||||||
@ -540,10 +542,10 @@ public class ConversationListFragment extends Fragment
|
|||||||
float dX, float dY, int actionState,
|
float dX, float dY, int actionState,
|
||||||
boolean isCurrentlyActive)
|
boolean isCurrentlyActive)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (actionState == ItemTouchHelper.ACTION_STATE_SWIPE) {
|
if (actionState == ItemTouchHelper.ACTION_STATE_SWIPE) {
|
||||||
View itemView = viewHolder.itemView;
|
View itemView = viewHolder.itemView;
|
||||||
Paint p = new Paint();
|
Paint p = new Paint();
|
||||||
|
float alpha = 1.0f - Math.abs(dX) / (float) viewHolder.itemView.getWidth();
|
||||||
|
|
||||||
if (dX > 0) {
|
if (dX > 0) {
|
||||||
Bitmap icon;
|
Bitmap icon;
|
||||||
@ -551,7 +553,8 @@ public class ConversationListFragment extends Fragment
|
|||||||
if (archive) icon = BitmapFactory.decodeResource(getResources(), R.drawable.ic_unarchive_white_36dp);
|
if (archive) icon = BitmapFactory.decodeResource(getResources(), R.drawable.ic_unarchive_white_36dp);
|
||||||
else icon = BitmapFactory.decodeResource(getResources(), R.drawable.ic_archive_white_36dp);
|
else icon = BitmapFactory.decodeResource(getResources(), R.drawable.ic_archive_white_36dp);
|
||||||
|
|
||||||
p.setColor(getResources().getColor(R.color.green_500));
|
if (alpha > 0) p.setColor(getResources().getColor(R.color.green_500));
|
||||||
|
else p.setColor(Color.WHITE);
|
||||||
|
|
||||||
c.drawRect((float) itemView.getLeft(), (float) itemView.getTop(), dX,
|
c.drawRect((float) itemView.getLeft(), (float) itemView.getTop(), dX,
|
||||||
(float) itemView.getBottom(), p);
|
(float) itemView.getBottom(), p);
|
||||||
@ -562,10 +565,8 @@ public class ConversationListFragment extends Fragment
|
|||||||
p);
|
p);
|
||||||
}
|
}
|
||||||
|
|
||||||
float alpha = 1.0f - Math.abs(dX) / (float) viewHolder.itemView.getWidth();
|
|
||||||
viewHolder.itemView.setAlpha(alpha);
|
viewHolder.itemView.setAlpha(alpha);
|
||||||
viewHolder.itemView.setTranslationX(dX);
|
viewHolder.itemView.setTranslationX(dX);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive);
|
super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user