From fbe1409862722198db90e774fadea7fe6fcbf6cb Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 8 Nov 2016 20:08:39 +0100 Subject: [PATCH] add a pickAlbumActivity for picking copy destination --- app/src/main/AndroidManifest.xml | 4 ++ .../gallery/activities/MainActivity.java | 1 + .../gallery/activities/PickAlbumActivity.kt | 53 +++++++++++++++++++ app/src/main/res/layout/activity_main.xml | 1 - 4 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 app/src/main/kotlin/com/simplemobiletools/gallery/activities/PickAlbumActivity.kt diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index d94205c2c..7de7d9e7b 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -47,6 +47,10 @@ android:name=".activities.MediaActivity" android:parentActivityName=".activities.MainActivity"/> + + () + } + + override fun onResume() { + super.onResume() + tryloadGallery() + } + + private fun tryloadGallery() { + if (Utils.hasStoragePermission(applicationContext)) { + getDirectories() + } else { + Utils.showToast(applicationContext, R.string.no_permissions) + } + } + + private fun getDirectories() { + GetDirectoriesAsynctask(applicationContext, false, false, ArrayList(), this).execute() + } + + override fun onItemClick(parent: AdapterView<*>, view: View, position: Int, id: Long) { + val path = mDirs!![position].path + } + + override fun gotDirectories(dirs: ArrayList) { + mDirs = dirs + + val adapter = DirectoryAdapter(this, dirs) + directories_grid.adapter = adapter + directories_grid.onItemClickListener = this + } + + companion object { + private var mDirs: MutableList? = null + } +} diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index c2debc26e..3fb3717e8 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -14,7 +14,6 @@ android:id="@+id/directories_grid" android:layout_width="match_parent" android:layout_height="wrap_content" - android:choiceMode="multipleChoiceModal" android:columnWidth="@dimen/dir_tmb_size" android:horizontalSpacing="1dp" android:numColumns="auto_fit"