Skip to content

Commit bb90bb7

Browse files
author
Kaushik Gopal
committed
chore: Add LeakCanary to project
1 parent d7c5f4e commit bb90bb7

File tree

4 files changed

+36
-7
lines changed

4 files changed

+36
-7
lines changed

app/build.gradle

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ dependencies {
1414
compile 'com.squareup.okhttp:okhttp:2.0.0'
1515
compile 'com.squareup.okhttp:okhttp-urlconnection:2.0.0'
1616

17+
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.3'
18+
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.3'
1719
}
1820

1921
android {
@@ -33,8 +35,4 @@ android {
3335
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
3436
}
3537
}
36-
}
37-
38-
dependencies {
39-
compile fileTree(dir: 'libs', include: ['*.jar'])
40-
}
38+
}

app/src/main/AndroidManifest.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3-
package="com.morihacky.android.rxjava.app" >
3+
package="com.morihacky.android.rxjava" >
44

55
<application
6+
android:name=".MyApp"
67
android:allowBackup="true"
78
android:icon="@drawable/ic_launcher"
89
android:label="@string/app_name"
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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+
}

app/src/main/java/com/morihacky/android/rxjava/rxbus/RxBusDemo_TopFragment.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@
88
import android.view.ViewGroup;
99
import butterknife.ButterKnife;
1010
import butterknife.OnClick;
11+
import com.morihacky.android.rxjava.BaseFragment;
1112
import com.morihacky.android.rxjava.MainActivity;
1213
import com.morihacky.android.rxjava.app.R;
1314

1415
public class RxBusDemo_TopFragment
15-
extends Fragment {
16+
extends BaseFragment {
1617

1718
private RxBus _rxBus;
1819

0 commit comments

Comments
 (0)