diff --git a/app/src/main/java/org/schabi/newpipe/MainActivity.java b/app/src/main/java/org/schabi/newpipe/MainActivity.java index e696f867f..573479ea7 100644 --- a/app/src/main/java/org/schabi/newpipe/MainActivity.java +++ b/app/src/main/java/org/schabi/newpipe/MainActivity.java @@ -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); } diff --git a/app/src/main/java/org/schabi/newpipe/settings/DebugSettingsFragment.java b/app/src/main/java/org/schabi/newpipe/settings/DebugSettingsFragment.java new file mode 100644 index 000000000..0956f47d6 --- /dev/null +++ b/app/src/main/java/org/schabi/newpipe/settings/DebugSettingsFragment.java @@ -0,0 +1,12 @@ +package org.schabi.newpipe.settings; + +import android.os.Bundle; + +import org.schabi.newpipe.R; + +public class DebugSettingsFragment extends BasePreferenceFragment { + @Override + public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { + addPreferencesFromResource(R.xml.debug_settings); + } +} diff --git a/app/src/main/java/org/schabi/newpipe/settings/MainSettingsFragment.java b/app/src/main/java/org/schabi/newpipe/settings/MainSettingsFragment.java index 728da0ae5..5e07e2b12 100644 --- a/app/src/main/java/org/schabi/newpipe/settings/MainSettingsFragment.java +++ b/app/src/main/java/org/schabi/newpipe/settings/MainSettingsFragment.java @@ -3,11 +3,19 @@ package org.schabi.newpipe.settings; import android.os.Bundle; import android.support.v7.preference.Preference; +import org.schabi.newpipe.BuildConfig; import org.schabi.newpipe.R; public class MainSettingsFragment extends BasePreferenceFragment { + public static final boolean DEBUG = !BuildConfig.BUILD_TYPE.equals("release"); + @Override public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { addPreferencesFromResource(R.xml.main_settings); + + if (!DEBUG) { + final Preference debug = findPreference(getString(R.string.debug_pref_screen_key)); + getPreferenceScreen().removePreference(debug); + } } } diff --git a/app/src/main/res/menu/debug_menu.xml b/app/src/main/res/menu/debug_menu.xml deleted file mode 100644 index 448f9cf23..000000000 --- a/app/src/main/res/menu/debug_menu.xml +++ /dev/null @@ -1,12 +0,0 @@ - -
\ No newline at end of file diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index afdb6efd0..25cba8191 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -395,9 +395,6 @@