[Android] Fix crash on label click
Edward Wang
git at videolan.org
Sat Aug 31 18:47:34 CEST 2013
vlc-ports/android | branch: master | Edward Wang <edward.c.wang at compdigitec.com> | Sat Aug 31 18:34:48 2013 +0200| [aa90be51f54fb04f00ccb6feb5bb2dfd2afd3e93] | committer: Edward Wang
Fix crash on label click
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=aa90be51f54fb04f00ccb6feb5bb2dfd2afd3e93
---
vlc-android/res/layout/audio_player.xml | 9 ++--
.../vlc/gui/audio/AudioPlayerFragment.java | 46 +++++++++-----------
2 files changed, 23 insertions(+), 32 deletions(-)
diff --git a/vlc-android/res/layout/audio_player.xml b/vlc-android/res/layout/audio_player.xml
index 46950df..2b886b6 100644
--- a/vlc-android/res/layout/audio_player.xml
+++ b/vlc-android/res/layout/audio_player.xml
@@ -122,8 +122,7 @@
android:layout_marginBottom="4dip"
android:id="@+id/title"
android:clickable="true"
- android:focusable="false"
- android:onClick="onTextClick" />
+ android:focusable="false" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
@@ -138,8 +137,7 @@
android:layout_marginBottom="4dip"
android:id="@+id/artist"
android:clickable="true"
- android:focusable="false"
- android:onClick="onTextClick" />
+ android:focusable="false" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
@@ -153,8 +151,7 @@
android:ellipsize="marquee"
android:id="@+id/album"
android:clickable="true"
- android:focusable="false"
- android:onClick="onTextClick" />
+ android:focusable="false" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
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 263942e..42ee0bf 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayerFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayerFragment.java
@@ -46,6 +46,7 @@ import android.widget.ImageView;
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.TextView;
+import android.widget.Toast;
public class AudioPlayerFragment extends SherlockFragment implements IAudioPlayer {
public final static String TAG = "VLC/AudioPlayerFragment";
@@ -112,6 +113,24 @@ public class AudioPlayerFragment extends SherlockFragment implements IAudioPlaye
mAdvFunc = (ImageButton) v.findViewById(R.id.adv_function);
mTimeline = (SeekBar) v.findViewById(R.id.timeline);
+ mTitle.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ onTextClick(v);
+ }
+ });
+ mArtist.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ onTextClick(v);
+ }
+ });
+ mAlbum.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ onTextClick(v);
+ }
+ });
mTime.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@@ -218,30 +237,8 @@ public class AudioPlayerFragment extends SherlockFragment implements IAudioPlaye
ft.replace(R.id.fragment_placeholder, audioPlayer, "player");
ft.addToBackStack(null);
ft.commit();
- /* Intent intent = new Intent(context, AudioPlayerFragment.class);
- intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
- if (dontParse)
- intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
- context.startActivity(intent); */
}
-/* TODO TODO TODO!!!!!
- @Override
- public void onBackPressed() {
- Bundle extras = getIntent().getExtras();
-
- if (extras != null && extras.containsKey(AudioService.START_FROM_NOTIFICATION)) {
- // Launched from notification (adding the MainActivity to the backstack)
- Intent intent = new Intent(this, MainActivity.class);
- intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
- startActivity(intent);
- finish();
- } else {
- super.onBackPressed();
- }
- }
-*/
-
@Override
public void update() {
// Exit the player and return to the main menu when there is no media
@@ -333,10 +330,7 @@ public class AudioPlayerFragment extends SherlockFragment implements IAudioPlaye
}
public void onTextClick(View view) {
- // TODO: verify this
- Intent intent = new Intent(getActivity(), AudioListFragment.class);
- intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
- startActivity(intent);
+ Toast.makeText(getActivity(), "Open playlist view", Toast.LENGTH_SHORT).show();
}
public void onPlayPauseClick(View view) {
More information about the Android
mailing list