diff --git a/app/build.gradle b/app/build.gradle
index 9b0ed176..b9c36381 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -15,8 +15,8 @@ repositories {
android {
- compileSdkVersion 29
- buildToolsVersion "29.0.2"
+ compileSdkVersion 30
+ buildToolsVersion "30.0.2"
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
@@ -34,7 +34,7 @@ android {
defaultConfig {
applicationId "net.pokeranalytics.android"
minSdkVersion 23
- targetSdkVersion 29
+ targetSdkVersion 30
versionCode 125
versionName "5.4.3"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 9ef0dffc..7e2af584 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -9,6 +9,8 @@
+
+
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R || granted) {
- val takePictureIntent = Intent(MediaStore.ACTION_IMAGE_CAPTURE)
- // Ensure that there's a camera activity to handle the intent
- if (takePictureIntent.resolveActivity(packageManager) != null) {
- // Create the File where the photo should go
- try {
- tempFile = ImageUtils.createImageFile(this)
- mCurrentPhotoPath = "file:" + tempFile?.absolutePath
- } catch (ex: IOException) {
- // Error occurred while creating the File
- }
+ val takePictureIntent = Intent(MediaStore.ACTION_IMAGE_CAPTURE)
+
+ // Create the File where the photo should go
+ try {
+ tempFile = ImageUtils.createImageFile(this)
+ mCurrentPhotoPath = "file:" + tempFile?.absolutePath
+ } catch (ex: IOException) {
+ // Error occurred while creating the File
+ }
+
+ // Continue only if the File was successfully created
+ if (tempFile != null) {
+ Timber.d("tempFile: ${tempFile?.absolutePath}")
+ val photoURI = FileProvider.getUriForFile(
+ this,
+ applicationContext.packageName + ".fileprovider", tempFile!!
+ )
+ takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoURI)
+ startActivityForResult(takePictureIntent, REQUEST_CODE_TAKE_PICTURE)
+ }
- // Continue only if the File was successfully created
- if (tempFile != null) {
- Timber.d("tempFile: ${tempFile?.absolutePath}")
- val photoURI = FileProvider.getUriForFile(
- this,
- applicationContext.packageName + ".fileprovider", tempFile!!
- )
- takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoURI)
- startActivityForResult(takePictureIntent, REQUEST_CODE_TAKE_PICTURE)
}
}
+
+// // Test if we have the permission
+// if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
+// selectedChoice = SELECTED_CHOICE_TAKE_PICTURE
+// askForStoragePermission()
+// return
+// }
+
}
@@ -188,20 +195,32 @@ open class MediaActivity : BaseActivity() {
this.multiplePictures = multiplePictures
- // Test if we have the permission
- if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
- selectedChoice = SELECTED_CHOICE_SELECT_PICTURE
- askForStoragePermission()
- return
+ askForPermission(arrayOf(Manifest.permission.WRITE_EXTERNAL_STORAGE), 201) { granted ->
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R || granted) {
+ val galleryIntent = Intent()
+ galleryIntent.type = "image/*"
+ galleryIntent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, multiplePictures)
+ galleryIntent.action = Intent.ACTION_GET_CONTENT
+ startActivityForResult(galleryIntent, REQUEST_CODE_SELECT_PICTURE)
+
+ }
}
- this.multiplePictures = multiplePictures
- val galleryIntent = Intent()
- galleryIntent.type = "image/*"
- galleryIntent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, multiplePictures)
- galleryIntent.action = Intent.ACTION_GET_CONTENT
- startActivityForResult(galleryIntent, REQUEST_CODE_SELECT_PICTURE)
+ // Test if we have the permission
+// if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
+// selectedChoice = SELECTED_CHOICE_SELECT_PICTURE
+// askForStoragePermission()
+// return
+// }
+//
+// this.multiplePictures = multiplePictures
+//
+// val galleryIntent = Intent()
+// galleryIntent.type = "image/*"
+// galleryIntent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, multiplePictures)
+// galleryIntent.action = Intent.ACTION_GET_CONTENT
+// startActivityForResult(galleryIntent, REQUEST_CODE_SELECT_PICTURE)
}
/**
@@ -215,43 +234,6 @@ open class MediaActivity : BaseActivity() {
}
}
-// /**
-// * Ask for the acmera permission
-// */
-// private fun askForCameraPermission() {
-// // Here, thisActivity is the current activity
-// if (ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) {
-// ActivityCompat.requestPermissions(this, arrayOf(Manifest.permission.CAMERA),
-// PERMISSION_REQUEST_CAMERA)
-// }
-// }
-
-// /**
-// * Ask for camera and storage permission
-// */
-// private fun askForCameraAndStoragePermissions() {
-//
-// val permissions = ArrayList()
-// if (ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) {
-// permissions.add(Manifest.permission.CAMERA)
-// }
-//
-// if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
-// permissions.add(Manifest.permission.WRITE_EXTERNAL_STORAGE)
-// }
-//
-// if (permissions.size > 0) {
-// ActivityCompat.requestPermissions(this, permissions.toArray(arrayOfNulls(permissions.size)), PERMISSION_REQUEST_CAMERA)
-// }
-// }
-//
-// /**
-// * Called when a bitmap is return
-// *
-// * @param bitmap the bitmap returned
-// */
-// open fun getBitmapImage(file: File?, bitmap: Bitmap?) {}
-
/**
* Called when the user is adding new photos
diff --git a/app/src/main/java/net/pokeranalytics/android/ui/modules/data/PlayerDataFragment.kt b/app/src/main/java/net/pokeranalytics/android/ui/modules/data/PlayerDataFragment.kt
index 4912b528..5a5d2684 100644
--- a/app/src/main/java/net/pokeranalytics/android/ui/modules/data/PlayerDataFragment.kt
+++ b/app/src/main/java/net/pokeranalytics/android/ui/modules/data/PlayerDataFragment.kt
@@ -3,6 +3,7 @@ package net.pokeranalytics.android.ui.modules.data
import android.app.Activity.RESULT_OK
import android.content.Context
import android.content.Intent
+import android.content.pm.PackageManager
import android.graphics.Color
import android.os.Bundle
import android.view.LayoutInflater
@@ -189,7 +190,9 @@ class PlayerDataFragment : EditableDataFragment(), StaticRowRepresentableDataSou
val builder = AlertDialog.Builder(requireContext())
val placesArray = ArrayList()
- placesArray.add(getString(R.string.take_a_picture))
+ if (requireActivity().packageManager.hasSystemFeature(PackageManager.FEATURE_CAMERA_ANY)) {
+ placesArray.add(getString(R.string.take_a_picture))
+ }
placesArray.add(getString(R.string.library))
placesArray.add(getString(R.string.select_a_color))
diff --git a/build.gradle b/build.gradle
index dbc01acb..6ce66563 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,13 +1,13 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
- ext.kotlin_version = '1.4.10'
+ ext.kotlin_version = '1.5.21'
repositories {
google()
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:4.1.3'
+ classpath 'com.android.tools.build:gradle:4.2.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'io.realm:realm-gradle-plugin:10.3.1'
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 2704510e..5fa78e3c 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip