Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 49 additions & 18 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -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
}
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'
}
33 changes: 14 additions & 19 deletions propicker/build.gradle
Original file line number Diff line number Diff line change
@@ -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"
}
Expand All @@ -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"
Expand All @@ -57,4 +52,4 @@ dependencies {

// Ucrop
implementation 'com.github.yalantis:ucrop:2.2.6'
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

package com.shaon2016.propicker.pro_image_picker


import android.app.Activity
import android.app.Dialog
import android.content.Context
Expand All @@ -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
Expand Down Expand Up @@ -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<TextView>(R.id.btnCamera).setOnClickListener {
Expand All @@ -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)
}
}
}
}
Expand Down Expand Up @@ -346,4 +350,4 @@ object ProPicker {

}

}
}