Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#159 Renamed resources leading with "__" #161

Merged
merged 2 commits into from
Jul 19, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions leakcanary-android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def gitSha() {
}

android {
resourcePrefix 'leak_canary_'
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
defaultConfig {
Expand Down
6 changes: 3 additions & 3 deletions leakcanary-android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@
android:enabled="false"
/>
<activity
android:theme="@style/__LeakCanary.Base"
android:theme="@style/leak_canary_LeakCanary.Base"
android:name=".internal.DisplayLeakActivity"
android:enabled="false"
android:label="@string/__leak_canary_display_activity_label"
android:icon="@drawable/__leak_canary_icon"
android:label="@string/leak_canary_display_activity_label"
android:icon="@drawable/leak_canary_icon"
android:taskAffinity="com.squareup.leakcanary"
>
<intent-filter>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ private void showToast(final FutureResult<Toast> waitingForToast) {
toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0);
toast.setDuration(Toast.LENGTH_LONG);
LayoutInflater inflater = LayoutInflater.from(context);
toast.setView(inflater.inflate(R.layout.__leak_canary_heap_dump_toast, null));
toast.setView(inflater.inflate(R.layout.leak_canary_heap_dump_toast, null));
toast.show();
// Waiting for Idle to make sure Toast gets rendered.
Looper.myQueue().addIdleHandler(new MessageQueue.IdleHandler() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ protected final void onHeapAnalyzed(HeapDump heapDump, AnalysisResult result) {
return;
}

int maxStoredLeaks = getResources().getInteger(R.integer.__leak_canary_max_stored_leaks);
int maxStoredLeaks = getResources().getInteger(R.integer.leak_canary_max_stored_leaks);
File renamedFile = findNextAvailableHprofFile(maxStoredLeaks);

if (renamedFile == null) {
Expand Down Expand Up @@ -100,25 +100,25 @@ protected final void onHeapAnalyzed(HeapDump heapDump, AnalysisResult result) {
String contentTitle;
if (result.failure == null) {
contentTitle =
getString(R.string.__leak_canary_class_has_leaked, classSimpleName(result.className));
getString(R.string.leak_canary_class_has_leaked, classSimpleName(result.className));
} else {
contentTitle = getString(R.string.__leak_canary_analysis_failed);
contentTitle = getString(R.string.leak_canary_analysis_failed);
}
String contentText = getString(R.string.__leak_canary_notification_message);
String contentText = getString(R.string.leak_canary_notification_message);

NotificationManager notificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);

Notification notification;
if (SDK_INT < HONEYCOMB) {
notification = new Notification();
notification.icon = R.drawable.__leak_canary_notification;
notification.icon = R.drawable.leak_canary_notification;
notification.when = System.currentTimeMillis();
notification.flags |= Notification.FLAG_AUTO_CANCEL;
notification.setLatestEventInfo(this, contentTitle, contentText, pendingIntent);
} else {
Notification.Builder builder = new Notification.Builder(this) //
.setSmallIcon(R.drawable.__leak_canary_notification)
.setSmallIcon(R.drawable.leak_canary_notification)
.setWhen(System.currentTimeMillis())
.setContentTitle(contentTitle)
.setContentText(contentText)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,13 @@ public static PendingIntent createPendingIntent(Context context, String referenc
//noinspection unchecked
leaks = (List<Leak>) getLastNonConfigurationInstance();

setContentView(R.layout.__leak_canary_display_leak);
setContentView(R.layout.leak_canary_display_leak);

listView = (ListView) findViewById(R.id.__leak_canary_display_leak_list);
failureView = (TextView) findViewById(R.id.__leak_canary_display_leak_failure);
actionButton = (Button) findViewById(R.id.__leak_canary_action);

maxStoredLeaks = getResources().getInteger(R.integer.__leak_canary_max_stored_leaks);
maxStoredLeaks = getResources().getInteger(R.integer.leak_canary_max_stored_leaks);

updateUi();
}
Expand All @@ -132,14 +132,14 @@ public static PendingIntent createPendingIntent(Context context, String referenc

@Override public boolean onCreateOptionsMenu(Menu menu) {
if (getVisibleLeak() != null) {
menu.add(R.string.__leak_canary_share_leak)
menu.add(R.string.leak_canary_share_leak)
.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
@Override public boolean onMenuItemClick(MenuItem item) {
shareLeak();
return true;
}
});
menu.add(R.string.__leak_canary_share_heap_dump)
menu.add(R.string.leak_canary_share_heap_dump)
.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
@Override public boolean onMenuItemClick(MenuItem item) {
shareHeapDump();
Expand Down Expand Up @@ -174,7 +174,7 @@ private void shareLeak() {
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_TEXT, leakInfo);
startActivity(Intent.createChooser(intent, getString(R.string.__leak_canary_share_with)));
startActivity(Intent.createChooser(intent, getString(R.string.leak_canary_share_with)));
}

private void shareHeapDump() {
Expand All @@ -184,7 +184,7 @@ private void shareHeapDump() {
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("application/octet-stream");
intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(heapDumpFile));
startActivity(Intent.createChooser(intent, getString(R.string.__leak_canary_share_with)));
startActivity(Intent.createChooser(intent, getString(R.string.leak_canary_share_with)));
}

private void updateUi() {
Expand Down Expand Up @@ -212,13 +212,13 @@ private void updateUi() {
listView.setVisibility(GONE);
failureView.setVisibility(VISIBLE);
failureView.setText(
getString(R.string.__leak_canary_failure_report) + Log.getStackTraceString(
getString(R.string.leak_canary_failure_report) + Log.getStackTraceString(
result.failure));
setTitle(R.string.__leak_canary_analysis_failed);
setTitle(R.string.leak_canary_analysis_failed);
invalidateOptionsMenu();
getActionBar().setDisplayHomeAsUpEnabled(true);
actionButton.setVisibility(VISIBLE);
actionButton.setText(R.string.__leak_canary_delete);
actionButton.setText(R.string.leak_canary_delete);
listView.setAdapter(null);
} else {
final DisplayLeakAdapter adapter;
Expand All @@ -236,7 +236,7 @@ public void onItemClick(AdapterView<?> parent, View view, int position, long id)
invalidateOptionsMenu();
getActionBar().setDisplayHomeAsUpEnabled(true);
actionButton.setVisibility(VISIBLE);
actionButton.setText(R.string.__leak_canary_delete);
actionButton.setText(R.string.leak_canary_delete);
actionButton.setOnClickListener(new View.OnClickListener() {
@Override public void onClick(View v) {
Leak visibleLeak = getVisibleLeak();
Expand All @@ -252,7 +252,7 @@ public void onItemClick(AdapterView<?> parent, View view, int position, long id)
HeapDump heapDump = visibleLeak.heapDump;
adapter.update(result.leakTrace, heapDump.referenceKey, heapDump.referenceName);
setTitle(
getString(R.string.__leak_canary_class_has_leaked, classSimpleName(result.className)));
getString(R.string.leak_canary_class_has_leaked, classSimpleName(result.className)));
}
} else {
if (listAdapter instanceof LeakListAdapter) {
Expand All @@ -268,9 +268,9 @@ public void onItemClick(AdapterView<?> parent, View view, int position, long id)
}
});
invalidateOptionsMenu();
setTitle(getString(R.string.__leak_canary_leak_list_title, getPackageName()));
setTitle(getString(R.string.leak_canary_leak_list_title, getPackageName()));
getActionBar().setDisplayHomeAsUpEnabled(false);
actionButton.setText(R.string.__leak_canary_delete_all);
actionButton.setText(R.string.leak_canary_delete_all);
actionButton.setOnClickListener(new View.OnClickListener() {
@Override public void onClick(View v) {
File[] files = detectedLeakDirectory().listFiles();
Expand Down Expand Up @@ -317,7 +317,7 @@ class LeakListAdapter extends BaseAdapter {
@Override public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = LayoutInflater.from(DisplayLeakActivity.this)
.inflate(R.layout.__leak_canary_leak_row, parent, false);
.inflate(R.layout.leak_canary_leak_row, parent, false);
}
TextView titleView = (TextView) convertView.findViewById(R.id.__leak_canary_row_text);
TextView timeView = (TextView) convertView.findViewById(R.id.__leak_canary_row_time);
Expand All @@ -332,7 +332,7 @@ class LeakListAdapter extends BaseAdapter {

String title;
if (leak.result.failure == null) {
title = index + getString(R.string.__leak_canary_class_has_leaked,
title = index + getString(R.string.leak_canary_class_has_leaked,
classSimpleName(leak.result.className));
} else {
title = index
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ final class DisplayLeakAdapter extends BaseAdapter {
if (getItemViewType(position) == TOP_ROW) {
if (convertView == null) {
convertView =
LayoutInflater.from(context).inflate(R.layout.__leak_canary_ref_top_row, parent, false);
LayoutInflater.from(context).inflate(R.layout.leak_canary_ref_top_row, parent, false);
}
TextView textView = findById(convertView, R.id.__leak_canary_row_text);
textView.setText(context.getPackageName());
} else {
if (convertView == null) {
convertView =
LayoutInflater.from(context).inflate(R.layout.__leak_canary_ref_row, parent, false);
LayoutInflater.from(context).inflate(R.layout.leak_canary_ref_row, parent, false);
}
TextView textView = findById(convertView, R.id.__leak_canary_row_text);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,22 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@drawable/__leak_canary_toast_background"
android:background="@drawable/leak_canary_toast_background"
android:padding="16dp"
>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:src="@drawable/__leak_canary_icon"/>
android:src="@drawable/leak_canary_icon"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:textColor="#ffffff"
android:textSize="18sp"
android:text="@string/__leak_canary_toast_heap_dump"
android:text="@string/leak_canary_toast_heap_dump"
/>

</LinearLayout>
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
~ limitations under the License.
-->
<resources>
<style name="__LeakCanary.Base" parent="android:Theme.Holo">
<style name="leak_canary_LeakCanary.Base" parent="android:Theme.Holo">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did this change?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, git is being bad at diffing.

</style>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
~ limitations under the License.
-->
<resources>
<style name="__LeakCanary.Base" parent="android:Theme.Material">
<style name="leak_canary_LeakCanary.Base" parent="android:Theme.Material">
</style>
</resources>
32 changes: 0 additions & 32 deletions leakcanary-android/src/main/res/values/__leak_canary_strings.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
~ limitations under the License.
-->
<resources>
<integer name="__leak_canary_max_stored_leaks">7</integer>
<integer name="leak_canary_max_stored_leaks">7</integer>
</resources>
32 changes: 32 additions & 0 deletions leakcanary-android/src/main/res/values/leak_canary_strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2015 Square, Inc.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<resources>

<string name="leak_canary_class_has_leaked">%s has leaked</string>
<string name="leak_canary_analysis_failed">Leak analysis failed</string>
<string name="leak_canary_leak_list_title">Leaks in %s</string>
<string name="leak_canary_notification_message">Click for more details</string>
<string name="leak_canary_share_leak">Share info</string>
<string name="leak_canary_share_heap_dump">Share heap dump</string>
<string name="leak_canary_share_with">Share with…</string>
<string name="leak_canary_display_activity_label">Leaks</string>
<string name="leak_canary_toast_heap_dump">Dumping memory, app will freeze. Brrrr.</string>
<string name="leak_canary_delete">Delete</string>
<string name="leak_canary_failure_report">"Please report this failure to http://github.com/square/leakcanary\n"</string>
<string name="leak_canary_delete_all">Delete all</string>

</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
~ limitations under the License.
-->
<resources>
<style name="__LeakCanary.Base" parent="android:Theme">
<style name="leak_canary_LeakCanary.Base" parent="android:Theme">
</style>
</resources>