From 57fec9277aef03de7179221a5dbacd0966789d26 Mon Sep 17 00:00:00 2001 From: Federico Navarrete Date: Sun, 26 Jul 2020 09:12:04 +0200 Subject: [PATCH] Upgraded to AndroidX - Upgraded to AndroidX - Added minimal documentation. - Re-targetted to Android 10. --- .idea/codeStyles/Project.xml | 116 ++++++++++++++++++ .idea/jarRepositories.xml | 25 ++++ .idea/misc.xml | 4 + .idea/modules.xml | 10 ++ .idea/vcs.xml | 6 + README.md | 23 ++-- app/build.gradle | 18 +-- .../ExampleInstrumentedTest.java | 4 +- .../guy/rateapplication/MainActivity.java | 32 ++--- app/src/main/res/layout/activity_main.xml | 12 +- app/src/main/res/layout/content_main.xml | 4 +- build.gradle | 2 +- gradle.properties | 2 + gradle/wrapper/gradle-wrapper.properties | 4 +- smartrate/build.gradle | 12 +- .../smartrate/ExampleInstrumentedTest.java | 4 +- .../java/guy4444/smartrate/SmartRate.java | 9 +- .../src/main/res/layout-land/dialog_rate.xml | 2 +- smartrate/src/main/res/layout/dialog_rate.xml | 2 +- 19 files changed, 219 insertions(+), 72 deletions(-) create mode 100644 .idea/codeStyles/Project.xml create mode 100644 .idea/jarRepositories.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml new file mode 100644 index 0000000..681f41a --- /dev/null +++ b/.idea/codeStyles/Project.xml @@ -0,0 +1,116 @@ + + + + + + + +
+ + + + xmlns:android + + ^$ + + + +
+
+ + + + xmlns:.* + + ^$ + + + BY_NAME + +
+
+ + + + .*:id + + http://schemas.android.com/apk/res/android + + + +
+
+ + + + .*:name + + http://schemas.android.com/apk/res/android + + + +
+
+ + + + name + + ^$ + + + +
+
+ + + + style + + ^$ + + + +
+
+ + + + .* + + ^$ + + + BY_NAME + +
+
+ + + + .* + + http://schemas.android.com/apk/res/android + + + ANDROID_ATTRIBUTE_ORDER + +
+
+ + + + .* + + .* + + + BY_NAME + +
+
+
+
+
+
\ No newline at end of file diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml new file mode 100644 index 0000000..a5f05cd --- /dev/null +++ b/.idea/jarRepositories.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..0d45e8d --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..10b0f86 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/README.md b/README.md index 8b4ff60..f8dfff1 100644 --- a/README.md +++ b/README.md @@ -7,10 +7,6 @@ A library for simple implementation of smart ranking. The user will see a dialog every x time. If the user gives a high score, he will be transferred to the Google store. If he gives a low score, he will only receive a thank you toast message. - - - - @@ -40,6 +36,10 @@ dependencies { ```java // For continual calls - +// first call after 3 days, the dialog will appear every 2 days until the user rates the app / or clicks on NEVER ASK AGAIN button +// the number 4 represents the minimum stars to be shown +// the 48 represents 48h and is going to be shown after 2 days +// the 72 represents 72h delay and the dialog is going to be shown after 3 days more SmartRate.Rate(MainActivity.this , "Rate Us" , "Tell others what you think about this app" @@ -57,6 +57,8 @@ SmartRate.Rate(MainActivity.this ); // For one time call +// it will appear after 3 days by default +// the number 4 represents the minimum stars to be shown SmartRate.Rate(MainActivity.this , "Rate Us" , "Tell others what you think about this app" @@ -70,6 +72,8 @@ SmartRate.Rate(MainActivity.this ); // With Call Back: +// it will appear after 3 days +// the number 4 represents the minimum stars to be shown SmartRate.Rate(MainActivity.this , "Rate Us" , "Tell others what you think about this app" @@ -108,13 +112,10 @@ SmartRate.Rate(MainActivity.this ![device-2018-06-06-144912](https://github.com/guy-4444/SmartRateUsDialog-Android/blob/master/desc.png?raw=true) ## What's new -1.00.08: -1. Landscape design improvements -2. Cancel button -3. google play click - new implementation -4. Fix bugs: - - first time does't appear - - 0 hour - now appear +1.1.0.0: +1. Upgraded to AndroidX +2. Added basic documentation + ## License Copyright 2019 Guy Isakov diff --git a/app/build.gradle b/app/build.gradle index 244b316..a1118a1 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,14 +1,14 @@ apply plugin: 'com.android.application' android { - compileSdkVersion 28 + compileSdkVersion 29 defaultConfig { applicationId "guy.rateapplication" minSdkVersion 18 - targetSdkVersion 28 + targetSdkVersion 29 versionCode 1 versionName "1.0" - testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' } buildTypes { release { @@ -20,11 +20,11 @@ android { dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) - implementation 'com.android.support:appcompat-v7:28.0.0' - implementation 'com.android.support.constraint:constraint-layout:1.1.3' - implementation 'com.android.support:design:28.0.0' + implementation 'androidx.appcompat:appcompat:1.0.0' + implementation 'androidx.constraintlayout:constraintlayout:1.1.3' + implementation 'com.google.android.material:material:1.0.0' testImplementation 'junit:junit:4.12' - androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' - androidTestImplementation 'com.android.support.test:runner:1.0.2' - compile project(path: ':smartrate') + androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0' + androidTestImplementation 'androidx.test.ext:junit:1.1.1' + implementation project(path: ':smartrate') } diff --git a/app/src/androidTest/java/guy/rateapplication/ExampleInstrumentedTest.java b/app/src/androidTest/java/guy/rateapplication/ExampleInstrumentedTest.java index 0c636b7..85b4dd5 100644 --- a/app/src/androidTest/java/guy/rateapplication/ExampleInstrumentedTest.java +++ b/app/src/androidTest/java/guy/rateapplication/ExampleInstrumentedTest.java @@ -1,8 +1,8 @@ package guy.rateapplication; import android.content.Context; -import android.support.test.InstrumentationRegistry; -import android.support.test.runner.AndroidJUnit4; +import androidx.test.platform.app.InstrumentationRegistry; +import androidx.test.ext.junit.runners.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/app/src/main/java/guy/rateapplication/MainActivity.java b/app/src/main/java/guy/rateapplication/MainActivity.java index ab80e02..6396022 100644 --- a/app/src/main/java/guy/rateapplication/MainActivity.java +++ b/app/src/main/java/guy/rateapplication/MainActivity.java @@ -1,31 +1,17 @@ package guy.rateapplication; -import android.app.Activity; -import android.content.ActivityNotFoundException; -import android.content.Context; -import android.content.Intent; -import android.content.SharedPreferences; import android.graphics.Color; -import android.graphics.PorterDuff; -import android.net.Uri; import android.os.Bundle; -import android.support.design.widget.FloatingActionButton; -import android.support.design.widget.Snackbar; -import android.support.v4.content.ContextCompat; -import android.support.v4.view.ViewCompat; -import android.support.v7.app.AlertDialog; -import android.support.v7.app.AppCompatActivity; -import android.support.v7.widget.AppCompatButton; -import android.support.v7.widget.Toolbar; -import android.view.LayoutInflater; +import com.google.android.material.floatingactionbutton.FloatingActionButton; + +import androidx.core.content.ContextCompat; +import androidx.core.view.ViewCompat; +import androidx.appcompat.app.AlertDialog; +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.AppCompatButton; +import androidx.appcompat.widget.Toolbar; + import android.view.View; -import android.view.Menu; -import android.view.MenuItem; -import android.widget.Button; -import android.widget.ImageButton; -import android.widget.ImageView; -import android.widget.RelativeLayout; -import android.widget.TextView; import android.widget.Toast; import guy4444.smartrate.SmartRate; diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 339231b..0b5009f 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -1,28 +1,28 @@ - - - - + - - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layout/content_main.xml b/app/src/main/res/layout/content_main.xml index 40d655d..2af07db 100644 --- a/app/src/main/res/layout/content_main.xml +++ b/app/src/main/res/layout/content_main.xml @@ -1,5 +1,5 @@ - - \ No newline at end of file + \ No newline at end of file diff --git a/build.gradle b/build.gradle index 02199bb..95a3996 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:3.4.1' + classpath 'com.android.tools.build:gradle:4.0.1' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/gradle.properties b/gradle.properties index 82618ce..d546dea 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,6 +6,8 @@ # http://www.gradle.org/docs/current/userguide/build_environment.html # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. +android.enableJetifier=true +android.useAndroidX=true org.gradle.jvmargs=-Xmx1536m # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 82cf648..88bd7d0 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Mon May 06 17:53:44 IDT 2019 +#Sun Jul 26 08:52:33 CEST 2020 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip diff --git a/smartrate/build.gradle b/smartrate/build.gradle index 5331c4f..3b02b40 100644 --- a/smartrate/build.gradle +++ b/smartrate/build.gradle @@ -1,17 +1,17 @@ apply plugin: 'com.android.library' android { - compileSdkVersion 28 + compileSdkVersion 29 defaultConfig { minSdkVersion 18 - targetSdkVersion 28 + targetSdkVersion 29 versionCode 1 versionName "1.0" - testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' } @@ -27,8 +27,8 @@ android { dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) - implementation 'com.android.support:appcompat-v7:28.0.0' + implementation 'androidx.appcompat:appcompat:1.0.0' testImplementation 'junit:junit:4.12' - androidTestImplementation 'com.android.support.test:runner:1.0.2' - androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' + androidTestImplementation 'androidx.test.ext:junit:1.1.1' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0' } diff --git a/smartrate/src/androidTest/java/guy4444/smartrate/ExampleInstrumentedTest.java b/smartrate/src/androidTest/java/guy4444/smartrate/ExampleInstrumentedTest.java index 60f7a72..7a21bce 100644 --- a/smartrate/src/androidTest/java/guy4444/smartrate/ExampleInstrumentedTest.java +++ b/smartrate/src/androidTest/java/guy4444/smartrate/ExampleInstrumentedTest.java @@ -1,8 +1,8 @@ package guy4444.smartrate; import android.content.Context; -import android.support.test.InstrumentationRegistry; -import android.support.test.runner.AndroidJUnit4; +import androidx.test.platform.app.InstrumentationRegistry; +import androidx.test.ext.junit.runners.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/smartrate/src/main/java/guy4444/smartrate/SmartRate.java b/smartrate/src/main/java/guy4444/smartrate/SmartRate.java index 08501a3..d6a7042 100644 --- a/smartrate/src/main/java/guy4444/smartrate/SmartRate.java +++ b/smartrate/src/main/java/guy4444/smartrate/SmartRate.java @@ -8,12 +8,9 @@ import android.graphics.Color; import android.graphics.PorterDuff; import android.net.Uri; -import android.support.v7.app.AlertDialog; -import android.support.v7.widget.AppCompatButton; -import android.text.Spannable; -import android.text.SpannableString; -import android.text.style.ForegroundColorSpan; -import android.text.style.RelativeSizeSpan; +import androidx.appcompat.app.AlertDialog; +import androidx.appcompat.widget.AppCompatButton; + import android.view.LayoutInflater; import android.view.View; import android.widget.Button; diff --git a/smartrate/src/main/res/layout-land/dialog_rate.xml b/smartrate/src/main/res/layout-land/dialog_rate.xml index e6b79d0..a489114 100644 --- a/smartrate/src/main/res/layout-land/dialog_rate.xml +++ b/smartrate/src/main/res/layout-land/dialog_rate.xml @@ -152,7 +152,7 @@ android:src="@drawable/ic_star_deactive" /> - -