mirror of
https://github.com/TeamAmaze/AmazeFileManager.git
synced 2026-10-18 22:00:45 +08:00
Revert "Prevents user from adding the same bookmark into the bookmarks…"
This commit is contained in:
@@ -8,6 +8,7 @@ import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.PopupMenu;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.amaze.filemanager.R;
|
||||
import com.amaze.filemanager.activities.MainActivity;
|
||||
import com.amaze.filemanager.activities.superclasses.ThemedActivity;
|
||||
@@ -22,6 +23,7 @@ import com.amaze.filemanager.utils.DataUtils;
|
||||
import com.amaze.filemanager.utils.files.EncryptDecryptUtils;
|
||||
import com.amaze.filemanager.utils.files.FileUtils;
|
||||
import com.amaze.filemanager.utils.provider.UtilitiesProvider;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.security.GeneralSecurityException;
|
||||
@@ -32,7 +34,6 @@ import java.util.ArrayList;
|
||||
*
|
||||
* @author Emmanuel
|
||||
* on 25/5/2017, at 16:39.
|
||||
* Edited by bowiechen on 2019-10-19.
|
||||
*/
|
||||
|
||||
public class ItemPopupMenu extends PopupMenu implements PopupMenu.OnMenuItemClickListener {
|
||||
@@ -110,12 +111,9 @@ public class ItemPopupMenu extends PopupMenu implements PopupMenu.OnMenuItemClic
|
||||
return true;
|
||||
case R.id.book:
|
||||
DataUtils dataUtils = DataUtils.getInstance();
|
||||
if (dataUtils.addBook(new String[]{rowItem.title, rowItem.desc}, true)) {
|
||||
mainFragment.getMainActivity().getDrawer().refreshDrawer();
|
||||
Toast.makeText(mainFragment.getActivity(), mainFragment.getString(R.string.bookmarks_added), Toast.LENGTH_LONG).show();
|
||||
} else {
|
||||
Toast.makeText(mainFragment.getActivity(), mainFragment.getString(R.string.bookmark_exists), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
dataUtils.addBook(new String[]{rowItem.title, rowItem.desc}, true);
|
||||
mainFragment.getMainActivity().getDrawer().refreshDrawer();
|
||||
Toast.makeText(mainFragment.getActivity(), mainFragment.getString(R.string.bookmarks_added), Toast.LENGTH_LONG).show();
|
||||
return true;
|
||||
case R.id.delete:
|
||||
ArrayList<LayoutElementParcelable> positions = new ArrayList<>();
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
* DataUtils.java
|
||||
*
|
||||
* Copyright (C) 2016-2018 Arpit Khurana <arpitkh96@gmail.com>, Vishal Nehra <vishalmeham2@gmail.com>,
|
||||
* Emmanuel Messulam<emmanuelbendavid@gmail.com>, Raymond Lai <airwave209gt at gmail.com>,
|
||||
* Bowie Chen, and Contributors.
|
||||
* Emmanuel Messulam<emmanuelbendavid@gmail.com>, Raymond Lai <airwave209gt at gmail.com> and Contributors.
|
||||
*
|
||||
* This file is part of Amaze File Manager.
|
||||
*
|
||||
@@ -22,8 +21,10 @@
|
||||
*/
|
||||
package com.amaze.filemanager.utils;
|
||||
|
||||
import android.view.MenuItem;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import android.view.MenuItem;
|
||||
|
||||
import com.amaze.filemanager.ui.views.drawer.MenuMetadata;
|
||||
import com.amaze.filemanager.utils.application.AppConfig;
|
||||
import com.cloudrail.si.interfaces.CloudStorage;
|
||||
@@ -36,6 +37,7 @@ import com.googlecode.concurrenttrees.radix.node.concrete.DefaultCharArrayNodeFa
|
||||
import com.googlecode.concurrenttrees.radix.node.concrete.voidvalue.VoidValue;
|
||||
import com.googlecode.concurrenttrees.radixinverted.ConcurrentInvertedRadixTree;
|
||||
import com.googlecode.concurrenttrees.radixinverted.InvertedRadixTree;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
@@ -233,35 +235,19 @@ public class DataUtils {
|
||||
}
|
||||
|
||||
public void addBook(String[] i) {
|
||||
if (containsBooks(i) != -1) {
|
||||
return;
|
||||
}
|
||||
synchronized (books) {
|
||||
|
||||
books.add(i);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param i The bookmark name and path.
|
||||
* @param refreshdrawer boolean flag to indicate if drawer refresh is desired.
|
||||
* @return True if operation successful, false if failure.
|
||||
*/
|
||||
public boolean addBook(final String[] i, boolean refreshdrawer) {
|
||||
if (containsBooks(i) != -1) {
|
||||
// book exists
|
||||
return false;
|
||||
public void addBook(final String[] i, boolean refreshdrawer) {
|
||||
synchronized (books) {
|
||||
|
||||
books.add(i);
|
||||
}
|
||||
else {
|
||||
synchronized (books) {
|
||||
books.add(i);
|
||||
}
|
||||
|
||||
if (dataChangeListener != null) {
|
||||
dataChangeListener.onBookAdded(i, refreshdrawer);
|
||||
}
|
||||
|
||||
return true;
|
||||
if (refreshdrawer && dataChangeListener != null) {
|
||||
dataChangeListener.onBookAdded(i, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -645,7 +645,6 @@
|
||||
<string name="empty_string" translatable="false" />
|
||||
<string name="cannot_extract_archive">Cannot extract archive \"%s\": %s</string>
|
||||
<string name="archive_unsupported_or_corrupt">Cannot open archive \"%s\". Either we cannot open the archive, or the archive was damaged.</string>
|
||||
<string name="bookmark_exists">Bookmark exists</string>
|
||||
<string name="hide_media">Hide from media browsers</string>
|
||||
</resources>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user