Skip to content

Commit

Permalink
Merge pull request #845 from g-maxime/android-update-lite
Browse files Browse the repository at this point in the history
Android GUI: Open files fixes
  • Loading branch information
JeromeMartinez authored May 29, 2024
2 parents fb46989 + 1a0dc9b commit 717208a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 18 deletions.
2 changes: 1 addition & 1 deletion Source/GUI/Android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ android {
defaultConfig {
applicationId "net.mediaarea.mediainfo"
multiDexEnabled = true
minSdkVersion 14
minSdkVersion 19
versionCode 42
versionName "24.04"
targetSdkVersion 34
Expand Down
4 changes: 0 additions & 4 deletions Source/GUI/Android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
<manifest
xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="com.android.vending.BILLING" />
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="32" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="20" />

Expand All @@ -27,7 +24,6 @@
android:name=".ReportListActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar"
android:launchMode="singleInstance"
android:configChanges="locale|layoutDirection"
android:exported="true">
<intent-filter>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,17 +189,7 @@ class ReportListActivity : AppCompatActivity(), ReportActivityListener {

private fun handleUri(uri: Uri) {
if (uri.scheme == "file") {
if (Build.VERSION.SDK_INT >= 33) {
if (checkSelfPermission(android.Manifest.permission.READ_MEDIA_IMAGES) != PackageManager.PERMISSION_GRANTED ||
checkSelfPermission(android.Manifest.permission.READ_MEDIA_VIDEO) != PackageManager.PERMISSION_GRANTED ||
checkSelfPermission(android.Manifest.permission.READ_MEDIA_AUDIO) != PackageManager.PERMISSION_GRANTED) {
pendingFileUris.add(uri)
ActivityCompat.requestPermissions(this@ReportListActivity,
arrayOf(android.Manifest.permission.READ_MEDIA_IMAGES, android.Manifest.permission.READ_MEDIA_VIDEO, android.Manifest.permission.READ_MEDIA_AUDIO),
READ_EXTERNAL_STORAGE_PERMISSION_REQUEST)
return
}
} else if (Build.VERSION.SDK_INT >= 23) {
if (Build.VERSION.SDK_INT >= 23) {
if (checkSelfPermission(android.Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
pendingFileUris.add(uri)
ActivityCompat.requestPermissions(this@ReportListActivity,
Expand Down Expand Up @@ -555,8 +545,8 @@ class ReportListActivity : AppCompatActivity(), ReportActivityListener {
reportModel = ViewModelProvider(this, viewModelFactory)[ReportViewModel::class.java]

activityReportListBinding.addButton.setOnClickListener {
if (Build.VERSION.SDK_INT >= 19) {
val intent = Intent(Intent.ACTION_OPEN_DOCUMENT)
if (Build.VERSION.SDK_INT >= 20) { // Official Android FileChooser is buggy on Android 4.4 (19)
val intent = Intent(Intent.ACTION_GET_CONTENT)

intent.addCategory(Intent.CATEGORY_OPENABLE)
intent.type = "*/*"
Expand Down

0 comments on commit 717208a

Please sign in to comment.