Skip to content
This repository has been archived by the owner on Aug 9, 2020. It is now read-only.

Commit

Permalink
Merge pull request #59 from ParthPadg/androidx
Browse files Browse the repository at this point in the history
migrate to AndroidX
  • Loading branch information
VictorAlbertos authored Nov 20, 2018
2 parents c228703 + eccf8b9 commit 3d1b78f
Show file tree
Hide file tree
Showing 27 changed files with 93 additions and 89 deletions.
3 changes: 0 additions & 3 deletions .idea/copyright/profiles_settings.xml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
58 changes: 30 additions & 28 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,28 +1,22 @@
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"
minSdkVersion 16
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
Expand All @@ -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'
}
2 changes: 1 addition & 1 deletion app/src/androidTest/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.SET_ANIMATION_SCALE"/>

<uses-sdk tools:overrideLibrary="android.support.test.uiautomator.v18"/>
<uses-sdk tools:overrideLibrary="androidx.test.uiautomator,android_libs.ub_uiautomator"/>
</manifest>
22 changes: 12 additions & 10 deletions app/src/androidTest/java/app/ApplicationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 {
Expand Down Expand Up @@ -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);
Expand Down
17 changes: 8 additions & 9 deletions app/src/androidTest/java/app/MultiStartTest.java
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
17 changes: 9 additions & 8 deletions app/src/androidTest/java/app/OnPreResultTest.java
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/app/HostActivitySampleFragment.java
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/app/OnPreResultActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/app/SampleActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/app/SampleFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/app/SampleParentFragmentNested.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/app/StartActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/app/multi_start/FirstActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/app/multi_start/MultiStartActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/app/multi_start/SecondActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
4 changes: 3 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -14,6 +15,7 @@ buildscript {

allprojects {
repositories {
google()
jcenter()
}
}
Expand Down
5 changes: 4 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
# org.gradle.parallel=true

android.enableJetifier=true
android.useAndroidX=true
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 4 additions & 6 deletions rx_activity_result/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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<T> {
Expand Down
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
Loading

0 comments on commit 3d1b78f

Please sign in to comment.