adding a portrait photo stripe

This commit is contained in:
tibbi 2019-10-01 23:13:17 +02:00
parent ac39523478
commit f1a4e21d94
3 changed files with 38 additions and 2 deletions

View File

@ -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()
}
}
}

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/photo_holder"
android:layout_width="match_parent"
android:layout_height="match_parent">
@ -79,6 +79,23 @@
android:textColor="@android:color/white"
android:textSize="@dimen/extra_big_text_size"/>
<RelativeLayout
android:id="@+id/photo_portrait_stripe_wrapper"
android:layout_width="match_parent"
android:layout_height="@dimen/portrait_photos_stripe_height"
android:layout_alignParentBottom="true"
android:visibility="gone">
<com.simplemobiletools.commons.views.MyRecyclerView
android:id="@+id/photo_portrait_stripe"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:overScrollMode="never"
app:layoutManager="com.simplemobiletools.commons.views.MyLinearLayoutManager" />
</RelativeLayout>
<com.simplemobiletools.gallery.pro.views.InstantItemSwitch
android:id="@+id/instant_prev_item"
android:layout_width="@dimen/instant_change_bar_width"

View File

@ -19,6 +19,7 @@
<dimen name="bottom_filters_height">90dp</dimen>
<dimen name="bottom_filters_height_with_margin">98dp</dimen>
<dimen name="bottom_editor_actions_shadow_height">180dp</dimen>
<dimen name="portrait_photos_stripe_height">60dp</dimen>
<dimen name="default_status_action_height">86dp</dimen>
<dimen name="widget_initial_size">110dp</dimen>
<dimen name="full_brush_size">40dp</dimen>