diff --git a/build.gradle b/build.gradle index 71e100b..90c922d 100644 --- a/build.gradle +++ b/build.gradle @@ -1,24 +1,55 @@ -// Top-level build file where you can add configuration options common to all sub-projects/modules. -buildscript { - ext.kotlin_version = "1.6.10" - repositories { - google() - jcenter() +apply plugin: 'com.android.library' +apply plugin: 'kotlin-android' +apply plugin: 'kotlin-kapt' +apply plugin: 'kotlin-parcelize' + +android { + namespace 'com.shaon2016.propicker' + compileSdkVersion 35 + + defaultConfig { + minSdkVersion 19 + targetSdkVersion 35 + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + consumerProguardFiles "consumer-rules.pro" } - dependencies { - classpath 'com.android.tools.build:gradle:7.1.2' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } } -} -allprojects { - repositories { - google() - jcenter() - maven { url "https://jitpack.io" } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_9 + targetCompatibility JavaVersion.VERSION_17 + } + kotlinOptions { + jvmTarget = "17" } } -task clean(type: Delete) { - delete rootProject.buildDir -} \ No newline at end of file +dependencies { + //noinspection UseTomlInstead + implementation fileTree(dir: "libs", include: ["*.jar"]) + implementation "org.jetbrains.kotlin:kotlin-stdlib:1.8.0" + implementation 'androidx.appcompat:appcompat:1.4.1' + implementation 'com.github.Necrobhyangel.InlineActivityResult:inline-activity-result:-SNAPSHOT' + implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.4.1' + implementation 'androidx.activity:activity-ktx:1.6.0-alpha01' + implementation 'androidx.fragment:fragment-ktx:1.5.0-alpha04' + implementation 'androidx.legacy:legacy-support-v4:1.0.0' + + // CameraX Library + def camerax_version = "1.1.0-beta02" + // CameraX core library using camera2 implementation + implementation "androidx.camera:camera-camera2:$camerax_version" + // CameraX Lifecycle Library + implementation "androidx.camera:camera-lifecycle:$camerax_version" + // CameraX View class + implementation "androidx.camera:camera-view:$camerax_version" + + // Ucrop + implementation 'com.github.yalantis:ucrop:2.2.6' +} diff --git a/propicker/build.gradle b/propicker/build.gradle index 4158afa..a5929f0 100644 --- a/propicker/build.gradle +++ b/propicker/build.gradle @@ -1,16 +1,15 @@ apply plugin: 'com.android.library' apply plugin: 'kotlin-android' -apply plugin: 'kotlin-android-extensions' apply plugin: 'kotlin-kapt' +apply plugin: 'kotlin-parcelize' android { - compileSdkVersion 32 - buildToolsVersion "30.0.3" + namespace 'com.shaon2016.propicker' + compileSdkVersion 35 defaultConfig { minSdkVersion 19 - targetSdkVersion 32 - + targetSdkVersion 35 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" consumerProguardFiles "consumer-rules.pro" } @@ -22,29 +21,25 @@ android { } } - kotlinOptions { - jvmTarget = "1.8" - } - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_1_9 + targetCompatibility JavaVersion.VERSION_17 + } + kotlinOptions { + jvmTarget = "17" } } dependencies { + //noinspection UseTomlInstead implementation fileTree(dir: "libs", include: ["*.jar"]) - implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + implementation "org.jetbrains.kotlin:kotlin-stdlib:1.8.0" implementation 'androidx.appcompat:appcompat:1.4.1' - - // Inline activity result - implementation 'com.github.florent37:inline-activity-result-kotlin:1.0.4' - // For lifecyclescope + implementation 'com.afollestad.inline-activity-result:core:0.2.0' implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.4.1' - implementation 'androidx.activity:activity-ktx:1.6.0-alpha01' implementation 'androidx.fragment:fragment-ktx:1.5.0-alpha04' -// implementation 'androidx.legacy:legacy-support-v4:1.0.0' + implementation 'androidx.legacy:legacy-support-v4:1.0.0' // CameraX Library def camerax_version = "1.1.0-beta02" @@ -57,4 +52,4 @@ dependencies { // Ucrop implementation 'com.github.yalantis:ucrop:2.2.6' -} \ No newline at end of file +} diff --git a/propicker/src/main/java/com/shaon2016/propicker/pro_image_picker/ProPicker.kt b/propicker/src/main/java/com/shaon2016/propicker/pro_image_picker/ProPicker.kt index dc869e2..d94ba92 100644 --- a/propicker/src/main/java/com/shaon2016/propicker/pro_image_picker/ProPicker.kt +++ b/propicker/src/main/java/com/shaon2016/propicker/pro_image_picker/ProPicker.kt @@ -6,7 +6,6 @@ package com.shaon2016.propicker.pro_image_picker - import android.app.Activity import android.app.Dialog import android.content.Context @@ -17,10 +16,10 @@ import android.view.View import android.widget.TextView import androidx.appcompat.app.AppCompatActivity import androidx.fragment.app.Fragment -import com.github.florent37.inlineactivityresult.kotlin.startForResult +import com.afollestad.inlineactivityresult.startActivityForResult import com.shaon2016.propicker.R -import com.shaon2016.propicker.pro_image_picker.model.Picker import com.shaon2016.propicker.pro_image_picker.model.ImageProvider +import com.shaon2016.propicker.pro_image_picker.model.Picker import com.shaon2016.propicker.pro_image_picker.ui.ProPickerActivity import com.shaon2016.propicker.util.FileUtil import kotlinx.coroutines.Dispatchers @@ -282,7 +281,7 @@ object ProPicker { private fun showImageProviderDialog(completionHandler: ((resultCode: Int, data: Intent?) -> Unit)? = null) { val v = View.inflate(activity.baseContext, R.layout.dialog_image_picker_chooser, null) - val d = Dialog(activity, R.style.Theme_AppCompat_Dialog_Alert) + val d = Dialog(activity, androidx.appcompat.R.style.Theme_AppCompat_Dialog_Alert) d.setContentView(v) v.findViewById(R.id.btnCamera).setOnClickListener { @@ -308,17 +307,22 @@ object ProPicker { val intent = Intent(activity, ProPickerActivity::class.java) intent.putExtras(getBundle()) if (fragment != null) { - - fragment?.startForResult(intent) { result -> - completionHandler?.invoke(result.resultCode, result.data) - }?.onFailed { result -> - completionHandler?.invoke(result.resultCode, result.data) + fragment?.startActivityForResult(intent){ + success: Boolean, data: Intent -> + if(success){ + completionHandler?.invoke(1,data) + }else{ + completionHandler?.invoke(0,data) + } } } else { - (activity as AppCompatActivity).startForResult(intent) { result -> - completionHandler?.invoke(result.resultCode, result.data) - }.onFailed { result -> - completionHandler?.invoke(result.resultCode, result.data) + (activity as AppCompatActivity).startActivityForResult(intent){ + success: Boolean, data: Intent -> + if(success){ + completionHandler?.invoke(1,data) + }else{ + completionHandler?.invoke(0,data) + } } } } @@ -346,4 +350,4 @@ object ProPicker { } -} \ No newline at end of file +}