try adding OTG automatically once
This commit is contained in:
parent
cb17ab5b97
commit
6464c7eee4
|
@ -47,7 +47,7 @@ ext {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.simplemobiletools:commons:3.19.11'
|
||||
implementation 'com.simplemobiletools:commons:3.19.12'
|
||||
implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.0'
|
||||
implementation 'com.android.support:multidex:1.0.3'
|
||||
implementation 'it.sephiroth.android.exif:library:1.0.1'
|
||||
|
|
|
@ -100,6 +100,10 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
|||
config.wasNewAppShown = true
|
||||
NewAppDialog(this, NEW_APP_PACKAGE, "Simple Clock")
|
||||
}*/
|
||||
|
||||
if (hasPermission(PERMISSION_WRITE_STORAGE)) {
|
||||
checkOTGInclusion()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onStart() {
|
||||
|
@ -246,6 +250,21 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
|||
}
|
||||
}
|
||||
|
||||
private fun checkOTGInclusion() {
|
||||
if (!config.wasOTGHandled) {
|
||||
Thread {
|
||||
if (hasOTGConnected()) {
|
||||
runOnUiThread {
|
||||
handleOTGPermission {
|
||||
config.addIncludedFolder(OTG_PATH)
|
||||
}
|
||||
}
|
||||
config.wasOTGHandled = true
|
||||
}
|
||||
}.start()
|
||||
}
|
||||
}
|
||||
|
||||
private fun tryLoadGallery() {
|
||||
handlePermission(PERMISSION_WRITE_STORAGE) {
|
||||
if (it) {
|
||||
|
|
|
@ -327,4 +327,8 @@ class Config(context: Context) : BaseConfig(context) {
|
|||
var lastFilepickerPath: String
|
||||
get() = prefs.getString(LAST_FILEPICKER_PATH, "")
|
||||
set(lastFilepickerPath) = prefs.edit().putString(LAST_FILEPICKER_PATH, lastFilepickerPath).apply()
|
||||
|
||||
var wasOTGHandled: Boolean
|
||||
get() = prefs.getBoolean(WAS_OTG_HANDLED, false)
|
||||
set(wasOTGHandled) = prefs.edit().putBoolean(WAS_OTG_HANDLED, wasOTGHandled).apply()
|
||||
}
|
||||
|
|
|
@ -47,6 +47,7 @@ const val REPLACE_ZOOMABLE_IMAGES = "replace_zoomable_images"
|
|||
const val DO_EXTRA_CHECK = "do_extra_check"
|
||||
const val WAS_NEW_APP_SHOWN = "was_new_app_shown_clock"
|
||||
const val LAST_FILEPICKER_PATH = "last_filepicker_path"
|
||||
const val WAS_OTG_HANDLED = "was_otg_handled"
|
||||
|
||||
// slideshow
|
||||
const val SLIDESHOW_INTERVAL = "slideshow_interval"
|
||||
|
|
Loading…
Reference in New Issue