mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-23 04:57:59 +01:00
properly display the albums at album picker
This commit is contained in:
parent
af246cdcf0
commit
c525a0ebc7
1 changed files with 6 additions and 2 deletions
|
@ -1,20 +1,24 @@
|
||||||
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.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import com.simplemobiletools.gallery.R
|
import com.simplemobiletools.gallery.R
|
||||||
import com.simplemobiletools.gallery.activities.SimpleActivity
|
import com.simplemobiletools.gallery.activities.SimpleActivity
|
||||||
import com.simplemobiletools.gallery.adapters.DirectoryAdapter
|
import com.simplemobiletools.gallery.adapters.DirectoryAdapter
|
||||||
import com.simplemobiletools.gallery.asynctasks.GetDirectoriesAsynctask
|
import com.simplemobiletools.gallery.asynctasks.GetDirectoriesAsynctask
|
||||||
import com.simplemobiletools.gallery.models.Directory
|
import com.simplemobiletools.gallery.models.Directory
|
||||||
|
import kotlinx.android.synthetic.main.dialog_album_picker.view.*
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
class PickAlbumDialog(val activity: SimpleActivity, val listener: OnPickAlbumListener) : GetDirectoriesAsynctask.GetDirectoriesListener {
|
class PickAlbumDialog(val activity: SimpleActivity, val listener: OnPickAlbumListener) : GetDirectoriesAsynctask.GetDirectoriesListener {
|
||||||
val context = activity.applicationContext
|
val context = activity.applicationContext
|
||||||
var dialog: AlertDialog
|
var dialog: AlertDialog
|
||||||
|
var directoriesGrid: RecyclerView
|
||||||
|
|
||||||
init {
|
init {
|
||||||
val view = LayoutInflater.from(context).inflate(R.layout.dialog_album_picker, null)
|
val view = LayoutInflater.from(context).inflate(R.layout.dialog_album_picker, null)
|
||||||
|
directoriesGrid = view.directories_grid
|
||||||
|
|
||||||
dialog = AlertDialog.Builder(activity)
|
dialog = AlertDialog.Builder(activity)
|
||||||
.setTitle(context.resources.getString(R.string.select_destination))
|
.setTitle(context.resources.getString(R.string.select_destination))
|
||||||
|
@ -24,15 +28,15 @@ class PickAlbumDialog(val activity: SimpleActivity, val listener: OnPickAlbumLis
|
||||||
.create()
|
.create()
|
||||||
|
|
||||||
dialog.show()
|
dialog.show()
|
||||||
|
|
||||||
GetDirectoriesAsynctask(context, false, false, ArrayList<String>(), this).execute()
|
GetDirectoriesAsynctask(context, false, false, ArrayList<String>(), this).execute()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun gotDirectories(dirs: ArrayList<Directory>) {
|
override fun gotDirectories(dirs: ArrayList<Directory>) {
|
||||||
DirectoryAdapter(activity, dirs, null) {
|
val adapter = DirectoryAdapter(activity, dirs, null) {
|
||||||
listener.onSuccess(it.path)
|
listener.onSuccess(it.path)
|
||||||
dialog.dismiss()
|
dialog.dismiss()
|
||||||
}
|
}
|
||||||
|
directoriesGrid.adapter = adapter
|
||||||
}
|
}
|
||||||
|
|
||||||
interface OnPickAlbumListener {
|
interface OnPickAlbumListener {
|
||||||
|
|
Loading…
Reference in a new issue