Commit 7898c757 authored by Alexandre Perraud's avatar Alexandre Perraud

Preferences : move Developer preferences to Advanced category

parent 9b8b7d77
......@@ -50,9 +50,6 @@
<Preference
android:title="@string/advanced_prefs_category"
android:key="adv_category" />
<Preference
android:title="@string/developer_prefs_category"
android:key="dev_category" />
</PreferenceCategory>
......
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/advanced_prefs_category" >
android:title="@string/advanced_prefs_category">
<!--<ListPreference-->
<!--android:key="vout"-->
<!--android:summary="@string/vout_summary"-->
......@@ -60,4 +60,17 @@
android:summary="@string/enable_frame_skip_summary"
android:title="@string/enable_frame_skip" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/developer_prefs_category">
<CheckBoxPreference
android:defaultValue="true"
android:key="enable_verbose_mode"
android:summary="@string/enable_verbose_mode_summary"
android:title="@string/enable_verbose_mode" />
<PreferenceScreen
android:key="debug_logs"
android:title="@string/debug_logs" />
</PreferenceCategory>
</PreferenceScreen>
\ No newline at end of file
......@@ -23,16 +23,22 @@
package org.videolan.vlc.gui.preferences;
import android.Manifest;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.support.v7.preference.EditTextPreference;
import android.support.v7.preference.Preference;
import android.text.TextUtils;
import org.videolan.libvlc.util.AndroidUtil;
import org.videolan.vlc.BuildConfig;
import org.videolan.vlc.R;
import org.videolan.vlc.VLCApplication;
import org.videolan.vlc.gui.DebugLogActivity;
import org.videolan.vlc.gui.helpers.AudioUtil;
import org.videolan.vlc.gui.helpers.BitmapCache;
import org.videolan.vlc.gui.helpers.UiTools;
......@@ -59,6 +65,9 @@ public class PreferencesAdvanced extends BasePreferenceFragment implements Share
findPreference("quit_app").setEnabled(false);
}
findPreference("debug_logs").setVisible(AndroidUtil.isJellyBeanOrLater() ||
(BuildConfig.DEBUG && getActivity().checkCallingOrSelfPermission(Manifest.permission.READ_LOGS) == PackageManager.PERMISSION_GRANTED));
// Video output
// FIXME : This setting is disable until OpenGL is fixed
// ListPreference voutPref = (ListPreference) findPreference("vout");
......@@ -87,6 +96,10 @@ public class PreferencesAdvanced extends BasePreferenceFragment implements Share
if (preference.getKey() == null)
return false;
switch (preference.getKey()){
case "debug_logs":
Intent intent = new Intent(VLCApplication.getAppContext(), DebugLogActivity.class);
startActivity(intent);
return true;
case "clear_history":
new AlertDialog.Builder(getActivity())
.setTitle(R.string.clear_history)
......@@ -137,6 +150,7 @@ public class PreferencesAdvanced extends BasePreferenceFragment implements Share
case "deblocking":
case "enable_frame_skip":
case "enable_time_stretching_audio":
case "enable_verbose_mode":
VLCInstance.restart();
if (getActivity() != null )
((PreferencesActivity)getActivity()).restartMediaPlayer();
......
/*
* *************************************************************************
* PreferencesDeveloper.java
* **************************************************************************
* Copyright © 2015 VLC authors and VideoLAN
* Author: Geoffrey Métais
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* ***************************************************************************
*/
package org.videolan.vlc.gui.preferences;
import android.Manifest;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.support.v7.preference.Preference;
import org.videolan.libvlc.util.AndroidUtil;
import org.videolan.vlc.BuildConfig;
import org.videolan.vlc.R;
import org.videolan.vlc.VLCApplication;
import org.videolan.vlc.gui.DebugLogActivity;
import org.videolan.vlc.util.VLCInstance;
public class PreferencesDeveloper extends BasePreferenceFragment implements SharedPreferences.OnSharedPreferenceChangeListener {
@Override
protected int getXml() {
return R.xml.preferences_dev;
}
@Override
protected int getTitleId() {
return R.string.developer_prefs_category;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
findPreference("debug_logs").setVisible(AndroidUtil.isJellyBeanOrLater() ||
(BuildConfig.DEBUG && getActivity().checkCallingOrSelfPermission(Manifest.permission.READ_LOGS) == PackageManager.PERMISSION_GRANTED));
}
@Override
public void onStart() {
super.onStart();
getPreferenceScreen().getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
}
@Override
public void onStop() {
super.onStop();
getPreferenceScreen().getSharedPreferences()
.unregisterOnSharedPreferenceChangeListener(this);
}
@Override
public boolean onPreferenceTreeClick(Preference preference) {
switch (preference.getKey()){
case "debug_logs":
Intent intent = new Intent(VLCApplication.getAppContext(), DebugLogActivity.class);
startActivity(intent);
return true;
}
return super.onPreferenceTreeClick(preference);
}
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
switch (key){
case "enable_verbose_mode":
VLCInstance.restart();
if (getActivity() != null )
((PreferencesActivity)getActivity()).restartMediaPlayer();
}
}
}
......@@ -93,9 +93,6 @@ public class PreferencesFragment extends BasePreferenceFragment implements Share
case "adv_category":
loadFragment(new PreferencesAdvanced());
break;
case "dev_category":
loadFragment(new PreferencesDeveloper());
break;
case PLAYBACK_HISTORY:
getActivity().setResult(PreferencesActivity.RESULT_RESTART);
return true;
......
......@@ -23,10 +23,13 @@
package org.videolan.vlc.gui.tv.preferences;
import android.Manifest;
import android.annotation.TargetApi;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Bundle;
import android.support.v7.preference.EditTextPreference;
......@@ -34,9 +37,11 @@ import android.support.v7.preference.Preference;
import android.text.TextUtils;
import android.widget.Toast;
import org.videolan.libvlc.util.AndroidUtil;
import org.videolan.vlc.BuildConfig;
import org.videolan.vlc.R;
import org.videolan.vlc.VLCApplication;
import org.videolan.vlc.gui.DebugLogActivity;
import org.videolan.vlc.gui.helpers.AudioUtil;
import org.videolan.vlc.gui.helpers.BitmapCache;
import org.videolan.vlc.gui.helpers.UiTools;
......@@ -62,6 +67,8 @@ public class PreferencesAdvanced extends BasePreferenceFragment implements Share
if (TextUtils.equals(BuildConfig.FLAVOR_target, "chrome")) {
findPreference("quit_app").setEnabled(false);
}
findPreference("debug_logs").setVisible(AndroidUtil.isJellyBeanOrLater() ||
(BuildConfig.DEBUG && getActivity().checkCallingOrSelfPermission(Manifest.permission.READ_LOGS) == PackageManager.PERMISSION_GRANTED));
// Video output
// FIXME : This setting is disable until OpenGL is fixed
......@@ -93,6 +100,10 @@ public class PreferencesAdvanced extends BasePreferenceFragment implements Share
if (preference.getKey() == null)
return false;
switch (preference.getKey()){
case "debug_logs":
Intent intent = new Intent(VLCApplication.getAppContext(), DebugLogActivity.class);
startActivity(intent);
return true;
case "clear_history":
new AlertDialog.Builder(getActivity())
.setTitle(R.string.clear_history)
......@@ -143,6 +154,7 @@ public class PreferencesAdvanced extends BasePreferenceFragment implements Share
case "deblocking":
case "enable_frame_skip":
case "enable_time_stretching_audio":
case "enable_verbose_mode":
VLCInstance.restart();
if (getActivity() != null )
((PreferencesActivity)getActivity()).restartMediaPlayer();
......
/*
* *************************************************************************
* PreferencesDeveloper.java
* **************************************************************************
* Copyright © 2015 VLC authors and VideoLAN
* Author: Geoffrey Métais
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* ***************************************************************************
*/
package org.videolan.vlc.gui.tv.preferences;
import android.Manifest;
import android.annotation.TargetApi;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Bundle;
import android.support.v7.preference.Preference;
import org.videolan.libvlc.util.AndroidUtil;
import org.videolan.vlc.BuildConfig;
import org.videolan.vlc.R;
import org.videolan.vlc.VLCApplication;
import org.videolan.vlc.gui.DebugLogActivity;
import org.videolan.vlc.util.VLCInstance;
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
public class PreferencesDeveloper extends BasePreferenceFragment implements SharedPreferences.OnSharedPreferenceChangeListener {
@Override
protected int getXml() {
return R.xml.preferences_dev;
}
@Override
protected int getTitleId() {
return R.string.developer_prefs_category;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
findPreference("debug_logs").setVisible(AndroidUtil.isJellyBeanOrLater() ||
(BuildConfig.DEBUG && getActivity().checkCallingOrSelfPermission(Manifest.permission.READ_LOGS) == PackageManager.PERMISSION_GRANTED));
}
@Override
public void onStart() {
super.onStart();
getPreferenceScreen().getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
}
@Override
public void onStop() {
super.onStop();
getPreferenceScreen().getSharedPreferences()
.unregisterOnSharedPreferenceChangeListener(this);
}
@Override
public boolean onPreferenceTreeClick(Preference preference) {
switch (preference.getKey()){
case "debug_logs":
Intent intent = new Intent(VLCApplication.getAppContext(), DebugLogActivity.class);
startActivity(intent);
return true;
}
return super.onPreferenceTreeClick(preference);
}
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
switch (key){
case "enable_verbose_mode":
VLCInstance.restart();
if (getActivity() != null )
((PreferencesActivity)getActivity()).restartMediaPlayer();
}
}
}
......@@ -96,9 +96,6 @@ public class PreferencesFragment extends BasePreferenceFragment implements Share
case "adv_category":
loadFragment(new PreferencesAdvanced());
break;
case "dev_category":
loadFragment(new PreferencesDeveloper());
break;
case PLAYBACK_HISTORY:
getActivity().setResult(PreferencesActivity.RESULT_RESTART);
return true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment