OSDN Git Service

OSがAndroid OS 10よりも小さい場合、起動できなくなる不具合を修正。
authorMRSa <mrsa@myad.jp>
Mon, 5 Jun 2023 14:32:57 +0000 (23:32 +0900)
committerMRSa <mrsa@myad.jp>
Mon, 5 Jun 2023 14:32:57 +0000 (23:32 +0900)
app/build.gradle
app/src/main/java/net/osdn/gokigen/pkremote/MainActivity.kt
build.gradle

index 8520951..0b85dfb 100644 (file)
@@ -7,8 +7,8 @@ android {
         applicationId "net.osdn.gokigen.pkremote"
         minSdkVersion 14
         targetSdkVersion 33
-        versionCode 10803
-        versionName "1.8.3"
+        versionCode 10804
+        versionName "1.8.4"
         multiDexEnabled true
     }
     buildTypes {
@@ -31,13 +31,13 @@ dependencies {
     implementation 'androidx.appcompat:appcompat:1.6.1'
     implementation 'androidx.exifinterface:exifinterface:1.3.6'
     implementation 'androidx.preference:preference-ktx:1.2.0'
-    implementation 'com.google.android.material:material:1.8.0'
+    implementation 'com.google.android.material:material:1.9.0'
     implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
     implementation 'androidx.vectordrawable:vectordrawable:1.1.0'
     //implementation "androidx.core:core-splashscreen:1.0.1"
 
     api files('libs/olycamerakit.jar')
-    implementation "androidx.core:core-ktx:1.10.0"
+    implementation "androidx.core:core-ktx:1.10.1"
     //implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
 }
 repositories {
index 11b1e79..bf084c9 100644 (file)
@@ -138,9 +138,40 @@ class MainActivity : AppCompatActivity(),
         }
     }
 
+    private fun allPermissionsGranted() : Boolean
+    {
+        var result = true
+        for (param in REQUIRED_PERMISSIONS) {
+            if (ContextCompat.checkSelfPermission(
+                    baseContext,
+                    param
+                ) != PackageManager.PERMISSION_GRANTED
+            )
+            {
+                // Permission Denied
+                if ((param == Manifest.permission.READ_EXTERNAL_STORAGE)&&(Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN))
+                {
+                    // この場合は権限付与の判断を除外 (デバイスが JELLY_BEAN よりも古く、READ_EXTERNAL_STORAGE がない場合)
+                }
+                else if ((param == Manifest.permission.ACCESS_MEDIA_LOCATION)&&(Build.VERSION.SDK_INT < Build.VERSION_CODES.Q))
+                {
+                    // この場合は権限付与の判断を除外 (デバイスが (10) よりも古く、ACCESS_MEDIA_LOCATION がない場合)
+                }
+                else
+                {
+                    result = false
+                }
+            }
+        }
+        return (result)
+    }
+
+/*
     private fun allPermissionsGranted() = REQUIRED_PERMISSIONS.all {
         ContextCompat.checkSelfPermission(baseContext, it) == PackageManager.PERMISSION_GRANTED
     }
+*/
+
 
     /**
      * パーミッション設定が終わった後...
index fa9d74c..7d71ba1 100644 (file)
@@ -8,7 +8,7 @@ buildscript {
         mavenCentral()
     }
     dependencies {
-        classpath 'com.android.tools.build:gradle:8.0.1'
+        classpath 'com.android.tools.build:gradle:8.0.2'
         classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
 
         // NOTE: Do not place your application dependencies here; they belong