diff --git a/app/build.gradle b/app/build.gradle index 86268b68f..67dfb9030 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -53,6 +53,7 @@ dependencies { implementation 'it.sephiroth.android.exif:library:1.0.1' implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.12' implementation 'com.github.chrisbanes:PhotoView:2.1.3' + implementation 'com.android.support.constraint:constraint-layout:1.1.2' kapt "android.arch.persistence.room:compiler:1.1.0" implementation "android.arch.persistence.room:runtime:1.1.0" diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt index 2a92a42c0..14b69e3be 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -69,6 +69,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View private var mIsOrientationLocked = false private var mStoredReplaceZoomableImages = false + private var mStoredBottomActions = true private var mMediaFiles = ArrayList() companion object { @@ -92,6 +93,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View } storeStateVariables() + initBottomActions() } @TargetApi(Build.VERSION_CODES.LOLLIPOP) @@ -115,6 +117,10 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View refreshViewPager() } + if (mStoredBottomActions != config.bottomActions) { + initBottomActions() + } + supportActionBar?.setBackgroundDrawable(resources.getDrawable(R.drawable.actionbar_gradient_background)) if (config.maxBrightness) { @@ -240,10 +246,18 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View view_pager.adapter?.let { (it as MyPagerAdapter).toggleFullscreen(mIsFullScreen) checkSystemUI() + if (!bottom_actions.isGone()) { + bottom_actions.animate().alpha(if (mIsFullScreen) 0f else 1f).start() + } } } } + private fun initBottomActions() { + initBottomActionsLayout() + initBottomActionButtons() + } + private fun setupRotation() { if (mIsOrientationLocked) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { @@ -313,6 +327,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View private fun storeStateVariables() { config.apply { mStoredReplaceZoomableImages = replaceZoomableImages + mStoredBottomActions = bottomActions } } @@ -719,6 +734,33 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View return (floatD + floatM / 60 + floatS / 3600).toFloat() } + private fun initBottomActionsLayout() { + bottom_actions.layoutParams.height = resources.getDimension(R.dimen.bottom_actions_height).toInt() + navigationBarHeight + if (config.bottomActions) { + bottom_actions.beVisible() + } else { + bottom_actions.beGone() + } + } + + private fun initBottomActionButtons() { + bottom_properties.setOnClickListener { + + } + + bottom_edit.setOnClickListener { + + } + + bottom_share.setOnClickListener { + + } + + bottom_delete.setOnClickListener { + + } + } + override fun onActivityResult(requestCode: Int, resultCode: Int, resultData: Intent?) { if (requestCode == REQUEST_EDIT_IMAGE) { if (resultCode == Activity.RESULT_OK && resultData != null) { 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 6dcf9a864..2ad42afb4 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt @@ -51,7 +51,6 @@ class PhotoFragment : ViewPagerFragment() { private var storedShowExtendedDetails = false private var storedHideExtendedDetails = false - private var storedBottomActions = false private var storedExtendedDetails = 0 lateinit var view: ViewGroup @@ -118,7 +117,6 @@ class PhotoFragment : ViewPagerFragment() { isFullscreen = activity!!.window.decorView.systemUiVisibility and View.SYSTEM_UI_FLAG_FULLSCREEN == View.SYSTEM_UI_FLAG_FULLSCREEN loadImage() initExtendedDetails() - initBottomActions() wasInit = true return view @@ -135,10 +133,6 @@ class PhotoFragment : ViewPagerFragment() { initExtendedDetails() } - if (wasInit && (context!!.config.bottomActions != storedBottomActions)) { - initBottomActions() - } - val allowPhotoGestures = context!!.config.allowPhotoGestures val allowInstantChange = context!!.config.allowInstantChange @@ -168,7 +162,6 @@ class PhotoFragment : ViewPagerFragment() { storedShowExtendedDetails = showExtendedDetails storedHideExtendedDetails = hideExtendedDetails storedExtendedDetails = extendedDetails - storedBottomActions = bottomActions } } @@ -404,14 +397,6 @@ 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) { @@ -424,7 +409,6 @@ class PhotoFragment : ViewPagerFragment() { super.onConfigurationChanged(newConfig) loadImage() initExtendedDetails() - initBottomActions() } private fun photoClicked() { @@ -442,10 +426,6 @@ class PhotoFragment : ViewPagerFragment() { } } } - - if (storedBottomActions) { - view.bottom_actions.animate().alpha(if (isFullscreen) 0f else 1f).start() - } } private fun getExtendedDetailsY(height: Int): Float { diff --git a/app/src/main/res/layout/activity_medium.xml b/app/src/main/res/layout/activity_medium.xml index 1d8dc6c42..368540386 100644 --- a/app/src/main/res/layout/activity_medium.xml +++ b/app/src/main/res/layout/activity_medium.xml @@ -1,6 +1,7 @@ @@ -10,4 +11,57 @@ android:layout_width="match_parent" android:layout_height="match_parent"/> + + + + + + + + + + + diff --git a/app/src/main/res/layout/pager_photo_item.xml b/app/src/main/res/layout/pager_photo_item.xml index 85765aa38..deb877e71 100644 --- a/app/src/main/res/layout/pager_photo_item.xml +++ b/app/src/main/res/layout/pager_photo_item.xml @@ -68,14 +68,4 @@ android:layout_alignParentEnd="true" android:layout_alignParentRight="true"/> - - - diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index 3771a2dbc..79eab94d2 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -10,5 +10,5 @@ 60dp 30dp 72dp - 110dp + 54dp