adding some bottom gradient to panoramas for easier button visibility
This commit is contained in:
parent
33880f7c1b
commit
f1b0e6a001
|
@ -12,6 +12,7 @@ import android.widget.RelativeLayout
|
|||
import com.google.vr.sdk.widgets.pano.VrPanoramaEventListener
|
||||
import com.google.vr.sdk.widgets.pano.VrPanoramaView
|
||||
import com.simplemobiletools.commons.extensions.beVisible
|
||||
import com.simplemobiletools.commons.extensions.onGlobalLayout
|
||||
import com.simplemobiletools.commons.extensions.showErrorToast
|
||||
import com.simplemobiletools.commons.extensions.toast
|
||||
import com.simplemobiletools.commons.helpers.PERMISSION_WRITE_STORAGE
|
||||
|
@ -166,14 +167,17 @@ open class PanoramaPhotoActivity : SimpleActivity() {
|
|||
}
|
||||
|
||||
(explore.layoutParams as RelativeLayout.LayoutParams).bottomMargin = navigationBarHeight
|
||||
|
||||
cardboard.onGlobalLayout {
|
||||
panorama_gradient_background.layoutParams.height = navBarHeight + cardboard.height
|
||||
}
|
||||
}
|
||||
|
||||
private fun toggleButtonVisibility() {
|
||||
cardboard.animate().alpha(if (isFullscreen) 0f else 1f)
|
||||
cardboard.isClickable = !isFullscreen
|
||||
|
||||
explore.animate().alpha(if (isFullscreen) 0f else 1f)
|
||||
explore.isClickable = !isFullscreen
|
||||
arrayOf(cardboard, explore, panorama_gradient_background).forEach {
|
||||
it.animate().alpha(if (isFullscreen) 0f else 1f)
|
||||
it.isClickable = !isFullscreen
|
||||
}
|
||||
}
|
||||
|
||||
private fun handleClick() {
|
||||
|
|
|
@ -56,7 +56,7 @@ open class PanoramaVideoActivity : SimpleActivity(), SeekBar.OnSeekBarChangeList
|
|||
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS)
|
||||
}
|
||||
|
||||
setupButtonMargins()
|
||||
setupButtons()
|
||||
|
||||
cardboard.setOnClickListener {
|
||||
vr_video_view.displayMode = CARDBOARD_DISPLAY_MODE
|
||||
|
@ -179,7 +179,7 @@ open class PanoramaVideoActivity : SimpleActivity(), SeekBar.OnSeekBarChangeList
|
|||
|
||||
override fun onConfigurationChanged(newConfig: Configuration?) {
|
||||
super.onConfigurationChanged(newConfig)
|
||||
setupButtonMargins()
|
||||
setupButtons()
|
||||
}
|
||||
|
||||
private fun setupDuration(duration: Long) {
|
||||
|
@ -256,7 +256,7 @@ open class PanoramaVideoActivity : SimpleActivity(), SeekBar.OnSeekBarChangeList
|
|||
}, HIDE_PLAY_PAUSE_DELAY)
|
||||
}
|
||||
|
||||
private fun setupButtonMargins() {
|
||||
private fun setupButtons() {
|
||||
val navBarHeight = navigationBarHeight
|
||||
video_time_holder.apply {
|
||||
(layoutParams as RelativeLayout.LayoutParams).bottomMargin = navBarHeight
|
||||
|
@ -270,16 +270,17 @@ open class PanoramaVideoActivity : SimpleActivity(), SeekBar.OnSeekBarChangeList
|
|||
bottomMargin = navBarHeight + video_time_holder.height
|
||||
rightMargin = navigationBarWidth
|
||||
}
|
||||
vr_view_gradient_background.layoutParams.height = navBarHeight + video_time_holder.height + explore.height
|
||||
explore.requestLayout()
|
||||
}
|
||||
}
|
||||
|
||||
private fun toggleButtonVisibility() {
|
||||
cardboard.animate().alpha(if (mIsFullscreen) 0f else 1f)
|
||||
cardboard.isClickable = !mIsFullscreen
|
||||
|
||||
explore.animate().alpha(if (mIsFullscreen) 0f else 1f)
|
||||
explore.isClickable = !mIsFullscreen
|
||||
val newAlpha = if (mIsFullscreen) 0f else 1f
|
||||
arrayOf(cardboard, explore, vr_view_gradient_background).forEach {
|
||||
it.animate().alpha(newAlpha)
|
||||
it.isClickable = !mIsFullscreen
|
||||
}
|
||||
|
||||
var anim = android.R.anim.fade_in
|
||||
if (mIsFullscreen) {
|
||||
|
|
|
@ -12,6 +12,13 @@
|
|||
android:layout_height="match_parent"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/panorama_gradient_background"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:background="@drawable/gradient_background"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/cardboard"
|
||||
android:layout_width="wrap_content"
|
||||
|
|
|
@ -11,6 +11,13 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/vr_view_gradient_background"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:background="@drawable/gradient_background"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/explore"
|
||||
android:layout_width="wrap_content"
|
||||
|
|
Loading…
Reference in New Issue