Skip to content

Commit 8a2fcc5

Browse files
author
Kaushik Gopal
committed
Merge branch 'kg/feat/google-java-fmt'
* kg/feat/google-java-fmt: fix: cleaup formatting to google-java-fmt chore: add javafmt plugin dep
2 parents 06f8bd3 + 59e31d1 commit 8a2fcc5

42 files changed

Lines changed: 3214 additions & 3176 deletions

Some content is hidden

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

app/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ buildscript {
1616

1717
apply plugin: 'com.android.application'
1818
apply plugin: 'me.tatarka.retrolambda'
19+
apply plugin: 'com.f2prateek.javafmt'
1920

2021
ext {
2122
okhttpVersion = "3.0.1"

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

Lines changed: 37 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -8,54 +8,52 @@
88
import com.morihacky.android.rxjava.fragments.RotationPersist2WorkerFragment;
99
import com.morihacky.android.rxjava.rxbus.RxBus;
1010

11-
public class MainActivity
12-
extends FragmentActivity {
11+
public class MainActivity extends FragmentActivity {
1312

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

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

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

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

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

42-
private void _removeWorkerFragments() {
43-
Fragment frag = getSupportFragmentManager().findFragmentByTag(RotationPersist1WorkerFragment.class.getName());
39+
return _rxBus;
40+
}
4441

45-
if (frag != null) {
46-
getSupportFragmentManager()
47-
.beginTransaction()
48-
.remove(frag)
49-
.commit();
50-
}
42+
private void _removeWorkerFragments() {
43+
Fragment frag =
44+
getSupportFragmentManager()
45+
.findFragmentByTag(RotationPersist1WorkerFragment.class.getName());
46+
47+
if (frag != null) {
48+
getSupportFragmentManager().beginTransaction().remove(frag).commit();
49+
}
5150

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

54-
if (frag != null) {
55-
getSupportFragmentManager()
56-
.beginTransaction()
57-
.remove(frag)
58-
.commit();
59-
}
55+
if (frag != null) {
56+
getSupportFragmentManager().beginTransaction().remove(frag).commit();
6057
}
61-
}
58+
}
59+
}

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

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,33 +6,32 @@
66
import com.squareup.leakcanary.RefWatcher;
77
import timber.log.Timber;
88

9-
public class MyApp
10-
extends Application {
9+
public class MyApp extends Application {
1110

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

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

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

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

27-
_instance = (MyApp) getApplicationContext();
28-
_refWatcher = LeakCanary.install(this);
26+
_instance = (MyApp) getApplicationContext();
27+
_refWatcher = LeakCanary.install(this);
2928

30-
// for better RxJava debugging
31-
//RxJavaHooks.enableAssemblyTracking();
29+
// for better RxJava debugging
30+
//RxJavaHooks.enableAssemblyTracking();
3231

33-
// Initialize Volley
34-
MyVolley.init(this);
32+
// Initialize Volley
33+
MyVolley.init(this);
3534

36-
Timber.plant(new Timber.DebugTree());
37-
}
35+
Timber.plant(new Timber.DebugTree());
36+
}
3837
}

app/src/main/java/com/morihacky/android/rxjava/fragments/BaseFragment.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@
44
import com.morihacky.android.rxjava.MyApp;
55
import com.squareup.leakcanary.RefWatcher;
66

7-
public class BaseFragment
8-
extends Fragment {
7+
public class BaseFragment extends Fragment {
98

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

0 commit comments

Comments
 (0)