Skip to content

Commit

Permalink
Cage up Leak Canary in the debug drawer.
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-horner committed Dec 22, 2015
1 parent 993ead0 commit bbbf15f
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/internalDebug/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>

<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
>
<!-- Used for sharing logs and Spoon. -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

Expand Down Expand Up @@ -31,5 +34,14 @@
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
<activity
android:name="com.squareup.leakcanary.internal.DisplayLeakActivity"
android:enabled="false"
android:label="@string/__leak_canary_display_activity_label"
android:taskAffinity="com.squareup.leakcanary"
android:theme="@style/__LeakCanary.Base"
>
<intent-filter tools:node="removeAll"/>
</activity>
</application>
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import android.animation.ValueAnimator;
import android.app.Application;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.support.v7.app.AlertDialog;
import android.util.AttributeSet;
Expand Down Expand Up @@ -47,6 +48,7 @@
import com.jakewharton.u2020.ui.misc.EnumAdapter;
import com.jakewharton.u2020.util.Keyboards;
import com.jakewharton.u2020.util.Strings;
import com.squareup.leakcanary.internal.DisplayLeakActivity;
import com.squareup.okhttp.Cache;
import com.squareup.okhttp.OkHttpClient;
import com.squareup.picasso.Picasso;
Expand Down Expand Up @@ -386,6 +388,11 @@ private void setupUserInterfaceSection() {
new LogsDialog(new ContextThemeWrapper(getContext(), R.style.Theme_U2020), lumberYard).show();
}

@OnClick(R.id.debug_leaks_show) void showLeaks() {
Intent intent = new Intent(getContext(), DisplayLeakActivity.class);
getContext().startActivity(intent);
}

private void setupBuildSection() {
buildNameView.setText(BuildConfig.VERSION_NAME);
buildCodeView.setText(String.valueOf(BuildConfig.VERSION_CODE));
Expand Down
8 changes: 8 additions & 0 deletions src/internalDebug/res/layout/debug_view_content.xml
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,14 @@
android:layout_gravity="start|fill_horizontal"
android:text="Show logs"
/>
<Button
android:id="@+id/debug_leaks_show"
android:layout_columnSpan="2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="start|fill_horizontal"
android:text="Leak analysis"
/>

<!-- BUILD INFORMATION SECTION -->

Expand Down

0 comments on commit bbbf15f

Please sign in to comment.