From abd027e27bf89947052581a952a80c14bbeeac74 Mon Sep 17 00:00:00 2001 From: Nikola Trubitsyn Date: Fri, 2 Feb 2018 16:32:27 +0300 Subject: [PATCH] Use MediaSideScroll in PhotoFragment --- .../gallery/fragments/PhotoFragment.kt | 12 ++++++++++ app/src/main/res/layout/pager_photo_item.xml | 24 +++++++++++++++++++ app/src/main/res/values/dimens.xml | 1 + 3 files changed, 37 insertions(+) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt index 1cb1d5e23..d689fa449 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt @@ -30,6 +30,7 @@ import com.simplemobiletools.gallery.activities.ViewPagerActivity import com.simplemobiletools.gallery.extensions.* import com.simplemobiletools.gallery.helpers.GlideRotateTransformation import com.simplemobiletools.gallery.helpers.MEDIUM +import com.simplemobiletools.gallery.helpers.MediaSideScroll import com.simplemobiletools.gallery.models.Medium import it.sephiroth.android.library.exif2.ExifInterface import kotlinx.android.synthetic.main.pager_photo_item.view.* @@ -49,6 +50,8 @@ class PhotoFragment : ViewPagerFragment() { private var storedHideExtendedDetails = false private var storedExtendedDetails = 0 + private lateinit var mediaSideScroll: MediaSideScroll + lateinit var view: ViewGroup lateinit var medium: Medium @@ -58,6 +61,10 @@ class PhotoFragment : ViewPagerFragment() { gif_view.setOnClickListener { photoClicked() } instant_prev_item.setOnClickListener { listener?.goToPrevItem() } instant_next_item.setOnClickListener { listener?.goToNextItem() } + photo_brightness_controller.setOnTouchListener { v, event -> + mediaSideScroll.handleBrightnessTouched(event) + true + } } storeStateVariables() @@ -105,6 +112,11 @@ class PhotoFragment : ViewPagerFragment() { return view } + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + mediaSideScroll = MediaSideScroll(context!!, activity!!, view.slide_info, {}) + } + override fun onPause() { super.onPause() storeStateVariables() diff --git a/app/src/main/res/layout/pager_photo_item.xml b/app/src/main/res/layout/pager_photo_item.xml index e86420b4f..38c9c4c2e 100644 --- a/app/src/main/res/layout/pager_photo_item.xml +++ b/app/src/main/res/layout/pager_photo_item.xml @@ -31,6 +31,30 @@ android:visibility="gone" tools:text="My image\nAnother line"/> + + + + 150dp 24dp 50dp + 150dp 150dp 60dp 72dp