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

@ -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)
}
})
}
}