Commit 8c4e8379 authored by Alexandre Perraud's avatar Alexandre Perraud

Preferences : Subtitles reorganization

parent bb03ff96
......@@ -296,6 +296,20 @@
<string name="audio_title_alignment_right">Right</string>
<string name="audio_title_alignment_marquee">Marquee</string>
<string name="subtitles_prefs_category">Subtitles</string>
<string name="subtitles_size_title">Subtitles Size</string>
<string name="subtitles_size_small">Small</string>
<string name="subtitles_size_normal">Normal</string>
<string name="subtitles_size_big">Big</string>
<string name="subtitles_size_huge">Huge</string>
<string name="subtitles_color_title">Subtitles Color</string>
<string name="subtitles_color_white">White</string>
<string name="subtitles_color_pink">Pink</string>
<string name="subtitles_color_blue">Blue</string>
<string name="subtitles_color_yellow">Yellow</string>
<string name="subtitles_color_green">Green</string>
<string name="subtitles_background_title">Subtitles Background</string>
<string name="performance_prefs_category">Performance</string>
<string name="chroma_format">Force video chroma</string>
<string name="chroma_format_summary">RGB 32-bit: default chroma\nRGB 16-bit: better performance but lower quality\nYUV: best performance but does not work on all devices. Android 2.3 and later only.</string>
......@@ -396,18 +410,6 @@
<string name="video_min_group_length_first">First letter only</string>
<string name="video_min_group_length_short">Short number of letters (6)</string>
<string name="video_min_group_length_long">Long number of letters (9)</string>
<string name="subtitles_size_title">Subtitles Size</string>
<string name="subtitles_size_small">Small</string>
<string name="subtitles_size_normal">Normal</string>
<string name="subtitles_size_big">Big</string>
<string name="subtitles_size_huge">Huge</string>
<string name="subtitles_color_title">Subtitles Color</string>
<string name="subtitles_color_white">White</string>
<string name="subtitles_color_pink">Pink</string>
<string name="subtitles_color_blue">Blue</string>
<string name="subtitles_color_yellow">Yellow</string>
<string name="subtitles_color_green">Green</string>
<string name="subtitles_background_title">Subtitles Background</string>
<!--Accessibility-->
<string name="more_actions">More Actions</string>
......
......@@ -21,14 +21,6 @@
android:summary="@string/play_as_audio_background_summary"
android:title="@string/play_as_audio_background" />
<ListPreference
android:defaultValue=""
android:entries="@array/subtitles_encoding_list"
android:entryValues="@array/subtitles_encoding_values"
android:key="subtitle_text_encoding"
android:persistent="true"
android:title="@string/subtitle_text_encoding" />
<ListPreference
android:defaultValue="99"
android:entries="@array/screen_orientation_list"
......@@ -46,6 +38,9 @@
<Preference
android:title="@string/interface_prefs_screen"
android:key="ui_category" />
<Preference
android:title="@string/subtitles_prefs_category"
android:key="subtitles_category" />
<Preference
android:title="@string/performance_prefs_category"
android:key="perf_category" />
......
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
android:key="subtitles_category"
android:title="@string/subtitles_prefs_category">
<ListPreference
android:defaultValue="16"
android:entries="@array/subtitles_size_entries"
android:entryValues="@array/subtitles_size_values"
android:key="subtitles_size"
android:persistent="true"
android:title="@string/subtitles_size_title" />
<ListPreference
android:defaultValue="16777215"
android:entries="@array/subtitles_color_entries"
android:entryValues="@array/subtitles_color_values"
android:key="subtitles_color"
android:persistent="true"
android:title="@string/subtitles_color_title" />
<CheckBoxPreference
android:defaultValue="false"
android:key="subtitles_background"
android:title="@string/subtitles_background_title" />
<android.support.v14.preference.MultiSelectListPreference
android:dialogTitle="@string/preferences_languages_download"
android:entries="@array/language_entries"
android:entryValues="@array/language_values"
android:key="languages_download_list"
android:summary="@string/list_languages_download_summary"
android:title="@string/list_languages_download_title" />
<ListPreference
android:defaultValue=""
android:entries="@array/subtitles_encoding_list"
android:entryValues="@array/subtitles_encoding_values"
android:key="subtitle_text_encoding"
android:persistent="true"
android:title="@string/subtitle_text_encoding" />
</PreferenceScreen>
......@@ -85,34 +85,6 @@
android:title="@string/enable_steal_remote_control" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/subtitles">
<ListPreference
android:defaultValue="16"
android:entries="@array/subtitles_size_entries"
android:entryValues="@array/subtitles_size_values"
android:key="subtitles_size"
android:persistent="true"
android:title="@string/subtitles_size_title" />
<ListPreference
android:defaultValue="16777215"
android:entries="@array/subtitles_color_entries"
android:entryValues="@array/subtitles_color_values"
android:key="subtitles_color"
android:persistent="true"
android:title="@string/subtitles_color_title" />
<CheckBoxPreference
android:defaultValue="false"
android:key="subtitles_background"
android:title="@string/subtitles_background_title" />
<android.support.v14.preference.MultiSelectListPreference
android:dialogTitle="@string/preferences_languages_download"
android:entries="@array/language_entries"
android:entryValues="@array/language_values"
android:key="languages_download_list"
android:summary="@string/list_languages_download_summary"
android:title="@string/list_languages_download_title" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/interface_secondary_display_category_title">
<Preference android:summary="@string/interface_secondary_display_category_summary" />
......
......@@ -75,8 +75,7 @@ public class PreferencesFragment extends BasePreferenceFragment implements Share
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
if(key.equalsIgnoreCase("hardware_acceleration")
|| key.equalsIgnoreCase("subtitle_text_encoding")) {
if(key.equalsIgnoreCase("hardware_acceleration")) {
VLCInstance.restart();
if (getActivity() != null )
((PreferencesActivity)getActivity()).restartMediaPlayer();
......@@ -95,6 +94,9 @@ public class PreferencesFragment extends BasePreferenceFragment implements Share
case "ui_category":
loadFragment(new PreferencesUi());
break;
case "subtitles_category":
loadFragment(new PreferencesSubtitles());
break;
case "perf_category":
loadFragment(new PreferencesPerformances());
break;
......
/*
* *************************************************************************
* PreferencesSubtitles.java
* **************************************************************************
* Copyright © 2016 VLC authors and VideoLAN
*
* 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.content.SharedPreferences;
import android.os.Bundle;
import org.videolan.libvlc.util.AndroidUtil;
import org.videolan.vlc.R;
import org.videolan.vlc.util.VLCInstance;
public class PreferencesSubtitles extends BasePreferenceFragment implements SharedPreferences.OnSharedPreferenceChangeListener {
@Override
protected int getXml() {
return R.xml.preferences_subtitles;
}
@Override
protected int getTitleId() {
return R.string.subtitles_prefs_category;
}
@Override
public void onStart() {
super.onStart();
getPreferenceScreen().getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
findPreference("languages_download_list").setVisible(AndroidUtil.isHoneycombOrLater());
}
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
switch (key){
case "subtitles_size":
case "subtitles_color":
case "subtitles_background":
case "subtitle_text_encoding":
VLCInstance.restart();
if (getActivity() != null )
((PreferencesActivity)getActivity()).restartMediaPlayer();
}
}
}
......@@ -33,7 +33,7 @@ import org.videolan.vlc.PlaybackService;
import org.videolan.vlc.R;
import org.videolan.vlc.util.VLCInstance;
public class PreferencesUi extends BasePreferenceFragment implements SharedPreferences.OnSharedPreferenceChangeListener {
public class PreferencesUi extends BasePreferenceFragment {
@Override
protected int getXml() {
......@@ -48,7 +48,6 @@ public class PreferencesUi extends BasePreferenceFragment implements SharedPrefe
@Override
public void onStart() {
super.onStart();
getPreferenceScreen().getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
}
@Override
......@@ -56,22 +55,9 @@ public class PreferencesUi extends BasePreferenceFragment implements SharedPrefe
super.onCreate(savedInstanceState);
findPreference("tv_ui").setVisible(AndroidUtil.isJellyBeanMR1OrLater());
findPreference("languages_download_list").setVisible(AndroidUtil.isHoneycombOrLater());
findPreference("enable_play_on_headset_insertion").setVisible(((TwoStatePreference) findPreference("enable_headset_detection")).isChecked());
}
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
switch (key){
case "subtitles_size":
case "subtitles_color":
case "subtitles_background":
VLCInstance.restart();
if (getActivity() != null )
((PreferencesActivity)getActivity()).restartMediaPlayer();
}
}
@Override
public boolean onPreferenceTreeClick(Preference preference) {
if (preference.getKey() == null)
......
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