mirror of
https://github.com/TeamNewPipe/NewPipe.git
synced 2025-10-03 09:49:21 +02:00
-Added debug preference settings for debug and beta builds.
-Removed leak canary toggle on app menu. -Added leak canary settings to debug preference. -Removed/renamed leak canary related strings.
This commit is contained in:
parent
c1a302834c
commit
e8402008bc
14 changed files with 48 additions and 76 deletions
|
@ -20,7 +20,6 @@
|
|||
|
||||
package org.schabi.newpipe;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.net.Uri;
|
||||
|
@ -28,7 +27,6 @@ import android.os.Bundle;
|
|||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.design.widget.NavigationView;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.view.GravityCompat;
|
||||
|
@ -264,22 +262,6 @@ public class MainActivity extends AppCompatActivity {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressLint("ShowToast")
|
||||
private void onHeapDumpToggled(@NonNull MenuItem item) {
|
||||
final boolean isHeapDumpEnabled = !item.isChecked();
|
||||
|
||||
PreferenceManager.getDefaultSharedPreferences(this).edit()
|
||||
.putBoolean(getString(R.string.allow_heap_dumping_key), isHeapDumpEnabled).apply();
|
||||
item.setChecked(isHeapDumpEnabled);
|
||||
|
||||
final String heapDumpNotice;
|
||||
if (isHeapDumpEnabled) {
|
||||
heapDumpNotice = getString(R.string.enable_leak_canary_notice);
|
||||
} else {
|
||||
heapDumpNotice = getString(R.string.disable_leak_canary_notice);
|
||||
}
|
||||
Toast.makeText(getApplicationContext(), heapDumpNotice, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
/*//////////////////////////////////////////////////////////////////////////
|
||||
// Menu
|
||||
//////////////////////////////////////////////////////////////////////////*/
|
||||
|
@ -301,10 +283,6 @@ public class MainActivity extends AppCompatActivity {
|
|||
inflater.inflate(R.menu.main_menu, menu);
|
||||
}
|
||||
|
||||
if (DEBUG) {
|
||||
getMenuInflater().inflate(R.menu.debug_menu, menu);
|
||||
}
|
||||
|
||||
ActionBar actionBar = getSupportActionBar();
|
||||
if (actionBar != null) {
|
||||
actionBar.setDisplayHomeAsUpEnabled(false);
|
||||
|
@ -315,17 +293,6 @@ public class MainActivity extends AppCompatActivity {
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPrepareOptionsMenu(Menu menu) {
|
||||
MenuItem heapDumpToggle = menu.findItem(R.id.action_toggle_heap_dump);
|
||||
if (heapDumpToggle != null) {
|
||||
final boolean isToggled = PreferenceManager.getDefaultSharedPreferences(this)
|
||||
.getBoolean(getString(R.string.allow_heap_dumping_key), false);
|
||||
heapDumpToggle.setChecked(isToggled);
|
||||
}
|
||||
return super.onPrepareOptionsMenu(menu);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
if (DEBUG) Log.d(TAG, "onOptionsItemSelected() called with: item = [" + item + "]");
|
||||
|
@ -346,9 +313,6 @@ public class MainActivity extends AppCompatActivity {
|
|||
case R.id.action_history:
|
||||
NavigationHelper.openHistory(this);
|
||||
return true;
|
||||
case R.id.action_toggle_heap_dump:
|
||||
onHeapDumpToggled(item);
|
||||
return true;
|
||||
default:
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue