mirror of
https://github.com/nextcloud/notes-android.git
synced 2024-11-21 20:35:58 +03:00
Fix #884 Option to disable / improve swipe to delete (provide 12 seconds for undo)
32de460dd1/src/App.vue (L261)
This commit is contained in:
parent
83024f6efe
commit
d6762872b3
3 changed files with 6 additions and 7 deletions
|
@ -6,7 +6,6 @@ import android.view.View;
|
|||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.StringRes;
|
||||
|
||||
import com.google.android.material.snackbar.BaseTransientBottomBar;
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
|
||||
import it.niedermann.owncloud.notes.shared.util.ColorUtil;
|
||||
|
@ -14,7 +13,7 @@ import it.niedermann.owncloud.notes.shared.util.ColorUtil;
|
|||
public class BrandedSnackbar {
|
||||
|
||||
@NonNull
|
||||
public static Snackbar make(@NonNull View view, @NonNull CharSequence text, @BaseTransientBottomBar.Duration int duration) {
|
||||
public static Snackbar make(@NonNull View view, @NonNull CharSequence text, @Snackbar.Duration int duration) {
|
||||
final Snackbar snackbar = Snackbar.make(view, text, duration);
|
||||
if (BrandingUtil.isBrandingEnabled(view.getContext())) {
|
||||
int color = BrandingUtil.readBrandMainColor(view.getContext());
|
||||
|
@ -24,7 +23,7 @@ public class BrandedSnackbar {
|
|||
}
|
||||
|
||||
@NonNull
|
||||
public static Snackbar make(@NonNull View view, @StringRes int resId, @BaseTransientBottomBar.Duration int duration) {
|
||||
public static Snackbar make(@NonNull View view, @StringRes int resId, @Snackbar.Duration int duration) {
|
||||
return make(view, view.getResources().getText(resId), duration);
|
||||
}
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ import it.niedermann.owncloud.notes.persistence.NotesDatabase;
|
|||
public class NotesListViewItemTouchHelper extends ItemTouchHelper {
|
||||
|
||||
private static final String TAG = NotesListViewItemTouchHelper.class.getSimpleName();
|
||||
private static final int UNDO_DURATION = 12_000;
|
||||
|
||||
public NotesListViewItemTouchHelper(
|
||||
@NonNull SingleSignOnAccount ssoAccount,
|
||||
|
@ -79,7 +80,7 @@ public class NotesListViewItemTouchHelper extends ItemTouchHelper {
|
|||
if (viewProvider == null) {
|
||||
Toast.makeText(context, context.getString(R.string.action_note_deleted, dbNote.getTitle()), Toast.LENGTH_LONG).show();
|
||||
} else {
|
||||
BrandedSnackbar.make(viewProvider.getView(), context.getString(R.string.action_note_deleted, dbNote.getTitle()), Snackbar.LENGTH_LONG)
|
||||
BrandedSnackbar.make(viewProvider.getView(), context.getString(R.string.action_note_deleted, dbNote.getTitle()), UNDO_DURATION)
|
||||
.setAction(R.string.action_undo, (View v) -> {
|
||||
db.getNoteServerSyncHelper().addCallbackPush(ssoAccount, refreshLists::run);
|
||||
db.addNoteAndSync(ssoAccount, dbNote.getAccountId(), dbNote);
|
||||
|
|
|
@ -1,3 +1,2 @@
|
|||
- 🌎 Language updates
|
||||
- 🐞 Prevent CalledFromWrongThreadException
|
||||
- 🐞 Prevent ArrayIndexOutOfBoundsException (#912)
|
||||
- 🐞 Prevent ArrayIndexOutOfBoundsException (#912)
|
||||
- ⏰ Increase undo timeframe to 12 seconds like web ui (#884)
|
Loading…
Reference in a new issue