adding a toggle play/pause button at the video player
|
@ -130,6 +130,7 @@ open class VideoPlayerActivity : SimpleActivity(), SeekBar.OnSeekBarChangeListen
|
|||
video_seekbar.setOnClickListener { }
|
||||
video_curr_time.setOnClickListener { skip(false) }
|
||||
video_duration.setOnClickListener { skip(true) }
|
||||
video_toggle_play_pause.setOnClickListener { togglePlayPause() }
|
||||
video_player_holder.setOnClickListener {
|
||||
fullscreenToggled(!mIsFullscreen)
|
||||
}
|
||||
|
@ -258,6 +259,7 @@ open class VideoPlayerActivity : SimpleActivity(), SeekBar.OnSeekBarChangeListen
|
|||
mWasVideoStarted = true
|
||||
mIsPlaying = true
|
||||
mExoPlayer?.playWhenReady = true
|
||||
video_toggle_play_pause.setImageResource(R.drawable.ic_pause_outline)
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
|
||||
}
|
||||
|
||||
|
@ -271,6 +273,7 @@ open class VideoPlayerActivity : SimpleActivity(), SeekBar.OnSeekBarChangeListen
|
|||
mExoPlayer?.playWhenReady = false
|
||||
}
|
||||
|
||||
video_toggle_play_pause.setImageResource(R.drawable.ic_play_outline)
|
||||
window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
|
||||
}
|
||||
|
||||
|
|
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 3.0 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 5.9 KiB |
After Width: | Height: | Size: 7.1 KiB |
After Width: | Height: | Size: 4.6 KiB |
After Width: | Height: | Size: 5.9 KiB |
|
@ -7,10 +7,21 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/video_toggle_play_pause"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="60dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="@dimen/activity_margin"
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:padding="@dimen/small_margin"
|
||||
android:src="@drawable/ic_pause_outline"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/video_curr_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_below="@+id/video_toggle_play_pause"
|
||||
android:layout_alignTop="@+id/video_seekbar"
|
||||
android:layout_alignBottom="@+id/video_seekbar"
|
||||
android:layout_alignParentStart="true"
|
||||
|
@ -26,6 +37,7 @@
|
|||
android:id="@+id/video_seekbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/video_toggle_play_pause"
|
||||
android:layout_toStartOf="@+id/video_duration"
|
||||
android:layout_toLeftOf="@+id/video_duration"
|
||||
android:layout_toEndOf="@+id/video_curr_time"
|
||||
|
@ -37,6 +49,7 @@
|
|||
android:id="@+id/video_duration"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/video_toggle_play_pause"
|
||||
android:layout_alignTop="@+id/video_seekbar"
|
||||
android:layout_alignBottom="@+id/video_seekbar"
|
||||
android:layout_alignParentEnd="true"
|
||||
|
|