Added swipe to delete

pull/177/head
M66B 5 years ago
parent b6e04abbde
commit 531e1347a9

@ -172,6 +172,7 @@ public class FragmentAccount extends FragmentBase {
static final Long SWIPE_ACTION_HIDE = -4L;
static final Long SWIPE_ACTION_MOVE = -5L;
static final Long SWIPE_ACTION_FLAG = -6L;
static final Long SWIPE_ACTION_DELETE = -7L;
@Override
public void onCreate(Bundle savedInstanceState) {
@ -1728,6 +1729,11 @@ public class FragmentAccount extends FragmentBase {
move.name = getString(R.string.title_move);
folders.add(move);
EntityFolder delete = new EntityFolder();
delete.id = SWIPE_ACTION_DELETE;
delete.name = getString(R.string.title_delete);
folders.add(delete);
folders.addAll(_folders);
adapterSwipe.clear();

@ -1688,6 +1688,9 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
? R.drawable.baseline_visibility_24 : R.drawable.baseline_timer_off_24));
else if (FragmentAccount.SWIPE_ACTION_MOVE.equals(action))
icon = R.drawable.baseline_folder_24;
else if (FragmentAccount.SWIPE_ACTION_DELETE.equals(action) ||
(action.equals(message.folder) && EntityFolder.TRASH.equals(message.folderType)))
icon = R.drawable.baseline_delete_forever_24;
else
icon = EntityFolder.getIcon(dX > 0 ? swipes.right_type : swipes.left_type);
Drawable d = getResources().getDrawable(icon, getContext().getTheme()).mutate();
@ -1771,7 +1774,8 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
else if (FragmentAccount.SWIPE_ACTION_MOVE.equals(action)) {
adapter.notifyItemChanged(pos);
onSwipeMove(message);
} else if (action.equals(message.folder) && EntityFolder.TRASH.equals(message.folderType)) {
} else if (FragmentAccount.SWIPE_ACTION_DELETE.equals(action) ||
(action.equals(message.folder) && EntityFolder.TRASH.equals(message.folderType))) {
adapter.notifyItemChanged(pos);
onSwipeDelete(message);
} else

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M6,19c0,1.1 0.9,2 2,2h8c1.1,0 2,-0.9 2,-2L18,7L6,7v12zM8.46,11.88l1.41,-1.41L12,12.59l2.12,-2.12 1.41,1.41L13.41,14l2.12,2.12 -1.41,1.41L12,15.41l-2.12,2.12 -1.41,-1.41L10.59,14l-2.13,-2.12zM15.5,4l-1,-1h-5l-1,1L5,4v2h14L19,4z"/>
</vector>
Loading…
Cancel
Save