[Android] onRestart() MediaBrowserFragment callback
Geoffrey Métais
git at videolan.org
Wed Jan 16 11:09:46 CET 2019
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Jan 16 11:01:00 2019 +0100| [4feb71e73665fcf9a7e22f4de520044c858fd158] | committer: Geoffrey Métais
onRestart() MediaBrowserFragment callback
> https://code.videolan.org/videolan/vlc-android/commit/4feb71e73665fcf9a7e22f4de520044c858fd158
---
.../src/org/videolan/vlc/gui/browser/MediaBrowserFragment.java | 5 +++++
.../src/org/videolan/vlc/gui/video/VideoGridFragment.java | 9 +++++----
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/browser/MediaBrowserFragment.java b/vlc-android/src/org/videolan/vlc/gui/browser/MediaBrowserFragment.java
index ed1916b57..8c75bfc8f 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/MediaBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/MediaBrowserFragment.java
@@ -77,6 +77,7 @@ public abstract class MediaBrowserFragment<T extends SortableModel> extends Frag
protected ActionMode mActionMode;
public FloatingActionButton mFabPlay;
protected T viewModel;
+ private boolean restart = false;
public T getViewModel() {
return viewModel;
@@ -121,12 +122,16 @@ public abstract class MediaBrowserFragment<T extends SortableModel> extends Frag
}
});
}
+ if (restart) onRestart();
}
+ protected void onRestart() {}
+
@Override
public void onStop() {
super.onStop();
setFabPlayVisibility(false);
+ restart = true;
}
public void updateActionBar() {
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
index 932e85d6e..c898ad9f8 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
@@ -137,8 +137,6 @@ public class VideoGridFragment extends MediaBrowserFragment<VideosModel> impleme
mSwipeRefreshLayout.setOnRefreshListener(this);
mBinding.videoGrid.setAdapter(mAdapter);
}
-
- private boolean restart = false;
@Override
public void onStart() {
super.onStart();
@@ -146,14 +144,17 @@ public class VideoGridFragment extends MediaBrowserFragment<VideosModel> impleme
updateViewMode();
setFabPlayVisibility(true);
mFabPlay.setImageResource(R.drawable.ic_fab_play);
- if (restart && getFilterQuery() == null) viewModel.refresh();
+ }
+
+ @Override
+ protected void onRestart() {
+ if (getFilterQuery() == null) viewModel.refresh();
}
@Override
public void onStop() {
super.onStop();
unregisterForContextMenu(mBinding.videoGrid);
- restart = true;
}
@Override
More information about the Android
mailing list