move the video player bottom gradient in a different view

This commit is contained in:
tibbi 2019-01-03 23:45:59 +01:00
parent 04f8abe23f
commit 1bc4ce47bb
4 changed files with 15 additions and 3 deletions

View file

@ -244,6 +244,7 @@ open class PanoramaVideoActivity : SimpleActivity(), SeekBar.OnSeekBarChangeList
} }
video_time_holder.setPadding(0, 0, right, bottom) video_time_holder.setPadding(0, 0, right, bottom)
video_time_holder.background = resources.getDrawable(R.drawable.gradient_background)
video_time_holder.onGlobalLayout { video_time_holder.onGlobalLayout {
val newBottomMargin = video_time_holder.height - resources.getDimension(R.dimen.video_player_play_pause_size).toInt() - resources.getDimension(R.dimen.activity_margin).toInt() val newBottomMargin = video_time_holder.height - resources.getDimension(R.dimen.video_player_play_pause_size).toInt() - resources.getDimension(R.dimen.activity_margin).toInt()
(explore.layoutParams as RelativeLayout.LayoutParams).bottomMargin = newBottomMargin (explore.layoutParams as RelativeLayout.LayoutParams).bottomMargin = newBottomMargin

View file

@ -399,6 +399,7 @@ open class VideoPlayerActivity : SimpleActivity(), SeekBar.OnSeekBarChangeListen
val newAlpha = if (isFullScreen) 0f else 1f val newAlpha = if (isFullScreen) 0f else 1f
top_shadow.animate().alpha(newAlpha).start() top_shadow.animate().alpha(newAlpha).start()
video_time_holder.animate().alpha(newAlpha).start() video_time_holder.animate().alpha(newAlpha).start()
video_bottom_gradient.animate().alpha(newAlpha).start()
video_seekbar.setOnSeekBarChangeListener(if (mIsFullscreen) null else this) video_seekbar.setOnSeekBarChangeListener(if (mIsFullscreen) null else this)
arrayOf(video_toggle_play_pause, video_curr_time, video_duration).forEach { arrayOf(video_toggle_play_pause, video_curr_time, video_duration).forEach {
it.isClickable = !mIsFullscreen it.isClickable = !mIsFullscreen

View file

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout <RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/video_player_holder" android:id="@+id/video_player_holder"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
@ -46,6 +47,16 @@
android:textColor="@android:color/white" android:textColor="@android:color/white"
android:textSize="@dimen/extra_big_text_size"/> android:textSize="@dimen/extra_big_text_size"/>
<include layout="@layout/bottom_video_time_holder"/> <TextView
android:id="@+id/video_bottom_gradient"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignTop="@+id/video_time_holder"
android:layout_alignParentBottom="true"
android:background="@drawable/gradient_background"
tools:ignore="UnknownIdInLayout"/>
<include
layout="@layout/bottom_video_time_holder"/>
</RelativeLayout> </RelativeLayout>

View file

@ -5,8 +5,7 @@
android:id="@+id/video_time_holder" android:id="@+id/video_time_holder"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true">
android:background="@drawable/gradient_background">
<ImageView <ImageView
android:id="@+id/video_toggle_play_pause" android:id="@+id/video_toggle_play_pause"