adding a toggle play/pause button at the video player
|
@ -130,6 +130,7 @@ open class VideoPlayerActivity : SimpleActivity(), SeekBar.OnSeekBarChangeListen
|
||||||
video_seekbar.setOnClickListener { }
|
video_seekbar.setOnClickListener { }
|
||||||
video_curr_time.setOnClickListener { skip(false) }
|
video_curr_time.setOnClickListener { skip(false) }
|
||||||
video_duration.setOnClickListener { skip(true) }
|
video_duration.setOnClickListener { skip(true) }
|
||||||
|
video_toggle_play_pause.setOnClickListener { togglePlayPause() }
|
||||||
video_player_holder.setOnClickListener {
|
video_player_holder.setOnClickListener {
|
||||||
fullscreenToggled(!mIsFullscreen)
|
fullscreenToggled(!mIsFullscreen)
|
||||||
}
|
}
|
||||||
|
@ -258,6 +259,7 @@ open class VideoPlayerActivity : SimpleActivity(), SeekBar.OnSeekBarChangeListen
|
||||||
mWasVideoStarted = true
|
mWasVideoStarted = true
|
||||||
mIsPlaying = true
|
mIsPlaying = true
|
||||||
mExoPlayer?.playWhenReady = true
|
mExoPlayer?.playWhenReady = true
|
||||||
|
video_toggle_play_pause.setImageResource(R.drawable.ic_pause_outline)
|
||||||
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
|
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -271,6 +273,7 @@ open class VideoPlayerActivity : SimpleActivity(), SeekBar.OnSeekBarChangeListen
|
||||||
mExoPlayer?.playWhenReady = false
|
mExoPlayer?.playWhenReady = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
video_toggle_play_pause.setImageResource(R.drawable.ic_play_outline)
|
||||||
window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
|
window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
BIN
app/src/main/res/drawable-hdpi/ic_pause_outline.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
app/src/main/res/drawable-hdpi/ic_play_outline.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
app/src/main/res/drawable-xhdpi/ic_pause_outline.png
Normal file
After Width: | Height: | Size: 3 KiB |
BIN
app/src/main/res/drawable-xhdpi/ic_play_outline.png
Normal file
After Width: | Height: | Size: 3.6 KiB |
BIN
app/src/main/res/drawable-xxhdpi/ic_pause_outline.png
Normal file
After Width: | Height: | Size: 5.9 KiB |
BIN
app/src/main/res/drawable-xxhdpi/ic_play_outline.png
Normal file
After Width: | Height: | Size: 7.1 KiB |
BIN
app/src/main/res/drawable-xxxhdpi/ic_pause_outline.png
Normal file
After Width: | Height: | Size: 4.6 KiB |
BIN
app/src/main/res/drawable-xxxhdpi/ic_play_outline.png
Normal file
After Width: | Height: | Size: 5.9 KiB |
|
@ -7,10 +7,21 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentBottom="true">
|
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
|
<TextView
|
||||||
android:id="@+id/video_curr_time"
|
android:id="@+id/video_curr_time"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:layout_below="@+id/video_toggle_play_pause"
|
||||||
android:layout_alignTop="@+id/video_seekbar"
|
android:layout_alignTop="@+id/video_seekbar"
|
||||||
android:layout_alignBottom="@+id/video_seekbar"
|
android:layout_alignBottom="@+id/video_seekbar"
|
||||||
android:layout_alignParentStart="true"
|
android:layout_alignParentStart="true"
|
||||||
|
@ -26,6 +37,7 @@
|
||||||
android:id="@+id/video_seekbar"
|
android:id="@+id/video_seekbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@+id/video_toggle_play_pause"
|
||||||
android:layout_toStartOf="@+id/video_duration"
|
android:layout_toStartOf="@+id/video_duration"
|
||||||
android:layout_toLeftOf="@+id/video_duration"
|
android:layout_toLeftOf="@+id/video_duration"
|
||||||
android:layout_toEndOf="@+id/video_curr_time"
|
android:layout_toEndOf="@+id/video_curr_time"
|
||||||
|
@ -37,6 +49,7 @@
|
||||||
android:id="@+id/video_duration"
|
android:id="@+id/video_duration"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@+id/video_toggle_play_pause"
|
||||||
android:layout_alignTop="@+id/video_seekbar"
|
android:layout_alignTop="@+id/video_seekbar"
|
||||||
android:layout_alignBottom="@+id/video_seekbar"
|
android:layout_alignBottom="@+id/video_seekbar"
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
|
|