GeezerVison is showing github.com — chore: Add LeakCanary to project · ttylinux/Android-RxJava@bb90bb7
File tree
Expand file treeCollapse file tree
Open diff view settings
java/com/morihacky/android/rxjava
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: app/build.gradle +3-5Lines changed: 3 additions & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -14,6 +14,8 @@ dependencies { |
14 | 14 | compile 'com.squareup.okhttp:okhttp:2.0.0' |
15 | 15 | compile 'com.squareup.okhttp:okhttp-urlconnection:2.0.0' |
16 | 16 |
|
| 17 | + debugCompile 'com.squareup.leakcanary:leakcanary-android:1.3' |
| 18 | + releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.3' |
17 | 19 | } |
18 | 20 |
|
19 | 21 | android { |
@@ -33,8 +35,4 @@ android { |
33 | 35 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' |
34 | 36 | } |
35 | 37 | } |
36 | | -} |
37 | | - |
38 | | -dependencies { |
39 | | - compile fileTree(dir: 'libs', include: ['*.jar']) |
40 | | -} |
| 38 | +} |
Collapse file
Copy file name to clipboardExpand all lines: app/src/main/AndroidManifest.xml +2-1Lines changed: 2 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
|
1 | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | 2 | <manifest xmlns:android="http://schemas.android.com/apk/res/android" |
3 | | - package="com.morihacky.android.rxjava.app" > |
| 3 | + package="com.morihacky.android.rxjava" > |
4 | 4 |
|
5 | 5 | <application |
| 6 | + android:name=".MyApp" |
6 | 7 | android:allowBackup="true" |
7 | 8 | android:icon="@drawable/ic_launcher" |
8 | 9 | android:label="@string/app_name" |
|
Collapse file
Copy file name to clipboard +29Lines changed: 29 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +package com.morihacky.android.rxjava; |
| 2 | + |
| 3 | +import android.app.Application; |
| 4 | +import com.squareup.leakcanary.LeakCanary; |
| 5 | +import com.squareup.leakcanary.RefWatcher; |
| 6 | +import timber.log.Timber; |
| 7 | + |
| 8 | +public class MyApp |
| 9 | + extends Application { |
| 10 | + |
| 11 | + private static MyApp _instance; |
| 12 | + private RefWatcher _refWatcher; |
| 13 | + |
| 14 | + public static MyApp get() { |
| 15 | + return _instance; |
| 16 | + } |
| 17 | + |
| 18 | + public static RefWatcher getRefWatcher() { |
| 19 | + return MyApp.get()._refWatcher; |
| 20 | + } |
| 21 | + |
| 22 | + @Override |
| 23 | + public void onCreate() { |
| 24 | + super.onCreate(); |
| 25 | + |
| 26 | + _instance = (MyApp) getApplicationContext(); |
| 27 | + _refWatcher = LeakCanary.install(this); |
| 28 | + } |
| 29 | +} |
Collapse file
Copy file name to clipboardExpand all lines: app/src/main/java/com/morihacky/android/rxjava/rxbus/RxBusDemo_TopFragment.java +2-1Lines changed: 2 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
|
8 | 8 | import android.view.ViewGroup; |
9 | 9 | import butterknife.ButterKnife; |
10 | 10 | import butterknife.OnClick; |
| 11 | +import com.morihacky.android.rxjava.BaseFragment; |
11 | 12 | import com.morihacky.android.rxjava.MainActivity; |
12 | 13 | import com.morihacky.android.rxjava.app.R; |
13 | 14 |
|
14 | 15 | public class RxBusDemo_TopFragment |
15 | | - extends Fragment { |
| 16 | + extends BaseFragment { |
16 | 17 |
|
17 | 18 | private RxBus _rxBus; |
18 | 19 |
|
|