mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2025-01-30 19:56:44 +01:00
handle horizontal scrolling at copy/move destination picker too
This commit is contained in:
parent
5604d1f8b5
commit
f2b1ef2c3b
3 changed files with 78 additions and 12 deletions
|
@ -17,7 +17,7 @@ class ChangeSortingDialog(val activity: SimpleActivity, val isDirectorySorting:
|
||||||
val path: String = "", val callback: () -> Unit) :
|
val path: String = "", val callback: () -> Unit) :
|
||||||
DialogInterface.OnClickListener {
|
DialogInterface.OnClickListener {
|
||||||
private var currSorting = 0
|
private var currSorting = 0
|
||||||
private var config: Config = activity.config
|
private var config = activity.config
|
||||||
private var view: View
|
private var view: View
|
||||||
|
|
||||||
init {
|
init {
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
package com.simplemobiletools.gallery.dialogs
|
package com.simplemobiletools.gallery.dialogs
|
||||||
|
|
||||||
import android.support.v7.app.AlertDialog
|
import android.support.v7.app.AlertDialog
|
||||||
import android.support.v7.widget.RecyclerView
|
import android.support.v7.widget.GridLayoutManager
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
import com.simplemobiletools.commons.dialogs.FilePickerDialog
|
import com.simplemobiletools.commons.dialogs.FilePickerDialog
|
||||||
|
import com.simplemobiletools.commons.extensions.beGoneIf
|
||||||
|
import com.simplemobiletools.commons.extensions.beVisibleIf
|
||||||
import com.simplemobiletools.commons.extensions.setupDialogStuff
|
import com.simplemobiletools.commons.extensions.setupDialogStuff
|
||||||
import com.simplemobiletools.commons.extensions.toast
|
import com.simplemobiletools.commons.extensions.toast
|
||||||
import com.simplemobiletools.gallery.R
|
import com.simplemobiletools.gallery.R
|
||||||
|
@ -17,12 +20,15 @@ import kotlinx.android.synthetic.main.dialog_directory_picker.view.*
|
||||||
|
|
||||||
class PickDirectoryDialog(val activity: SimpleActivity, val sourcePath: String, val callback: (path: String) -> Unit) {
|
class PickDirectoryDialog(val activity: SimpleActivity, val sourcePath: String, val callback: (path: String) -> Unit) {
|
||||||
var dialog: AlertDialog
|
var dialog: AlertDialog
|
||||||
var directoriesGrid: RecyclerView
|
|
||||||
var shownDirectories: ArrayList<Directory> = ArrayList()
|
var shownDirectories: ArrayList<Directory> = ArrayList()
|
||||||
|
var view: View
|
||||||
|
|
||||||
init {
|
init {
|
||||||
val view = LayoutInflater.from(activity).inflate(R.layout.dialog_directory_picker, null)
|
view = LayoutInflater.from(activity).inflate(R.layout.dialog_directory_picker, null)
|
||||||
directoriesGrid = view.directories_grid
|
(view.directories_grid.layoutManager as GridLayoutManager).apply {
|
||||||
|
orientation = if (activity.config.scrollHorizontally) GridLayoutManager.HORIZONTAL else GridLayoutManager.VERTICAL
|
||||||
|
spanCount = activity.config.dirColumnCnt
|
||||||
|
}
|
||||||
|
|
||||||
dialog = AlertDialog.Builder(activity)
|
dialog = AlertDialog.Builder(activity)
|
||||||
.setPositiveButton(R.string.ok, null)
|
.setPositiveButton(R.string.ok, null)
|
||||||
|
@ -63,6 +69,22 @@ class PickDirectoryDialog(val activity: SimpleActivity, val sourcePath: String,
|
||||||
dialog.dismiss()
|
dialog.dismiss()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
directoriesGrid.adapter = adapter
|
|
||||||
|
val scrollHorizontally = activity.config.scrollHorizontally
|
||||||
|
view.apply {
|
||||||
|
directories_grid.adapter = adapter
|
||||||
|
|
||||||
|
directories_vertical_fastscroller.isHorizontal = false
|
||||||
|
directories_vertical_fastscroller.beGoneIf(scrollHorizontally)
|
||||||
|
|
||||||
|
directories_horizontal_fastscroller.isHorizontal = true
|
||||||
|
directories_horizontal_fastscroller.beVisibleIf(scrollHorizontally)
|
||||||
|
|
||||||
|
if (scrollHorizontally) {
|
||||||
|
directories_horizontal_fastscroller.setViews(directories_grid)
|
||||||
|
} else {
|
||||||
|
directories_vertical_fastscroller.setViews(directories_grid)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,54 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<android.support.v7.widget.RecyclerView
|
<RelativeLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:id="@+id/directories_grid_holder"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<com.simplemobiletools.commons.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"
|
||||||
android:paddingTop="@dimen/activity_margin"
|
android:scrollbars="none"
|
||||||
app:layoutManager="android.support.v7.widget.GridLayoutManager"
|
app:layoutManager="android.support.v7.widget.GridLayoutManager"
|
||||||
app:spanCount="@integer/directory_columns_vertical_scroll"/>
|
app:spanCount="@integer/directory_columns_vertical_scroll"/>
|
||||||
|
|
||||||
|
<com.simplemobiletools.commons.views.FastScroller
|
||||||
|
android:id="@+id/directories_vertical_fastscroller"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:paddingLeft="@dimen/normal_margin"
|
||||||
|
android:paddingStart="@dimen/normal_margin">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/fastscroller_handle_vertical"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="end"
|
||||||
|
android:alpha="0"
|
||||||
|
android:background="@drawable/fastscroller_handle_vertical"/>
|
||||||
|
|
||||||
|
</com.simplemobiletools.commons.views.FastScroller>
|
||||||
|
|
||||||
|
<com.simplemobiletools.commons.views.FastScroller
|
||||||
|
android:id="@+id/directories_horizontal_fastscroller"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:layout_alignParentStart="true"
|
||||||
|
android:paddingTop="@dimen/normal_margin">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/fastscroller_handle_horizontal"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="bottom"
|
||||||
|
android:alpha="0"
|
||||||
|
android:background="@drawable/fastscroller_handle_horizontal"/>
|
||||||
|
|
||||||
|
</com.simplemobiletools.commons.views.FastScroller>
|
||||||
|
</RelativeLayout>
|
||||||
|
|
Loading…
Reference in a new issue