[Android] Code cleaning
Geoffrey Métais
git at videolan.org
Mon Aug 21 16:06:15 CEST 2017
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Aug 21 16:04:42 2017 +0200| [e24e785694ebd1c6084f24c4f3e9689fda4652d2] | committer: Geoffrey Métais
Code cleaning
> https://code.videolan.org/videolan/vlc-android/commit/e24e785694ebd1c6084f24c4f3e9689fda4652d2
---
.../vlc/gui/AudioPlayerContainerActivity.java | 2 +-
.../org/videolan/vlc/gui/audio/AudioPlayer.java | 26 +++-------------------
2 files changed, 4 insertions(+), 24 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/AudioPlayerContainerActivity.java b/vlc-android/src/org/videolan/vlc/gui/AudioPlayerContainerActivity.java
index 33926fa05..adddb139a 100644
--- a/vlc-android/src/org/videolan/vlc/gui/AudioPlayerContainerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/AudioPlayerContainerActivity.java
@@ -120,7 +120,7 @@ public class AudioPlayerContainerActivity extends BaseActivity implements Playba
mBottomSheetBehavior = BottomSheetBehavior.from(mAudioPlayerContainer);
mBottomSheetBehavior.setPeekHeight(getResources().getDimensionPixelSize(R.dimen.player_peek_height));
mBottomSheetBehavior.setBottomSheetCallback(mAudioPlayerBottomSheetCallback);
- mAudioPlayer.showAudioPlayerTips();
+ showTipViewIfNeeded(R.id.audio_player_tips, AudioPlayer.PREF_AUDIOPLAYER_TIPS_SHOWN);
}
@Override
diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java
index 042eae41b..6ec01f3ad 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java
@@ -106,7 +106,7 @@ public class AudioPlayer extends PlaybackServiceFragment implements PlaybackServ
// Tips
private static final String PREF_PLAYLIST_TIPS_SHOWN = "playlist_tips_shown";
- private static final String PREF_AUDIOPLAYER_TIPS_SHOWN = "audioplayer_tips_shown";
+ public static final String PREF_AUDIOPLAYER_TIPS_SHOWN = "audioplayer_tips_shown";
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
@@ -163,11 +163,6 @@ public class AudioPlayer extends PlaybackServiceFragment implements PlaybackServ
}
@Override
- public void onStart() {
- super.onStart();
- }
-
- @Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putInt("player_state", mPlayerState);
@@ -418,7 +413,7 @@ public class AudioPlayer extends PlaybackServiceFragment implements PlaybackServ
if (mService.hasNext())
mService.next();
else
- Snackbar.make(getView(), R.string.lastsong, Snackbar.LENGTH_SHORT).show();
+ Snackbar.make(mBinding.getRoot(), R.string.lastsong, Snackbar.LENGTH_SHORT).show();
}
public void onPreviousClick(View view) {
@@ -427,7 +422,7 @@ public class AudioPlayer extends PlaybackServiceFragment implements PlaybackServ
if (mService.hasPrevious() || mService.isSeekable())
mService.previous(false);
else
- Snackbar.make(getView(), R.string.firstsong, Snackbar.LENGTH_SHORT).show();
+ Snackbar.make(mBinding.getRoot(), R.string.firstsong, Snackbar.LENGTH_SHORT).show();
}
public void onRepeatClick(View view) {
@@ -752,12 +747,6 @@ public class AudioPlayer extends PlaybackServiceFragment implements PlaybackServ
activity.showTipViewIfNeeded(R.id.audio_playlist_tips, PREF_PLAYLIST_TIPS_SHOWN);
}
- public void showAudioPlayerTips() {
- AudioPlayerContainerActivity activity = (AudioPlayerContainerActivity)getActivity();
- if (activity != null)
- activity.showTipViewIfNeeded(R.id.audio_player_tips, PREF_AUDIOPLAYER_TIPS_SHOWN);
- }
-
public void onStateChanged(int newState) {
mPlayerState = newState;
switch (newState) {
@@ -777,15 +766,6 @@ public class AudioPlayer extends PlaybackServiceFragment implements PlaybackServ
}
}
- /*
- * Override this method to prefent NPE on mFragmentManager reference.
- */
- @Override
- public void setUserVisibleHint(boolean isVisibleToUser) {
- if (getFragmentManager() != null)
- super.setUserVisibleHint(isVisibleToUser);
- }
-
static final int UPDATE = 0;
private Handler mHandler = new Handler() {
@Override
More information about the Android
mailing list