Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gradle version Updated, Migrated to AndroidX, Dependencies version Updated #8

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
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
Binary file modified .idea/caches/build_file_checksums.ser
Binary file not shown.
152 changes: 127 additions & 25 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 40 additions & 0 deletions .idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

41 changes: 21 additions & 20 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 27
buildToolsVersion "27.0.3"
compileSdkVersion 29
buildToolsVersion '29.0.2'
defaultConfig {
applicationId "com.boisneyphilippe.githubarchitecturecomponents"
minSdkVersion 19
targetSdkVersion 27
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
}
buildTypes {
release {
Expand All @@ -25,32 +25,33 @@ android {

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.google.android.material:material:1.2.1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
implementation 'androidx.recyclerview:recyclerview:1.1.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.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'

// ViewModel and LiveData
implementation "android.arch.lifecycle:extensions:1.1.1"
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
// alternatively, just ViewModel
implementation "android.arch.lifecycle:viewmodel:1.1.1"
implementation 'androidx.lifecycle:lifecycle-viewmodel:2.2.0'
// alternatively, just LiveData
implementation "android.arch.lifecycle:livedata:1.1.1"
implementation 'androidx.lifecycle:lifecycle-livedata:2.2.0'

annotationProcessor "android.arch.lifecycle:compiler:1.1.1"
//noinspection LifecycleAnnotationProcessorWithJava8
annotationProcessor 'androidx.lifecycle:lifecycle-compiler:2.2.0'

// Room (use 1.1.0-alpha2 for latest alpha)
implementation "android.arch.persistence.room:runtime:1.1.1"
annotationProcessor "android.arch.persistence.room:compiler:1.1.1"
implementation 'androidx.room:room-runtime:2.2.5'
annotationProcessor 'androidx.room:room-compiler:2.2.5'

// GSON
compile 'com.google.code.gson:gson:2.8.2'
implementation 'com.google.code.gson:gson:2.8.5'

// RETROFIT
compile 'com.squareup.retrofit2:retrofit:2.4.0'
compile 'com.squareup.retrofit2:converter-gson:2.4.0'
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'

// DAGGER 2
implementation 'com.google.dagger:dagger-android:2.17'
Expand All @@ -59,8 +60,8 @@ dependencies {
annotationProcessor 'com.google.dagger:dagger-compiler:2.17'

// BUTTERKNIFE
compile 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
implementation 'com.jakewharton:butterknife:10.0.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.0.0'

// GLIDE
implementation 'com.github.bumptech.glide:glide:4.8.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
package com.boisneyphilippe.githubarchitecturecomponents.db;


import android.arch.persistence.room.Room;
import android.support.test.InstrumentationRegistry;
import androidx.room.Room;
import androidx.test.platform.app.InstrumentationRegistry;

import com.boisneyphilippe.githubarchitecturecomponents.database.MyDatabase;

Expand All @@ -30,7 +30,7 @@ abstract public class DbTest {

@Before
public void initDb() {
db = Room.inMemoryDatabaseBuilder(InstrumentationRegistry.getContext(),
db = Room.inMemoryDatabaseBuilder(InstrumentationRegistry.getInstrumentation().getContext(),
MyDatabase.class).build();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
package com.boisneyphilippe.githubarchitecturecomponents.db;

import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import androidx.test.ext.junit.runners.AndroidJUnit4;

import com.boisneyphilippe.githubarchitecturecomponents.database.entity.User;
import com.boisneyphilippe.githubarchitecturecomponents.db.DbTest;
import com.boisneyphilippe.githubarchitecturecomponents.utils.LiveDataTestUtil;

import org.junit.Test;
Expand All @@ -15,7 +12,6 @@

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.*;

/**
* Instrumented test, which will execute on an Android device.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
package com.boisneyphilippe.githubarchitecturecomponents.utils;

import android.arch.lifecycle.LiveData;
import android.arch.lifecycle.Observer;
import android.support.annotation.Nullable;
import android.os.Handler;
import android.os.Looper;

import androidx.lifecycle.LiveData;
import androidx.lifecycle.Observer;
import androidx.annotation.Nullable;

import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
Expand All @@ -23,7 +26,12 @@ public void onChanged(@Nullable T o) {
liveData.removeObserver(this);
}
};
liveData.observeForever(observer);
new Handler(Looper.getMainLooper()).post(new Runnable() {
@Override
public void run() {
liveData.observeForever(observer);
}
});
latch.await(2, TimeUnit.SECONDS);
//noinspection unchecked
return (T) data[0];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.boisneyphilippe.githubarchitecturecomponents.activities;

import android.support.v4.app.Fragment;
import android.support.v7.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;

import com.boisneyphilippe.githubarchitecturecomponents.R;
Expand All @@ -10,7 +10,6 @@
import javax.inject.Inject;

import dagger.android.AndroidInjection;
import dagger.android.AndroidInjector;
import dagger.android.DispatchingAndroidInjector;
import dagger.android.support.HasSupportFragmentInjector;

Expand Down
Loading