Skip to content

Commit 40aaf94

Browse files
author
Venkatesh Burgula
committed
Update gradle to 3.0
1 parent f8f59b5 commit 40aaf94

File tree

63 files changed

+3377
-3297
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+3377
-3297
lines changed

app/build.gradle

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
buildscript {
22
repositories {
3-
// mavenCentral()
3+
mavenCentral()
44
jcenter()
55
}
66
dependencies {
7-
classpath 'me.tatarka:gradle-retrolambda:3.6.0'
7+
classpath 'me.tatarka:gradle-retrolambda:3.7.0'
88
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}"
99
}
1010

@@ -38,7 +38,7 @@ dependencies {
3838

3939
compile "android.arch.lifecycle:runtime:${archComponentsVersion}"
4040
compile "android.arch.lifecycle:extensions:${archComponentsVersion}"
41-
kapt "android.arch.lifecycle:compiler:${archComponentsVersion}"
41+
kapt "android.arch.lifecycle:compiler:${archComponentsVersion}"
4242

4343
// ----------------------------------
4444
// Rx dependencies
@@ -90,4 +90,5 @@ android {
9090
packagingOptions {
9191
pickFirst 'META-INF/rxjava.properties'
9292
}
93+
buildToolsVersion '26.0.2'
9394
}

app/src/main/java/com/morihacky/android/rxjava/MainActivity.java

+36-34
Original file line numberDiff line numberDiff line change
@@ -3,57 +3,59 @@
33
import android.os.Bundle;
44
import android.support.v4.app.Fragment;
55
import android.support.v7.app.AppCompatActivity;
6+
67
import com.morihacky.android.rxjava.fragments.MainFragment;
78
import com.morihacky.android.rxjava.fragments.RotationPersist1WorkerFragment;
89
import com.morihacky.android.rxjava.fragments.RotationPersist2WorkerFragment;
910
import com.morihacky.android.rxjava.rxbus.RxBus;
1011

1112
public class MainActivity extends AppCompatActivity {
1213

13-
private RxBus _rxBus = null;
14+
private RxBus _rxBus = null;
1415

15-
@Override
16-
public void onBackPressed() {
17-
super.onBackPressed();
18-
_removeWorkerFragments();
19-
}
16+
@Override
17+
public void onBackPressed() {
18+
super.onBackPressed();
19+
_removeWorkerFragments();
20+
}
2021

21-
@Override
22-
protected void onCreate(Bundle savedInstanceState) {
23-
super.onCreate(savedInstanceState);
22+
@Override
23+
protected void onCreate(Bundle savedInstanceState) {
24+
super.onCreate(savedInstanceState);
2425

25-
if (savedInstanceState == null) {
26-
getSupportFragmentManager()
27-
.beginTransaction()
28-
.replace(android.R.id.content, new MainFragment(), this.toString())
29-
.commit();
26+
if (savedInstanceState == null) {
27+
getSupportFragmentManager()
28+
.beginTransaction()
29+
.replace(android.R.id.content, new MainFragment(), this.toString())
30+
.commit();
31+
}
3032
}
31-
}
3233

33-
// This is better done with a DI Library like Dagger
34-
public RxBus getRxBusSingleton() {
35-
if (_rxBus == null) {
36-
_rxBus = new RxBus();
34+
// This is better done with a DI Library like Dagger
35+
public RxBus getRxBusSingleton() {
36+
if (_rxBus == null) {
37+
_rxBus = new RxBus();
3738
}
3839

39-
return _rxBus;
40-
}
40+
return _rxBus;
41+
}
4142

42-
private void _removeWorkerFragments() {
43-
Fragment frag =
44-
getSupportFragmentManager()
45-
.findFragmentByTag(RotationPersist1WorkerFragment.class.getName());
43+
private void _removeWorkerFragments() {
44+
Fragment frag =
45+
getSupportFragmentManager()
46+
.findFragmentByTag(RotationPersist1WorkerFragment.class.getName());
4647

47-
if (frag != null) {
48-
getSupportFragmentManager().beginTransaction().remove(frag).commit();
49-
}
48+
if (frag != null) {
49+
getSupportFragmentManager().beginTransaction().remove(frag).commit();
50+
}
5051

51-
frag =
52-
getSupportFragmentManager()
53-
.findFragmentByTag(RotationPersist2WorkerFragment.class.getName());
52+
frag =
53+
getSupportFragmentManager()
54+
.findFragmentByTag(RotationPersist2WorkerFragment.class.getName());
5455

55-
if (frag != null) {
56-
getSupportFragmentManager().beginTransaction().remove(frag).commit();
56+
if (frag != null) {
57+
getSupportFragmentManager().beginTransaction().remove(frag).commit();
58+
}
5759
}
58-
}
60+
5961
}
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,45 @@
11
package com.morihacky.android.rxjava;
22

33
import android.support.multidex.MultiDexApplication;
4+
45
import com.morihacky.android.rxjava.volley.MyVolley;
56
import com.squareup.leakcanary.LeakCanary;
67
import com.squareup.leakcanary.RefWatcher;
8+
79
import timber.log.Timber;
810

911
public class MyApp extends MultiDexApplication {
1012

11-
private static MyApp _instance;
12-
private RefWatcher _refWatcher;
13+
private static MyApp _instance;
14+
private RefWatcher _refWatcher;
1315

14-
public static MyApp get() {
15-
return _instance;
16-
}
16+
public static MyApp get() {
17+
return _instance;
18+
}
1719

18-
public static RefWatcher getRefWatcher() {
19-
return MyApp.get()._refWatcher;
20-
}
20+
public static RefWatcher getRefWatcher() {
21+
return MyApp.get()._refWatcher;
22+
}
2123

22-
@Override
23-
public void onCreate() {
24-
super.onCreate();
24+
@Override
25+
public void onCreate() {
26+
super.onCreate();
2527

26-
if (LeakCanary.isInAnalyzerProcess(this)) {
27-
// This process is dedicated to LeakCanary for heap analysis.
28-
// You should not init your app in this process.
29-
return;
30-
}
28+
if (LeakCanary.isInAnalyzerProcess(this)) {
29+
// This process is dedicated to LeakCanary for heap analysis.
30+
// You should not init your app in this process.
31+
return;
32+
}
3133

32-
_instance = (MyApp) getApplicationContext();
33-
_refWatcher = LeakCanary.install(this);
34+
_instance = (MyApp) getApplicationContext();
35+
_refWatcher = LeakCanary.install(this);
3436

35-
// for better RxJava debugging
36-
//RxJavaHooks.enableAssemblyTracking();
37+
// for better RxJava debugging
38+
//RxJavaHooks.enableAssemblyTracking();
3739

38-
// Initialize Volley
39-
MyVolley.init(this);
40+
// Initialize Volley
41+
MyVolley.init(this);
4042

41-
Timber.plant(new Timber.DebugTree());
42-
}
43+
Timber.plant(new Timber.DebugTree());
44+
}
4345
}
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
package com.morihacky.android.rxjava.fragments;
22

33
import android.support.v4.app.Fragment;
4+
45
import com.morihacky.android.rxjava.MyApp;
56
import com.squareup.leakcanary.RefWatcher;
67

78
public class BaseFragment extends Fragment {
89

9-
@Override
10-
public void onDestroy() {
11-
super.onDestroy();
12-
RefWatcher refWatcher = MyApp.getRefWatcher();
13-
refWatcher.watch(this);
14-
}
10+
@Override
11+
public void onDestroy() {
12+
super.onDestroy();
13+
RefWatcher refWatcher = MyApp.getRefWatcher();
14+
refWatcher.watch(this);
15+
}
1516
}

0 commit comments

Comments
 (0)