[Android] Equalizer fragment: add a layout for landscape mode
Adrien Maglo
git at videolan.org
Thu Feb 6 18:45:19 CET 2014
vlc-ports/android | branch: master | Adrien Maglo <magsoft at videolan.org> | Thu Feb 6 18:43:05 2014 +0100| [cda8615971316ab05e0e61d589c6f2142f375b82] | committer: Adrien Maglo
Equalizer fragment: add a layout for landscape mode
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=cda8615971316ab05e0e61d589c6f2142f375b82
---
vlc-android/res/layout-land/equalizer.xml | 50 ++++++++++++++++++++
vlc-android/res/layout/equalizer.xml | 4 +-
.../videolan/vlc/gui/audio/EqualizerFragment.java | 21 +++++++-
3 files changed, 73 insertions(+), 2 deletions(-)
diff --git a/vlc-android/res/layout-land/equalizer.xml b/vlc-android/res/layout-land/equalizer.xml
new file mode 100644
index 0000000..0deb913
--- /dev/null
+++ b/vlc-android/res/layout-land/equalizer.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical" >
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal" >
+
+ <ToggleButton
+ android:id="@+id/equalizer_button"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content" />
+
+ <Spinner
+ android:id="@+id/equalizer_presets"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content" />
+
+ <SeekBar
+ android:id="@+id/equalizer_preamp"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical"
+ android:layout_weight="1"
+ android:maxHeight="4dip"
+ android:minHeight="4dip"
+ android:progressDrawable="@drawable/po_seekbar"
+ android:thumb="@drawable/seekbar_thumb" />
+ </LinearLayout>
+
+ <HorizontalScrollView
+ android:id="@+id/equalizer_scroll"
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="1"
+ android:fillViewport="true"
+ android:fadeScrollbars="false" >
+
+ <LinearLayout
+ android:id="@+id/equalizer_bands"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:layout_gravity="center_horizontal"
+ android:orientation="horizontal" />
+ </HorizontalScrollView>
+
+</LinearLayout>
\ No newline at end of file
diff --git a/vlc-android/res/layout/equalizer.xml b/vlc-android/res/layout/equalizer.xml
index 12358bd..07cac2f 100644
--- a/vlc-android/res/layout/equalizer.xml
+++ b/vlc-android/res/layout/equalizer.xml
@@ -31,15 +31,17 @@
<HorizontalScrollView
android:id="@+id/equalizer_scroll"
- android:layout_width="wrap_content"
+ android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
+ android:fillViewport="true"
android:fadeScrollbars="false" >
<LinearLayout
android:id="@+id/equalizer_bands"
android:layout_width="wrap_content"
android:layout_height="match_parent"
+ android:layout_gravity="center_horizontal"
android:orientation="horizontal" />
</HorizontalScrollView>
diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/EqualizerFragment.java b/vlc-android/src/org/videolan/vlc/gui/audio/EqualizerFragment.java
index 1ad3d16..4a60ca7 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/EqualizerFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/EqualizerFragment.java
@@ -29,7 +29,9 @@ import org.videolan.vlc.widget.EqualizerBar;
import com.actionbarsherlock.app.SherlockFragment;
+import android.content.Context;
import android.content.SharedPreferences;
+import android.content.res.Configuration;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.view.LayoutInflater;
@@ -71,13 +73,30 @@ public class EqualizerFragment extends SherlockFragment {
super.onCreateView(inflater, container, savedInstanceState);
View v = inflater.inflate(R.layout.equalizer, container, false);
+ saveViewChildren(v);
+ return v;
+ }
+
+ private void saveViewChildren(View v) {
button = (ToggleButton) v.findViewById(R.id.equalizer_button);
equalizer_presets = (Spinner) v.findViewById(R.id.equalizer_presets);
preamp = (SeekBar) v.findViewById(R.id.equalizer_preamp);
bands_layout = (LinearLayout) v.findViewById(R.id.equalizer_bands);
+ }
- return v;
+ @Override
+ public void onConfigurationChanged(Configuration newConfig) {
+ super.onConfigurationChanged(newConfig);
+
+ LayoutInflater inflater = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+ View v = inflater.inflate(R.layout.equalizer, null);
+ ViewGroup rootView = (ViewGroup) getView();
+ rootView.removeAllViews();
+ rootView.addView(v);
+ saveViewChildren(v);
+
+ onResume();
}
@Override
More information about the Android
mailing list