add a pickAlbumActivity for picking copy destination
This commit is contained in:
parent
10e197af95
commit
fbe1409862
4 changed files with 58 additions and 1 deletions
|
@ -47,6 +47,10 @@
|
|||
android:name=".activities.MediaActivity"
|
||||
android:parentActivityName=".activities.MainActivity"/>
|
||||
|
||||
<activity
|
||||
android:name=".activities.PickAlbumActivity"
|
||||
android:parentActivityName=".activities.MainActivity"/>
|
||||
|
||||
<activity
|
||||
android:name=".activities.ViewPagerActivity"
|
||||
android:configChanges="orientation|keyboardHidden|screenSize"
|
||||
|
|
|
@ -560,5 +560,6 @@ public class MainActivity extends SimpleActivity
|
|||
mGridView.setOnItemClickListener(this);
|
||||
mGridView.setMultiChoiceModeListener(this);
|
||||
mGridView.setOnTouchListener(this);
|
||||
mGridView.setChoiceMode(GridView.CHOICE_MODE_MULTIPLE_MODAL);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
package com.simplemobiletools.gallery.activities
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.widget.AdapterView
|
||||
import com.simplemobiletools.gallery.R
|
||||
import com.simplemobiletools.gallery.Utils
|
||||
import com.simplemobiletools.gallery.adapters.DirectoryAdapter
|
||||
import com.simplemobiletools.gallery.asynctasks.GetDirectoriesAsynctask
|
||||
import com.simplemobiletools.gallery.models.Directory
|
||||
import kotlinx.android.synthetic.main.activity_main.*
|
||||
import java.util.*
|
||||
|
||||
class PickAlbumActivity : SimpleActivity(), AdapterView.OnItemClickListener, GetDirectoriesAsynctask.GetDirectoriesListener {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_main)
|
||||
mDirs = ArrayList<Directory>()
|
||||
}
|
||||
|
||||
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<String>(), this).execute()
|
||||
}
|
||||
|
||||
override fun onItemClick(parent: AdapterView<*>, view: View, position: Int, id: Long) {
|
||||
val path = mDirs!![position].path
|
||||
}
|
||||
|
||||
override fun gotDirectories(dirs: ArrayList<Directory>) {
|
||||
mDirs = dirs
|
||||
|
||||
val adapter = DirectoryAdapter(this, dirs)
|
||||
directories_grid.adapter = adapter
|
||||
directories_grid.onItemClickListener = this
|
||||
}
|
||||
|
||||
companion object {
|
||||
private var mDirs: MutableList<Directory>? = null
|
||||
}
|
||||
}
|
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue