Skip to content

Commit

Permalink
Attempt both methods to open documents
Browse files Browse the repository at this point in the history
  • Loading branch information
AbandonedCart committed Aug 2, 2024
1 parent b7d6ecf commit a010252
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
6 changes: 3 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ android {
compileSdk 34
minSdk 21
targetSdk 34
versionName "4.2.2"
versionName "4.2.3"
versionCode = versionName.replace(".","").toInteger() * 10

vectorDrawables {
Expand Down Expand Up @@ -118,7 +118,7 @@ android {
}

dependencies {
implementation 'androidx.activity:activity-ktx:1.9.0'
implementation 'androidx.activity:activity-ktx:1.9.1'
implementation 'androidx.appcompat:appcompat:1.7.0'
implementation "androidx.browser:browser:1.8.0"
def androidx_camera = '1.3.4'
Expand All @@ -129,7 +129,7 @@ dependencies {
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.core:core-ktx:1.13.1'
implementation 'androidx.core:core-splashscreen:1.0.1'
implementation 'androidx.fragment:fragment-ktx:1.8.1'
implementation 'androidx.fragment:fragment-ktx:1.8.2'
implementation 'androidx.preference:preference-ktx:1.2.1'
implementation 'androidx.recyclerview:recyclerview:1.3.2'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
Expand Down
22 changes: 13 additions & 9 deletions app/src/main/java/com/hiddenramblings/tagmo/BrowserActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -1402,21 +1402,25 @@ class BrowserActivity : AppCompatActivity(), BrowserSettingsListener,
@Throws(ActivityNotFoundException::class)
fun onDocumentRequested() {
if (Version.isLollipop) {
val docTreeIntent = Intent(Intent.ACTION_OPEN_DOCUMENT_TREE)
.putExtra("android.content.extra.SHOW_ADVANCED", true)
.putExtra("android.content.extra.FANCY", true)
if (prefs.isDocumentStorage) {
onDocumentTree.launch(Intent(Intent.ACTION_OPEN_DOCUMENT_TREE)
.putExtra("android.content.extra.SHOW_ADVANCED", true)
.putExtra("android.content.extra.FANCY", true)
)
try {
onDocumentTree.launch(docTreeIntent)
} catch (anf: ActivityNotFoundException) {
onDocumentTree.launch(docTreeIntent.setType("*/*"))
}
return
}
FittedSheets.newInstance().apply {
setTitleText(this@BrowserActivity.getString(R.string.storage_setup))
setPositiveButton(this@BrowserActivity.getString(R.string.proceed)) {
onDocumentTree.launch(
Intent(Intent.ACTION_OPEN_DOCUMENT_TREE)
.putExtra("android.content.extra.SHOW_ADVANCED", true)
.putExtra("android.content.extra.FANCY", true)
)
try {
onDocumentTree.launch(docTreeIntent)
} catch (anf: ActivityNotFoundException) {
onDocumentTree.launch(docTreeIntent.setType("*/*"))
}
}
setNegativeButton(this@BrowserActivity.getString(R.string.close)) {
finish()
Expand Down

0 comments on commit a010252

Please sign in to comment.