Use MediaSideScroll in PhotoFragment

This commit is contained in:
Nikola Trubitsyn 2018-02-02 16:32:27 +03:00
parent ff66f36cda
commit abd027e27b
3 changed files with 37 additions and 0 deletions

View File

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

View File

@ -31,6 +31,30 @@
android:visibility="gone"
tools:text="My image\nAnother line"/>
<RelativeLayout
android:id="@+id/photo_brightness_controller"
android:layout_width="@dimen/photo_side_slider_width"
android:layout_height="match_parent"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"/>
<TextView
android:id="@+id/slide_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="120dp"
android:alpha="0"
android:background="@drawable/black_rounded_background"
android:gravity="center"
android:paddingBottom="@dimen/medium_margin"
android:paddingLeft="@dimen/activity_margin"
android:paddingRight="@dimen/activity_margin"
android:paddingTop="@dimen/medium_margin"
android:textColor="@android:color/white"
android:textSize="@dimen/extra_big_text_size"/>
<RelativeLayout
android:id="@+id/instant_prev_item"
android:layout_width="@dimen/instant_change_bar_width"

View File

@ -8,6 +8,7 @@
<dimen name="play_outline_size_big">150dp</dimen>
<dimen name="timer_padding">24dp</dimen>
<dimen name="tmb_shadow_height">50dp</dimen>
<dimen name="photo_side_slider_width">150dp</dimen>
<dimen name="video_side_slider_width">150dp</dimen>
<dimen name="instant_change_bar_width">60dp</dimen>
<dimen name="list_view_folder_thumbnail_size">72dp</dimen>