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