diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml deleted file mode 100644 index e7bedf3..0000000 --- a/.idea/copyright/profiles_settings.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/README.md b/README.md index d5d5135..b706450 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ public class SampleApp extends Application { You can call `RxActivityResult.on(this).startIntent(intent)` supplying both, an `Activity` instance or a `Fragment` instance. Observe the emitted [Result](https://github.com/VictorAlbertos/RxActivityResult/blob/master/rx_activity_result/src/main/java/rx_activity_result/Result.java) item to know the resultCode and retrieve the associated data if appropriate. -**Limitation:**: Your fragments need to extend from `android.support.v4.app.Fragment` instead of `android.app.Fragment`, otherwise they won't be notified. +**Limitation:** Your fragments need to extend from `androidx.fragment.app.Fragment` instead of `android.app.Fragment`, otherwise they won't be notified. ```java diff --git a/app/build.gradle b/app/build.gradle index 677b9d4..1ff8af7 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,20 +1,14 @@ apply plugin: 'com.android.application' -apply plugin: 'me.tatarka.retrolambda' buildscript { repositories { mavenCentral() jcenter() } - - dependencies { - classpath 'me.tatarka:gradle-retrolambda:3.2.4' - } } android { - compileSdkVersion 24 - buildToolsVersion "24.0.1" + compileSdkVersion 28 defaultConfig { applicationId "io.victoralbertos.app" @@ -22,7 +16,7 @@ android { targetSdkVersion 24 versionCode 1 versionName "1.0" - testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } buildTypes { release { @@ -40,33 +34,41 @@ android { } dependencies { - compile fileTree(dir: 'libs', include: ['*.jar']) - compile project(":rx_activity_result") + implementation fileTree(dir: 'libs', include: ['*.jar']) + implementation project(":rx_activity_result") - compile 'com.android.support:appcompat-v7:24.2.1' - compile 'com.android.support:design:24.2.1' + implementation('androidx.appcompat:appcompat:1.0.2') { + exclude group: "androidx.legacy", module: "legacy-support-core-utils" + } + implementation('com.google.android.material:material:1.0.0'){ + exclude group: "androidx.legacy", module: "legacy-support-core-utils" + } - testCompile 'junit:junit:4.12' - androidTestCompile ("com.android.support.test:runner:0.4.1") { - exclude module: 'support-annotations' + testImplementation 'junit:junit:4.12' + androidTestImplementation('androidx.test:runner:1.1.0') { + exclude module: 'annotation' + } + androidTestImplementation('androidx.test:rules:1.1.0') { + exclude module: 'annotation' } - androidTestCompile ("com.android.support.test:rules:0.4.1") { - exclude module: 'support-annotations' + + androidTestImplementation('androidx.test.ext:junit:1.0.0') { + exclude module: 'annotation' } - androidTestCompile ("com.android.support.test.espresso:espresso-intents:2.2.1") { - exclude module: 'support-annotations' - exclude module: 'support-v4' - exclude module: 'support-v13' - exclude module: 'recyclerview-v7' + androidTestImplementation('androidx.test.espresso:espresso-intents:3.1.0') { + exclude module: 'annotation' + exclude module: 'legacy-support-v4' + exclude module: 'legacy-support-v13' + exclude module: 'recyclerview' } - androidTestCompile ("com.android.support.test.espresso:espresso-contrib:2.2.1") { - exclude module: 'support-annotations' - exclude module: 'support-v4' - exclude module: 'support-v13' - exclude module: 'recyclerview-v7' + androidTestImplementation('androidx.test.espresso:espresso-contrib:3.1.0') { + exclude module: 'annotation' + exclude module: 'legacy-support-v4' + exclude module: 'legacy-support-v13' + exclude module: 'recyclerview' } - androidTestCompile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.2' + androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0' } diff --git a/app/src/androidTest/AndroidManifest.xml b/app/src/androidTest/AndroidManifest.xml index db9bf3f..9d7fe3e 100644 --- a/app/src/androidTest/AndroidManifest.xml +++ b/app/src/androidTest/AndroidManifest.xml @@ -4,5 +4,5 @@ xmlns:tools="http://schemas.android.com/tools"> - + diff --git a/app/src/androidTest/java/app/ApplicationTest.java b/app/src/androidTest/java/app/ApplicationTest.java index e439f36..7bda243 100644 --- a/app/src/androidTest/java/app/ApplicationTest.java +++ b/app/src/androidTest/java/app/ApplicationTest.java @@ -3,11 +3,6 @@ import android.content.Context; import android.graphics.Point; import android.os.RemoteException; -import android.support.test.InstrumentationRegistry; -import android.support.test.espresso.matcher.BoundedMatcher; -import android.support.test.rule.ActivityTestRule; -import android.support.test.runner.AndroidJUnit4; -import android.support.test.uiautomator.UiDevice; import android.view.Display; import android.view.View; import android.view.WindowManager; @@ -19,12 +14,17 @@ import org.junit.Test; import org.junit.runner.RunWith; +import androidx.test.espresso.matcher.BoundedMatcher; +import androidx.test.ext.junit.runners.AndroidJUnit4; +import androidx.test.platform.app.InstrumentationRegistry; +import androidx.test.rule.ActivityTestRule; +import androidx.test.uiautomator.UiDevice; import io.victoralbertos.app.R; -import static android.support.test.espresso.Espresso.onView; -import static android.support.test.espresso.action.ViewActions.click; -import static android.support.test.espresso.assertion.ViewAssertions.matches; -import static android.support.test.espresso.matcher.ViewMatchers.withId; +import static androidx.test.espresso.Espresso.onView; +import static androidx.test.espresso.action.ViewActions.click; +import static androidx.test.espresso.assertion.ViewAssertions.matches; +import static androidx.test.espresso.matcher.ViewMatchers.withId; @RunWith(AndroidJUnit4.class) public class ApplicationTest { @@ -123,7 +123,9 @@ private void rotateDevice() { } private void clickBottomMiddleScreen() { - WindowManager wm = (WindowManager) InstrumentationRegistry.getTargetContext().getSystemService(Context.WINDOW_SERVICE); + WindowManager wm = (WindowManager) InstrumentationRegistry.getInstrumentation() + .getTargetContext() + .getSystemService(Context.WINDOW_SERVICE); Display display = wm.getDefaultDisplay(); Point size = new Point(); display.getSize(size); diff --git a/app/src/androidTest/java/app/MultiStartTest.java b/app/src/androidTest/java/app/MultiStartTest.java index 687b8cf..e9fbdb9 100644 --- a/app/src/androidTest/java/app/MultiStartTest.java +++ b/app/src/androidTest/java/app/MultiStartTest.java @@ -1,20 +1,19 @@ package app; -import android.support.test.rule.ActivityTestRule; -import android.support.test.runner.AndroidJUnit4; - -import app.multi_start.MultiStartActivity; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; +import androidx.test.ext.junit.runners.AndroidJUnit4; +import androidx.test.rule.ActivityTestRule; +import app.multi_start.MultiStartActivity; import io.victoralbertos.app.R; -import static android.support.test.espresso.Espresso.onView; -import static android.support.test.espresso.action.ViewActions.click; -import static android.support.test.espresso.assertion.ViewAssertions.matches; -import static android.support.test.espresso.matcher.ViewMatchers.withId; -import static android.support.test.espresso.matcher.ViewMatchers.withText; +import static androidx.test.espresso.Espresso.onView; +import static androidx.test.espresso.action.ViewActions.click; +import static androidx.test.espresso.assertion.ViewAssertions.matches; +import static androidx.test.espresso.matcher.ViewMatchers.withId; +import static androidx.test.espresso.matcher.ViewMatchers.withText; @RunWith(AndroidJUnit4.class) public class MultiStartTest { diff --git a/app/src/androidTest/java/app/OnPreResultTest.java b/app/src/androidTest/java/app/OnPreResultTest.java index 107f35a..4b7ab00 100644 --- a/app/src/androidTest/java/app/OnPreResultTest.java +++ b/app/src/androidTest/java/app/OnPreResultTest.java @@ -1,17 +1,18 @@ package app; -import android.support.test.rule.ActivityTestRule; -import android.support.test.runner.AndroidJUnit4; -import io.victoralbertos.app.R; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; -import static android.support.test.espresso.Espresso.onView; -import static android.support.test.espresso.action.ViewActions.click; -import static android.support.test.espresso.assertion.ViewAssertions.matches; -import static android.support.test.espresso.matcher.ViewMatchers.withId; -import static android.support.test.espresso.matcher.ViewMatchers.withText; +import androidx.test.ext.junit.runners.AndroidJUnit4; +import androidx.test.rule.ActivityTestRule; +import io.victoralbertos.app.R; + +import static androidx.test.espresso.Espresso.onView; +import static androidx.test.espresso.action.ViewActions.click; +import static androidx.test.espresso.assertion.ViewAssertions.matches; +import static androidx.test.espresso.matcher.ViewMatchers.withId; +import static androidx.test.espresso.matcher.ViewMatchers.withText; @RunWith(AndroidJUnit4.class) public class OnPreResultTest { diff --git a/app/src/main/java/app/HostActivitySampleFragment.java b/app/src/main/java/app/HostActivitySampleFragment.java index 73d8320..6720bd6 100644 --- a/app/src/main/java/app/HostActivitySampleFragment.java +++ b/app/src/main/java/app/HostActivitySampleFragment.java @@ -1,7 +1,7 @@ package app; import android.os.Bundle; -import android.support.v7.app.AppCompatActivity; +import androidx.appcompat.app.AppCompatActivity; import io.victoralbertos.app.R; diff --git a/app/src/main/java/app/HostActivitySampleFragmentNested.java b/app/src/main/java/app/HostActivitySampleFragmentNested.java index 261d85f..9810168 100644 --- a/app/src/main/java/app/HostActivitySampleFragmentNested.java +++ b/app/src/main/java/app/HostActivitySampleFragmentNested.java @@ -1,7 +1,7 @@ package app; import android.os.Bundle; -import android.support.v7.app.AppCompatActivity; +import androidx.appcompat.app.AppCompatActivity; import io.victoralbertos.app.R; diff --git a/app/src/main/java/app/OnPreResultActivity.java b/app/src/main/java/app/OnPreResultActivity.java index ef5a617..5e16e5f 100644 --- a/app/src/main/java/app/OnPreResultActivity.java +++ b/app/src/main/java/app/OnPreResultActivity.java @@ -2,7 +2,7 @@ import android.content.Intent; import android.os.Bundle; -import android.support.v7.app.AppCompatActivity; +import androidx.appcompat.app.AppCompatActivity; import android.view.View; import android.widget.TextView; import app.multi_start.FirstActivity; diff --git a/app/src/main/java/app/SampleActivity.java b/app/src/main/java/app/SampleActivity.java index f917570..9879ee6 100644 --- a/app/src/main/java/app/SampleActivity.java +++ b/app/src/main/java/app/SampleActivity.java @@ -5,7 +5,7 @@ import android.graphics.Bitmap; import android.os.Bundle; import android.provider.MediaStore; -import android.support.v7.app.AppCompatActivity; +import androidx.appcompat.app.AppCompatActivity; import android.widget.ImageView; import android.widget.Toast; diff --git a/app/src/main/java/app/SampleFragment.java b/app/src/main/java/app/SampleFragment.java index 49c7f46..6e88258 100644 --- a/app/src/main/java/app/SampleFragment.java +++ b/app/src/main/java/app/SampleFragment.java @@ -6,7 +6,7 @@ import android.graphics.Bitmap; import android.os.Bundle; import android.provider.MediaStore; -import android.support.v4.app.Fragment; +import androidx.fragment.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/app/src/main/java/app/SampleParentFragmentNested.java b/app/src/main/java/app/SampleParentFragmentNested.java index ac3c8fb..0f05c18 100644 --- a/app/src/main/java/app/SampleParentFragmentNested.java +++ b/app/src/main/java/app/SampleParentFragmentNested.java @@ -5,8 +5,8 @@ import android.graphics.Bitmap; import android.os.Bundle; import android.provider.MediaStore; -import android.support.annotation.Nullable; -import android.support.v4.app.Fragment; +import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/app/src/main/java/app/StartActivity.java b/app/src/main/java/app/StartActivity.java index a421383..d6d3ab1 100644 --- a/app/src/main/java/app/StartActivity.java +++ b/app/src/main/java/app/StartActivity.java @@ -2,7 +2,7 @@ import android.content.Intent; import android.os.Bundle; -import android.support.v7.app.AppCompatActivity; +import androidx.appcompat.app.AppCompatActivity; import app.multi_start.MultiStartActivity; import io.victoralbertos.app.R; diff --git a/app/src/main/java/app/multi_start/FirstActivity.java b/app/src/main/java/app/multi_start/FirstActivity.java index e8197f0..a35fc7a 100644 --- a/app/src/main/java/app/multi_start/FirstActivity.java +++ b/app/src/main/java/app/multi_start/FirstActivity.java @@ -2,7 +2,7 @@ import android.content.Intent; import android.os.Bundle; -import android.support.v7.app.AppCompatActivity; +import androidx.appcompat.app.AppCompatActivity; public class FirstActivity extends AppCompatActivity { diff --git a/app/src/main/java/app/multi_start/MultiStartActivity.java b/app/src/main/java/app/multi_start/MultiStartActivity.java index 39da0de..2beea46 100644 --- a/app/src/main/java/app/multi_start/MultiStartActivity.java +++ b/app/src/main/java/app/multi_start/MultiStartActivity.java @@ -2,7 +2,7 @@ import android.content.Intent; import android.os.Bundle; -import android.support.v7.app.AppCompatActivity; +import androidx.appcompat.app.AppCompatActivity; import android.view.View; import android.widget.TextView; diff --git a/app/src/main/java/app/multi_start/SecondActivity.java b/app/src/main/java/app/multi_start/SecondActivity.java index 18703d8..f79ccad 100644 --- a/app/src/main/java/app/multi_start/SecondActivity.java +++ b/app/src/main/java/app/multi_start/SecondActivity.java @@ -2,7 +2,7 @@ import android.content.Intent; import android.os.Bundle; -import android.support.v7.app.AppCompatActivity; +import androidx.appcompat.app.AppCompatActivity; public class SecondActivity extends AppCompatActivity { diff --git a/build.gradle b/build.gradle index 54bb68b..ffd3be5 100644 --- a/build.gradle +++ b/build.gradle @@ -2,10 +2,11 @@ buildscript { repositories { + google() jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:2.2.3' + classpath 'com.android.tools.build:gradle:3.2.1' classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files @@ -14,6 +15,7 @@ buildscript { allprojects { repositories { + google() jcenter() } } diff --git a/gradle.properties b/gradle.properties index 1d3591c..c2d20e3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,4 +15,7 @@ # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects -# org.gradle.parallel=true \ No newline at end of file +# org.gradle.parallel=true + +android.enableJetifier=true +android.useAndroidX=true diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 8a7af3d..5cbe1a8 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-2.14.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip diff --git a/rx_activity_result/build.gradle b/rx_activity_result/build.gradle index 2b94fd5..fe563c7 100644 --- a/rx_activity_result/build.gradle +++ b/rx_activity_result/build.gradle @@ -4,8 +4,7 @@ group='com.github.VictorAlbertos' version='0.4.4-2.x' android { - compileSdkVersion 25 - buildToolsVersion "25.0.0" + compileSdkVersion 28 defaultConfig { minSdkVersion 16 @@ -22,11 +21,10 @@ android { } dependencies { - compile fileTree(dir: 'libs', include: ['*.jar']) - compile 'com.android.support:support-fragment:25.1.1' - compile "io.reactivex.rxjava2:rxjava:2.0.5" + api "androidx.fragment:fragment:1.0.0" + api "io.reactivex.rxjava2:rxjava:2.2.3" - testCompile 'junit:junit:4.12' + testImplementation 'junit:junit:4.12' } install { diff --git a/rx_activity_result/src/main/java/rx_activity_result2/ActivitiesLifecycleCallbacks.java b/rx_activity_result/src/main/java/rx_activity_result2/ActivitiesLifecycleCallbacks.java index c3a6784..38b3384 100644 --- a/rx_activity_result/src/main/java/rx_activity_result2/ActivitiesLifecycleCallbacks.java +++ b/rx_activity_result/src/main/java/rx_activity_result2/ActivitiesLifecycleCallbacks.java @@ -3,7 +3,7 @@ import android.app.Activity; import android.app.Application; import android.os.Bundle; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import io.reactivex.Observable; import io.reactivex.functions.Function; diff --git a/rx_activity_result/src/main/java/rx_activity_result2/OnPreResult.java b/rx_activity_result/src/main/java/rx_activity_result2/OnPreResult.java index be7e4a4..a45b37e 100644 --- a/rx_activity_result/src/main/java/rx_activity_result2/OnPreResult.java +++ b/rx_activity_result/src/main/java/rx_activity_result2/OnPreResult.java @@ -1,7 +1,7 @@ package rx_activity_result2; import android.content.Intent; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import io.reactivex.Observable; public interface OnPreResult { diff --git a/rx_activity_result/src/main/java/rx_activity_result2/OnResult.java b/rx_activity_result/src/main/java/rx_activity_result2/OnResult.java index 4050327..9447d43 100644 --- a/rx_activity_result/src/main/java/rx_activity_result2/OnResult.java +++ b/rx_activity_result/src/main/java/rx_activity_result2/OnResult.java @@ -1,7 +1,7 @@ package rx_activity_result2; import android.content.Intent; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import java.io.Serializable; diff --git a/rx_activity_result/src/main/java/rx_activity_result2/Request.java b/rx_activity_result/src/main/java/rx_activity_result2/Request.java index 4f15393..70cba85 100644 --- a/rx_activity_result/src/main/java/rx_activity_result2/Request.java +++ b/rx_activity_result/src/main/java/rx_activity_result2/Request.java @@ -17,7 +17,7 @@ package rx_activity_result2; import android.content.Intent; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; class Request { private final Intent intent; diff --git a/rx_activity_result/src/main/java/rx_activity_result2/RequestIntentSender.java b/rx_activity_result/src/main/java/rx_activity_result2/RequestIntentSender.java index c195b5e..a3815bb 100644 --- a/rx_activity_result/src/main/java/rx_activity_result2/RequestIntentSender.java +++ b/rx_activity_result/src/main/java/rx_activity_result2/RequestIntentSender.java @@ -19,7 +19,7 @@ import android.content.Intent; import android.content.IntentSender; import android.os.Bundle; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; public class RequestIntentSender extends Request { private final IntentSender intentSender; diff --git a/rx_activity_result/src/main/java/rx_activity_result2/RxActivityResult.java b/rx_activity_result/src/main/java/rx_activity_result2/RxActivityResult.java index 617061e..1b562f1 100644 --- a/rx_activity_result/src/main/java/rx_activity_result2/RxActivityResult.java +++ b/rx_activity_result/src/main/java/rx_activity_result2/RxActivityResult.java @@ -21,10 +21,10 @@ import android.content.Intent; import android.content.IntentSender; import android.os.Bundle; -import android.support.annotation.Nullable; -import android.support.v4.app.Fragment; -import android.support.v4.app.FragmentActivity; -import android.support.v4.app.FragmentManager; +import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentActivity; +import androidx.fragment.app.FragmentManager; import java.util.List;