[Android] Audio player: remplace the FlyingView by a ViewSwitcher to switch between the playlist and the cover
Adrien Maglo
git at videolan.org
Fri Dec 6 10:43:10 CET 2013
vlc-ports/android | branch: master | Adrien Maglo <magsoft at videolan.org> | Fri Dec 6 10:40:52 2013 +0100| [ef4661ec8f8de9e56b32064035aba918cdcb759f] | committer: Adrien Maglo
Audio player: remplace the FlyingView by a ViewSwitcher to switch between the playlist and the cover
Add an ImageButton to trigger the switch.
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=ef4661ec8f8de9e56b32064035aba918cdcb759f
---
vlc-android/res/drawable/ic_playlist_switch.png | Bin 0 -> 3137 bytes
.../res/drawable/ic_playlist_switch_glow.png | Bin 0 -> 459 bytes
vlc-android/res/layout/audio_player.xml | 47 ++++++++++++--------
.../vlc/gui/audio/AudioPlayerFragment.java | 19 ++++++++
4 files changed, 47 insertions(+), 19 deletions(-)
diff --git a/vlc-android/res/drawable/ic_playlist_switch.png b/vlc-android/res/drawable/ic_playlist_switch.png
new file mode 100644
index 0000000..202923b
Binary files /dev/null and b/vlc-android/res/drawable/ic_playlist_switch.png differ
diff --git a/vlc-android/res/drawable/ic_playlist_switch_glow.png b/vlc-android/res/drawable/ic_playlist_switch_glow.png
new file mode 100644
index 0000000..a897e38
Binary files /dev/null and b/vlc-android/res/drawable/ic_playlist_switch_glow.png differ
diff --git a/vlc-android/res/layout/audio_player.xml b/vlc-android/res/layout/audio_player.xml
index b10f1d7..432ea83 100644
--- a/vlc-android/res/layout/audio_player.xml
+++ b/vlc-android/res/layout/audio_player.xml
@@ -46,6 +46,16 @@
</LinearLayout>
<ImageButton
+ android:id="@+id/playlist_switch"
+ android:layout_width="40dp"
+ android:layout_height="40dp"
+ android:layout_gravity="center"
+ android:background="#00000000"
+ android:focusable="true"
+ android:scaleType="fitXY"
+ android:src="@drawable/ic_playlist_switch_glow" />
+
+ <ImageButton
android:id="@+id/adv_function"
android:layout_width="40dp"
android:layout_height="40dp"
@@ -57,25 +67,24 @@
android:src="@drawable/dots" />
</LinearLayout>
- <org.videolan.vlc.widget.FlingViewGroup
- android:id="@+id/content"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:layout_weight="1" >
-
- <ListView
- android:id="@+id/songs_list"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:background="?attr/background_menu" />
-
- <org.videolan.vlc.widget.AnimatedCoverView
- android:id="@+id/big_cover"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:scaleType="centerCrop" />
-
- </org.videolan.vlc.widget.FlingViewGroup>
+ <ViewSwitcher
+ android:id="@+id/view_switcher"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_weight="1" >
+
+ <ListView
+ android:id="@+id/songs_list"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:background="?attr/background_menu" />
+
+ <org.videolan.vlc.widget.AnimatedCoverView
+ android:id="@+id/big_cover"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:scaleType="centerCrop" />
+ </ViewSwitcher>
<LinearLayout
android:layout_width="fill_parent"
diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayerFragment.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayerFragment.java
index 7505b4f..f1f2dd4 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayerFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayerFragment.java
@@ -54,6 +54,7 @@ import android.widget.SeekBar;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.TextView;
+import android.widget.ViewSwitcher;
public class AudioPlayerFragment extends SherlockFragment implements IAudioPlayer {
public final static String TAG = "VLC/AudioPlayerFragment";
@@ -71,9 +72,12 @@ public class AudioPlayerFragment extends SherlockFragment implements IAudioPlaye
private ImageButton mShuffle;
private ImageButton mRepeat;
private ImageButton mAdvFunc;
+ private ImageButton mPlaylistSwitch;
private SeekBar mTimeline;
private ListView mSongsList;
+ ViewSwitcher mSwitcher;
+
private AudioServiceController mAudioController;
private boolean mShowRemainingTime = false;
private String lastTitle;
@@ -112,11 +116,16 @@ public class AudioPlayerFragment extends SherlockFragment implements IAudioPlaye
mShuffle = (ImageButton) v.findViewById(R.id.shuffle);
mRepeat = (ImageButton) v.findViewById(R.id.repeat);
mAdvFunc = (ImageButton) v.findViewById(R.id.adv_function);
+ mPlaylistSwitch = (ImageButton) v.findViewById(R.id.playlist_switch);
mTimeline = (SeekBar) v.findViewById(R.id.timeline);
mSongsList = (ListView) v.findViewById(R.id.songs_list);
mSongsList.setAdapter(mSongsListAdapter);
+ mSwitcher = (ViewSwitcher) v.findViewById(R.id.view_switcher);
+ mSwitcher.setInAnimation(getActivity(), android.R.anim.fade_in);
+ mSwitcher.setOutAnimation(getActivity(), android.R.anim.fade_out);
+
mTime.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@@ -165,6 +174,16 @@ public class AudioPlayerFragment extends SherlockFragment implements IAudioPlaye
showAdvancedOptions(v);
}
});
+ mPlaylistSwitch.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ mSwitcher.showNext();
+ if (mSwitcher.getDisplayedChild() == 0)
+ mPlaylistSwitch.setImageResource(R.drawable.ic_playlist_switch_glow);
+ else
+ mPlaylistSwitch.setImageResource(R.drawable.ic_playlist_switch);
+ }
+ });
mSongsList.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> av, View v, int p, long id) {
More information about the Android
mailing list