add some bottom shadow to fullscreen photos when Bottom Actions are enabled
This commit is contained in:
parent
5de6eb9765
commit
715b783a8a
|
@ -80,7 +80,6 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
|||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_medium)
|
||||
setTranslucentNavigation()
|
||||
mMediaFiles = MediaActivity.mMedia.clone() as ArrayList<Medium>
|
||||
|
||||
handlePermission(PERMISSION_WRITE_STORAGE) {
|
||||
|
@ -95,6 +94,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
|||
storeStateVariables()
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
if (!hasPermission(PERMISSION_WRITE_STORAGE)) {
|
||||
|
@ -102,6 +102,14 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
|||
return
|
||||
}
|
||||
|
||||
if (config.bottomActions) {
|
||||
if (isLollipopPlus()) {
|
||||
window.navigationBarColor = Color.TRANSPARENT
|
||||
}
|
||||
} else {
|
||||
setTranslucentNavigation()
|
||||
}
|
||||
|
||||
if (mStoredReplaceZoomableImages != config.replaceZoomableImages) {
|
||||
mPrevHashcode = 0
|
||||
refreshViewPager()
|
||||
|
|
|
@ -51,6 +51,7 @@ class PhotoFragment : ViewPagerFragment() {
|
|||
|
||||
private var storedShowExtendedDetails = false
|
||||
private var storedHideExtendedDetails = false
|
||||
private var storedBottomActions = false
|
||||
private var storedExtendedDetails = 0
|
||||
|
||||
lateinit var view: ViewGroup
|
||||
|
@ -116,7 +117,8 @@ class PhotoFragment : ViewPagerFragment() {
|
|||
|
||||
isFullscreen = activity!!.window.decorView.systemUiVisibility and View.SYSTEM_UI_FLAG_FULLSCREEN == View.SYSTEM_UI_FLAG_FULLSCREEN
|
||||
loadImage()
|
||||
checkExtendedDetails()
|
||||
initExtendedDetails()
|
||||
initBottomActions()
|
||||
wasInit = true
|
||||
|
||||
return view
|
||||
|
@ -130,7 +132,11 @@ class PhotoFragment : ViewPagerFragment() {
|
|||
override fun onResume() {
|
||||
super.onResume()
|
||||
if (wasInit && (context!!.config.showExtendedDetails != storedShowExtendedDetails || context!!.config.extendedDetails != storedExtendedDetails)) {
|
||||
checkExtendedDetails()
|
||||
initExtendedDetails()
|
||||
}
|
||||
|
||||
if (wasInit && (context!!.config.bottomActions != storedBottomActions)) {
|
||||
initBottomActions()
|
||||
}
|
||||
|
||||
val allowPhotoGestures = context!!.config.allowPhotoGestures
|
||||
|
@ -162,6 +168,7 @@ class PhotoFragment : ViewPagerFragment() {
|
|||
storedShowExtendedDetails = showExtendedDetails
|
||||
storedHideExtendedDetails = hideExtendedDetails
|
||||
storedExtendedDetails = extendedDetails
|
||||
storedBottomActions = bottomActions
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -376,7 +383,7 @@ class PhotoFragment : ViewPagerFragment() {
|
|||
loadBitmap(degrees)
|
||||
}
|
||||
|
||||
private fun checkExtendedDetails() {
|
||||
private fun initExtendedDetails() {
|
||||
if (context!!.config.showExtendedDetails) {
|
||||
view.photo_details.apply {
|
||||
beInvisible() // make it invisible so we can measure it, but not show yet
|
||||
|
@ -397,6 +404,14 @@ class PhotoFragment : ViewPagerFragment() {
|
|||
}
|
||||
}
|
||||
|
||||
private fun initBottomActions() {
|
||||
if (context!!.config.bottomActions) {
|
||||
view.bottom_actions.beVisible()
|
||||
} else {
|
||||
view.bottom_actions.beGone()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
super.onDestroyView()
|
||||
if (activity?.isActivityDestroyed() == false) {
|
||||
|
@ -408,7 +423,8 @@ class PhotoFragment : ViewPagerFragment() {
|
|||
override fun onConfigurationChanged(newConfig: Configuration) {
|
||||
super.onConfigurationChanged(newConfig)
|
||||
loadImage()
|
||||
checkExtendedDetails()
|
||||
initExtendedDetails()
|
||||
initBottomActions()
|
||||
}
|
||||
|
||||
private fun photoClicked() {
|
||||
|
@ -426,6 +442,10 @@ class PhotoFragment : ViewPagerFragment() {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (storedBottomActions) {
|
||||
view.bottom_actions.animate().alpha(if (isFullscreen) 0f else 1f).start()
|
||||
}
|
||||
}
|
||||
|
||||
private fun getExtendedDetailsY(height: Int): Float {
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<gradient
|
||||
android:angle="90"
|
||||
android:endColor="@android:color/transparent"
|
||||
android:startColor="@color/circle_black_background"/>
|
||||
</shape>
|
|
@ -68,4 +68,14 @@
|
|||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentRight="true"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/bottom_actions"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:background="@drawable/gradient_background_lighter"
|
||||
android:minHeight="@dimen/bottom_actions_height"
|
||||
android:orientation="horizontal">
|
||||
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|
|
|
@ -10,4 +10,5 @@
|
|||
<dimen name="media_side_slider_width">60dp</dimen>
|
||||
<dimen name="instant_change_bar_width">30dp</dimen>
|
||||
<dimen name="list_view_folder_thumbnail_size">72dp</dimen>
|
||||
<dimen name="bottom_actions_height">110dp</dimen>
|
||||
</resources>
|
||||
|
|
Loading…
Reference in New Issue