mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-23 13:08:00 +01:00
allow changing directory column cnt too
This commit is contained in:
parent
f2074a4d16
commit
72381ba53d
2 changed files with 23 additions and 1 deletions
|
@ -10,6 +10,7 @@ import android.os.Bundle
|
||||||
import android.provider.MediaStore
|
import android.provider.MediaStore
|
||||||
import android.support.design.widget.Snackbar
|
import android.support.design.widget.Snackbar
|
||||||
import android.support.v4.app.ActivityCompat
|
import android.support.v4.app.ActivityCompat
|
||||||
|
import android.support.v7.widget.GridLayoutManager
|
||||||
import android.view.Menu
|
import android.view.Menu
|
||||||
import android.view.MenuItem
|
import android.view.MenuItem
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
@ -20,6 +21,7 @@ import com.simplemobiletools.gallery.asynctasks.GetDirectoriesAsynctask
|
||||||
import com.simplemobiletools.gallery.dialogs.ChangeSortingDialog
|
import com.simplemobiletools.gallery.dialogs.ChangeSortingDialog
|
||||||
import com.simplemobiletools.gallery.helpers.*
|
import com.simplemobiletools.gallery.helpers.*
|
||||||
import com.simplemobiletools.gallery.models.Directory
|
import com.simplemobiletools.gallery.models.Directory
|
||||||
|
import com.simplemobiletools.gallery.views.MyScalableRecyclerView
|
||||||
import kotlinx.android.synthetic.main.activity_main.*
|
import kotlinx.android.synthetic.main.activity_main.*
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
@ -60,6 +62,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
||||||
mToBeDeleted = ArrayList<String>()
|
mToBeDeleted = ArrayList<String>()
|
||||||
directories_holder.setOnRefreshListener({ getDirectories() })
|
directories_holder.setOnRefreshListener({ getDirectories() })
|
||||||
mDirs = ArrayList<Directory>()
|
mDirs = ArrayList<Directory>()
|
||||||
|
handleZooming()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
||||||
|
@ -229,6 +232,25 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
||||||
getDirectories()
|
getDirectories()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun handleZooming() {
|
||||||
|
val layoutManager = directories_grid.layoutManager as GridLayoutManager
|
||||||
|
MyScalableRecyclerView.mListener = object : MyScalableRecyclerView.ZoomListener {
|
||||||
|
override fun zoomIn() {
|
||||||
|
if (layoutManager.spanCount > 1) {
|
||||||
|
layoutManager.spanCount--
|
||||||
|
DirectoryAdapter.actMode?.finish()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun zoomOut() {
|
||||||
|
if (layoutManager.spanCount < 10) {
|
||||||
|
layoutManager.spanCount++
|
||||||
|
DirectoryAdapter.actMode?.finish()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun isPickImageIntent(intent: Intent) = isPickIntent(intent) && (hasImageContentData(intent) || isImageType(intent))
|
private fun isPickImageIntent(intent: Intent) = isPickIntent(intent) && (hasImageContentData(intent) || isImageType(intent))
|
||||||
|
|
||||||
private fun isPickVideoIntent(intent: Intent) = isPickIntent(intent) && (hasVideoContentData(intent) || isVideoType(intent))
|
private fun isPickVideoIntent(intent: Intent) = isPickIntent(intent) && (hasVideoContentData(intent) || isVideoType(intent))
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<android.support.v7.widget.RecyclerView
|
<com.simplemobiletools.gallery.views.MyScalableRecyclerView
|
||||||
android:id="@+id/directories_grid"
|
android:id="@+id/directories_grid"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|
Loading…
Reference in a new issue