add the column changing methods to media screen too

This commit is contained in:
tibbi 2017-02-10 23:47:48 +01:00
parent 7f3b02a765
commit 07335fba67
2 changed files with 25 additions and 2 deletions

View file

@ -105,6 +105,9 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
findItem(R.id.open_camera).isVisible = mShowAll
findItem(R.id.settings).isVisible = mShowAll
findItem(R.id.about).isVisible = mShowAll
findItem(R.id.increase_column_count).isVisible = config.mediaColumnCnt < 10
findItem(R.id.reduce_column_count).isVisible = config.mediaColumnCnt > 1
}
return true
@ -118,6 +121,8 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
R.id.folder_view -> switchToFolderView()
R.id.hide_folder -> hideFolder()
R.id.unhide_folder -> unhideFolder()
R.id.increase_column_count -> increaseColumnCount()
R.id.reduce_column_count -> reduceColumnCount()
R.id.settings -> launchSettings()
R.id.about -> launchAbout()
else -> return super.onOptionsItemSelected(item)
@ -199,20 +204,30 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
MyScalableRecyclerView.mListener = object : MyScalableRecyclerView.ZoomListener {
override fun zoomIn() {
if (layoutManager.spanCount > 1) {
config.mediaColumnCnt = --layoutManager.spanCount
reduceColumnCount()
MediaAdapter.actMode?.finish()
}
}
override fun zoomOut() {
if (layoutManager.spanCount < 10) {
config.mediaColumnCnt = ++layoutManager.spanCount
increaseColumnCount()
MediaAdapter.actMode?.finish()
}
}
}
}
private fun increaseColumnCount() {
config.mediaColumnCnt = ++(media_grid.layoutManager as GridLayoutManager).spanCount
invalidateOptionsMenu()
}
private fun reduceColumnCount() {
config.mediaColumnCnt = --(media_grid.layoutManager as GridLayoutManager).spanCount
invalidateOptionsMenu()
}
override fun deleteFiles(files: ArrayList<File>) {
val needsPermissions = needsStupidWritePermissions(files[0].path)
if (needsPermissions && isShowingPermDialog(files[0])) {

View file

@ -28,6 +28,14 @@
android:id="@+id/unhide_folder"
android:title="@string/unhide_folder"
app:showAsAction="never"/>
<item
android:id="@+id/increase_column_count"
android:title="@string/increase_column_count"
app:showAsAction="never"/>
<item
android:id="@+id/reduce_column_count"
android:title="@string/reduce_column_count"
app:showAsAction="never"/>
<item
android:id="@+id/settings"
android:title="@string/settings"