From f1a4e21d949548048c3a086a09d723f4cdce0678 Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 1 Oct 2019 23:13:17 +0200 Subject: [PATCH] adding a portrait photo stripe --- .../gallery/pro/fragments/PhotoFragment.kt | 18 ++++++++++++++++ app/src/main/res/layout/pager_photo_item.xml | 21 +++++++++++++++++-- app/src/main/res/values/dimens.xml | 1 + 3 files changed, 38 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/PhotoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/PhotoFragment.kt index c150cbfdf..1dca82751 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/PhotoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/PhotoFragment.kt @@ -18,6 +18,7 @@ import android.util.DisplayMetrics import android.view.LayoutInflater import android.view.View import android.view.ViewGroup +import android.widget.RelativeLayout import com.alexvasilkov.gestures.GestureController import com.alexvasilkov.gestures.State import com.bumptech.glide.Glide @@ -343,6 +344,10 @@ class PhotoFragment : ViewPagerFragment() { mMedium.isSVG() -> loadSVG() else -> loadBitmap() } + + if (mMedium.isPortrait() && context != null) { + showPortraitStripe() + } } private fun loadGif() { @@ -440,6 +445,15 @@ class PhotoFragment : ViewPagerFragment() { } } + private fun showPortraitStripe() { + var bottomMargin = context!!.navigationBarHeight + context!!.resources.getDimension(R.dimen.normal_margin).toInt() + if (context!!.config.bottomActions) { + bottomMargin += context!!.resources.getDimension(R.dimen.bottom_actions_height).toInt() + } + (mView.photo_portrait_stripe_wrapper.layoutParams as RelativeLayout.LayoutParams).bottomMargin = bottomMargin + mView.photo_portrait_stripe_wrapper.beVisible() + } + private fun openPanorama() { Intent(context, PanoramaPhotoActivity::class.java).apply { putExtra(PATH, mMedium.path) @@ -663,6 +677,10 @@ class PhotoFragment : ViewPagerFragment() { panorama_outline.animate().alpha(if (isFullscreen) 0f else 1f).start() panorama_outline.isClickable = !isFullscreen } + + if (mMedium.isPortrait()) { + photo_portrait_stripe_wrapper.animate().alpha(if (isFullscreen) 0f else 1f).start() + } } } diff --git a/app/src/main/res/layout/pager_photo_item.xml b/app/src/main/res/layout/pager_photo_item.xml index 0ed59f42b..c3e8751fe 100644 --- a/app/src/main/res/layout/pager_photo_item.xml +++ b/app/src/main/res/layout/pager_photo_item.xml @@ -1,7 +1,7 @@ - @@ -79,6 +79,23 @@ android:textColor="@android:color/white" android:textSize="@dimen/extra_big_text_size"/> + + + + + + 90dp 98dp 180dp + 60dp 86dp 110dp 40dp