Skip to content

Commit

Permalink
Fix tourbook import location restriction for API <= 28
Browse files Browse the repository at this point in the history
  • Loading branch information
chrgernoe committed Jan 17, 2024
1 parent e3bf3ce commit e0e79de
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app/src/main/java/com/yacgroup/yacguide/TourbookActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import android.content.Context
import android.content.Intent
import android.content.SharedPreferences
import android.net.Uri
import android.os.Build
import android.os.Bundle
import android.view.Menu
import android.view.MenuItem
Expand Down Expand Up @@ -269,7 +270,12 @@ class TourbookActivity : BaseNavigationActivity() {
private fun _selectFileImport() {
val intent = Intent(Intent.ACTION_OPEN_DOCUMENT).apply {
addCategory(Intent.CATEGORY_OPENABLE)
type = TourbookExportFormat.eJSON.mimeType
/*
* NOTE:
* The reason is unclear, why the MIME type filter makes the import for other locations
* than the "Downloads" folder impossible for API version <= 28.
*/
type = if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.P) "*/*" else TourbookExportFormat.eJSON.mimeType
}
_importResultLauncher.launch(intent)
}
Expand Down

0 comments on commit e0e79de

Please sign in to comment.