implement the folder picker for saving stuff

This commit is contained in:
tibbi 2016-11-01 18:40:37 +01:00
parent 229f7111f2
commit 9d88e2136c
2 changed files with 13 additions and 2 deletions

View File

@ -37,7 +37,7 @@ dependencies {
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.jakewharton:butterknife:8.0.1'
compile 'com.simplemobiletools:filepicker:1.3.3@aar'
compile 'com.simplemobiletools:filepicker:1.3.5@aar'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"

View File

@ -8,6 +8,7 @@ import android.view.MenuItem
import android.view.View
import android.widget.AdapterView
import com.simplemobiletools.camera.R
import com.simplemobiletools.filepicker.dialogs.FilePickerDialog
import kotlinx.android.synthetic.main.activity_settings.*
class SettingsActivity : SimpleActivity() {
@ -48,9 +49,19 @@ class SettingsActivity : SimpleActivity() {
}
private fun setupUseDCIM() {
settings_save_photos.text = mConfig.savePhotosFolder.substring(mConfig.savePhotosFolder.lastIndexOf("/") + 1)
var currPath = mConfig.savePhotosFolder
settings_save_photos.text = currPath.substring(currPath.lastIndexOf("/") + 1)
settings_save_photos_holder.setOnClickListener {
FilePickerDialog(this, currPath, false, false, true, object: FilePickerDialog.OnFilePickerListener {
override fun onFail(error: FilePickerDialog.FilePickerResult) {
}
override fun onSuccess(pickedPath: String) {
currPath = pickedPath
mConfig.savePhotosFolder = pickedPath
settings_save_photos.text = pickedPath.substring(pickedPath.lastIndexOf("/") + 1)
}
})
}
}