GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Merge branch 'kg/feat/google-java-fmt' · Hancony/RxJava-Android-Samples@8a2fcc5

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • app
    • build.gradle
    • src/main/java/com/morihacky/android/rxjava
      • MainActivity.java
      • MyApp.java
      • fragments
        • BaseFragment.java
        • BufferDemoFragment.java
        • ConcurrencyWithSchedulersDemoFragment.java
        • DebounceSearchEmitterFragment.java
        • DoubleBindingTextViewFragment.java
        • ExponentialBackoffFragment.java
        • FormValidationCombineLatestFragment.java
        • MainFragment.java
        • NetworkDetectorFragment.java
        • PlaygroundFragment.java
        • PollingFragment.java
        • PseudoCacheFragment.java
        • PseudoCacheMergeFragment.java
        • RetrofitAsyncTaskDeathFragment.java
        • RetrofitFragment.java
        • RotationPersist1Fragment.java
        • RotationPersist1WorkerFragment.java
        • RotationPersist2Fragment.java
        • RotationPersist2WorkerFragment.java
        • TimeoutDemoFragment.java
        • TimingDemoFragment.java
      • pagination
        • PaginationAdapter.java
        • PaginationAutoAdapter.java
        • PaginationAutoFragment.java
        • PaginationFragment.java
      • retrofit
        • Contributor.java
        • GithubApi.java
        • GithubService.java
        • User.java
      • rxbus
        • RxBus.java
        • RxBusDemoFragment.java
        • RxBusDemo_Bottom1Fragment.java
        • RxBusDemo_Bottom2Fragment.java
        • RxBusDemo_Bottom3Fragment.java
        • RxBusDemo_TopFragment.java
      • volley
        • MyVolley.java
        • VolleyDemoFragment.java
      • wiring
        • LogAdapter.java
  • build.gradle

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎app/build.gradle‎

Copy file name to clipboardExpand all lines: app/build.gradle
+1Lines 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"
Collapse file

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

Copy file name to clipboardExpand all lines: app/src/main/java/com/morihacky/android/rxjava/MainActivity.java
+37-39Lines 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+
}
Collapse file

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

Copy file name to clipboardExpand all lines: app/src/main/java/com/morihacky/android/rxjava/MyApp.java
+20-21Lines 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
}
Collapse file

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

Copy file name to clipboardExpand all lines: app/src/main/java/com/morihacky/android/rxjava/fragments/BaseFragment.java
+7-8Lines 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 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.