From cd2726de8001890042590c8fe26624394df087b9 Mon Sep 17 00:00:00 2001 From: Stefan Schueller Date: Sun, 6 Jan 2019 14:56:40 +0100 Subject: [PATCH] Moved torrent progressbas into video OSD --- .../peertube/fragment/VideoPlayerFragment.java | 10 ++++++++-- .../main/res/layout/fragment_video_player.xml | 7 ------- .../res/layout/video_playback_controls.xml | 18 ++++++++++++++++-- 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/net/schueller/peertube/fragment/VideoPlayerFragment.java b/app/src/main/java/net/schueller/peertube/fragment/VideoPlayerFragment.java index 2680e25..1aba113 100644 --- a/app/src/main/java/net/schueller/peertube/fragment/VideoPlayerFragment.java +++ b/app/src/main/java/net/schueller/peertube/fragment/VideoPlayerFragment.java @@ -34,6 +34,8 @@ import android.view.LayoutInflater; import android.view.Surface; import android.view.View; import android.view.ViewGroup; +import android.widget.FrameLayout; +import android.widget.LinearLayout; import android.widget.ProgressBar; import android.widget.TextView; import android.widget.Toast; @@ -77,6 +79,7 @@ public class VideoPlayerFragment extends Fragment implements VideoRendererEventL private Boolean isFullscreen = false; private VideoPlayerService mService; private TorrentStream torrentStream; + private LinearLayout torrentStatus; private static final String TAG = "VideoPlayerFragment"; @@ -122,7 +125,7 @@ public class VideoPlayerFragment extends Fragment implements VideoRendererEventL mVideoUuid = videoUuid; assert activity != null; - progressBar = activity.findViewById(R.id.progress); + progressBar = activity.findViewById(R.id.torrent_progress); progressBar.setMax(100); simpleExoPlayerView = new PlayerView(context); @@ -131,6 +134,8 @@ public class VideoPlayerFragment extends Fragment implements VideoRendererEventL simpleExoPlayerView.setControllerShowTimeoutMs(1000); simpleExoPlayerView.setResizeMode(AspectRatioFrameLayout.RESIZE_MODE_FIT); + torrentStatus = activity.findViewById(R.id.exo_torrent_status); + // Full screen Icon TextView fullscreenButton = activity.findViewById(R.id.exo_fullscreen); fullscreenButton.setText(R.string.video_expand_icon); @@ -208,12 +213,13 @@ public class VideoPlayerFragment extends Fragment implements VideoRendererEventL SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(context); if (sharedPref.getBoolean("pref_torrent_player", false)) { - + torrentStatus.setVisibility(View.VISIBLE); String stream = video.getFiles().get(0).getTorrentUrl(); Log.v(TAG, "getTorrentUrl : " + video.getFiles().get(0).getTorrentUrl()); torrentStream = setupTorrentStream(); torrentStream.startStream(stream); } else { + torrentStatus.setVisibility(View.GONE); startPlayer(); } Log.v(TAG, "end of load Video"); diff --git a/app/src/main/res/layout/fragment_video_player.xml b/app/src/main/res/layout/fragment_video_player.xml index 14a5876..f05d160 100644 --- a/app/src/main/res/layout/fragment_video_player.xml +++ b/app/src/main/res/layout/fragment_video_player.xml @@ -15,12 +15,5 @@ /> - \ No newline at end of file diff --git a/app/src/main/res/layout/video_playback_controls.xml b/app/src/main/res/layout/video_playback_controls.xml index 7dd5b36..f15235b 100644 --- a/app/src/main/res/layout/video_playback_controls.xml +++ b/app/src/main/res/layout/video_playback_controls.xml @@ -10,8 +10,6 @@ android:orientation="vertical" tools:targetApi="28"> - - + + + + + + \ No newline at end of file