diff --git a/app/src/main/java/com/simplemobiletools/gallery/Config.java b/app/src/main/java/com/simplemobiletools/gallery/Config.java index 650f6342a..3024c8ad3 100644 --- a/app/src/main/java/com/simplemobiletools/gallery/Config.java +++ b/app/src/main/java/com/simplemobiletools/gallery/Config.java @@ -77,7 +77,17 @@ public class Config { mPrefs.edit().putStringSet(Constants.HIDDEN_FOLDERS, hiddenFolders).apply(); } + public void removeHiddenDirectory(String path) { + final Set hiddenFolders = getHiddenFolders(); + hiddenFolders.remove(path); + mPrefs.edit().putStringSet(Constants.HIDDEN_FOLDERS, hiddenFolders).apply(); + } + public Set getHiddenFolders() { return mPrefs.getStringSet(Constants.HIDDEN_FOLDERS, new HashSet()); } + + public boolean getIsFolderHidden(String path) { + return getHiddenFolders().contains(path); + } } diff --git a/app/src/main/java/com/simplemobiletools/gallery/activities/MainActivity.java b/app/src/main/java/com/simplemobiletools/gallery/activities/MainActivity.java index 00358092c..ad970ac95 100644 --- a/app/src/main/java/com/simplemobiletools/gallery/activities/MainActivity.java +++ b/app/src/main/java/com/simplemobiletools/gallery/activities/MainActivity.java @@ -16,7 +16,6 @@ import android.support.design.widget.Snackbar; import android.support.v4.app.ActivityCompat; import android.support.v4.widget.SwipeRefreshLayout; import android.support.v7.app.AlertDialog; -import android.util.Log; import android.util.SparseBooleanArray; import android.view.ActionMode; import android.view.Menu; diff --git a/app/src/main/java/com/simplemobiletools/gallery/activities/MediaActivity.java b/app/src/main/java/com/simplemobiletools/gallery/activities/MediaActivity.java index 065f34c64..b67b9fef8 100644 --- a/app/src/main/java/com/simplemobiletools/gallery/activities/MediaActivity.java +++ b/app/src/main/java/com/simplemobiletools/gallery/activities/MediaActivity.java @@ -130,6 +130,11 @@ public class MediaActivity extends SimpleActivity @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu_media, menu); + + final boolean isFolderHidden = mConfig.getIsFolderHidden(mPath); + menu.findItem(R.id.hide_folder).setVisible(!isFolderHidden); + menu.findItem(R.id.unhide_folder).setVisible(isFolderHidden); + return true; } @@ -142,6 +147,9 @@ public class MediaActivity extends SimpleActivity case R.id.hide_folder: hideDirectory(); return true; + case R.id.unhide_folder: + unhideDirectory(); + return true; default: return super.onOptionsItemSelected(item); } @@ -166,7 +174,14 @@ public class MediaActivity extends SimpleActivity private void hideDirectory() { mConfig.addHiddenDirectory(mPath); - finish(); + + if (!mConfig.getShowHiddenFolders()) + finish(); + } + + private void unhideDirectory() { + mConfig.removeHiddenDirectory(mPath); + invalidateOptionsMenu(); } private void deleteDirectoryIfEmpty() { diff --git a/app/src/main/res/menu/menu_media.xml b/app/src/main/res/menu/menu_media.xml index d8f86cb36..bae61b508 100644 --- a/app/src/main/res/menu/menu_media.xml +++ b/app/src/main/res/menu/menu_media.xml @@ -10,5 +10,8 @@ android:id="@+id/hide_folder" android:title="@string/hide_folder" app:showAsAction="never"/> - + diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 2f9398378..30acfe266 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -32,6 +32,7 @@ Open with No valid app found Hide folder + Unhide folder 1 Ordner gelöscht diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index f1215934e..9a5e2627d 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -32,6 +32,7 @@ Open with No valid app found Hide folder + Unhide folder 1 carpeta eliminada diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 5f73f4cc5..3f659fd02 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -32,6 +32,7 @@ Open with No valid app found Hide folder + Unhide folder 1 cartella eliminata diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 6dfcbb62e..76d8dee89 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -32,6 +32,7 @@ Open with No valid app found Hide folder + Unhide folder 1 フォルダーを削除しました diff --git a/app/src/main/res/values-pt-rPT/strings.xml b/app/src/main/res/values-pt-rPT/strings.xml index 70590722b..b198c8d6a 100644 --- a/app/src/main/res/values-pt-rPT/strings.xml +++ b/app/src/main/res/values-pt-rPT/strings.xml @@ -32,6 +32,7 @@ Open with No valid app found Hide folder + Unhide folder 1 pasta eliminada diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index 03ed5c35f..4d06fcd89 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -32,6 +32,7 @@ Open with No valid app found Hide folder + Unhide folder 1 mapp borttagen diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 491934761..814b1e3d2 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -32,6 +32,7 @@ Open with No valid app found Hide folder + Unhide folder 1 folder deleted