request WRITE_EXTERNAL_STORAGE + cleanup

This commit is contained in:
tibbi
2016-10-30 17:35:32 +01:00
parent 22b3c3f5cc
commit b1c9822179
4 changed files with 3 additions and 21 deletions

View File

@ -51,7 +51,7 @@ class MainActivity : SimpleActivity(), ItemsFragment.ItemInteractionListener, Br
if (Utils.hasStoragePermission(applicationContext)) {
initRootFileManager()
} else {
ActivityCompat.requestPermissions(this, arrayOf(Manifest.permission.READ_EXTERNAL_STORAGE), STORAGE_PERMISSION)
ActivityCompat.requestPermissions(this, arrayOf(Manifest.permission.WRITE_EXTERNAL_STORAGE), STORAGE_PERMISSION)
}
}

View File

@ -38,8 +38,7 @@ class CopyDialog(val activity: Activity, val files: List<File>, val path: String
.setTitle(mContext.resources.getString(R.string.create_new))
.setView(view)
.setPositiveButton(R.string.ok, null)
.setNegativeButton(R.string.cancel, { dialog, which -> dialogDismissed() })
.setOnCancelListener { dialogDismissed() }
.setNegativeButton(R.string.cancel, null)
.create().apply {
window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE)
show()
@ -75,13 +74,7 @@ class CopyDialog(val activity: Activity, val files: List<File>, val path: String
}
}
private fun dialogDismissed() {
listener.onCancel()
}
interface OnCopyListener {
fun onSuccess()
fun onCancel()
}
}