fix #2659, #2004, add an Open Recycle Bin menu item, if it is enabled

This commit is contained in:
tibbi 2023-01-23 15:37:54 +01:00
parent 4e6373288a
commit a03a246033
6 changed files with 32 additions and 2 deletions

View File

@ -78,7 +78,7 @@ android {
}
dependencies {
implementation 'com.github.SimpleMobileTools:Simple-Commons:b9fb97bfe1'
implementation 'com.github.SimpleMobileTools:Simple-Commons:9428140d75'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0'
implementation 'it.sephiroth.android.exif:library:1.0.1'
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.24'

View File

@ -313,6 +313,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
main_menu.getToolbar().menu.apply {
findItem(R.id.column_count).isVisible = config.viewTypeFolders == VIEW_TYPE_GRID
findItem(R.id.set_as_default_folder).isVisible = !config.defaultFolder.isEmpty()
findItem(R.id.open_recycle_bin).isVisible = !config.useRecycleBin
findItem(R.id.more_apps_from_us).isVisible = !resources.getBoolean(R.bool.hide_google_relations)
}
}
@ -361,6 +362,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
R.id.temporarily_show_excluded -> tryToggleTemporarilyShowExcluded()
R.id.stop_showing_excluded -> tryToggleTemporarilyShowExcluded()
R.id.create_new_folder -> createNewFolder()
R.id.open_recycle_bin -> openRecycleBin()
R.id.column_count -> changeColumnCount()
R.id.set_as_default_folder -> setAsDefaultFolder()
R.id.more_apps_from_us -> launchMoreAppsFromUsIntent()

View File

@ -242,6 +242,7 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
findItem(R.id.open_camera).isVisible = mShowAll
findItem(R.id.about).isVisible = mShowAll
findItem(R.id.create_new_folder).isVisible = !mShowAll && mPath != RECYCLE_BIN && mPath != FAVORITES
findItem(R.id.open_recycle_bin).isVisible = mPath != RECYCLE_BIN
findItem(R.id.temporarily_show_hidden).isVisible = !config.shouldShowHidden
findItem(R.id.stop_showing_hidden).isVisible = (!isRPlus() || isExternalStorageManager()) && config.temporarilyShowHidden
@ -279,6 +280,7 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
R.id.change_view_type -> changeViewType()
R.id.group -> showGroupByDialog()
R.id.create_new_folder -> createNewFolder()
R.id.open_recycle_bin -> openRecycleBin()
R.id.temporarily_show_hidden -> tryToggleTemporarilyShowHidden()
R.id.stop_showing_hidden -> tryToggleTemporarilyShowHidden()
R.id.column_count -> changeColumnCount()
@ -601,7 +603,14 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
}
}
finish()
if (mPath == RECYCLE_BIN) {
media_empty_text_placeholder.setText(R.string.no_items_found)
media_empty_text_placeholder.beVisible()
media_empty_text_placeholder_2.beGone()
} else {
finish()
}
true
} else {
false

View File

@ -34,10 +34,12 @@ import com.simplemobiletools.commons.models.FAQItem
import com.simplemobiletools.commons.models.FileDirItem
import com.simplemobiletools.gallery.pro.BuildConfig
import com.simplemobiletools.gallery.pro.R
import com.simplemobiletools.gallery.pro.activities.MediaActivity
import com.simplemobiletools.gallery.pro.activities.SettingsActivity
import com.simplemobiletools.gallery.pro.activities.SimpleActivity
import com.simplemobiletools.gallery.pro.dialogs.AllFilesPermissionDialog
import com.simplemobiletools.gallery.pro.dialogs.PickDirectoryDialog
import com.simplemobiletools.gallery.pro.helpers.DIRECTORY
import com.simplemobiletools.gallery.pro.helpers.RECYCLE_BIN
import com.simplemobiletools.gallery.pro.models.DateTaken
import com.squareup.picasso.Picasso
@ -792,3 +794,10 @@ fun Activity.handleExcludedFolderPasswordProtection(callback: () -> Unit) {
callback()
}
}
fun Activity.openRecycleBin() {
Intent(this, MediaActivity::class.java).apply {
putExtra(DIRECTORY, RECYCLE_BIN)
startActivity(this)
}
}

View File

@ -58,6 +58,11 @@
android:showAsAction="never"
android:title="@string/create_new_folder"
app:showAsAction="never" />
<item
android:id="@+id/open_recycle_bin"
android:showAsAction="never"
android:title="@string/open_the_recycle_bin"
app:showAsAction="never" />
<item
android:id="@+id/column_count"
android:icon="@drawable/ic_column_count_vector"

View File

@ -48,6 +48,11 @@
android:showAsAction="never"
android:title="@string/empty_and_disable_recycle_bin"
app:showAsAction="never" />
<item
android:id="@+id/open_recycle_bin"
android:showAsAction="never"
android:title="@string/open_the_recycle_bin"
app:showAsAction="never" />
<item
android:id="@+id/restore_all_files"
android:showAsAction="never"