From a49179a8463add0a8fb70f5db600dfbb305507a3 Mon Sep 17 00:00:00 2001 From: Shreyas Date: Sat, 29 Aug 2020 22:22:41 +0530 Subject: [PATCH 01/31] Add kotlin plugin and dependencies --- EasyUpiPayment/build.gradle | 20 ++++++++++++++++---- app/build.gradle | 22 +++++++++++++++++----- build.gradle | 6 ++++-- 3 files changed, 37 insertions(+), 11 deletions(-) diff --git a/EasyUpiPayment/build.gradle b/EasyUpiPayment/build.gradle index ac710e7..b19328c 100644 --- a/EasyUpiPayment/build.gradle +++ b/EasyUpiPayment/build.gradle @@ -1,15 +1,16 @@ apply plugin: 'com.android.library' +apply plugin: 'kotlin-android' apply plugin: 'com.github.dcendents.android-maven' apply plugin: "com.jfrog.bintray" version = "2.2" android { - compileSdkVersion 29 + compileSdkVersion 30 defaultConfig { minSdkVersion 19 - targetSdkVersion 29 + targetSdkVersion 30 versionCode 4 versionName version testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" @@ -22,16 +23,24 @@ android { proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + buildToolsVersion '30.0.2' } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) - implementation 'androidx.appcompat:appcompat:1.1.0' + implementation 'androidx.appcompat:appcompat:1.2.0' + implementation "androidx.core:core-ktx:1.3.1" + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation 'androidx.annotation:annotation:1.1.0' - testImplementation 'junit:junit:4.12' + testImplementation 'junit:junit:4.13' androidTestImplementation 'androidx.test:runner:1.2.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' + } ext { @@ -150,3 +159,6 @@ bintray { } } } +repositories { + mavenCentral() +} diff --git a/app/build.gradle b/app/build.gradle index 038a47e..81fe811 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,4 +1,6 @@ apply plugin: 'com.android.application' +apply plugin: 'kotlin-android' +apply plugin: 'kotlin-android-extensions' android { compileSdkVersion 29 @@ -16,19 +18,29 @@ android { proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } + compileOptions { + sourceCompatibility "1.8" + targetCompatibility "1.8" + } + buildToolsVersion '30.0.2' } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) - implementation 'androidx.appcompat:appcompat:1.1.0' - implementation 'androidx.constraintlayout:constraintlayout:1.1.3' - implementation 'com.google.android.material:material:1.1.0' + implementation "androidx.core:core-ktx:1.3.1" + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" + implementation 'androidx.appcompat:appcompat:1.2.0' + implementation 'androidx.constraintlayout:constraintlayout:2.0.0' + implementation 'com.google.android.material:material:1.2.0' testImplementation 'junit:junit:4.13' androidTestImplementation 'androidx.test:runner:1.2.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' // EasyUpiPayment Library - implementation 'com.shreyaspatil:EasyUpiPayment:2.2' +// implementation 'com.shreyaspatil:EasyUpiPayment:2.2' -// implementation project(path: ':EasyUpiPayment') + implementation project(path: ':EasyUpiPayment') +} +repositories { + mavenCentral() } diff --git a/build.gradle b/build.gradle index 7ac6b38..ee71fd1 100644 --- a/build.gradle +++ b/build.gradle @@ -1,18 +1,20 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { + ext.kotlin_version = '1.4.0' repositories { google() jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:4.0.0' + classpath 'com.android.tools.build:gradle:4.0.1' // Required plugins added to classpath to facilitate pushing to Jcenter/Bintray classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4' classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0' - + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } From e62f0524d5b628c2476c39dd667e8e9bb944aabc Mon Sep 17 00:00:00 2001 From: Shreyas Date: Sat, 29 Aug 2020 22:26:34 +0530 Subject: [PATCH 02/31] Create AppNotFoundException --- .../EasyUpiPayment/exception/AppNotFoundException.kt | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 EasyUpiPayment/src/main/java/com/shreyaspatil/EasyUpiPayment/exception/AppNotFoundException.kt diff --git a/EasyUpiPayment/src/main/java/com/shreyaspatil/EasyUpiPayment/exception/AppNotFoundException.kt b/EasyUpiPayment/src/main/java/com/shreyaspatil/EasyUpiPayment/exception/AppNotFoundException.kt new file mode 100644 index 0000000..68ad70f --- /dev/null +++ b/EasyUpiPayment/src/main/java/com/shreyaspatil/EasyUpiPayment/exception/AppNotFoundException.kt @@ -0,0 +1,5 @@ +package com.shreyaspatil.easyupipayment.exception + +class AppNotFoundException(appPackage: String?) : Exception(""" + No UPI app${appPackage?.let { " with package name '$it'" } ?: ""} exists on this device to perform this transaction. +""".trimIndent()) \ No newline at end of file From cf132cda1219cfd2b253a5ed6a814b59b2be2deb Mon Sep 17 00:00:00 2001 From: Shreyas Date: Sat, 29 Aug 2020 22:27:20 +0530 Subject: [PATCH 03/31] Convert listener to kotlin and remove other methods --- .idea/codeStyles/Project.xml | 18 ++++++++++++++++++ .idea/codeStyles/codeStyleConfig.xml | 5 +++++ .idea/jarRepositories.xml | 5 +++++ .idea/misc.xml | 2 +- .../listener/PaymentStatusListener.java | 17 ----------------- 5 files changed, 29 insertions(+), 18 deletions(-) create mode 100644 .idea/codeStyles/codeStyleConfig.xml delete mode 100644 EasyUpiPayment/src/main/java/com/shreyaspatil/EasyUpiPayment/listener/PaymentStatusListener.java diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml index 681f41a..0d15693 100644 --- a/.idea/codeStyles/Project.xml +++ b/.idea/codeStyles/Project.xml @@ -1,5 +1,23 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 845e2b6..b9ed663 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -14,7 +14,7 @@