mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-23 04:57:59 +01:00
add a menu button for easier new folder creating
This commit is contained in:
parent
8ea418dad6
commit
2aab1ba5e5
3 changed files with 24 additions and 1 deletions
|
@ -37,7 +37,7 @@ android {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile 'com.simplemobiletools:commons:2.27.8'
|
compile 'com.simplemobiletools:commons:2.27.9'
|
||||||
compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.6.0'
|
compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.6.0'
|
||||||
compile 'com.theartofdev.edmodo:android-image-cropper:2.4.0'
|
compile 'com.theartofdev.edmodo:android-image-cropper:2.4.0'
|
||||||
compile 'com.bignerdranch.android:recyclerview-multiselect:0.2'
|
compile 'com.bignerdranch.android:recyclerview-multiselect:0.2'
|
||||||
|
|
|
@ -17,6 +17,8 @@ import android.view.MenuItem
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.FrameLayout
|
import android.widget.FrameLayout
|
||||||
import com.google.gson.Gson
|
import com.google.gson.Gson
|
||||||
|
import com.simplemobiletools.commons.dialogs.CreateNewFolderDialog
|
||||||
|
import com.simplemobiletools.commons.dialogs.FilePickerDialog
|
||||||
import com.simplemobiletools.commons.extensions.*
|
import com.simplemobiletools.commons.extensions.*
|
||||||
import com.simplemobiletools.commons.models.Release
|
import com.simplemobiletools.commons.models.Release
|
||||||
import com.simplemobiletools.commons.views.MyScalableRecyclerView
|
import com.simplemobiletools.commons.views.MyScalableRecyclerView
|
||||||
|
@ -55,6 +57,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
||||||
private var mLoadedInitialPhotos = false
|
private var mLoadedInitialPhotos = false
|
||||||
private var mLastMediaModified = 0
|
private var mLastMediaModified = 0
|
||||||
private var mLastMediaHandler = Handler()
|
private var mLastMediaHandler = Handler()
|
||||||
|
private var mNewFolderPath = ""
|
||||||
|
|
||||||
private var mCurrAsyncTask: GetDirectoriesAsynctask? = null
|
private var mCurrAsyncTask: GetDirectoriesAsynctask? = null
|
||||||
|
|
||||||
|
@ -105,6 +108,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
||||||
R.id.show_all -> showAllMedia()
|
R.id.show_all -> showAllMedia()
|
||||||
R.id.temporarily_show_hidden -> tryToggleTemporarilyShowHidden()
|
R.id.temporarily_show_hidden -> tryToggleTemporarilyShowHidden()
|
||||||
R.id.stop_showing_hidden -> tryToggleTemporarilyShowHidden()
|
R.id.stop_showing_hidden -> tryToggleTemporarilyShowHidden()
|
||||||
|
R.id.create_new_folder -> createNewFolder()
|
||||||
R.id.increase_column_count -> increaseColumnCount()
|
R.id.increase_column_count -> increaseColumnCount()
|
||||||
R.id.reduce_column_count -> reduceColumnCount()
|
R.id.reduce_column_count -> reduceColumnCount()
|
||||||
R.id.settings -> launchSettings()
|
R.id.settings -> launchSettings()
|
||||||
|
@ -155,6 +159,13 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
||||||
override fun onDestroy() {
|
override fun onDestroy() {
|
||||||
super.onDestroy()
|
super.onDestroy()
|
||||||
config.temporarilyShowHidden = false
|
config.temporarilyShowHidden = false
|
||||||
|
|
||||||
|
val newFolder = File(mNewFolderPath)
|
||||||
|
if (newFolder.exists() && newFolder.isDirectory) {
|
||||||
|
if (newFolder.list()?.isEmpty() == true) {
|
||||||
|
deleteFileBg(newFolder, true) { }
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun tryloadGallery() {
|
private fun tryloadGallery() {
|
||||||
|
@ -300,6 +311,14 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun createNewFolder() {
|
||||||
|
FilePickerDialog(this, internalStoragePath, false, config.shouldShowHidden) {
|
||||||
|
CreateNewFolderDialog(this, it) {
|
||||||
|
mNewFolderPath = it
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun increaseColumnCount() {
|
private fun increaseColumnCount() {
|
||||||
config.dirColumnCnt = ++(directories_grid.layoutManager as GridLayoutManager).spanCount
|
config.dirColumnCnt = ++(directories_grid.layoutManager as GridLayoutManager).spanCount
|
||||||
invalidateOptionsMenu()
|
invalidateOptionsMenu()
|
||||||
|
|
|
@ -28,6 +28,10 @@
|
||||||
android:id="@+id/stop_showing_hidden"
|
android:id="@+id/stop_showing_hidden"
|
||||||
android:title="@string/stop_showing_hidden"
|
android:title="@string/stop_showing_hidden"
|
||||||
app:showAsAction="never"/>
|
app:showAsAction="never"/>
|
||||||
|
<item
|
||||||
|
android:id="@+id/create_new_folder"
|
||||||
|
android:title="@string/create_new_folder"
|
||||||
|
app:showAsAction="never"/>
|
||||||
<item
|
<item
|
||||||
android:id="@+id/increase_column_count"
|
android:id="@+id/increase_column_count"
|
||||||
android:title="@string/increase_column_count"
|
android:title="@string/increase_column_count"
|
||||||
|
|
Loading…
Reference in a new issue