Commit 71986d16 authored by Geoffrey Métais's avatar Geoffrey Métais

New advanced dialog for music too

parent 4faef55a
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid
android:color="@color/whitetransparent" >
</solid>
<corners
android:radius="3dp" >
</corners>
</shape>
\ No newline at end of file
......@@ -32,7 +32,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:src="@drawable/ic_speed_normal_w" />
android:src="?attr/ic_speed_normal_style" />
<LinearLayout
android:layout_width="match_parent"
......@@ -138,7 +138,7 @@
android:layout_gravity="center"
android:gravity="center_vertical"
android:text="@string/sleep_title"
android:drawableLeft="@drawable/ic_sleep_normal_w"/>
android:drawableLeft="?attr/ic_speed_normal_style"/>
<TextView
android:id="@+id/sleep_timer_value"
......@@ -178,7 +178,7 @@
android:focusable="true"
android:gravity="center_vertical"
android:text="@string/jump_to_time"
android:drawableLeft="@drawable/ic_jumpto_normal_w"/>
android:drawableLeft="?attr/ic_jumpto_normal_style"/>
<TextView
android:id="@+id/jump_chapter_title"
android:layout_width="wrap_content"
......
......@@ -64,6 +64,7 @@
<attr name="shadow_bottom_9patch" format="reference"/>
<attr name="advanced_options_style" format="reference" />
<attr name="rounded_bg" format="reference" />
<declare-styleable name="SlidingPaneLayout">
<attr name="overhangSize" format="dimension" />
......
......@@ -39,4 +39,5 @@
<color name="grey900transparent">#80212121</color>
<color name="blacktransparent">#b4000000</color>
<color name="whitetransparent">#dcffffff</color>
</resources>
\ No newline at end of file
......@@ -67,7 +67,11 @@
<item name="shadow_bottom_9patch">@drawable/shadow_bottom</item>
<item name="gridview_progressbar">@drawable/gridview_progressbar_w</item>
<item name="progress_mini_player">@drawable/progress_mini_player</item>
<item name="advanced_options_style">@style/Theme.VLC.AdvancedOptionsLight</item>
<item name="advanced_options_style">@style/Theme.AppCompat.Light.Dialog</item>
<item name="rounded_bg">@drawable/rounded_corners_light</item>
<item name="ic_speed_normal_style">@drawable/ic_speed_normal</item>
<item name="ic_sleep_normal_style">@drawable/ic_sleep_normal</item>
<item name="ic_jumpto_normal_style">@drawable/ic_jumpto_normal</item>
</style>
<style name="Theme.VLC.Black" parent="Theme.VLC.Black.7"/>
......@@ -136,7 +140,11 @@
<item name="shadow_bottom_9patch">@drawable/shadow_bottom_dark</item>
<item name="gridview_progressbar">@drawable/gridview_progressbar</item>
<item name="progress_mini_player">@drawable/progress_mini_player_dark</item>
<item name="advanced_options_style">@style/Theme.VLC.AdvancedOptionsBlack</item>
<item name="advanced_options_style">@style/Theme.AppCompat.Dialog</item>
<item name="rounded_bg">@drawable/rounded_corners</item>
<item name="ic_speed_normal_style">@drawable/ic_speed_normal_w</item>
<item name="ic_sleep_normal_style">@drawable/ic_sleep_normal_w</item>
<item name="ic_jumpto_normal_style">@drawable/ic_jumpto_normal_w</item>
</style>
<style name="Theme.VLC.List">
......@@ -163,7 +171,11 @@
<item name="video_player_overlay">@android:color/transparent</item>
<item name="status_bar_overlay">@android:color/transparent</item>
<item name="advanced_options_style">@style/Theme.VLC.AdvancedOptionsBlack</item>
<item name="rounded_bg">@drawable/rounded_corners</item>
<item name="advanced_options_style">@style/Theme.AppCompat.Dialog</item>
<item name="ic_speed_normal_style">@drawable/ic_speed_normal_w</item>
<item name="ic_sleep_normal_style">@drawable/ic_sleep_normal_w</item>
<item name="ic_jumpto_normal_style">@drawable/ic_jumpto_normal_w</item>
</style>
<style name="ActionBar" parent="Widget.AppCompat.Light.ActionBar">
......@@ -180,50 +192,6 @@
<style name="Toolbar.VLC" parent="ThemeOverlay.AppCompat.Dark.ActionBar"/>
<!-- Advanced options menu styles -->
<style name="Theme.VLC.TransparentDialog" parent="@style/Theme.AppCompat.Dialog">
<item name="android:windowIsFloating">true</item>
<item name="android:backgroundDimEnabled">true</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowBackground">@drawable/rounded_corners</item>
</style>
<style name="Theme.VLC.AdvancedOptions" parent="@android:style/Theme.Dialog">
<item name="android:windowIsFloating">true</item>
<item name="android:backgroundDimEnabled">false</item>
<item name="android:windowIsTranslucent">false</item>
<item name="android:windowNoTitle">true</item>
</style>
<style name="Theme.VLC.AdvancedOptionsLight" parent="Theme.VLC.AdvancedOptions">
<item name="android:windowBackground">@drawable/abc_item_background_holo_light</item>
<item name="android:textColor">@color/grey850</item>
<item name="advanced_options_divider">@color/grey500</item>
<item name="advanced_options_background">@color/grey300</item>
<item name="ic_speed_normal_style">@drawable/ic_speed_normal</item>
<item name="ic_sleep_normal_style">@drawable/ic_sleep_normal</item>
<item name="ic_jumpto_normal_style">@drawable/ic_jumpto_normal</item>
<item name="ic_equalizer_normal_style">@drawable/ic_equalizer_normal</item>
<item name="ic_down_style">@drawable/ic_down</item>
<item name="ic_up_style">@drawable/ic_up</item>
</style>
<style name="Theme.VLC.AdvancedOptionsBlack" parent="Theme.VLC.AdvancedOptions">
<item name="android:windowBackground">@drawable/abc_item_background_holo_dark</item>
<item name="android:textColor">@color/white</item>
<item name="advanced_options_divider">@color/grey850</item>
<item name="advanced_options_background">@color/grey900</item>
<item name="ic_speed_normal_style">@drawable/ic_speed_normal_w</item>
<item name="ic_sleep_normal_style">@drawable/ic_sleep_normal_w</item>
<item name="ic_jumpto_normal_style">@drawable/ic_jumpto_normal_w</item>
<item name="ic_equalizer_normal_style">@drawable/ic_equalizer_normal_w</item>
<item name="ic_down_style">@drawable/ic_down_w</item>
<item name="ic_up_style">@drawable/ic_up_w</item>
</style>
<!-- Tips Apearance-->
<style name="TipsFontStyle">
......
......@@ -36,6 +36,7 @@ import org.videolan.vlc.gui.CommonDialogs.MenuType;
import org.videolan.vlc.gui.audio.widget.CoverMediaSwitcher;
import org.videolan.vlc.gui.audio.widget.HeaderMediaSwitcher;
import org.videolan.vlc.gui.dialogs.SavePlaylist;
import org.videolan.vlc.gui.video.AdvOptionsDialog;
import org.videolan.vlc.interfaces.IAudioPlayer;
import org.videolan.vlc.util.Strings;
import org.videolan.vlc.util.Util;
......@@ -478,7 +479,12 @@ public class AudioPlayer extends Fragment implements IAudioPlayer, View.OnClickL
}
public void showAdvancedOptions(View v) {
CommonDialogs.advancedOptions(getActivity(), v, MenuType.Audio);
FragmentManager fm = getActivity().getSupportFragmentManager();
AdvOptionsDialog advOptionsDialog = new AdvOptionsDialog();
Bundle args = new Bundle();
args.putInt(AdvOptionsDialog.MODE_KEY, AdvOptionsDialog.MODE_AUDIO);
advOptionsDialog.setArguments(args);
advOptionsDialog.show(fm, "fragment_adv_options");
}
public void show() {
......
......@@ -30,12 +30,14 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import org.videolan.libvlc.LibVLC;
import org.videolan.vlc.R;
import org.videolan.vlc.util.Util;
import org.videolan.vlc.util.VLCInstance;
public abstract class PickTimeFragment extends DialogFragment implements DialogInterface.OnKeyListener, View.OnClickListener, View.OnFocusChangeListener, TextView.OnEditorActionListener {
......@@ -63,6 +65,12 @@ public abstract class PickTimeFragment extends DialogFragment implements DialogI
mLibVLC = VLCInstance.get();
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setStyle(DialogFragment.STYLE_NO_FRAME, R.attr.advanced_options_style);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
......@@ -91,10 +99,12 @@ public abstract class PickTimeFragment extends DialogFragment implements DialogI
view.findViewById(R.id.jump_seconds_up).setOnClickListener(this);
view.findViewById(R.id.jump_seconds_down).setOnClickListener(this);
getDialog().getWindow().requestFeature(Window.FEATURE_NO_TITLE);
getDialog().setOnKeyListener(this);
getDialog().getWindow().setLayout(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
getDialog().getWindow().setBackgroundDrawableResource(R.drawable.rounded_corners);
getDialog().setCancelable(true);
getDialog().setCanceledOnTouchOutside(true);
Window window = getDialog().getWindow();
window.setBackgroundDrawableResource(Util.getResourceFromAttribute(getActivity(), R.attr.rounded_bg));
window.setLayout(WindowManager.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.WRAP_CONTENT);
return view;
}
......
......@@ -30,6 +30,7 @@ import android.widget.TimePicker;
import org.videolan.libvlc.LibVLC;
import org.videolan.libvlc.LibVlcUtil;
import org.videolan.vlc.R;
import org.videolan.vlc.VLCApplication;
import org.videolan.vlc.gui.video.AdvOptionsDialog;
import org.videolan.vlc.util.VLCInstance;
......@@ -48,6 +49,7 @@ public class TimePickerDialogFragment extends DialogFragment implements TimePick
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
setStyle(STYLE_NO_FRAME, R.attr.advanced_options_style);
action = getArguments().getInt("action");
boolean is24 = true;
int hour = 0;
......
......@@ -35,6 +35,8 @@ import android.text.format.DateFormat;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
......@@ -54,6 +56,7 @@ import org.videolan.vlc.gui.dialogs.TimePickerDialogFragment;
import org.videolan.vlc.interfaces.IDelayController;
import org.videolan.vlc.util.AndroidDevices;
import org.videolan.vlc.util.Strings;
import org.videolan.vlc.util.Util;
import org.videolan.vlc.util.VLCInstance;
import java.util.Calendar;
......@@ -65,12 +68,17 @@ import static org.videolan.vlc.gui.dialogs.PickTimeFragment.ACTION_SPU_DELAY;
public class AdvOptionsDialog extends DialogFragment implements View.OnClickListener {
public final static String TAG = "VLC/AdvOptionsDialog";
public static final String MODE_KEY = "mode";
public static final int MODE_VIDEO = 0;
public static final int MODE_AUDIO = 1;
public static final int SPEED_TEXT = 0;
public static final int SLEEP_TEXT = 1;
public static final int TOGGLE_CANCEL = 2;
public static final int DIALOG_LISTENER = 3;
public static final int RESET_RETRY = 4;
private int mMode = -1;
private TextView mAudioMode;
private TextView mSpeedTv;
......@@ -98,27 +106,32 @@ public class AdvOptionsDialog extends DialogFragment implements View.OnClickList
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setStyle(DialogFragment.STYLE_NO_FRAME, R.attr.advanced_options_style);
sInstance = this;
setStyle(STYLE_NO_FRAME, R.style.Theme_VLC_TransparentDialog);
if (VLCApplication.sPlayerSleepTime != null && VLCApplication.sPlayerSleepTime.before(Calendar.getInstance()))
VLCApplication.sPlayerSleepTime = null;
mLibVLC = VLCInstance.get();
if (getArguments() != null && getArguments().containsKey(MODE_KEY))
mMode = getArguments().getInt(MODE_KEY);
else
mMode = MODE_VIDEO;
}
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
mDelayController = (IDelayController) activity;
if (mMode == MODE_VIDEO) {
mDelayController = (IDelayController) activity;
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View root = inflater.inflate(R.layout.fragment_advanced_options, container, false);
getDialog().setCancelable(true);
getDialog().setCanceledOnTouchOutside(true);
mAudioMode = (TextView) root.findViewById(R.id.playback_switch_audio);
mAudioMode.setOnClickListener(this);
mAudioMode.setOnFocusChangeListener(mFocusListener);
mSeek = (SeekBar) root.findViewById(R.id.playback_speed_seek);
mSpeedTv = (TextView) root.findViewById(R.id.playback_speed_value);
......@@ -130,6 +143,9 @@ public class AdvOptionsDialog extends DialogFragment implements View.OnClickList
mSleepTitle = (TextView) root.findViewById(R.id.sleep_timer_title);
mSleepTime = (TextView) root.findViewById(R.id.sleep_timer_value);
mSleepCancel = (TextView) root.findViewById(R.id.sleep_timer_cancel);
mJumpTitle = (TextView) root.findViewById(R.id.jump_title);
mJumpTitle.setOnClickListener(this);
if (AndroidDevices.hasTsp()) {
mSleepTitle.setOnClickListener(this);
......@@ -139,31 +155,40 @@ public class AdvOptionsDialog extends DialogFragment implements View.OnClickList
root.findViewById(R.id.sleep_timer_container).setVisibility(View.GONE);
}
mJumpTitle = (TextView) root.findViewById(R.id.jump_title);
mChapters = (Spinner) root.findViewById(R.id.jump_chapter);
mChaptersTitle = (TextView) root.findViewById(R.id.jump_chapter_title);
mAudioDelay = (TextView) root.findViewById(R.id.audio_delay);
mSpuDelay = (TextView) root.findViewById(R.id.spu_delay);
mJumpTitle.setOnClickListener(this);
mSpuDelay.setOnClickListener(this);
mReset.setOnFocusChangeListener(mFocusListener);
mSleepTime.setOnFocusChangeListener(mFocusListener);
mSleepCancel.setOnFocusChangeListener(mFocusListener);
mJumpTitle.setOnFocusChangeListener(mFocusListener);
mSpuDelay.setOnFocusChangeListener(mFocusListener);
if (BuildConfig.DEBUG) { //Hide audio delay option for now, it is not usable yet.
mAudioDelay.setOnClickListener(this);
mAudioDelay.setOnFocusChangeListener(mFocusListener);
if (mMode == MODE_VIDEO) {
mAudioMode = (TextView) root.findViewById(R.id.playback_switch_audio);
mAudioMode.setOnClickListener(this);
mAudioMode.setOnFocusChangeListener(mFocusListener);
mChapters = (Spinner) root.findViewById(R.id.jump_chapter);
mChaptersTitle = (TextView) root.findViewById(R.id.jump_chapter_title);
mAudioDelay = (TextView) root.findViewById(R.id.audio_delay);
mSpuDelay = (TextView) root.findViewById(R.id.spu_delay);
mSpuDelay.setOnClickListener(this);
mSpuDelay.setOnFocusChangeListener(mFocusListener);
if (BuildConfig.DEBUG) { //Hide audio delay option for now, it is not usable yet.
mAudioDelay.setOnClickListener(this);
mAudioDelay.setOnFocusChangeListener(mFocusListener);
} else {
mAudioDelay.setVisibility(View.GONE);
}
initChapterSpinner();
} else {
mAudioDelay.setVisibility(View.GONE);
root.findViewById(R.id.audio_delay).setVisibility(View.GONE);
root.findViewById(R.id.spu_delay).setVisibility(View.GONE);
root.findViewById(R.id.jump_chapter).setVisibility(View.GONE);
root.findViewById(R.id.jump_chapter_title).setVisibility(View.GONE);
root.findViewById(R.id.playback_switch_audio).setVisibility(View.GONE);
}
initChapterSpinner();
getDialog().setCancelable(true);
mHandler.sendEmptyMessage(TOGGLE_CANCEL);
mTextColor = mSleepTitle.getCurrentTextColor();
......@@ -172,6 +197,10 @@ public class AdvOptionsDialog extends DialogFragment implements View.OnClickList
speed = 100 * (1 + Math.log(speed) / Math.log(4));
mSeek.setProgress((int) speed);
}
Window window = getDialog().getWindow();
window.setBackgroundDrawableResource(Util.getResourceFromAttribute(getActivity(), R.attr.rounded_bg));
window.setLayout(WindowManager.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.WRAP_CONTENT);
return root;
}
......@@ -223,14 +252,18 @@ public class AdvOptionsDialog extends DialogFragment implements View.OnClickList
};
private void showTimePickerFragment(int action) {
if (mDelayController == null && getActivity() instanceof IDelayController)
mDelayController = (IDelayController) getActivity();
DialogFragment newFragment = null;
if (AndroidDevices.hasTsp()) {
switch (action){
case PickTimeFragment.ACTION_AUDIO_DELAY:
mDelayController.showAudioDelaySetting();
if (mDelayController != null)
mDelayController.showAudioDelaySetting();
break;
case PickTimeFragment.ACTION_SPU_DELAY:
mDelayController.showSubsDelaySetting();
if (mDelayController != null)
mDelayController.showSubsDelaySetting();
break;
case PickTimeFragment.ACTION_JUMP_TO_TIME:
newFragment = new JumpToTimeDialog();
......
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