From f4a475da185cfbd742cd9c7cb2276da6afe7c330 Mon Sep 17 00:00:00 2001 From: Nikola Trubitsyn Date: Tue, 30 Jan 2018 23:59:38 +0300 Subject: [PATCH 01/63] Set unique applicationIdSuffix in debug builds --- app/build.gradle | 3 +++ app/src/debug/res/values/strings.xml | 4 ++++ 2 files changed, 7 insertions(+) create mode 100644 app/src/debug/res/values/strings.xml diff --git a/app/build.gradle b/app/build.gradle index 45a3d649c..c875caf29 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -21,6 +21,9 @@ android { } buildTypes { + debug { + applicationIdSuffix ".debug" + } release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' diff --git a/app/src/debug/res/values/strings.xml b/app/src/debug/res/values/strings.xml new file mode 100644 index 000000000..ebf8b9d2a --- /dev/null +++ b/app/src/debug/res/values/strings.xml @@ -0,0 +1,4 @@ + + + Gallery_debug + \ No newline at end of file From ff66f36cda93e28625e4248ee2c4363356f81e3b Mon Sep 17 00:00:00 2001 From: Nikola Trubitsyn Date: Fri, 2 Feb 2018 16:28:13 +0300 Subject: [PATCH 02/63] Move side scroll functionality to MediaSideScroll.kt --- .../gallery/fragments/VideoFragment.kt | 159 ++---------------- .../gallery/helpers/MediaSideScroll.kt | 150 +++++++++++++++++ 2 files changed, 168 insertions(+), 141 deletions(-) create mode 100644 app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaSideScroll.kt diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt index 0ee831121..1c3516642 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt @@ -7,7 +7,6 @@ import android.net.Uri import android.os.Build import android.os.Bundle import android.os.Handler -import android.provider.Settings import android.support.annotation.RequiresApi import android.util.DisplayMetrics import android.view.* @@ -17,16 +16,17 @@ import android.widget.TextView import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.activities.VideoActivity -import com.simplemobiletools.gallery.activities.ViewPagerActivity -import com.simplemobiletools.gallery.extensions.* +import com.simplemobiletools.gallery.extensions.config +import com.simplemobiletools.gallery.extensions.navigationBarHeight +import com.simplemobiletools.gallery.extensions.usableScreenSize +import com.simplemobiletools.gallery.extensions.windowManager import com.simplemobiletools.gallery.helpers.MEDIUM +import com.simplemobiletools.gallery.helpers.MediaSideScroll import com.simplemobiletools.gallery.models.Medium import kotlinx.android.synthetic.main.pager_video_item.view.* import java.io.IOException class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSeekBarChangeListener { - private val CLICK_MAX_DURATION = 150 - private val SLIDE_INFO_FADE_DELAY = 1000L private val PROGRESS = "progress" private var mMediaPlayer: MediaPlayer? = null @@ -50,21 +50,12 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee private var mDuration = 0 private var mEncodedPath = "" - private var mTouchDownX = 0f - private var mTouchDownY = 0f - private var mTouchDownTime = 0L - private var mTouchDownVolume = 0 - private var mTouchDownBrightness = -1 - private var mTempBrightness = 0 - private var mLastTouchY = 0f - - private var mSlideInfoText = "" - private var mSlideInfoFadeHandler = Handler() - private var mStoredShowExtendedDetails = false private var mStoredHideExtendedDetails = false private var mStoredExtendedDetails = 0 + private lateinit var mediaSideScroll: MediaSideScroll + lateinit var medium: Medium override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { @@ -94,6 +85,13 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee return mView } + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + mediaSideScroll = MediaSideScroll(context!!, activity!!, view.slide_info, { + view.video_holder.performClick() + }) + } + override fun onResume() { super.onResume() activity!!.updateTextColors(mView!!.video_holder) @@ -145,13 +143,15 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee mSurfaceHolder!!.addCallback(this) mSurfaceView!!.setOnClickListener { toggleFullscreen() } mView!!.video_holder.setOnClickListener { toggleFullscreen() } + mView!!.video_volume_controller.setOnTouchListener { v, event -> - handleVolumeTouched(event) + mediaSideScroll.handleVolumeTouched(event) + true true } mView!!.video_brightness_controller.setOnTouchListener { v, event -> - handleBrightnessTouched(event) + mediaSideScroll.handleBrightnessTouched(event) true } @@ -186,129 +186,6 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee listener?.fragmentClicked() } - private fun handleVolumeTouched(event: MotionEvent) { - when (event.action) { - MotionEvent.ACTION_DOWN -> { - mTouchDownX = event.x - mTouchDownY = event.y - mLastTouchY = event.y - mTouchDownTime = System.currentTimeMillis() - mTouchDownVolume = getCurrentVolume() - mSlideInfoText = "${getString(R.string.volume)}:\n" - } - MotionEvent.ACTION_MOVE -> { - val diffX = mTouchDownX - event.x - val diffY = mTouchDownY - event.y - - if (Math.abs(diffY) > 20 && Math.abs(diffY) > Math.abs(diffX)) { - var percent = ((diffY / ViewPagerActivity.screenHeight) * 100).toInt() * 3 - percent = Math.min(100, Math.max(-100, percent)) - - if ((percent == 100 && event.y > mLastTouchY) || (percent == -100 && event.y < mLastTouchY)) { - mTouchDownY = event.y - mTouchDownVolume = getCurrentVolume() - } - - volumePercentChanged(percent) - } - mLastTouchY = event.y - } - MotionEvent.ACTION_UP, MotionEvent.ACTION_CANCEL -> { - val diffX = Math.abs(event.x - mTouchDownX) - val diffY = Math.abs(event.y - mTouchDownY) - if (System.currentTimeMillis() - mTouchDownTime < CLICK_MAX_DURATION && diffX < 20 && diffY < 20) { - mView!!.video_holder.performClick() - } - } - } - } - - private fun handleBrightnessTouched(event: MotionEvent) { - when (event.action) { - MotionEvent.ACTION_DOWN -> { - mTouchDownX = event.x - mTouchDownY = event.y - mLastTouchY = event.y - mTouchDownTime = System.currentTimeMillis() - mSlideInfoText = "${getString(R.string.brightness)}:\n" - if (mTouchDownBrightness == -1) - mTouchDownBrightness = getCurrentBrightness() - } - MotionEvent.ACTION_MOVE -> { - val diffX = mTouchDownX - event.x - val diffY = mTouchDownY - event.y - - if (Math.abs(diffY) > 20 && Math.abs(diffY) > Math.abs(diffX)) { - var percent = ((diffY / ViewPagerActivity.screenHeight) * 100).toInt() * 3 - percent = Math.min(100, Math.max(-100, percent)) - - if ((percent == 100 && event.y > mLastTouchY) || (percent == -100 && event.y < mLastTouchY)) { - mTouchDownY = event.y - mTouchDownBrightness = mTempBrightness - } - - brightnessPercentChanged(percent) - } - mLastTouchY = event.y - } - MotionEvent.ACTION_UP, MotionEvent.ACTION_CANCEL -> { - val diffX = Math.abs(event.x - mTouchDownX) - val diffY = Math.abs(event.y - mTouchDownY) - if (System.currentTimeMillis() - mTouchDownTime < CLICK_MAX_DURATION && diffX < 20 && diffY < 20) { - mView!!.video_holder.performClick() - } - mTouchDownBrightness = mTempBrightness - } - } - mView!!.video_holder - } - - private fun getCurrentVolume() = context!!.audioManager.getStreamVolume(AudioManager.STREAM_MUSIC) - - private fun getCurrentBrightness() = Settings.System.getInt(activity!!.contentResolver, Settings.System.SCREEN_BRIGHTNESS) - - private fun volumePercentChanged(percent: Int) { - val stream = AudioManager.STREAM_MUSIC - val maxVolume = context!!.audioManager.getStreamMaxVolume(stream) - val percentPerPoint = 100 / maxVolume - val addPoints = percent / percentPerPoint - val newVolume = Math.min(maxVolume, Math.max(0, mTouchDownVolume + addPoints)) - context!!.audioManager.setStreamVolume(stream, newVolume, 0) - - val absolutePercent = ((newVolume / maxVolume.toFloat()) * 100).toInt() - mView!!.slide_info.apply { - text = "$mSlideInfoText$absolutePercent%" - alpha = 1f - } - - mSlideInfoFadeHandler.removeCallbacksAndMessages(null) - mSlideInfoFadeHandler.postDelayed({ - mView!!.slide_info.animate().alpha(0f) - }, SLIDE_INFO_FADE_DELAY) - } - - private fun brightnessPercentChanged(percent: Int) { - val maxBrightness = 255f - var newBrightness = (mTouchDownBrightness + 2.55 * percent).toFloat() - newBrightness = Math.min(maxBrightness, Math.max(0f, newBrightness)) - mTempBrightness = newBrightness.toInt() - - val absolutePercent = ((newBrightness / maxBrightness) * 100).toInt() - mView!!.slide_info.apply { - text = "$mSlideInfoText$absolutePercent%" - alpha = 1f - } - - val attributes = activity!!.window.attributes - attributes.screenBrightness = absolutePercent / 100f - activity!!.window.attributes = attributes - - mSlideInfoFadeHandler.removeCallbacksAndMessages(null) - mSlideInfoFadeHandler.postDelayed({ - mView!!.slide_info.animate().alpha(0f) - }, SLIDE_INFO_FADE_DELAY) - } - private fun initTimeHolder() { val res = resources val height = context!!.navigationBarHeight diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaSideScroll.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaSideScroll.kt new file mode 100644 index 000000000..9536f7abb --- /dev/null +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaSideScroll.kt @@ -0,0 +1,150 @@ +package com.simplemobiletools.gallery.helpers + +import android.app.Activity +import android.content.Context +import android.media.AudioManager +import android.os.Handler +import android.provider.Settings +import android.view.MotionEvent +import android.widget.TextView +import com.simplemobiletools.gallery.R +import com.simplemobiletools.gallery.activities.ViewPagerActivity +import com.simplemobiletools.gallery.extensions.audioManager + +class MediaSideScroll(val context: Context, val activity: Activity, val slideInfoView: TextView, val onSpecialEvent: () -> Unit) { + private val CLICK_MAX_DURATION = 150 + private val SLIDE_INFO_FADE_DELAY = 1000L + private var mTouchDownX = 0f + private var mTouchDownY = 0f + private var mTouchDownTime = 0L + private var mTouchDownVolume = 0 + private var mTouchDownBrightness = -1 + private var mTempBrightness = 0 + private var mLastTouchY = 0f + + private var mSlideInfoText = "" + private var mSlideInfoFadeHandler = Handler() + + fun handleVolumeTouched(event: MotionEvent) { + when (event.action) { + MotionEvent.ACTION_DOWN -> { + mTouchDownX = event.x + mTouchDownY = event.y + mLastTouchY = event.y + mTouchDownTime = System.currentTimeMillis() + mTouchDownVolume = getCurrentVolume() + mSlideInfoText = "${context.getString(R.string.volume)}:\n" + } + MotionEvent.ACTION_MOVE -> { + val diffX = mTouchDownX - event.x + val diffY = mTouchDownY - event.y + + if (Math.abs(diffY) > 20 && Math.abs(diffY) > Math.abs(diffX)) { + var percent = ((diffY / ViewPagerActivity.screenHeight) * 100).toInt() * 3 + percent = Math.min(100, Math.max(-100, percent)) + + if ((percent == 100 && event.y > mLastTouchY) || (percent == -100 && event.y < mLastTouchY)) { + mTouchDownY = event.y + mTouchDownVolume = getCurrentVolume() + } + + volumePercentChanged(percent) + } + mLastTouchY = event.y + } + MotionEvent.ACTION_UP, MotionEvent.ACTION_CANCEL -> { + val diffX = Math.abs(event.x - mTouchDownX) + val diffY = Math.abs(event.y - mTouchDownY) + if (System.currentTimeMillis() - mTouchDownTime < CLICK_MAX_DURATION && diffX < 20 && diffY < 20) { + onSpecialEvent() + } + } + } + } + + fun handleBrightnessTouched(event: MotionEvent) { + when (event.action) { + MotionEvent.ACTION_DOWN -> { + mTouchDownX = event.x + mTouchDownY = event.y + mLastTouchY = event.y + mTouchDownTime = System.currentTimeMillis() + mSlideInfoText = "${context.getString(R.string.brightness)}:\n" + if (mTouchDownBrightness == -1) + mTouchDownBrightness = getCurrentBrightness() + } + MotionEvent.ACTION_MOVE -> { + val diffX = mTouchDownX - event.x + val diffY = mTouchDownY - event.y + + if (Math.abs(diffY) > 20 && Math.abs(diffY) > Math.abs(diffX)) { + var percent = ((diffY / ViewPagerActivity.screenHeight) * 100).toInt() * 3 + percent = Math.min(100, Math.max(-100, percent)) + + if ((percent == 100 && event.y > mLastTouchY) || (percent == -100 && event.y < mLastTouchY)) { + mTouchDownY = event.y + mTouchDownBrightness = mTempBrightness + } + + brightnessPercentChanged(percent) + } + mLastTouchY = event.y + } + MotionEvent.ACTION_UP, MotionEvent.ACTION_CANCEL -> { + val diffX = Math.abs(event.x - mTouchDownX) + val diffY = Math.abs(event.y - mTouchDownY) + if (System.currentTimeMillis() - mTouchDownTime < CLICK_MAX_DURATION && diffX < 20 && diffY < 20) { + onSpecialEvent() + } + mTouchDownBrightness = mTempBrightness + } + } + //mView.video_holder + } + + private fun getCurrentVolume() = context.audioManager.getStreamVolume(AudioManager.STREAM_MUSIC) + + private fun getCurrentBrightness() = Settings.System.getInt(activity.contentResolver, Settings.System.SCREEN_BRIGHTNESS) + + private fun volumePercentChanged(percent: Int) { + val stream = AudioManager.STREAM_MUSIC + val maxVolume = context.audioManager.getStreamMaxVolume(stream) + val percentPerPoint = 100 / maxVolume + val addPoints = percent / percentPerPoint + val newVolume = Math.min(maxVolume, Math.max(0, mTouchDownVolume + addPoints)) + context.audioManager.setStreamVolume(stream, newVolume, 0) + + val absolutePercent = ((newVolume / maxVolume.toFloat()) * 100).toInt() + slideInfoView.apply { + text = "$mSlideInfoText$absolutePercent%" + alpha = 1f + } + + mSlideInfoFadeHandler.removeCallbacksAndMessages(null) + mSlideInfoFadeHandler.postDelayed({ + slideInfoView.animate().alpha(0f) + }, SLIDE_INFO_FADE_DELAY) + } + + private fun brightnessPercentChanged(percent: Int) { + val maxBrightness = 255f + var newBrightness = (mTouchDownBrightness + 2.55 * percent).toFloat() + newBrightness = Math.min(maxBrightness, Math.max(0f, newBrightness)) + mTempBrightness = newBrightness.toInt() + + val absolutePercent = ((newBrightness / maxBrightness) * 100).toInt() + slideInfoView.apply { + text = "$mSlideInfoText$absolutePercent%" + alpha = 1f + } + + val attributes = activity.window.attributes + attributes.screenBrightness = absolutePercent / 100f + activity.window.attributes = attributes + + mSlideInfoFadeHandler.removeCallbacksAndMessages(null) + mSlideInfoFadeHandler.postDelayed({ + slideInfoView.animate().alpha(0f) + }, SLIDE_INFO_FADE_DELAY) + } +} \ No newline at end of file From abd027e27bf89947052581a952a80c14bbeeac74 Mon Sep 17 00:00:00 2001 From: Nikola Trubitsyn Date: Fri, 2 Feb 2018 16:32:27 +0300 Subject: [PATCH 03/63] 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 From 330d501889c9aa9bbfcb362501b009162b0e3b42 Mon Sep 17 00:00:00 2001 From: Nikola Trubitsyn Date: Fri, 2 Feb 2018 16:50:19 +0300 Subject: [PATCH 04/63] Remove Context from MediaSideScroll constructor --- .../gallery/fragments/PhotoFragment.kt | 2 +- .../gallery/fragments/VideoFragment.kt | 2 +- .../gallery/helpers/MediaSideScroll.kt | 13 ++++++------- 3 files changed, 8 insertions(+), 9 deletions(-) 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 d689fa449..0b077c905 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt @@ -114,7 +114,7 @@ class PhotoFragment : ViewPagerFragment() { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) - mediaSideScroll = MediaSideScroll(context!!, activity!!, view.slide_info, {}) + mediaSideScroll = MediaSideScroll(activity!!, view.slide_info, {}) } override fun onPause() { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt index 1c3516642..968ee24b2 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt @@ -87,7 +87,7 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) - mediaSideScroll = MediaSideScroll(context!!, activity!!, view.slide_info, { + mediaSideScroll = MediaSideScroll(activity!!, view.slide_info, { view.video_holder.performClick() }) } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaSideScroll.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaSideScroll.kt index 9536f7abb..3aaf33ff0 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaSideScroll.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaSideScroll.kt @@ -1,7 +1,6 @@ package com.simplemobiletools.gallery.helpers import android.app.Activity -import android.content.Context import android.media.AudioManager import android.os.Handler import android.provider.Settings @@ -11,7 +10,7 @@ import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.activities.ViewPagerActivity import com.simplemobiletools.gallery.extensions.audioManager -class MediaSideScroll(val context: Context, val activity: Activity, val slideInfoView: TextView, val onSpecialEvent: () -> Unit) { +class MediaSideScroll(val activity: Activity, val slideInfoView: TextView, val onSpecialEvent: () -> Unit) { private val CLICK_MAX_DURATION = 150 private val SLIDE_INFO_FADE_DELAY = 1000L private var mTouchDownX = 0f @@ -33,7 +32,7 @@ class MediaSideScroll(val context: Context, val activity: Activity, val slideInf mLastTouchY = event.y mTouchDownTime = System.currentTimeMillis() mTouchDownVolume = getCurrentVolume() - mSlideInfoText = "${context.getString(R.string.volume)}:\n" + mSlideInfoText = "${activity.getString(R.string.volume)}:\n" } MotionEvent.ACTION_MOVE -> { val diffX = mTouchDownX - event.x @@ -69,7 +68,7 @@ class MediaSideScroll(val context: Context, val activity: Activity, val slideInf mTouchDownY = event.y mLastTouchY = event.y mTouchDownTime = System.currentTimeMillis() - mSlideInfoText = "${context.getString(R.string.brightness)}:\n" + mSlideInfoText = "${activity.getString(R.string.brightness)}:\n" if (mTouchDownBrightness == -1) mTouchDownBrightness = getCurrentBrightness() } @@ -102,17 +101,17 @@ class MediaSideScroll(val context: Context, val activity: Activity, val slideInf //mView.video_holder } - private fun getCurrentVolume() = context.audioManager.getStreamVolume(AudioManager.STREAM_MUSIC) + private fun getCurrentVolume() = activity.audioManager.getStreamVolume(AudioManager.STREAM_MUSIC) private fun getCurrentBrightness() = Settings.System.getInt(activity.contentResolver, Settings.System.SCREEN_BRIGHTNESS) private fun volumePercentChanged(percent: Int) { val stream = AudioManager.STREAM_MUSIC - val maxVolume = context.audioManager.getStreamMaxVolume(stream) + val maxVolume = activity.audioManager.getStreamMaxVolume(stream) val percentPerPoint = 100 / maxVolume val addPoints = percent / percentPerPoint val newVolume = Math.min(maxVolume, Math.max(0, mTouchDownVolume + addPoints)) - context.audioManager.setStreamVolume(stream, newVolume, 0) + activity.audioManager.setStreamVolume(stream, newVolume, 0) val absolutePercent = ((newVolume / maxVolume.toFloat()) * 100).toInt() slideInfoView.apply { From e91bc71ee0149e636d745af48490a600998d1a71 Mon Sep 17 00:00:00 2001 From: Nikola Trubitsyn Date: Fri, 2 Feb 2018 16:52:23 +0300 Subject: [PATCH 05/63] Add an empty line to the end of MediaSideScroll.kt --- .../com/simplemobiletools/gallery/helpers/MediaSideScroll.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaSideScroll.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaSideScroll.kt index 3aaf33ff0..f18cc03e8 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaSideScroll.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaSideScroll.kt @@ -146,4 +146,4 @@ class MediaSideScroll(val activity: Activity, val slideInfoView: TextView, val o slideInfoView.animate().alpha(0f) }, SLIDE_INFO_FADE_DELAY) } -} \ No newline at end of file +} From b735636ecf6e2b9ceaeb0e09146e96693219f0fe Mon Sep 17 00:00:00 2001 From: Nikola Trubitsyn Date: Fri, 2 Feb 2018 16:52:58 +0300 Subject: [PATCH 06/63] Remove unused comment --- .../com/simplemobiletools/gallery/helpers/MediaSideScroll.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaSideScroll.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaSideScroll.kt index f18cc03e8..35117fc27 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaSideScroll.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaSideScroll.kt @@ -98,7 +98,6 @@ class MediaSideScroll(val activity: Activity, val slideInfoView: TextView, val o mTouchDownBrightness = mTempBrightness } } - //mView.video_holder } private fun getCurrentVolume() = activity.audioManager.getStreamVolume(AudioManager.STREAM_MUSIC) From 5ab2bc2fe73f8a642e953e057fb37462b5405ab5 Mon Sep 17 00:00:00 2001 From: Nikola Trubitsyn Date: Fri, 2 Feb 2018 16:55:12 +0300 Subject: [PATCH 07/63] Join two dimens together --- app/src/main/res/layout/pager_photo_item.xml | 2 +- app/src/main/res/layout/pager_video_item.xml | 4 ++-- app/src/main/res/values/dimens.xml | 3 +-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/app/src/main/res/layout/pager_photo_item.xml b/app/src/main/res/layout/pager_photo_item.xml index 38c9c4c2e..9a82b9b16 100644 --- a/app/src/main/res/layout/pager_photo_item.xml +++ b/app/src/main/res/layout/pager_photo_item.xml @@ -33,7 +33,7 @@ diff --git a/app/src/main/res/layout/pager_video_item.xml b/app/src/main/res/layout/pager_video_item.xml index c8ddbf676..30a61c50c 100644 --- a/app/src/main/res/layout/pager_video_item.xml +++ b/app/src/main/res/layout/pager_video_item.xml @@ -15,14 +15,14 @@ 150dp 24dp 50dp - 150dp - 150dp + 150dp 60dp 72dp From 467058583bc37b835a00246ba0953eeebccd3b3e Mon Sep 17 00:00:00 2001 From: Nikola Trubitsyn Date: Fri, 2 Feb 2018 17:07:49 +0300 Subject: [PATCH 08/63] Rename callback and allow it to be set externally --- .../simplemobiletools/gallery/fragments/PhotoFragment.kt | 2 +- .../simplemobiletools/gallery/fragments/VideoFragment.kt | 5 +++-- .../simplemobiletools/gallery/helpers/MediaSideScroll.kt | 8 +++++--- 3 files changed, 9 insertions(+), 6 deletions(-) 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 0b077c905..bac0962cb 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt @@ -114,7 +114,7 @@ class PhotoFragment : ViewPagerFragment() { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) - mediaSideScroll = MediaSideScroll(activity!!, view.slide_info, {}) + mediaSideScroll = MediaSideScroll(activity!!, view.slide_info) } override fun onPause() { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt index 968ee24b2..0cab540ba 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt @@ -87,9 +87,10 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) - mediaSideScroll = MediaSideScroll(activity!!, view.slide_info, { + mediaSideScroll = MediaSideScroll(activity!!, view.slide_info) + mediaSideScroll.onClickOnSlider = { view.video_holder.performClick() - }) + } } override fun onResume() { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaSideScroll.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaSideScroll.kt index 35117fc27..f94ae7411 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaSideScroll.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaSideScroll.kt @@ -10,7 +10,7 @@ import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.activities.ViewPagerActivity import com.simplemobiletools.gallery.extensions.audioManager -class MediaSideScroll(val activity: Activity, val slideInfoView: TextView, val onSpecialEvent: () -> Unit) { +class MediaSideScroll(val activity: Activity, val slideInfoView: TextView) { private val CLICK_MAX_DURATION = 150 private val SLIDE_INFO_FADE_DELAY = 1000L private var mTouchDownX = 0f @@ -24,6 +24,8 @@ class MediaSideScroll(val activity: Activity, val slideInfoView: TextView, val o private var mSlideInfoText = "" private var mSlideInfoFadeHandler = Handler() + var onClickOnSlider: (() -> Unit)? = null + fun handleVolumeTouched(event: MotionEvent) { when (event.action) { MotionEvent.ACTION_DOWN -> { @@ -55,7 +57,7 @@ class MediaSideScroll(val activity: Activity, val slideInfoView: TextView, val o val diffX = Math.abs(event.x - mTouchDownX) val diffY = Math.abs(event.y - mTouchDownY) if (System.currentTimeMillis() - mTouchDownTime < CLICK_MAX_DURATION && diffX < 20 && diffY < 20) { - onSpecialEvent() + onClickOnSlider?.invoke() } } } @@ -93,7 +95,7 @@ class MediaSideScroll(val activity: Activity, val slideInfoView: TextView, val o val diffX = Math.abs(event.x - mTouchDownX) val diffY = Math.abs(event.y - mTouchDownY) if (System.currentTimeMillis() - mTouchDownTime < CLICK_MAX_DURATION && diffX < 20 && diffY < 20) { - onSpecialEvent() + onClickOnSlider?.invoke() } mTouchDownBrightness = mTempBrightness } From 16945a153f9a5ff4ce34b5e08f5bb9a3a84df7ea Mon Sep 17 00:00:00 2001 From: anthologist Date: Fri, 2 Feb 2018 21:36:10 +0100 Subject: [PATCH 09/63] Updated italian --- app/src/main/res/values-it/strings.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index a040ee80d..ab436012a 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -132,14 +132,14 @@ Mostra informazioni estese su media a schermo intero Gestisci le informazioni estese Abilita zoom con un dito su media a schermo intero - Allow instantly changing media by clicking on screen sides - Replace deep zoomable images with better quality ones - Hide extended details when status bar is hidden + Cambia media istantaneamente toccando sui lati dello schermo + Sostituisci le immagini ingrandibili a fondo con altre di migliore qualità + Nascondi i dettagli estesi quando la barra di stato è nascosta - Thumbnails - Fullscreen media - Extended details + Miniature + Media a schermo intero + Dettagli estesi From e76e7a7d8e1f18c461fd64f53831bf4ee2e3bb22 Mon Sep 17 00:00:00 2001 From: gregory678 Date: Fri, 2 Feb 2018 23:58:10 +0100 Subject: [PATCH 10/63] Translation update [2018.02.02] --- app/src/main/res/values-pl/strings.xml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index 5b5505b85..e868c3eda 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -7,7 +7,7 @@ (ukryty) Przypnij folder Wypakuj folder - Pin to the top +    Przypnij na górze Pokaż wszystko Wszystkie foldery Przełącz na widok folderów @@ -131,15 +131,15 @@ Zamień funkcję udostępniania na obracanie w menu pełnoekranowym Dodatkowe szczegóły przy podglądzie pełnoekranowym Zarządzaj dodatkowymi szczegółami - Allow one finger zoom at fullscreen media - Allow instantly changing media by clicking on screen sides - Replace deep zoomable images with better quality ones - Hide extended details when status bar is hidden +    Zezwalaj na powiększanie jednym palcem w widoku pełnoekranowym +    Zezwalaj na natychmiastową zmianę multimediów po kliknięciu boków ekranu +    Zamieniaj powiększalne obrazy na te o lepszej jakości +    Ukrywaj dodatkowe szczegóły gdy pasek stanu jest ukryty - Thumbnails - Fullscreen media - Extended details +    Miniatury +    Widok pełnoekranowy +    Dodatkowe szczegóły From d884da9b824901cb111abcb118f64923edd70d01 Mon Sep 17 00:00:00 2001 From: Nikola Trubitsyn Date: Sun, 4 Feb 2018 03:33:51 +0300 Subject: [PATCH 11/63] Allow to toggle photo gestures via settings toggle --- .../gallery/activities/SettingsActivity.kt | 9 +++++++++ .../gallery/fragments/PhotoFragment.kt | 10 ++++++++-- .../gallery/helpers/Config.kt | 4 ++++ .../gallery/helpers/Constants.kt | 1 + app/src/main/res/layout/activity_settings.xml | 20 +++++++++++++++++++ app/src/main/res/values-ar/strings.xml | 1 + app/src/main/res/values-ca/strings.xml | 1 + app/src/main/res/values-cs/strings.xml | 1 + app/src/main/res/values-de/strings.xml | 1 + app/src/main/res/values-es/strings.xml | 1 + app/src/main/res/values-fi/strings.xml | 1 + app/src/main/res/values-fr/strings.xml | 1 + app/src/main/res/values-gl/strings.xml | 1 + app/src/main/res/values-hr/strings.xml | 1 + app/src/main/res/values-hu/strings.xml | 1 + app/src/main/res/values-it/strings.xml | 1 + app/src/main/res/values-ja/strings.xml | 1 + app/src/main/res/values-ko-rKR/strings.xml | 1 + app/src/main/res/values-nb/strings.xml | 1 + app/src/main/res/values-nl/strings.xml | 1 + app/src/main/res/values-pl/strings.xml | 1 + app/src/main/res/values-pt-rBR/strings.xml | 1 + app/src/main/res/values-pt/strings.xml | 1 + app/src/main/res/values-ru/strings.xml | 1 + app/src/main/res/values-sk/strings.xml | 1 + app/src/main/res/values-sv/strings.xml | 1 + app/src/main/res/values-tr/strings.xml | 1 + app/src/main/res/values-zh-rCN/strings.xml | 1 + app/src/main/res/values-zh-rTW/strings.xml | 1 + app/src/main/res/values/strings.xml | 1 + 30 files changed, 67 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt index 0e75cdddd..6e6537f5f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt @@ -50,6 +50,7 @@ class SettingsActivity : SimpleActivity() { setupPasswordProtection() setupAppPasswordProtection() setupDeleteEmptyFolders() + setupAllowPhotoGestures() setupAllowVideoGestures() setupShowMediaCount() setupKeepLastModified() @@ -250,6 +251,14 @@ class SettingsActivity : SimpleActivity() { } } + private fun setupAllowPhotoGestures() { + settings_allow_photo_gestures.isChecked = config.allowPhotoGestures + settings_allow_photo_gestures_holder.setOnClickListener { + settings_allow_photo_gestures.toggle() + config.allowPhotoGestures = settings_allow_photo_gestures.isChecked + } + } + private fun setupAllowVideoGestures() { settings_allow_video_gestures.isChecked = config.allowVideoGestures settings_allow_video_gestures_holder.setOnClickListener { 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 bac0962cb..bed5b928a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt @@ -128,9 +128,15 @@ class PhotoFragment : ViewPagerFragment() { checkExtendedDetails() } + val allowPhotoGestures = context!!.config.allowPhotoGestures val allowInstantChange = context!!.config.allowInstantChange - view.instant_prev_item.beVisibleIf(allowInstantChange) - view.instant_next_item.beVisibleIf(allowInstantChange) + + view.apply { + photo_brightness_controller.beVisibleIf(allowPhotoGestures) + instant_prev_item.beVisibleIf(allowInstantChange) + instant_next_item.beVisibleIf(allowInstantChange) + } + storeStateVariables() } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt index 9f10cbaa1..39c26d6d4 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt @@ -253,6 +253,10 @@ class Config(context: Context) : BaseConfig(context) { get() = prefs.getBoolean(DELETE_EMPTY_FOLDERS, false) set(deleteEmptyFolders) = prefs.edit().putBoolean(DELETE_EMPTY_FOLDERS, deleteEmptyFolders).apply() + var allowPhotoGestures: Boolean + get() = prefs.getBoolean(ALLOW_PHOTO_GESTURES, true) + set(allowPhotoGestures) = prefs.edit().putBoolean(ALLOW_PHOTO_GESTURES, allowPhotoGestures).apply() + var allowVideoGestures: Boolean get() = prefs.getBoolean(ALLOW_VIDEO_GESTURES, true) set(allowVideoGestures) = prefs.edit().putBoolean(ALLOW_VIDEO_GESTURES, allowVideoGestures).apply() diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt index 33a95e350..70cd2c7b1 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt @@ -35,6 +35,7 @@ const val SCROLL_HORIZONTALLY = "scroll_horizontally" const val HIDE_SYSTEM_UI = "hide_system_ui" const val REPLACE_SHARE_WITH_ROTATE = "replace_share_with_rotate" const val DELETE_EMPTY_FOLDERS = "delete_empty_folders" +const val ALLOW_PHOTO_GESTURES = "allow_photo_gestures" const val ALLOW_VIDEO_GESTURES = "allow_video_gestures" const val SHOW_MEDIA_COUNT = "show_media_count" const val TEMP_FOLDER_PATH = "temp_folder_path" diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index 6558a9fb1..95c9e84a9 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -203,6 +203,26 @@ + + + + + + قم بتمرير الصور المصغرة أفقيا إخفاء واجهة النظام تلقائيا عند العرض في وضع ملء الشاشة احذف المجلدات الفارغة بعد حذف محتواها + Allow controlling photo brightness with vertical gestures السماح بالتحكم في صوت الفيديو والسطوع بالإيماءات العمودية إظهار عدد لوسائط المجلد على طريقة العرض الرئيسية استبدال خيار المشاركة مع خيار تدوير في القائمة ملء الشاشة diff --git a/app/src/main/res/values-ca/strings.xml b/app/src/main/res/values-ca/strings.xml index fae7b6b0a..ee0086c84 100644 --- a/app/src/main/res/values-ca/strings.xml +++ b/app/src/main/res/values-ca/strings.xml @@ -126,6 +126,7 @@ Desplaçar miniatures horizontalment Ocultar automàticament la interficie de usuari del sistema a pantalla complerta Eliminar carpetes buides després d\'esborrar el seu contingut + Allow controlling photo brightness with vertical gestures Permet controlar el volum i la brillantor del vídeo amb gestos verticals Mostrar el número de mitjans de les carpetes a la vista principal Reemplaçar Compartir per Girar al menú de pantalla complerta diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index 859adbd5f..68b5670e5 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -126,6 +126,7 @@ Scroll thumbnails horizontally Automatically hide system UI at fullscreen media Delete empty folders after deleting their content + Allow controlling photo brightness with vertical gestures Allow controlling video volume and brightness with vertical gestures Show folder media count on the main view Replace Share with Rotate at fullscreen menu diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 39b4d3634..48215ed88 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -126,6 +126,7 @@ Kacheln horizontal scrollen Systemleiste im Vollbild ausblenden Nach Löschen leere Ordner löschen + Allow controlling photo brightness with vertical gestures Gesten für Videolautstärke/Helligkeit zulassen Medienanzahl bei Ordnern anzeigen Teilen/Drehen im Vollbild-Menü vertauschen diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 031a2c97d..e1f5c0ba7 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -126,6 +126,7 @@ Desplazar miniaturas horizontalmente Ocultar automáticamente la interfaz de usuario del sistema en medios de pantalla completa Eliminar carpetas vacias despues de borrar su contenido + Allow controlling photo brightness with vertical gestures Permite controlar el volumen y el brillo del video con gestos verticales Mostrar el conteo de medios de las carpetas en la vista principal Reemplazar Compartir con Girar en el menú de pantalla completa diff --git a/app/src/main/res/values-fi/strings.xml b/app/src/main/res/values-fi/strings.xml index 45386c324..130af2791 100644 --- a/app/src/main/res/values-fi/strings.xml +++ b/app/src/main/res/values-fi/strings.xml @@ -126,6 +126,7 @@ Vieritä pienoiskuvia vaakasuorassa Piilota järjestelmän UI automaattisesti koko näytön mediassa Poista tyhjät kansiot kansion tyhjennyksen jälkeen + Allow controlling photo brightness with vertical gestures Salli videon äänenvoimakkuuden ja kirkkauden säätö pystysuorilla eleillä Show folder media count on the main view Korvaa jakaminen kääntämisellä koko näytön tilassa diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 51702b67f..3934f7ed8 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -126,6 +126,7 @@ Défilement des miniatures horizontalement Masquer automatiquement l\'interface utilisateur si média plein écran Supprimer les dossiers vides après avoir supprimé leur contenu + Allow controlling photo brightness with vertical gestures Permettre le contrôle du volume vidéo et de la luminosité avec des gestes verticaux Afficher le nombre de fichiers dans les dossiers sur l\'écran principal Remplacer Partager par Pivoter si menu en plein écran diff --git a/app/src/main/res/values-gl/strings.xml b/app/src/main/res/values-gl/strings.xml index 31b8eb039..fe5afac60 100644 --- a/app/src/main/res/values-gl/strings.xml +++ b/app/src/main/res/values-gl/strings.xml @@ -126,6 +126,7 @@ Desplazar iconas horizontalmente Agochar controis do sistema cando visualice a pantalla completa Borrar cartafoles baldeiros cando elmine o seu contido + Allow controlling photo brightness with vertical gestures Permitir controlar o volume do vídeo e o brillo con xestos verticáis Mostrar a conta de medios do cartafol na vista principal Substituír Compartir con Rotar no menú de pantalla completa diff --git a/app/src/main/res/values-hr/strings.xml b/app/src/main/res/values-hr/strings.xml index 9de39af66..8c5e71f42 100644 --- a/app/src/main/res/values-hr/strings.xml +++ b/app/src/main/res/values-hr/strings.xml @@ -126,6 +126,7 @@ Listaj sličice horizontalno Automatski sakrij UI sustava pri pregledu datoteka Izbriži prazne direktorije nakon brisanja njihovog sadržaja + Allow controlling photo brightness with vertical gestures Omogući kontrolu glasnoće videa i svjetline pomoću vertikalnih gesti Prikaži broj datoteka u direktoriju na glavnom zaslonu Zamjeni Dijeli s Rotiraj pri pregledu datoteka diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index d2ff7481a..51eddf77e 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -126,6 +126,7 @@ Scroll thumbnails horizontally Automatically hide system UI at fullscreen media Delete empty folders after deleting their content + Allow controlling photo brightness with vertical gestures Allow controlling video volume and brightness with vertical gestures Show folder media count on the main view Replace Share with Rotate at fullscreen menu diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index a040ee80d..49e950261 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -126,6 +126,7 @@ Scorri le miniature orizzontalmente Nascondi UI di sistema con media a schermo intero Elimina cartelle vuote dopo averne eliminato il contenuto + Allow controlling photo brightness with vertical gestures Gestisci il volume e la luminosità dei video con gesti verticali Mostra numero elementi nella cartella Sostituisci Condividi con Ruota a schermo intero diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index c2d4de191..697f54752 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -126,6 +126,7 @@ サムネイル画面を横方向にスクロール フルスクリーン時にシステムUIを非表示にする メディアの削除後にフォルダーが空になった場合、そのフォルダーを削除する + Allow controlling photo brightness with vertical gestures ビデオ再生中に、音量と明るさを縦方向のジェスチャーで変更する Show folder media count on the main view フルスクリーンメニューの「共有」を「回転」に置き換える diff --git a/app/src/main/res/values-ko-rKR/strings.xml b/app/src/main/res/values-ko-rKR/strings.xml index 03a188346..d674a574e 100644 --- a/app/src/main/res/values-ko-rKR/strings.xml +++ b/app/src/main/res/values-ko-rKR/strings.xml @@ -126,6 +126,7 @@ 섬네일 수평스크롤 전체화면 모드에서 시스템 UI 숨김 콘텐츠 삭제 후 빈폴더 삭제 + Allow controlling photo brightness with vertical gestures 수직 제스처로 비디오 볼륨 및 밝기 제어 폴더에 포함된 미디어파일 수 표시 전체화면 메뉴의 공유 아이콘을 회전 아이콘으로 변경 diff --git a/app/src/main/res/values-nb/strings.xml b/app/src/main/res/values-nb/strings.xml index 342bb2f27..c44e95e83 100644 --- a/app/src/main/res/values-nb/strings.xml +++ b/app/src/main/res/values-nb/strings.xml @@ -126,6 +126,7 @@ Horisontal rulling av minibilder Skjul automatisk systemlinjer ved mediavisning Slett tomme mapper etter sletting av deres innhold + Allow controlling photo brightness with vertical gestures Tillat å styre videovolum og lysstyrke med vertikale bevegelser Vis mediaantallet i mapper på hovedvisningen Erstatt Del med Roter i meny ved mediavisning diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index be82781f7..a8a41ead3 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -126,6 +126,7 @@ Horizontaal scrollen Statusbalk automatisch verbergen in volledig scherm Lege mappen verwijderen na leegmaken + Allow controlling photo brightness with vertical gestures Volume en helderheid aanpassen met verticale gebaren Aantallen in mappen tonen Menu-item Draaien vastzetten in volledig scherm (in plaats van Delen) diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index 5b5505b85..f0a5dd403 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -126,6 +126,7 @@ Przewijaj miniatury poziomo Ukrywaj interfejs przy pełnoekranowym podglądzie Usuwaj puste foldery po usunięciu ich zawartości + Allow controlling photo brightness with vertical gestures Zezwalaj na kontrolę jasności i głośności filmów pionowymi gestami Pokazuj liczbę elementów w folderach w głównym widoku Zamień funkcję udostępniania na obracanie w menu pełnoekranowym diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index bb2cdec30..142ab825f 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -126,6 +126,7 @@ Rolar miniaturas horizontalmente Esconder interface do sistema automaticamente quando em tela cheia Apagar pastas vazias após deleter seu conteúdo + Allow controlling photo brightness with vertical gestures Permitir controle do volume e brilho com gestos na vertical Mostrar quantidade de arquivos das pastas Substituir botão "Compartilhar" por "Rotação de tela" quando em tela cheia diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index 8afac4e8d..4d8fe5e46 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -126,6 +126,7 @@ Deslocação horizontal de miniaturas Ocultar interface do sistema se em ecrã completo Apagar as pastas vazias depois de remover o seu conteúdo + Allow controlling photo brightness with vertical gestures Permitir controlo do volume e brilho dos vídeos através de gestos verticais Mostrar número de ficheiros na vista principal Substituir a opção Partilhar pela opção Rodar se em ecrã completo diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 69b3df690..9d1a86a1f 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -126,6 +126,7 @@ Прокрутка эскизов по горизонтали Автоматически скрывать системный интерфейс в полноэкранном режиме Удалять пустые папки после удаления их содержимого + Управлять яркостью фото с помощью вертикальных жестов Управлять громкостью и яркостью видео с помощью вертикальных жестов Показывать количество файлов в папках Заменить \"Поделиться\" на \"Повернуть\" в меню полноэкранного режима diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index aeb067881..102e6c1b3 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -126,6 +126,7 @@ Prehliadať miniatúry vodorovne Automaticky skrývať systémové lišty pri celoobrazovkových médiách Odstrániť prázdne priečinky po vymazaní ich obsahu + Allow controlling photo brightness with vertical gestures Povoliť ovládanie hlasitosti a jasu videí vertikálnymi ťahmi Zobraziť počet médií v priečinku na hlavnej obrazovke Nahradiť Zdieľanie s Otočením v celoobrazovkovom menu diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index a4c380455..cff13c4cd 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -126,6 +126,7 @@ Rulla horisontellt genom miniatyrer Dölj systemanvändargränssnittet automatiskt när media visas i helskärmsläge Ta bort tomma mappar när deras innehåll tas bort + Allow controlling photo brightness with vertical gestures Tillåt styrning av videovolym och videoljusstyrka med vertikala gester Visa antalet mediefiler i varje mapp i huvudvyn Ersätt Dela med Rotera i helskärmsmenyn diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index fdb8ddf11..4b3df55a3 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -126,6 +126,7 @@ Scroll thumbnails horizontally Automatically hide system UI at fullscreen media Delete empty folders after deleting their content + Allow controlling photo brightness with vertical gestures Allow controlling video volume and brightness with vertical gestures Show folder media count on the main view Replace Share with Rotate at fullscreen menu diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 9989b6f9d..b56f181ef 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -126,6 +126,7 @@ 水平滚动缩略图 全屏时自动隐藏状态栏 删除没有内容的空文件夹 + Allow controlling photo brightness with vertical gestures 使用纵向滑动手势控制视频音量和亮度 在主界面显示文件夹媒体计数 替换全屏时菜单栏的“分享”为“旋转” diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index a00a943a1..89272de76 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -126,6 +126,7 @@ 橫向滑動縮圖 全螢幕時自動隱藏系統介面 刪除內容後刪除空白資料夾 + Allow controlling photo brightness with vertical gestures 允許用上下手勢來控制影片的音量和亮度 主畫面顯示資料夾內媒體檔案數量 將全螢幕選單的分享取代為旋轉 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 5cea74dfe..9259c090e 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -126,6 +126,7 @@ Scroll thumbnails horizontally Automatically hide system UI at fullscreen media Delete empty folders after deleting their content + Allow controlling photo brightness with vertical gestures Allow controlling video volume and brightness with vertical gestures Show folder media count on the main view Replace Share with Rotate at fullscreen menu From 8524970d6d3d0504c963cf24e319ff946b7e67c4 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 4 Feb 2018 11:49:54 +0100 Subject: [PATCH 12/63] add a toggle for preventing showing Whats New --- app/build.gradle | 2 +- .../gallery/activities/SettingsActivity.kt | 9 ++++++++ app/src/main/res/layout/activity_settings.xml | 21 +++++++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index c875caf29..d7dc29c52 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -46,7 +46,7 @@ ext { } dependencies { - implementation 'com.simplemobiletools:commons:3.9.4' + implementation 'com.simplemobiletools:commons:3.9.10' implementation 'com.theartofdev.edmodo:android-image-cropper:2.6.0' implementation 'com.android.support:multidex:1.0.2' implementation 'com.google.code.gson:gson:2.8.2' diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt index 0e75cdddd..e3226ab72 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt @@ -33,6 +33,7 @@ class SettingsActivity : SimpleActivity() { setupCustomizeColors() setupUseEnglish() + setupAvoidWhatsNew() setupManageIncludedFolders() setupManageExcludedFolders() setupManageHiddenFolders() @@ -88,6 +89,14 @@ class SettingsActivity : SimpleActivity() { } } + private fun setupAvoidWhatsNew() { + settings_avoid_whats_new.isChecked = config.avoidWhatsNew + settings_avoid_whats_new_holder.setOnClickListener { + settings_avoid_whats_new.toggle() + config.avoidWhatsNew = settings_avoid_whats_new.isChecked + } + } + private fun setupManageIncludedFolders() { settings_manage_included_folders_holder.setOnClickListener { startActivity(Intent(this, IncludedFoldersActivity::class.java)) diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index 6558a9fb1..cb9a44aa3 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -50,6 +50,27 @@ + + + + + + + Date: Sun, 4 Feb 2018 11:58:46 +0100 Subject: [PATCH 13/63] move the Photo gestures toggle from Videos to Fullscreen media section --- app/src/main/res/layout/activity_settings.xml | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index 95c9e84a9..444ca3d75 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -203,26 +203,6 @@ - - - - - - + + + + + + Date: Sun, 4 Feb 2018 12:13:49 +0100 Subject: [PATCH 14/63] delete file from mediastore on ViewPagerActivity in the background --- .../gallery/activities/ViewPagerActivity.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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 f9a813d6d..64b5e02e6 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -181,8 +181,10 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View } val file = File(mPath) - if (!file.exists()) { - deleteFromMediaStore(file) + if (!file.exists() && file.length() == 0L) { + Thread { + deleteFromMediaStore(file) + }.start() finish() return } From 605cf6ae0fd8ef8e3de5195004a308da9472dd6c Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 4 Feb 2018 12:57:40 +0100 Subject: [PATCH 15/63] wteak the MediaSideScroll callback a bit --- .../gallery/fragments/PhotoFragment.kt | 10 +++++++++- .../gallery/fragments/VideoFragment.kt | 3 +-- .../gallery/helpers/MediaSideScroll.kt | 8 +++----- 3 files changed, 13 insertions(+), 8 deletions(-) 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 bed5b928a..0831224cb 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt @@ -114,7 +114,15 @@ class PhotoFragment : ViewPagerFragment() { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) - mediaSideScroll = MediaSideScroll(activity!!, view.slide_info) + mediaSideScroll = MediaSideScroll(activity!!, view.slide_info) { + view.apply { + if (subsampling_view.isVisible()) { + subsampling_view.performClick() + } else { + gif_view.performClick() + } + } + } } override fun onPause() { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt index 0cab540ba..a636bc715 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt @@ -87,8 +87,7 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) - mediaSideScroll = MediaSideScroll(activity!!, view.slide_info) - mediaSideScroll.onClickOnSlider = { + mediaSideScroll = MediaSideScroll(activity!!, view.slide_info) { view.video_holder.performClick() } } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaSideScroll.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaSideScroll.kt index f94ae7411..652001ec1 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaSideScroll.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaSideScroll.kt @@ -10,7 +10,7 @@ import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.activities.ViewPagerActivity import com.simplemobiletools.gallery.extensions.audioManager -class MediaSideScroll(val activity: Activity, val slideInfoView: TextView) { +class MediaSideScroll(val activity: Activity, val slideInfoView: TextView, val callback: () -> Unit) { private val CLICK_MAX_DURATION = 150 private val SLIDE_INFO_FADE_DELAY = 1000L private var mTouchDownX = 0f @@ -24,8 +24,6 @@ class MediaSideScroll(val activity: Activity, val slideInfoView: TextView) { private var mSlideInfoText = "" private var mSlideInfoFadeHandler = Handler() - var onClickOnSlider: (() -> Unit)? = null - fun handleVolumeTouched(event: MotionEvent) { when (event.action) { MotionEvent.ACTION_DOWN -> { @@ -57,7 +55,7 @@ class MediaSideScroll(val activity: Activity, val slideInfoView: TextView) { val diffX = Math.abs(event.x - mTouchDownX) val diffY = Math.abs(event.y - mTouchDownY) if (System.currentTimeMillis() - mTouchDownTime < CLICK_MAX_DURATION && diffX < 20 && diffY < 20) { - onClickOnSlider?.invoke() + callback() } } } @@ -95,7 +93,7 @@ class MediaSideScroll(val activity: Activity, val slideInfoView: TextView) { val diffX = Math.abs(event.x - mTouchDownX) val diffY = Math.abs(event.y - mTouchDownY) if (System.currentTimeMillis() - mTouchDownTime < CLICK_MAX_DURATION && diffX < 20 && diffY < 20) { - onClickOnSlider?.invoke() + callback() } mTouchDownBrightness = mTempBrightness } From 38fe73d9b4d987e6e9a23b2f05582ef762d16dad Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 4 Feb 2018 12:59:13 +0100 Subject: [PATCH 16/63] updating some translations deleted by mistake --- app/src/main/res/values-de/strings.xml | 2 +- app/src/main/res/values-zh-rCN/strings.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 48215ed88..82bd32fa5 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -126,7 +126,7 @@ Kacheln horizontal scrollen Systemleiste im Vollbild ausblenden Nach Löschen leere Ordner löschen - Allow controlling photo brightness with vertical gestures + Fotohelligkeit mit vertikalen Gesten ändern Gesten für Videolautstärke/Helligkeit zulassen Medienanzahl bei Ordnern anzeigen Teilen/Drehen im Vollbild-Menü vertauschen diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index b56f181ef..e18df60de 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -126,7 +126,7 @@ 水平滚动缩略图 全屏时自动隐藏状态栏 删除没有内容的空文件夹 - Allow controlling photo brightness with vertical gestures + 使用纵向滑动手势控制照片亮度 使用纵向滑动手势控制视频音量和亮度 在主界面显示文件夹媒体计数 替换全屏时菜单栏的“分享”为“旋转” From 0a752cea037d1f7dbf0307fea6e8fecf4d65b665 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 4 Feb 2018 18:00:09 +0100 Subject: [PATCH 17/63] use our own Linear and Grid layout managers --- app/build.gradle | 2 +- app/src/main/res/layout/activity_main.xml | 2 +- app/src/main/res/layout/activity_manage_folders.xml | 2 +- app/src/main/res/layout/activity_media.xml | 2 +- app/src/main/res/layout/dialog_directory_picker.xml | 2 +- app/src/main/res/layout/dialog_medium_picker.xml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index d7dc29c52..11f6884b0 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -46,7 +46,7 @@ ext { } dependencies { - implementation 'com.simplemobiletools:commons:3.9.10' + implementation 'com.simplemobiletools:commons:3.9.11' implementation 'com.theartofdev.edmodo:android-image-cropper:2.6.0' implementation 'com.android.support:multidex:1.0.2' implementation 'com.google.code.gson:gson:2.8.2' diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 033563bb1..e3aad745a 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -38,7 +38,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:scrollbars="none" - app:layoutManager="android.support.v7.widget.GridLayoutManager" + app:layoutManager="com.simplemobiletools.commons.views.MyGridLayoutManager" app:spanCount="@integer/directory_columns_vertical_scroll"/> + app:layoutManager="com.simplemobiletools.commons.views.MyLinearLayoutManager"/> Date: Sun, 4 Feb 2018 18:02:06 +0100 Subject: [PATCH 18/63] catch and show exceptions thrown at fetching path of MediaActivity --- .../gallery/activities/MediaActivity.kt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt index 29b64841d..97becbd1c 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -81,7 +81,14 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { } media_refresh_layout.setOnRefreshListener { getMedia() } - mPath = intent.getStringExtra(DIRECTORY) + try { + mPath = intent.getStringExtra(DIRECTORY) + } catch (e: Exception) { + showErrorToast(e) + finish() + return + } + storeStateVariables() if (mShowAll) supportActionBar?.setDisplayHomeAsUpEnabled(false) From b02e02b6b0de9343d3b3c230fdc8926541188109 Mon Sep 17 00:00:00 2001 From: FTno <16176811+FTno@users.noreply.github.com> Date: Sun, 4 Feb 2018 19:21:59 +0100 Subject: [PATCH 19/63] Update strings.xml Norwegian translation update --- app/src/main/res/values-nb/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/values-nb/strings.xml b/app/src/main/res/values-nb/strings.xml index c44e95e83..7de6994ab 100644 --- a/app/src/main/res/values-nb/strings.xml +++ b/app/src/main/res/values-nb/strings.xml @@ -126,7 +126,7 @@ Horisontal rulling av minibilder Skjul automatisk systemlinjer ved mediavisning Slett tomme mapper etter sletting av deres innhold - Allow controlling photo brightness with vertical gestures + Tillat å styre fotolysstyrke med vertikale bevegelser Tillat å styre videovolum og lysstyrke med vertikale bevegelser Vis mediaantallet i mapper på hovedvisningen Erstatt Del med Roter i meny ved mediavisning From b2f54f0e6e0118b8ac325ed1af382c0e79df39a6 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 4 Feb 2018 19:58:44 +0100 Subject: [PATCH 20/63] add an optional extra check to avoid showing invalid files --- .../gallery/activities/SettingsActivity.kt | 9 ++++++++ .../gallery/helpers/Config.kt | 4 ++++ .../gallery/helpers/Constants.kt | 1 + .../gallery/helpers/MediaFetcher.kt | 3 ++- app/src/main/res/layout/activity_settings.xml | 22 ++++++++++++++++++- app/src/main/res/values-ar/strings.xml | 1 + app/src/main/res/values-ca/strings.xml | 3 ++- app/src/main/res/values-cs/strings.xml | 1 + app/src/main/res/values-de/strings.xml | 1 + app/src/main/res/values-es/strings.xml | 1 + app/src/main/res/values-fi/strings.xml | 1 + app/src/main/res/values-fr/strings.xml | 1 + app/src/main/res/values-gl/strings.xml | 1 + app/src/main/res/values-hr/strings.xml | 1 + app/src/main/res/values-hu/strings.xml | 1 + app/src/main/res/values-it/strings.xml | 1 + app/src/main/res/values-ja/strings.xml | 1 + app/src/main/res/values-ko-rKR/strings.xml | 1 + app/src/main/res/values-nb/strings.xml | 1 + app/src/main/res/values-nl/strings.xml | 1 + app/src/main/res/values-pl/strings.xml | 1 + app/src/main/res/values-pt-rBR/strings.xml | 1 + app/src/main/res/values-pt/strings.xml | 1 + app/src/main/res/values-ru/strings.xml | 1 + app/src/main/res/values-sk/strings.xml | 1 + app/src/main/res/values-sv/strings.xml | 1 + app/src/main/res/values-tr/strings.xml | 1 + app/src/main/res/values-zh-rCN/strings.xml | 1 + app/src/main/res/values-zh-rTW/strings.xml | 1 + app/src/main/res/values/strings.xml | 1 + 30 files changed, 63 insertions(+), 3 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt index ce0ad5fe4..4d16a3980 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt @@ -38,6 +38,7 @@ class SettingsActivity : SimpleActivity() { setupManageExcludedFolders() setupManageHiddenFolders() setupShowHiddenItems() + setupDoExtraCheck() setupAutoplayVideos() setupLoopVideos() setupAnimateGifs() @@ -136,6 +137,14 @@ class SettingsActivity : SimpleActivity() { config.showHiddenMedia = settings_show_hidden_items.isChecked } + private fun setupDoExtraCheck() { + settings_do_extra_check.isChecked = config.doExtraCheck + settings_do_extra_check_holder.setOnClickListener { + settings_do_extra_check.toggle() + config.doExtraCheck = settings_do_extra_check.isChecked + } + } + private fun setupAutoplayVideos() { settings_autoplay_videos.isChecked = config.autoplayVideos settings_autoplay_videos_holder.setOnClickListener { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt index 39c26d6d4..683c9ea8d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt @@ -320,4 +320,8 @@ class Config(context: Context) : BaseConfig(context) { var extendedDetails: Int get() = prefs.getInt(EXTENDED_DETAILS, EXT_RESOLUTION or EXT_LAST_MODIFIED or EXT_EXIF_PROPERTIES) set(extendedDetails) = prefs.edit().putInt(EXTENDED_DETAILS, extendedDetails).apply() + + var doExtraCheck: Boolean + get() = prefs.getBoolean(DO_EXTRA_CHECK, false) + set(doExtraCheck) = prefs.edit().putBoolean(DO_EXTRA_CHECK, doExtraCheck).apply() } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt index 70cd2c7b1..156bbf6b2 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt @@ -47,6 +47,7 @@ const val HIDE_EXTENDED_DETAILS = "hide_extended_details" const val ONE_FINGER_ZOOM = "one_finger_zoom" const val ALLOW_INSTANT_CHANGE = "allow_instant_change" const val REPLACE_ZOOMABLE_IMAGES = "replace_zoomable_images" +const val DO_EXTRA_CHECK = "do_extra_check" // slideshow const val SLIDESHOW_INTERVAL = "slideshow_interval" diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt index f941b8f03..a329f3ced 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt @@ -99,6 +99,7 @@ class MediaFetcher(val context: Context) { val filterMedia = config.filterMedia val showHidden = config.shouldShowHidden val isThirdPartyIntent = config.isThirdPartyIntent + val doExtraCheck = config.doExtraCheck cur.use { if (cur.moveToFirst()) { @@ -137,7 +138,7 @@ class MediaFetcher(val context: Context) { size = file.length() } - if (size <= 0L) + if (size <= 0L || (doExtraCheck && !file.exists())) continue val dateTaken = cur.getLongValue(MediaStore.Images.Media.DATE_TAKEN) diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index 1640769a8..cda8cc378 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -166,6 +166,26 @@ + + + + + + - + Allow instantly changing media by clicking on screen sides Replace deep zoomable images with better quality ones Hide extended details when status bar is hidden + Do an extra check to avoid showing invalid files Thumbnails diff --git a/app/src/main/res/values-ca/strings.xml b/app/src/main/res/values-ca/strings.xml index ee0086c84..f8bca8034 100644 --- a/app/src/main/res/values-ca/strings.xml +++ b/app/src/main/res/values-ca/strings.xml @@ -135,7 +135,8 @@ Permet fer zoom amb un sol dit a pantalla complerta Permet canviar els mitjans de manera instantània fent clic als costats de la pantalla Substituïr imatges ampliades per les de millor quialitat - Amaga els detalls estesos quan la barra d'estat està amagada + Amaga els detalls estesos quan la barra d\'estat està amagada + Do an extra check to avoid showing invalid files Miniatures diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index 68b5670e5..16b76fe49 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -136,6 +136,7 @@ Allow instantly changing media by clicking on screen sides Replace deep zoomable images with better quality ones Hide extended details when status bar is hidden + Do an extra check to avoid showing invalid files Thumbnails diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 82bd32fa5..0adbc4116 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -136,6 +136,7 @@ Beim Tippen auf eine Bildschirmseite sofort zwischen Medien wechseln Stark zoombare Bilder durch Bilder mit hoher Qualität ersetzen Erweiterte Details nicht anzeigen, wenn die Systemleiste versteckt ist + Do an extra check to avoid showing invalid files Thumbnails diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index e1f5c0ba7..cd4a1bcc2 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -136,6 +136,7 @@ Permitir el cambio instantáneo de medios haciendo clic en los lados de la pantalla Reemplace las imágenes con mucho zoom por otras de mejor calidad Ocultar detalles ampliados cuando la barra de estado está oculta + Do an extra check to avoid showing invalid files Miniaturas diff --git a/app/src/main/res/values-fi/strings.xml b/app/src/main/res/values-fi/strings.xml index 130af2791..5db309a6c 100644 --- a/app/src/main/res/values-fi/strings.xml +++ b/app/src/main/res/values-fi/strings.xml @@ -136,6 +136,7 @@ Allow instantly changing media by clicking on screen sides Replace deep zoomable images with better quality ones Hide extended details when status bar is hidden + Do an extra check to avoid showing invalid files Thumbnails diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 3934f7ed8..b24e55cf8 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -136,6 +136,7 @@ Allow instantly changing media by clicking on screen sides Replace deep zoomable images with better quality ones Hide extended details when status bar is hidden + Do an extra check to avoid showing invalid files Thumbnails diff --git a/app/src/main/res/values-gl/strings.xml b/app/src/main/res/values-gl/strings.xml index fe5afac60..ae64e382a 100644 --- a/app/src/main/res/values-gl/strings.xml +++ b/app/src/main/res/values-gl/strings.xml @@ -136,6 +136,7 @@ Allow instantly changing media by clicking on screen sides Replace deep zoomable images with better quality ones Hide extended details when status bar is hidden + Do an extra check to avoid showing invalid files Thumbnails diff --git a/app/src/main/res/values-hr/strings.xml b/app/src/main/res/values-hr/strings.xml index 8c5e71f42..36fb734fb 100644 --- a/app/src/main/res/values-hr/strings.xml +++ b/app/src/main/res/values-hr/strings.xml @@ -136,6 +136,7 @@ Allow instantly changing media by clicking on screen sides Replace deep zoomable images with better quality ones Hide extended details when status bar is hidden + Do an extra check to avoid showing invalid files Thumbnails diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index 51eddf77e..f6ee30b59 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -136,6 +136,7 @@ Allow instantly changing media by clicking on screen sides Replace deep zoomable images with better quality ones Hide extended details when status bar is hidden + Do an extra check to avoid showing invalid files Thumbnails diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index d94202120..c294d5ca2 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -136,6 +136,7 @@ Cambia media istantaneamente toccando sui lati dello schermo Sostituisci le immagini ingrandibili a fondo con altre di migliore qualità Nascondi i dettagli estesi quando la barra di stato è nascosta + Do an extra check to avoid showing invalid files Miniature diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 697f54752..540a8f242 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -136,6 +136,7 @@ Allow instantly changing media by clicking on screen sides Replace deep zoomable images with better quality ones Hide extended details when status bar is hidden + Do an extra check to avoid showing invalid files Thumbnails diff --git a/app/src/main/res/values-ko-rKR/strings.xml b/app/src/main/res/values-ko-rKR/strings.xml index d674a574e..813ff8565 100644 --- a/app/src/main/res/values-ko-rKR/strings.xml +++ b/app/src/main/res/values-ko-rKR/strings.xml @@ -136,6 +136,7 @@ Allow instantly changing media by clicking on screen sides Replace deep zoomable images with better quality ones Hide extended details when status bar is hidden + Do an extra check to avoid showing invalid files Thumbnails diff --git a/app/src/main/res/values-nb/strings.xml b/app/src/main/res/values-nb/strings.xml index 7de6994ab..be3397d38 100644 --- a/app/src/main/res/values-nb/strings.xml +++ b/app/src/main/res/values-nb/strings.xml @@ -136,6 +136,7 @@ Tillat å skifte media øyeblikkelig ved å trykke på kanten av skjermen Erstatt dyp-zoombare bilder med bilder av bedre kvalitet Skjul utvidede detaljer når statuslinjen er skjult + Do an extra check to avoid showing invalid files Minibilder diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index a8a41ead3..b966fa1f6 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -136,6 +136,7 @@ Direct naar vorige/volgende door op de zijkanten van het scherm te tikken In hoge kwaliteit weergeven (ten koste van ver inzoomen) Uitgebreide informatie niet tonen als de statusbalk is verborgen + Do an extra check to avoid showing invalid files Miniatuurvoorbeelden diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index a415e38c7..1ba92b71f 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -136,6 +136,7 @@    Zezwalaj na natychmiastową zmianę multimediów po kliknięciu boków ekranu    Zamieniaj powiększalne obrazy na te o lepszej jakości    Ukrywaj dodatkowe szczegóły gdy pasek stanu jest ukryty + Do an extra check to avoid showing invalid files    Miniatury diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 142ab825f..9c14638a8 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -136,6 +136,7 @@ Permitir alternância instantânia de mídia clicando nas laterais da tela Substituir imagens aptas a grande quantitade de zoom por imagens de melhor qualidade Ocultar detalhes extendidos quando a barra de status estiver oculta + Do an extra check to avoid showing invalid files Miniaturas diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index 4d8fe5e46..0cd30703d 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -136,6 +136,7 @@ Allow instantly changing media by clicking on screen sides Replace deep zoomable images with better quality ones Hide extended details when status bar is hidden + Do an extra check to avoid showing invalid files Thumbnails diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 9d1a86a1f..524853538 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -136,6 +136,7 @@ Мгновенное переключение медиафайлов нажатием по краю экрана Заменить масштабируемые изображения высококачественными Не показывать подробности, если скрыта строка состояния + Do an extra check to avoid showing invalid files Миниатюры diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index 102e6c1b3..21dd19109 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -136,6 +136,7 @@ Povoliť instantné prepínanie médií kliknutím na okraj obrazovky Nahradiť hlboko priblížiteľné obrázky s obrázkami s lepšou kvalitou Skryť rozšírené vlastnosti ak je skrytá stavová lišta + Predísť zobrazovaniu neplatných súborov dodatočnou kontrolou Náhľady diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index cff13c4cd..b65c23c2d 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -136,6 +136,7 @@ Allow instantly changing media by clicking on screen sides Replace deep zoomable images with better quality ones Hide extended details when status bar is hidden + Do an extra check to avoid showing invalid files Thumbnails diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index 4b3df55a3..834639abb 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -136,6 +136,7 @@ Allow instantly changing media by clicking on screen sides Replace deep zoomable images with better quality ones Hide extended details when status bar is hidden + Do an extra check to avoid showing invalid files Thumbnails diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index e18df60de..a547bf642 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -136,6 +136,7 @@ 通过单击屏幕边缘来切换媒体 用质量更好的图像替换可深度缩放的图像 当状态栏隐藏时隐藏扩展详情 + Do an extra check to avoid showing invalid files 缩略图 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 89272de76..bbb972443 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -136,6 +136,7 @@ 允許點擊螢幕邊緣來快速切換媒體檔案 可深度縮放的圖片用品質更佳的來取代 狀態欄隱藏時,同時隱藏詳細資訊 + Do an extra check to avoid showing invalid files 縮圖 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 9259c090e..abf2cb0ca 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -136,6 +136,7 @@ Allow instantly changing media by clicking on screen sides Replace deep zoomable images with better quality ones Hide extended details when status bar is hidden + Do an extra check to avoid showing invalid files Thumbnails From 98e01be2a7cb29d540a8d10afec43df9d3501cab Mon Sep 17 00:00:00 2001 From: Nikola Trubitsyn Date: Sun, 4 Feb 2018 22:37:33 +0300 Subject: [PATCH 21/63] Update strings.xml --- app/src/main/res/values-ru/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 524853538..468e48cca 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -136,7 +136,7 @@ Мгновенное переключение медиафайлов нажатием по краю экрана Заменить масштабируемые изображения высококачественными Не показывать подробности, если скрыта строка состояния - Do an extra check to avoid showing invalid files + Делать дополнительную проверку, чтобы избежать показа неверных файлов Миниатюры From 4597e888a5d68d43691923e6f21846d5358044ad Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 4 Feb 2018 21:01:43 +0100 Subject: [PATCH 22/63] try fixing TransactionTooLargeException on Android Nougat --- .../gallery/adapters/MyPagerAdapter.kt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MyPagerAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MyPagerAdapter.kt index 0317a1b36..c6f7776ab 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MyPagerAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MyPagerAdapter.kt @@ -1,6 +1,7 @@ package com.simplemobiletools.gallery.adapters import android.os.Bundle +import android.os.Parcelable import android.support.v4.app.Fragment import android.support.v4.app.FragmentManager import android.support.v4.app.FragmentStatePagerAdapter @@ -47,11 +48,18 @@ class MyPagerAdapter(val activity: ViewPagerActivity, fm: FragmentManager, val m super.destroyItem(container, position, any) } - fun getCurrentFragment(position: Int) = fragments.get(position) + fun getCurrentFragment(position: Int) = fragments[position] fun toggleFullscreen(isFullscreen: Boolean) { for ((pos, fragment) in fragments) { fragment.fullscreenToggled(isFullscreen) } } + + // try fixing TransactionTooLargeException crash on Android Nougat, tip from https://stackoverflow.com/a/43193425/1967672 + override fun saveState(): Parcelable? { + val bundle = super.saveState() as Bundle? + bundle!!.putParcelableArray("states", null) + return bundle + } } From b89c8e23212718928186a19480d0ce624e6c189f Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 4 Feb 2018 21:26:34 +0100 Subject: [PATCH 23/63] update subsampling to 3.9.0.1 --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 11f6884b0..887cf5555 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -55,7 +55,7 @@ dependencies { implementation 'com.github.chrisbanes:PhotoView:2.1.3' //implementation 'com.davemorrissey.labs:subsampling-scale-image-view:3.9.0' - implementation 'com.github.tibbi:subsampling-scale-image-view:v3.9.0-fork' + implementation 'com.github.tibbi:subsampling-scale-image-view:v3.9.0.1-fork' debugImplementation "com.squareup.leakcanary:leakcanary-android:$leakCanaryVersion" releaseImplementation "com.squareup.leakcanary:leakcanary-android-no-op:$leakCanaryVersion" From 53d79ecea8ce8541faae9b3e1f792ce141cda318 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 4 Feb 2018 23:56:11 +0100 Subject: [PATCH 24/63] search for new media files in the folders, from which we already have files --- .../asynctasks/GetDirectoriesAsynctask.kt | 3 +- .../gallery/helpers/MediaFetcher.kt | 33 +++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt index d1767ce4a..61f6cafc4 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt @@ -22,8 +22,9 @@ class GetDirectoriesAsynctask(val context: Context, val isPickVideo: Boolean, va val mediaFetcher = MediaFetcher(context) override fun doInBackground(vararg params: Void): ArrayList { - if (!context.hasPermission(PERMISSION_WRITE_STORAGE)) + if (!context.hasPermission(PERMISSION_WRITE_STORAGE)) { return ArrayList() + } val config = context.config val groupedMedia = mediaFetcher.getMediaByDirectories(isPickVideo, isPickImage) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt index a329f3ced..6df8fc016 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt @@ -40,9 +40,42 @@ class MediaFetcher(val context: Context) { directories.remove(it) } + searchNewFiles(directories, showHidden) return directories } + // search for undiscovered media files in the folders, from which we already have some media files + private fun searchNewFiles(directories: Map>, showHidden: Boolean) { + Thread { + // try not to delay the main media file loading + Thread.sleep(3000) + for ((path, dirMedia) in directories) { + if (path.contains("/.thumbnails/", true)) { + continue + } + + // get the file parent this way, "path" is lowercased + val folder = File(dirMedia.first().path).parentFile + val files = folder.listFiles() ?: continue + val fileCnt = files.filter { it.isFile }.size + val newPaths = ArrayList() + + if (dirMedia.size != fileCnt) { + val dirPaths = dirMedia.map { it.path } + files.forEach { + val filePath = it.absolutePath + if ((showHidden || !it.name.startsWith(".")) && !dirPaths.contains(filePath)) { + if (it.exists() && it.length() > 0 && it.isImageVideoGif()) { + newPaths.add(it.absolutePath) + } + } + } + } + context.scanPaths(newPaths) + } + }.start() + } + fun getFilesFrom(curPath: String, isPickImage: Boolean, isPickVideo: Boolean): ArrayList { val projection = arrayOf(MediaStore.Images.Media._ID, MediaStore.Images.Media.DISPLAY_NAME, From 7c54b75ab2fa7504d58e7086942d3220c72fe732 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 5 Feb 2018 00:13:43 +0100 Subject: [PATCH 25/63] update commons to 3.9.12 --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 887cf5555..8489c2e55 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -46,7 +46,7 @@ ext { } dependencies { - implementation 'com.simplemobiletools:commons:3.9.11' + implementation 'com.simplemobiletools:commons:3.9.12' implementation 'com.theartofdev.edmodo:android-image-cropper:2.6.0' implementation 'com.android.support:multidex:1.0.2' implementation 'com.google.code.gson:gson:2.8.2' From 4f227958451d8f99572919ffee2e87d1783553ea Mon Sep 17 00:00:00 2001 From: Phoenix1747 Date: Mon, 5 Feb 2018 08:57:54 +0100 Subject: [PATCH 26/63] Update strings.xml --- app/src/main/res/values-de/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 0adbc4116..b02e45e42 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -136,7 +136,7 @@ Beim Tippen auf eine Bildschirmseite sofort zwischen Medien wechseln Stark zoombare Bilder durch Bilder mit hoher Qualität ersetzen Erweiterte Details nicht anzeigen, wenn die Systemleiste versteckt ist - Do an extra check to avoid showing invalid files + Zusätzliche Überprüfung, um ungültige Dateien nicht anzuzeigen Thumbnails From 8d7853e4f06d510b3d43849736fd03c6b70313ac Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 5 Feb 2018 09:59:18 +0100 Subject: [PATCH 27/63] catch exceptions thrown at trying to show the image on a map --- .../gallery/activities/ViewPagerActivity.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 64b5e02e6..0d1033a2f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -644,7 +644,13 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View } private fun showOnMap() { - val exif = ExifInterface(getCurrentPath()) + val exif: ExifInterface + try { + exif = ExifInterface(getCurrentPath()) + } catch (e: Exception) { + showErrorToast(e) + return + } val lat = exif.getAttribute(ExifInterface.TAG_GPS_LATITUDE) val lat_ref = exif.getAttribute(ExifInterface.TAG_GPS_LATITUDE_REF) val lon = exif.getAttribute(ExifInterface.TAG_GPS_LONGITUDE) From f82550ae34c1d2490964e18d71b66feb72edb63d Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 5 Feb 2018 10:23:38 +0100 Subject: [PATCH 28/63] call searchQueryChanged only when search is open --- .../gallery/activities/MediaActivity.kt | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt index 97becbd1c..ca0e06ed0 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -9,6 +9,7 @@ import android.graphics.Bitmap import android.net.Uri import android.os.Bundle import android.os.Handler +import android.support.v4.view.MenuItemCompat import android.support.v7.widget.GridLayoutManager import android.support.v7.widget.SearchView import android.view.Menu @@ -52,6 +53,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { private var mAllowPickingMultiple = false private var mShowAll = false private var mLoadedInitialPhotos = false + private var mIsSearchOpen = false private var mLatestMediaId = 0L private var mLastMediaHandler = Handler() private var mTempShowHiddenHandler = Handler() @@ -240,11 +242,25 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { override fun onQueryTextSubmit(query: String) = false override fun onQueryTextChange(newText: String): Boolean { - searchQueryChanged(newText) + if (mIsSearchOpen) { + searchQueryChanged(newText) + } return true } }) } + + MenuItemCompat.setOnActionExpandListener(mSearchMenuItem, object : MenuItemCompat.OnActionExpandListener { + override fun onMenuItemActionExpand(item: MenuItem?): Boolean { + mIsSearchOpen = true + return true + } + + override fun onMenuItemActionCollapse(item: MenuItem?): Boolean { + mIsSearchOpen = false + return true + } + }) } private fun searchQueryChanged(text: String) { From 4941eb642a63aff48e242e611758e6419dfd8613 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 5 Feb 2018 11:04:21 +0100 Subject: [PATCH 29/63] increase the height of gradient background of thumbnail text --- app/build.gradle | 2 +- app/src/main/res/values/dimens.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 8489c2e55..859900970 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -46,7 +46,7 @@ ext { } dependencies { - implementation 'com.simplemobiletools:commons:3.9.12' + implementation 'com.simplemobiletools:commons:3.9.13' implementation 'com.theartofdev.edmodo:android-image-cropper:2.6.0' implementation 'com.android.support:multidex:1.0.2' implementation 'com.google.code.gson:gson:2.8.2' diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index 2521f820c..6c1f0feda 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -7,7 +7,7 @@ 26dp 150dp 24dp - 50dp + 60dp 150dp 60dp 72dp From c98658d0695916178ab752e7ae6778a82b1119c9 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 5 Feb 2018 11:15:09 +0100 Subject: [PATCH 30/63] store the info about directory location in the model itself --- .../simplemobiletools/gallery/adapters/DirectoryAdapter.kt | 2 +- .../gallery/asynctasks/GetDirectoriesAsynctask.kt | 7 ++----- .../com/simplemobiletools/gallery/extensions/Activity.kt | 2 +- .../com/simplemobiletools/gallery/models/Directory.kt | 2 +- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt index a334e344d..f6efe8972 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt @@ -349,7 +349,7 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: MutableList 0) Math.max(firstItem.modified, lastItem.modified) else Math.min(firstItem.modified, lastItem.modified) val dateTaken = if (config.directorySorting and SORT_DESCENDING > 0) Math.max(firstItem.taken, lastItem.taken) else Math.min(firstItem.taken, lastItem.taken) val size = curMedia.sumByLong { it.size } - val directory = Directory(parentDir, thumbnail, dirName, curMedia.size, lastModified, dateTaken, size) + val directory = Directory(parentDir, thumbnail, dirName, curMedia.size, lastModified, dateTaken, size, context.isPathOnSD(parentDir)) directories.add(directory) } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/Activity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/Activity.kt index 46a10186f..3103a84a9 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/Activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/Activity.kt @@ -185,7 +185,7 @@ fun BaseSimpleActivity.addTempFolderIfNeeded(dirs: ArrayList): ArrayL val directories = ArrayList() val tempFolderPath = config.tempFolderPath if (tempFolderPath.isNotEmpty()) { - val newFolder = Directory(tempFolderPath, "", tempFolderPath.getFilenameFromPath(), 0, 0, 0, 0L) + val newFolder = Directory(tempFolderPath, "", tempFolderPath.getFilenameFromPath(), 0, 0, 0, 0L, isPathOnSD(tempFolderPath)) directories.add(newFolder) } directories.addAll(dirs) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/models/Directory.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/models/Directory.kt index 271f065ed..a3a54fb5a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/models/Directory.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/models/Directory.kt @@ -6,7 +6,7 @@ import com.simplemobiletools.commons.helpers.* import java.io.Serializable data class Directory(val path: String, val tmb: String, val name: String, var mediaCnt: Int, val modified: Long, val taken: Long, - val size: Long) : Serializable, Comparable { + val size: Long, val isOnSDCard: Boolean) : Serializable, Comparable { companion object { private val serialVersionUID = -6553345863555455L var sorting: Int = 0 From d3106b50f9fd3bebc61abbf6513ae807abe9e7c4 Mon Sep 17 00:00:00 2001 From: fricyo <30796677+fricyo@users.noreply.github.com> Date: Mon, 5 Feb 2018 18:16:24 +0800 Subject: [PATCH 31/63] Translation update --- app/src/main/res/values-zh-rTW/strings.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index bbb972443..db09cd9f1 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -126,7 +126,7 @@ 橫向滑動縮圖 全螢幕時自動隱藏系統介面 刪除內容後刪除空白資料夾 - Allow controlling photo brightness with vertical gestures + 允許用上下手勢來控制相片的亮度 允許用上下手勢來控制影片的音量和亮度 主畫面顯示資料夾內媒體檔案數量 將全螢幕選單的分享取代為旋轉 @@ -136,7 +136,7 @@ 允許點擊螢幕邊緣來快速切換媒體檔案 可深度縮放的圖片用品質更佳的來取代 狀態欄隱藏時,同時隱藏詳細資訊 - Do an extra check to avoid showing invalid files + 進行額外檢查,避免顯示無效的檔案 縮圖 @@ -151,7 +151,7 @@ 這相簿也支援第三方應用,像是預覽圖片/影片、添加電子信箱附件...等功能,日常使用上相當適合。 - The fingerprint permission is needed for locking either hidden item visibility, or the whole app. + 指紋權限用來鎖定隱藏的項目或是整個程式。 優點包含沒廣告,也沒非必要的權限,而且完全開放原始碼,並提供自訂顏色。 From 51e91db662adbd86454af4a3ba11400a7a08c79d Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 5 Feb 2018 12:00:51 +0100 Subject: [PATCH 32/63] update commons to 3.10.0 --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 859900970..31604c15d 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -46,7 +46,7 @@ ext { } dependencies { - implementation 'com.simplemobiletools:commons:3.9.13' + implementation 'com.simplemobiletools:commons:3.10.0' implementation 'com.theartofdev.edmodo:android-image-cropper:2.6.0' implementation 'com.android.support:multidex:1.0.2' implementation 'com.google.code.gson:gson:2.8.2' From b373cb08187234b28379ed919d8ba79e8ae7ee2e Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 5 Feb 2018 12:28:20 +0100 Subject: [PATCH 33/63] update version to 3.4.0 --- app/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 31604c15d..08179fd86 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,8 +10,8 @@ android { applicationId "com.simplemobiletools.gallery" minSdkVersion 16 targetSdkVersion 27 - versionCode 159 - versionName "3.3.1" + versionCode 160 + versionName "3.4.0" multiDexEnabled true setProperty("archivesBaseName", "gallery") } From 0550015144990266e719e5cf3e26f337bfd9b47c Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 5 Feb 2018 12:28:26 +0100 Subject: [PATCH 34/63] updating changelog --- CHANGELOG.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6024cdef7..cd18565eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,18 @@ Changelog ========== +Version 3.4.0 *(2018-02-05)* +---------------------------- + + * Allow changing the brightness by vertical gestures on images (by trubitsyn) + * Properly fetch all media files from recognized folders + * Make thumbnail info on the main screen a bit easier to read + * Fix seeing blank thumbnail after deleting files in some cases + * Reset zoom level on orientation change at fullscreen media + * Add an optional extra check to avoid showing invalid files + * Add a toggle to prevent showing What's new on startup + * Many other stability and performance improvements + Version 3.3.1 *(2018-01-29)* ---------------------------- From 3acb97fad21471f11bddb12838204342a518845b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Solatec=20Inform=C3=A0tica?= <35220662+Solatec@users.noreply.github.com> Date: Mon, 5 Feb 2018 15:58:10 +0100 Subject: [PATCH 35/63] Update strings.xml --- app/src/main/res/values-ca/strings.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/res/values-ca/strings.xml b/app/src/main/res/values-ca/strings.xml index f8bca8034..37c20d263 100644 --- a/app/src/main/res/values-ca/strings.xml +++ b/app/src/main/res/values-ca/strings.xml @@ -126,7 +126,7 @@ Desplaçar miniatures horizontalment Ocultar automàticament la interficie de usuari del sistema a pantalla complerta Eliminar carpetes buides després d\'esborrar el seu contingut - Allow controlling photo brightness with vertical gestures + Permet controlar la brillantor amb gestos verticals Permet controlar el volum i la brillantor del vídeo amb gestos verticals Mostrar el número de mitjans de les carpetes a la vista principal Reemplaçar Compartir per Girar al menú de pantalla complerta @@ -136,7 +136,7 @@ Permet canviar els mitjans de manera instantània fent clic als costats de la pantalla Substituïr imatges ampliades per les de millor quialitat Amaga els detalls estesos quan la barra d\'estat està amagada - Do an extra check to avoid showing invalid files + Fer una verificació addicional per evitar que es mostrin fitxers no vàlids Miniatures From 59f51aa8203c8fadd3dfcb3ac781de3e5a73c5a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Solatec=20Inform=C3=A0tica?= <35220662+Solatec@users.noreply.github.com> Date: Mon, 5 Feb 2018 15:58:27 +0100 Subject: [PATCH 36/63] Update strings.xml --- app/src/main/res/values-es/strings.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index cd4a1bcc2..a6889d070 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -126,7 +126,7 @@ Desplazar miniaturas horizontalmente Ocultar automáticamente la interfaz de usuario del sistema en medios de pantalla completa Eliminar carpetas vacias despues de borrar su contenido - Allow controlling photo brightness with vertical gestures + Permite controlar el brillo con gestos verticales Permite controlar el volumen y el brillo del video con gestos verticales Mostrar el conteo de medios de las carpetas en la vista principal Reemplazar Compartir con Girar en el menú de pantalla completa @@ -136,7 +136,7 @@ Permitir el cambio instantáneo de medios haciendo clic en los lados de la pantalla Reemplace las imágenes con mucho zoom por otras de mejor calidad Ocultar detalles ampliados cuando la barra de estado está oculta - Do an extra check to avoid showing invalid files + Hacer una comprobación adicional para evitar mostrar archivos inválidos Miniaturas From 5f80172c92b7770b415edcf2779c4ac0828a9980 Mon Sep 17 00:00:00 2001 From: Rodrigo Date: Tue, 6 Feb 2018 13:50:45 -0200 Subject: [PATCH 37/63] Update strings.xml --- app/src/main/res/values-pt-rBR/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 9c14638a8..14d8ea1f3 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -136,7 +136,7 @@ Permitir alternância instantânia de mídia clicando nas laterais da tela Substituir imagens aptas a grande quantitade de zoom por imagens de melhor qualidade Ocultar detalhes extendidos quando a barra de status estiver oculta - Do an extra check to avoid showing invalid files + Realizar verificação extra para evitar mostrar arquivos inválidos Miniaturas From fb053fb487c22e65a88d3fe2c597b7d1b0b3ea40 Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 6 Feb 2018 16:59:52 +0100 Subject: [PATCH 38/63] disable image brightness gestures by default, it causes zooming issues --- .../main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt index 683c9ea8d..333937de6 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt @@ -254,7 +254,7 @@ class Config(context: Context) : BaseConfig(context) { set(deleteEmptyFolders) = prefs.edit().putBoolean(DELETE_EMPTY_FOLDERS, deleteEmptyFolders).apply() var allowPhotoGestures: Boolean - get() = prefs.getBoolean(ALLOW_PHOTO_GESTURES, true) + get() = prefs.getBoolean(ALLOW_PHOTO_GESTURES, false) set(allowPhotoGestures) = prefs.edit().putBoolean(ALLOW_PHOTO_GESTURES, allowPhotoGestures).apply() var allowVideoGestures: Boolean From acfe09b9ffe46412658fb1389235913288f68d14 Mon Sep 17 00:00:00 2001 From: Poussinou Date: Tue, 6 Feb 2018 18:12:57 +0100 Subject: [PATCH 39/63] Update strings.xml --- app/src/main/res/values-fr/strings.xml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index b24e55cf8..2163d8031 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -51,7 +51,7 @@ Dossiers inclus Gérer les dossiers inclus Ajouter un dossier - Si vous avez des dossiers contenant des médias et qui ne sont pas reconnus par l\'application alors, vous pouvez les ajouter manuellement ici. + Si vous avez des dossiers contenant des médias et qu\'ils ne sont pas reconnus par l\'application, vous pouvez les ajouter manuellement ici. Redimensionner @@ -122,9 +122,9 @@ Paramètres système Rotation de l\'appareil Ratio d\'aspect - Fond et barre de statur noir en plein écran + Fond et barre de statut noir en plein écran Défilement des miniatures horizontalement - Masquer automatiquement l\'interface utilisateur si média plein écran + Masquer automatiquement l\'interface utilisateur si média en plein écran Supprimer les dossiers vides après avoir supprimé leur contenu Allow controlling photo brightness with vertical gestures Permettre le contrôle du volume vidéo et de la luminosité avec des gestes verticaux @@ -132,16 +132,16 @@ Remplacer Partager par Pivoter si menu en plein écran Afficher les détails supplémentaires par dessus le média en plein écran Gérer les détails supplémentaires - Allow one finger zoom at fullscreen media - Allow instantly changing media by clicking on screen sides - Replace deep zoomable images with better quality ones - Hide extended details when status bar is hidden - Do an extra check to avoid showing invalid files + Autoriser le zoom avec un doigt sur un média en plein écran + Autoriser le changement instantané de média en cliquant sur les côtés de l\'écran + Remplacer les images zoomables profondes par des images de meilleure qualité + Masquer les détails supplémentaires lorsque la barre d\'état est masquée + Faire une vérification supplémentaire pour éviter de montrer des fichiers invalides - Thumbnails - Fullscreen media - Extended details + Vignettes + Média plein écran + Détails supplémentaires @@ -149,11 +149,11 @@ Un simple outil pour visionner les photos et les vidéos. Elles peuvent être triées par dates, tailles, noms dans les deux sens (alphabétique comme désalphabétique), il est possible de zoomer sur les photos. Les fichiers sont affichés sur de multiple colonnes en fonction de la taille de l\'écran, vous pouvez changer le nombre de colonnes par pincement. Elles peuvent être renommées, partagées, supprimées, copiées et déplacées. Les images peuvent en plus être tournées, rognées ou être définies comme fond d\'écran directement depuis l\'application. - La galerie est également proposée pour une utilisation comme tierce partie pour la prévisualisation des images/vidéos, ajouter des pièces jointes aux clients email etc. C\'est parfait pour un usage au quotidien. + La galerie est également proposée pour une utilisation comme tierce partie pour la prévisualisation des images/vidéos, ajouter des pièces jointes aux clients email, etc... C\'est parfait pour un usage au quotidien. L\'autorisation d\'empreinte digitale est nécessaire pour verrouiller les dossiers cachés et/ou l\'application. - L\'application ne contient ni publicité ni autorisation inutile. Elle est totalement opensource et est aussi fournie avec des couleurs personnalisables. + L\'application ne contient ni publicité ni autorisation inutile. Elle est totalement opensource et est également fournie avec des couleurs personnalisables. Cette application fait partie d\'une plus grande suite. Vous pouvez trouver les autres applications sur http://www.simplemobiletools.com From 4809f54bae4bc9fb1fdc4394a72414c20b222f46 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 8 Feb 2018 18:01:30 +0100 Subject: [PATCH 40/63] lets just catch all exceptions thrown at storing folders json --- app/build.gradle | 2 +- .../com/simplemobiletools/gallery/activities/MediaActivity.kt | 1 + app/src/main/res/layout/activity_settings.xml | 1 - 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 08179fd86..532123bb8 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -46,7 +46,7 @@ ext { } dependencies { - implementation 'com.simplemobiletools:commons:3.10.0' + implementation 'com.simplemobiletools:commons:3.11.0' implementation 'com.theartofdev.edmodo:android-image-cropper:2.6.0' implementation 'com.android.support:multidex:1.0.2' implementation 'com.google.code.gson:gson:2.8.2' diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt index ca0e06ed0..8051f0ded 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -656,6 +656,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { val subList = mMedia.subList(0, Math.min(SAVE_MEDIA_CNT, mMedia.size)) val json = Gson().toJson(subList) config.saveFolderMedia(mPath, json) + } catch (ignored: Exception) { } catch (ignored: OutOfMemoryError) { } }.start() diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index cda8cc378..6d47e7ab8 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -50,7 +50,6 @@ - Date: Thu, 8 Feb 2018 18:07:52 +0100 Subject: [PATCH 41/63] catch exceptions thrown at getting device brightness --- .../gallery/helpers/MediaSideScroll.kt | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaSideScroll.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaSideScroll.kt index 652001ec1..8b89d7caf 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaSideScroll.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaSideScroll.kt @@ -69,8 +69,9 @@ class MediaSideScroll(val activity: Activity, val slideInfoView: TextView, val c mLastTouchY = event.y mTouchDownTime = System.currentTimeMillis() mSlideInfoText = "${activity.getString(R.string.brightness)}:\n" - if (mTouchDownBrightness == -1) + if (mTouchDownBrightness == -1) { mTouchDownBrightness = getCurrentBrightness() + } } MotionEvent.ACTION_MOVE -> { val diffX = mTouchDownX - event.x @@ -102,7 +103,13 @@ class MediaSideScroll(val activity: Activity, val slideInfoView: TextView, val c private fun getCurrentVolume() = activity.audioManager.getStreamVolume(AudioManager.STREAM_MUSIC) - private fun getCurrentBrightness() = Settings.System.getInt(activity.contentResolver, Settings.System.SCREEN_BRIGHTNESS) + private fun getCurrentBrightness(): Int { + return try { + Settings.System.getInt(activity.contentResolver, Settings.System.SCREEN_BRIGHTNESS) + } catch (e: Settings.SettingNotFoundException) { + 70 + } + } private fun volumePercentChanged(percent: Int) { val stream = AudioManager.STREAM_MUSIC From 1bcbe96b04e7e04e5e77c4cd2c1270f77feb815f Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 8 Feb 2018 18:10:40 +0100 Subject: [PATCH 42/63] replace GridLayoutManager with MyGridLayoutManager --- .../gallery/activities/MainActivity.kt | 11 ++++++----- .../gallery/activities/MediaActivity.kt | 11 ++++++----- .../gallery/dialogs/PickDirectoryDialog.kt | 2 +- .../gallery/dialogs/PickMediumDialog.kt | 2 +- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt index 6b722080a..3c59a8361 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -22,6 +22,7 @@ import com.simplemobiletools.commons.helpers.SORT_BY_DATE_MODIFIED import com.simplemobiletools.commons.helpers.SORT_BY_DATE_TAKEN import com.simplemobiletools.commons.models.RadioItem import com.simplemobiletools.commons.models.Release +import com.simplemobiletools.commons.views.MyGridLayoutManager import com.simplemobiletools.commons.views.MyRecyclerView import com.simplemobiletools.gallery.BuildConfig import com.simplemobiletools.gallery.R @@ -369,7 +370,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { } private fun setupGridLayoutManager() { - val layoutManager = directories_grid.layoutManager as GridLayoutManager + val layoutManager = directories_grid.layoutManager as MyGridLayoutManager if (config.scrollHorizontally) { layoutManager.orientation = GridLayoutManager.HORIZONTAL directories_refresh_layout.layoutParams = FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT) @@ -383,7 +384,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { private fun initZoomListener() { if (config.viewTypeFolders == VIEW_TYPE_GRID) { - val layoutManager = directories_grid.layoutManager as GridLayoutManager + val layoutManager = directories_grid.layoutManager as MyGridLayoutManager mZoomListener = object : MyRecyclerView.MyZoomListener { override fun zoomIn() { if (layoutManager.spanCount > 1) { @@ -405,7 +406,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { } private fun setupListLayoutManager() { - val layoutManager = directories_grid.layoutManager as GridLayoutManager + val layoutManager = directories_grid.layoutManager as MyGridLayoutManager layoutManager.spanCount = 1 layoutManager.orientation = GridLayoutManager.VERTICAL directories_refresh_layout.layoutParams = FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT) @@ -424,7 +425,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { private fun increaseColumnCount() { directories_vertical_fastscroller.measureRecyclerViewOnRedraw() directories_horizontal_fastscroller.measureRecyclerViewOnRedraw() - config.dirColumnCnt = ++(directories_grid.layoutManager as GridLayoutManager).spanCount + config.dirColumnCnt = ++(directories_grid.layoutManager as MyGridLayoutManager).spanCount invalidateOptionsMenu() directories_grid.adapter?.notifyDataSetChanged() } @@ -432,7 +433,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { private fun reduceColumnCount() { directories_vertical_fastscroller.measureRecyclerViewOnRedraw() directories_horizontal_fastscroller.measureRecyclerViewOnRedraw() - config.dirColumnCnt = --(directories_grid.layoutManager as GridLayoutManager).spanCount + config.dirColumnCnt = --(directories_grid.layoutManager as MyGridLayoutManager).spanCount invalidateOptionsMenu() directories_grid.adapter?.notifyDataSetChanged() } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt index 8051f0ded..82d8990ad 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -27,6 +27,7 @@ import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.helpers.PERMISSION_WRITE_STORAGE import com.simplemobiletools.commons.helpers.REQUEST_EDIT_IMAGE import com.simplemobiletools.commons.models.RadioItem +import com.simplemobiletools.commons.views.MyGridLayoutManager import com.simplemobiletools.commons.views.MyRecyclerView import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.adapters.MediaAdapter @@ -502,7 +503,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { } private fun setupGridLayoutManager() { - val layoutManager = media_grid.layoutManager as GridLayoutManager + val layoutManager = media_grid.layoutManager as MyGridLayoutManager if (config.scrollHorizontally) { layoutManager.orientation = GridLayoutManager.HORIZONTAL media_refresh_layout.layoutParams = FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT) @@ -516,7 +517,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { private fun initZoomListener() { if (config.viewTypeFiles == VIEW_TYPE_GRID) { - val layoutManager = media_grid.layoutManager as GridLayoutManager + val layoutManager = media_grid.layoutManager as MyGridLayoutManager mZoomListener = object : MyRecyclerView.MyZoomListener { override fun zoomIn() { if (layoutManager.spanCount > 1) { @@ -538,7 +539,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { } private fun setupListLayoutManager() { - val layoutManager = media_grid.layoutManager as GridLayoutManager + val layoutManager = media_grid.layoutManager as MyGridLayoutManager layoutManager.spanCount = 1 layoutManager.orientation = GridLayoutManager.VERTICAL media_refresh_layout.layoutParams = FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT) @@ -548,7 +549,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { private fun increaseColumnCount() { media_vertical_fastscroller.measureRecyclerViewOnRedraw() media_horizontal_fastscroller.measureRecyclerViewOnRedraw() - config.mediaColumnCnt = ++(media_grid.layoutManager as GridLayoutManager).spanCount + config.mediaColumnCnt = ++(media_grid.layoutManager as MyGridLayoutManager).spanCount invalidateOptionsMenu() media_grid.adapter?.notifyDataSetChanged() } @@ -556,7 +557,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { private fun reduceColumnCount() { media_vertical_fastscroller.measureRecyclerViewOnRedraw() media_horizontal_fastscroller.measureRecyclerViewOnRedraw() - config.mediaColumnCnt = --(media_grid.layoutManager as GridLayoutManager).spanCount + config.mediaColumnCnt = --(media_grid.layoutManager as MyGridLayoutManager).spanCount invalidateOptionsMenu() media_grid.adapter?.notifyDataSetChanged() } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickDirectoryDialog.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickDirectoryDialog.kt index cbaa30443..ab5c51e01 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickDirectoryDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickDirectoryDialog.kt @@ -26,7 +26,7 @@ class PickDirectoryDialog(val activity: BaseSimpleActivity, val sourcePath: Stri var isGridViewType = activity.config.viewTypeFolders == VIEW_TYPE_GRID init { - (view.directories_grid.layoutManager as GridLayoutManager).apply { + (view.directories_grid.layoutManager as MyGridLayoutManager).apply { orientation = if (activity.config.scrollHorizontally && isGridViewType) GridLayoutManager.HORIZONTAL else GridLayoutManager.VERTICAL spanCount = if (isGridViewType) activity.config.dirColumnCnt else 1 } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickMediumDialog.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickMediumDialog.kt index b94fd0aed..2fd295e6f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickMediumDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickMediumDialog.kt @@ -22,7 +22,7 @@ class PickMediumDialog(val activity: BaseSimpleActivity, val path: String, val c var isGridViewType = activity.config.viewTypeFiles == VIEW_TYPE_GRID init { - (view.media_grid.layoutManager as GridLayoutManager).apply { + (view.media_grid.layoutManager as MyGridLayoutManager).apply { orientation = if (activity.config.scrollHorizontally && isGridViewType) GridLayoutManager.HORIZONTAL else GridLayoutManager.VERTICAL spanCount = if (isGridViewType) activity.config.mediaColumnCnt else 1 } From 71243ec05e2141f229e1d12e9e96ec059a9afef9 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 8 Feb 2018 20:20:17 +0100 Subject: [PATCH 43/63] adding some missing imports --- .../com/simplemobiletools/gallery/dialogs/PickDirectoryDialog.kt | 1 + .../com/simplemobiletools/gallery/dialogs/PickMediumDialog.kt | 1 + 2 files changed, 2 insertions(+) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickDirectoryDialog.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickDirectoryDialog.kt index ab5c51e01..471237111 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickDirectoryDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickDirectoryDialog.kt @@ -8,6 +8,7 @@ import com.simplemobiletools.commons.extensions.beGoneIf import com.simplemobiletools.commons.extensions.beVisibleIf import com.simplemobiletools.commons.extensions.setupDialogStuff import com.simplemobiletools.commons.extensions.toast +import com.simplemobiletools.commons.views.MyGridLayoutManager import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.adapters.DirectoryAdapter import com.simplemobiletools.gallery.asynctasks.GetDirectoriesAsynctask diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickMediumDialog.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickMediumDialog.kt index 2fd295e6f..fd5abf97b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickMediumDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickMediumDialog.kt @@ -6,6 +6,7 @@ import com.simplemobiletools.commons.activities.BaseSimpleActivity import com.simplemobiletools.commons.extensions.beGoneIf import com.simplemobiletools.commons.extensions.beVisibleIf import com.simplemobiletools.commons.extensions.setupDialogStuff +import com.simplemobiletools.commons.views.MyGridLayoutManager import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.adapters.MediaAdapter import com.simplemobiletools.gallery.asynctasks.GetMediaAsynctask From 777472355dbe82920d89d9c584737a508b25a94d Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 8 Feb 2018 20:35:25 +0100 Subject: [PATCH 44/63] make fullscreen media side gesture bars smaller --- app/src/main/res/values-sw600dp/dimens.xml | 1 - app/src/main/res/values/dimens.xml | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/app/src/main/res/values-sw600dp/dimens.xml b/app/src/main/res/values-sw600dp/dimens.xml index 595bc8570..a63e7ef7d 100644 --- a/app/src/main/res/values-sw600dp/dimens.xml +++ b/app/src/main/res/values-sw600dp/dimens.xml @@ -7,5 +7,4 @@ 230dp 32dp 60dp - 250dp diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index 6c1f0feda..1e64de613 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -8,7 +8,7 @@ 150dp 24dp 60dp - 150dp - 60dp + 60dp + 30dp 72dp From 316c8fc85d8f65bf0b5c74d20475d98f062bbb53 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 8 Feb 2018 20:52:36 +0100 Subject: [PATCH 45/63] remove a redundant true --- .../com/simplemobiletools/gallery/fragments/VideoFragment.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt index a636bc715..01cea5817 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt @@ -147,7 +147,6 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee mView!!.video_volume_controller.setOnTouchListener { v, event -> mediaSideScroll.handleVolumeTouched(event) true - true } mView!!.video_brightness_controller.setOnTouchListener { v, event -> From a10fd3e8768c0259a1f8edb393f5d193258903e5 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 8 Feb 2018 21:11:22 +0100 Subject: [PATCH 46/63] fix #643, properly handle saving edited images with file uri --- .../gallery/activities/EditActivity.kt | 36 ++++++++++--------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt index 8e3d4d6c4..c1408b2c9 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt @@ -144,24 +144,28 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener override fun onCropImageComplete(view: CropImageView, result: CropImageView.CropResult) { if (result.error == null) { if (isCropIntent) { - var inputStream: InputStream? = null - var outputStream: OutputStream? = null - try { - val stream = ByteArrayOutputStream() - result.bitmap.compress(CompressFormat.JPEG, 100, stream) - inputStream = ByteArrayInputStream(stream.toByteArray()) - outputStream = contentResolver.openOutputStream(saveUri) - inputStream.copyTo(outputStream) - } finally { - inputStream?.close() - outputStream?.close() - } + if (saveUri.scheme == "file") { + saveBitmapToFile(result.bitmap, saveUri.path) + } else { + var inputStream: InputStream? = null + var outputStream: OutputStream? = null + try { + val stream = ByteArrayOutputStream() + result.bitmap.compress(CompressFormat.JPEG, 100, stream) + inputStream = ByteArrayInputStream(stream.toByteArray()) + outputStream = contentResolver.openOutputStream(saveUri) + inputStream.copyTo(outputStream) + } finally { + inputStream?.close() + outputStream?.close() + } - Intent().apply { - addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) - setResult(RESULT_OK, this) + Intent().apply { + addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) + setResult(RESULT_OK, this) + } + finish() } - finish() } else if (saveUri.scheme == "file") { SaveAsDialog(this, saveUri.path, true) { saveBitmapToFile(result.bitmap, it) From 9278ff125f415bfe0c325999f88b3c0e9edc21f2 Mon Sep 17 00:00:00 2001 From: Pzqqt <821026875@qq.com> Date: Fri, 9 Feb 2018 18:55:53 +0800 Subject: [PATCH 47/63] Update strings.xml --- app/src/main/res/values-zh-rCN/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index a547bf642..f4439d761 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -136,7 +136,7 @@ 通过单击屏幕边缘来切换媒体 用质量更好的图像替换可深度缩放的图像 当状态栏隐藏时隐藏扩展详情 - Do an extra check to avoid showing invalid files + 额外检查以避免显示无效的文件 缩略图 From 2a2d37e221e21dbbe4709c7545dd2c901a45f4dc Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 9 Feb 2018 16:41:17 +0100 Subject: [PATCH 48/63] fix some glitches with swiping to sides with Instant media change enabled --- .../gallery/fragments/PhotoFragment.kt | 4 ++ .../gallery/helpers/Constants.kt | 2 + .../gallery/helpers/MediaSideScroll.kt | 3 +- .../gallery/views/InstantItemSwitch.kt | 67 +++++++++++++++++++ app/src/main/res/layout/pager_photo_item.xml | 8 +-- 5 files changed, 78 insertions(+), 6 deletions(-) create mode 100644 app/src/main/kotlin/com/simplemobiletools/gallery/views/InstantItemSwitch.kt 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 0831224cb..63d795c2e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt @@ -61,6 +61,10 @@ class PhotoFragment : ViewPagerFragment() { gif_view.setOnClickListener { photoClicked() } instant_prev_item.setOnClickListener { listener?.goToPrevItem() } instant_next_item.setOnClickListener { listener?.goToNextItem() } + + instant_prev_item.parentView = container + instant_next_item.parentView = container + photo_brightness_controller.setOnTouchListener { v, event -> mediaSideScroll.handleBrightnessTouched(event) true diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt index 156bbf6b2..232708083 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt @@ -64,6 +64,8 @@ const val SLIDESHOW_SCROLL_DURATION = 500L const val NOMEDIA = ".nomedia" const val MAX_COLUMN_COUNT = 20 const val SHOW_TEMP_HIDDEN_DURATION = 600000L +const val CLICK_MAX_DURATION = 150 +const val DRAG_THRESHOLD = 10 const val DIRECTORY = "directory" const val MEDIUM = "medium" diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaSideScroll.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaSideScroll.kt index 8b89d7caf..7af072a4b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaSideScroll.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaSideScroll.kt @@ -11,7 +11,6 @@ import com.simplemobiletools.gallery.activities.ViewPagerActivity import com.simplemobiletools.gallery.extensions.audioManager class MediaSideScroll(val activity: Activity, val slideInfoView: TextView, val callback: () -> Unit) { - private val CLICK_MAX_DURATION = 150 private val SLIDE_INFO_FADE_DELAY = 1000L private var mTouchDownX = 0f private var mTouchDownY = 0f @@ -38,7 +37,7 @@ class MediaSideScroll(val activity: Activity, val slideInfoView: TextView, val c val diffX = mTouchDownX - event.x val diffY = mTouchDownY - event.y - if (Math.abs(diffY) > 20 && Math.abs(diffY) > Math.abs(diffX)) { + if (Math.abs(diffY) > DRAG_THRESHOLD && Math.abs(diffY) > Math.abs(diffX)) { var percent = ((diffY / ViewPagerActivity.screenHeight) * 100).toInt() * 3 percent = Math.min(100, Math.max(-100, percent)) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/views/InstantItemSwitch.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/views/InstantItemSwitch.kt new file mode 100644 index 000000000..f0d642a85 --- /dev/null +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/views/InstantItemSwitch.kt @@ -0,0 +1,67 @@ +package com.simplemobiletools.gallery.views + +import android.content.Context +import android.util.AttributeSet +import android.view.MotionEvent +import android.view.ViewGroup +import android.widget.RelativeLayout +import com.simplemobiletools.gallery.helpers.CLICK_MAX_DURATION +import com.simplemobiletools.gallery.helpers.DRAG_THRESHOLD + +// handle only one finger clicks, pass other events to the parent view and ignore it when received again +class InstantItemSwitch(context: Context, attrs: AttributeSet) : RelativeLayout(context, attrs) { + private var mTouchDownTime = 0L + private var mTouchDownX = 0f + private var mTouchDownY = 0f + private var passTouches = false + + var parentView: ViewGroup? = null + + override fun dispatchTouchEvent(ev: MotionEvent): Boolean { + if (passTouches) { + if (ev.actionMasked == MotionEvent.ACTION_DOWN) { + passTouches = false + } + return false + } + return super.dispatchTouchEvent(ev) + } + + override fun onTouchEvent(event: MotionEvent): Boolean { + if (passTouches) { + return false + } + + when (event.actionMasked) { + MotionEvent.ACTION_DOWN -> { + mTouchDownX = event.x + mTouchDownY = event.y + mTouchDownTime = System.currentTimeMillis() + } + MotionEvent.ACTION_UP -> { + if (System.currentTimeMillis() - mTouchDownTime < CLICK_MAX_DURATION) { + performClick() + } + } + MotionEvent.ACTION_MOVE -> { + if (passTouches) { + return false + } + + val diffX = mTouchDownX - event.x + val diffY = mTouchDownY - event.y + if (Math.abs(diffX) > DRAG_THRESHOLD || Math.abs(diffY) > DRAG_THRESHOLD) { + if (!passTouches) { + event.action = MotionEvent.ACTION_DOWN + event.setLocation(event.rawX, event.y) + parentView?.dispatchTouchEvent(event) + } + passTouches = true + parentView?.dispatchTouchEvent(event) + return false + } + } + } + return true + } +} diff --git a/app/src/main/res/layout/pager_photo_item.xml b/app/src/main/res/layout/pager_photo_item.xml index 9a82b9b16..095783b21 100644 --- a/app/src/main/res/layout/pager_photo_item.xml +++ b/app/src/main/res/layout/pager_photo_item.xml @@ -35,8 +35,8 @@ android:id="@+id/photo_brightness_controller" android:layout_width="@dimen/media_side_slider_width" android:layout_height="match_parent" - android:layout_alignParentStart="true" - android:layout_alignParentLeft="true"/> + android:layout_alignParentLeft="true" + android:layout_alignParentStart="true"/> - - Date: Fri, 9 Feb 2018 17:12:31 +0100 Subject: [PATCH 49/63] make MediaSideScroll extend RelativeLayout --- .../gallery/fragments/PhotoFragment.kt | 7 ++++--- .../gallery/fragments/VideoFragment.kt | 15 +++++++++++---- .../gallery/helpers/MediaSideScroll.kt | 15 ++++++++++++++- app/src/main/res/layout/pager_photo_item.xml | 2 +- app/src/main/res/layout/pager_video_item.xml | 4 ++-- 5 files changed, 32 insertions(+), 11 deletions(-) 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 63d795c2e..2d881aac5 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt @@ -50,7 +50,7 @@ class PhotoFragment : ViewPagerFragment() { private var storedHideExtendedDetails = false private var storedExtendedDetails = 0 - private lateinit var mediaSideScroll: MediaSideScroll + private lateinit var brightnessSideScroll: MediaSideScroll lateinit var view: ViewGroup lateinit var medium: Medium @@ -66,7 +66,7 @@ class PhotoFragment : ViewPagerFragment() { instant_next_item.parentView = container photo_brightness_controller.setOnTouchListener { v, event -> - mediaSideScroll.handleBrightnessTouched(event) + brightnessSideScroll.handleBrightnessTouched(event) true } } @@ -118,7 +118,8 @@ class PhotoFragment : ViewPagerFragment() { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) - mediaSideScroll = MediaSideScroll(activity!!, view.slide_info) { + brightnessSideScroll = view.photo_brightness_controller + brightnessSideScroll.initialize(activity!!, view.slide_info) { view.apply { if (subsampling_view.isVisible()) { subsampling_view.performClick() diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt index 01cea5817..3af74be26 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt @@ -54,7 +54,8 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee private var mStoredHideExtendedDetails = false private var mStoredExtendedDetails = 0 - private lateinit var mediaSideScroll: MediaSideScroll + private lateinit var brightnessSideScroll: MediaSideScroll + private lateinit var volumeSideScroll: MediaSideScroll lateinit var medium: Medium @@ -87,7 +88,13 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) - mediaSideScroll = MediaSideScroll(activity!!, view.slide_info) { + brightnessSideScroll = view.video_brightness_controller + brightnessSideScroll.initialize(activity!!, view.slide_info) { + view.video_holder.performClick() + } + + volumeSideScroll = view.video_volume_controller + volumeSideScroll.initialize(activity!!, view.slide_info) { view.video_holder.performClick() } } @@ -145,12 +152,12 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee mView!!.video_holder.setOnClickListener { toggleFullscreen() } mView!!.video_volume_controller.setOnTouchListener { v, event -> - mediaSideScroll.handleVolumeTouched(event) + volumeSideScroll.handleVolumeTouched(event) true } mView!!.video_brightness_controller.setOnTouchListener { v, event -> - mediaSideScroll.handleBrightnessTouched(event) + volumeSideScroll.handleBrightnessTouched(event) true } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaSideScroll.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaSideScroll.kt index 7af072a4b..f6f964461 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaSideScroll.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaSideScroll.kt @@ -1,16 +1,19 @@ package com.simplemobiletools.gallery.helpers import android.app.Activity +import android.content.Context import android.media.AudioManager import android.os.Handler import android.provider.Settings +import android.util.AttributeSet import android.view.MotionEvent +import android.widget.RelativeLayout import android.widget.TextView import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.activities.ViewPagerActivity import com.simplemobiletools.gallery.extensions.audioManager -class MediaSideScroll(val activity: Activity, val slideInfoView: TextView, val callback: () -> Unit) { +class MediaSideScroll(context: Context, attrs: AttributeSet) : RelativeLayout(context, attrs) { private val SLIDE_INFO_FADE_DELAY = 1000L private var mTouchDownX = 0f private var mTouchDownY = 0f @@ -23,6 +26,16 @@ class MediaSideScroll(val activity: Activity, val slideInfoView: TextView, val c private var mSlideInfoText = "" private var mSlideInfoFadeHandler = Handler() + private lateinit var activity: Activity + private lateinit var slideInfoView: TextView + private lateinit var callback: () -> Unit + + fun initialize(activity: Activity, slideInfoView: TextView, callback: () -> Unit) { + this.activity = activity + this.slideInfoView = slideInfoView + this.callback = callback + } + fun handleVolumeTouched(event: MotionEvent) { when (event.action) { MotionEvent.ACTION_DOWN -> { diff --git a/app/src/main/res/layout/pager_photo_item.xml b/app/src/main/res/layout/pager_photo_item.xml index 095783b21..bf3b9eb2d 100644 --- a/app/src/main/res/layout/pager_photo_item.xml +++ b/app/src/main/res/layout/pager_photo_item.xml @@ -31,7 +31,7 @@ android:visibility="gone" tools:text="My image\nAnother line"/> - - - From 4449b96d6ee2832df3c50500ce272563d3ecae6e Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 9 Feb 2018 17:51:42 +0100 Subject: [PATCH 50/63] handle touch events in MediaSideScroll itself --- .../gallery/fragments/PhotoFragment.kt | 28 ++--- .../gallery/fragments/VideoFragment.kt | 38 +++---- .../gallery/helpers/MediaSideScroll.kt | 104 ++++++++---------- app/src/main/res/layout/pager_video_item.xml | 4 +- 4 files changed, 67 insertions(+), 107 deletions(-) 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 2d881aac5..6c7ac8d6a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt @@ -30,7 +30,6 @@ 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.* @@ -50,8 +49,6 @@ class PhotoFragment : ViewPagerFragment() { private var storedHideExtendedDetails = false private var storedExtendedDetails = 0 - private lateinit var brightnessSideScroll: MediaSideScroll - lateinit var view: ViewGroup lateinit var medium: Medium @@ -65,9 +62,14 @@ class PhotoFragment : ViewPagerFragment() { instant_prev_item.parentView = container instant_next_item.parentView = container - photo_brightness_controller.setOnTouchListener { v, event -> - brightnessSideScroll.handleBrightnessTouched(event) - true + photo_brightness_controller.initialize(activity!!, slide_info, true, container) { + view.apply { + if (subsampling_view.isVisible()) { + subsampling_view.performClick() + } else { + gif_view.performClick() + } + } } } @@ -116,20 +118,6 @@ class PhotoFragment : ViewPagerFragment() { return view } - override fun onViewCreated(view: View, savedInstanceState: Bundle?) { - super.onViewCreated(view, savedInstanceState) - brightnessSideScroll = view.photo_brightness_controller - brightnessSideScroll.initialize(activity!!, view.slide_info) { - view.apply { - if (subsampling_view.isVisible()) { - subsampling_view.performClick() - } else { - gif_view.performClick() - } - } - } - } - override fun onPause() { super.onPause() storeStateVariables() diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt index 3af74be26..dfd152524 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt @@ -83,22 +83,21 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee checkFullscreen() wasInit = true + mView!!.apply { + brightnessSideScroll = video_brightness_controller + brightnessSideScroll.initialize(activity!!, slide_info, true, container) { + video_holder.performClick() + } + + volumeSideScroll = video_volume_controller + volumeSideScroll.initialize(activity!!, slide_info, false, container) { + video_holder.performClick() + } + } + return mView } - override fun onViewCreated(view: View, savedInstanceState: Bundle?) { - super.onViewCreated(view, savedInstanceState) - brightnessSideScroll = view.video_brightness_controller - brightnessSideScroll.initialize(activity!!, view.slide_info) { - view.video_holder.performClick() - } - - volumeSideScroll = view.video_volume_controller - volumeSideScroll.initialize(activity!!, view.slide_info) { - view.video_holder.performClick() - } - } - override fun onResume() { super.onResume() activity!!.updateTextColors(mView!!.video_holder) @@ -151,16 +150,6 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee mSurfaceView!!.setOnClickListener { toggleFullscreen() } mView!!.video_holder.setOnClickListener { toggleFullscreen() } - mView!!.video_volume_controller.setOnTouchListener { v, event -> - volumeSideScroll.handleVolumeTouched(event) - true - } - - mView!!.video_brightness_controller.setOnTouchListener { v, event -> - volumeSideScroll.handleBrightnessTouched(event) - true - } - initTimeHolder() checkExtendedDetails() initMediaPlayer() @@ -269,8 +258,9 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee } private fun checkFullscreen() { - if (activity == null) + if (activity == null) { return + } var anim = android.R.anim.fade_in if (mIsFullscreen) { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaSideScroll.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaSideScroll.kt index f6f964461..43e832084 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaSideScroll.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaSideScroll.kt @@ -7,6 +7,7 @@ import android.os.Handler import android.provider.Settings import android.util.AttributeSet import android.view.MotionEvent +import android.view.ViewGroup import android.widget.RelativeLayout import android.widget.TextView import com.simplemobiletools.gallery.R @@ -18,33 +19,42 @@ class MediaSideScroll(context: Context, attrs: AttributeSet) : RelativeLayout(co private var mTouchDownX = 0f private var mTouchDownY = 0f private var mTouchDownTime = 0L - private var mTouchDownVolume = 0 - private var mTouchDownBrightness = -1 + private var mTouchDownValue = -1 private var mTempBrightness = 0 private var mLastTouchY = 0f + private var mIsBrightnessScroll = false private var mSlideInfoText = "" private var mSlideInfoFadeHandler = Handler() + private var mParentView: ViewGroup? = null private lateinit var activity: Activity private lateinit var slideInfoView: TextView private lateinit var callback: () -> Unit - fun initialize(activity: Activity, slideInfoView: TextView, callback: () -> Unit) { + fun initialize(activity: Activity, slideInfoView: TextView, isBrightness: Boolean, parentView: ViewGroup?, callback: () -> Unit) { this.activity = activity this.slideInfoView = slideInfoView this.callback = callback + mParentView = parentView + mIsBrightnessScroll = isBrightness + mSlideInfoText = activity.getString(if (isBrightness) R.string.brightness else R.string.volume) } - fun handleVolumeTouched(event: MotionEvent) { + override fun onTouchEvent(event: MotionEvent): Boolean { when (event.action) { MotionEvent.ACTION_DOWN -> { mTouchDownX = event.x mTouchDownY = event.y mLastTouchY = event.y mTouchDownTime = System.currentTimeMillis() - mTouchDownVolume = getCurrentVolume() - mSlideInfoText = "${activity.getString(R.string.volume)}:\n" + if (mIsBrightnessScroll) { + if (mTouchDownValue == -1) { + mTouchDownValue = getCurrentBrightness() + } + } else { + mTouchDownValue = getCurrentVolume() + } } MotionEvent.ACTION_MOVE -> { val diffX = mTouchDownX - event.x @@ -56,61 +66,24 @@ class MediaSideScroll(context: Context, attrs: AttributeSet) : RelativeLayout(co if ((percent == 100 && event.y > mLastTouchY) || (percent == -100 && event.y < mLastTouchY)) { mTouchDownY = event.y - mTouchDownVolume = getCurrentVolume() + mTouchDownValue = if (mIsBrightnessScroll) mTempBrightness else getCurrentVolume() } - volumePercentChanged(percent) + percentChanged(percent) } mLastTouchY = event.y } MotionEvent.ACTION_UP, MotionEvent.ACTION_CANCEL -> { - val diffX = Math.abs(event.x - mTouchDownX) - val diffY = Math.abs(event.y - mTouchDownY) - if (System.currentTimeMillis() - mTouchDownTime < CLICK_MAX_DURATION && diffX < 20 && diffY < 20) { + if (System.currentTimeMillis() - mTouchDownTime < CLICK_MAX_DURATION) { callback() } + + if (mIsBrightnessScroll) { + mTouchDownValue = mTempBrightness + } } } - } - - fun handleBrightnessTouched(event: MotionEvent) { - when (event.action) { - MotionEvent.ACTION_DOWN -> { - mTouchDownX = event.x - mTouchDownY = event.y - mLastTouchY = event.y - mTouchDownTime = System.currentTimeMillis() - mSlideInfoText = "${activity.getString(R.string.brightness)}:\n" - if (mTouchDownBrightness == -1) { - mTouchDownBrightness = getCurrentBrightness() - } - } - MotionEvent.ACTION_MOVE -> { - val diffX = mTouchDownX - event.x - val diffY = mTouchDownY - event.y - - if (Math.abs(diffY) > 20 && Math.abs(diffY) > Math.abs(diffX)) { - var percent = ((diffY / ViewPagerActivity.screenHeight) * 100).toInt() * 3 - percent = Math.min(100, Math.max(-100, percent)) - - if ((percent == 100 && event.y > mLastTouchY) || (percent == -100 && event.y < mLastTouchY)) { - mTouchDownY = event.y - mTouchDownBrightness = mTempBrightness - } - - brightnessPercentChanged(percent) - } - mLastTouchY = event.y - } - MotionEvent.ACTION_UP, MotionEvent.ACTION_CANCEL -> { - val diffX = Math.abs(event.x - mTouchDownX) - val diffY = Math.abs(event.y - mTouchDownY) - if (System.currentTimeMillis() - mTouchDownTime < CLICK_MAX_DURATION && diffX < 20 && diffY < 20) { - callback() - } - mTouchDownBrightness = mTempBrightness - } - } + return true } private fun getCurrentVolume() = activity.audioManager.getStreamVolume(AudioManager.STREAM_MUSIC) @@ -123,19 +96,24 @@ class MediaSideScroll(context: Context, attrs: AttributeSet) : RelativeLayout(co } } + private fun percentChanged(percent: Int) { + if (mIsBrightnessScroll) { + brightnessPercentChanged(percent) + } else { + volumePercentChanged(percent) + } + } + private fun volumePercentChanged(percent: Int) { val stream = AudioManager.STREAM_MUSIC val maxVolume = activity.audioManager.getStreamMaxVolume(stream) val percentPerPoint = 100 / maxVolume val addPoints = percent / percentPerPoint - val newVolume = Math.min(maxVolume, Math.max(0, mTouchDownVolume + addPoints)) + val newVolume = Math.min(maxVolume, Math.max(0, mTouchDownValue + addPoints)) activity.audioManager.setStreamVolume(stream, newVolume, 0) val absolutePercent = ((newVolume / maxVolume.toFloat()) * 100).toInt() - slideInfoView.apply { - text = "$mSlideInfoText$absolutePercent%" - alpha = 1f - } + showValue(absolutePercent) mSlideInfoFadeHandler.removeCallbacksAndMessages(null) mSlideInfoFadeHandler.postDelayed({ @@ -145,15 +123,12 @@ class MediaSideScroll(context: Context, attrs: AttributeSet) : RelativeLayout(co private fun brightnessPercentChanged(percent: Int) { val maxBrightness = 255f - var newBrightness = (mTouchDownBrightness + 2.55 * percent).toFloat() + var newBrightness = (mTouchDownValue + 2.55 * percent).toFloat() newBrightness = Math.min(maxBrightness, Math.max(0f, newBrightness)) mTempBrightness = newBrightness.toInt() val absolutePercent = ((newBrightness / maxBrightness) * 100).toInt() - slideInfoView.apply { - text = "$mSlideInfoText$absolutePercent%" - alpha = 1f - } + showValue(absolutePercent) val attributes = activity.window.attributes attributes.screenBrightness = absolutePercent / 100f @@ -164,4 +139,11 @@ class MediaSideScroll(context: Context, attrs: AttributeSet) : RelativeLayout(co slideInfoView.animate().alpha(0f) }, SLIDE_INFO_FADE_DELAY) } + + private fun showValue(percent: Int) { + slideInfoView.apply { + text = "$mSlideInfoText:\n$percent%" + alpha = 1f + } + } } diff --git a/app/src/main/res/layout/pager_video_item.xml b/app/src/main/res/layout/pager_video_item.xml index 6d0ea0763..8b3291419 100644 --- a/app/src/main/res/layout/pager_video_item.xml +++ b/app/src/main/res/layout/pager_video_item.xml @@ -25,12 +25,12 @@ android:layout_width="@dimen/media_side_slider_width" android:layout_height="match_parent"/> - - Date: Fri, 9 Feb 2018 18:32:35 +0100 Subject: [PATCH 51/63] fix #638, allow horizontal swipes through the brightness/volume slider --- .../gallery/helpers/Constants.kt | 2 +- .../gallery/helpers/MediaSideScroll.kt | 29 +++++++++++++++++-- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt index 232708083..ab16d130f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt @@ -65,7 +65,7 @@ const val NOMEDIA = ".nomedia" const val MAX_COLUMN_COUNT = 20 const val SHOW_TEMP_HIDDEN_DURATION = 600000L const val CLICK_MAX_DURATION = 150 -const val DRAG_THRESHOLD = 10 +const val DRAG_THRESHOLD = 15 const val DIRECTORY = "directory" const val MEDIUM = "medium" diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaSideScroll.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaSideScroll.kt index 43e832084..0ac4801eb 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaSideScroll.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaSideScroll.kt @@ -14,6 +14,7 @@ import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.activities.ViewPagerActivity import com.simplemobiletools.gallery.extensions.audioManager +// allow horizontal swipes through the layout, else it can cause glitches at zoomed in images class MediaSideScroll(context: Context, attrs: AttributeSet) : RelativeLayout(context, attrs) { private val SLIDE_INFO_FADE_DELAY = 1000L private var mTouchDownX = 0f @@ -23,6 +24,7 @@ class MediaSideScroll(context: Context, attrs: AttributeSet) : RelativeLayout(co private var mTempBrightness = 0 private var mLastTouchY = 0f private var mIsBrightnessScroll = false + private var mPassTouches = false private var mSlideInfoText = "" private var mSlideInfoFadeHandler = Handler() @@ -41,8 +43,22 @@ class MediaSideScroll(context: Context, attrs: AttributeSet) : RelativeLayout(co mSlideInfoText = activity.getString(if (isBrightness) R.string.brightness else R.string.volume) } + override fun dispatchTouchEvent(ev: MotionEvent): Boolean { + if (mPassTouches) { + if (ev.actionMasked == MotionEvent.ACTION_DOWN) { + mPassTouches = false + } + return false + } + return super.dispatchTouchEvent(ev) + } + override fun onTouchEvent(event: MotionEvent): Boolean { - when (event.action) { + if (mPassTouches) { + return false + } + + when (event.actionMasked) { MotionEvent.ACTION_DOWN -> { mTouchDownX = event.x mTouchDownY = event.y @@ -70,10 +86,19 @@ class MediaSideScroll(context: Context, attrs: AttributeSet) : RelativeLayout(co } percentChanged(percent) + } else if (Math.abs(diffX) > DRAG_THRESHOLD || Math.abs(diffY) > DRAG_THRESHOLD) { + if (!mPassTouches) { + event.action = MotionEvent.ACTION_DOWN + event.setLocation(event.rawX, event.y) + mParentView?.dispatchTouchEvent(event) + } + mPassTouches = true + mParentView?.dispatchTouchEvent(event) + return false } mLastTouchY = event.y } - MotionEvent.ACTION_UP, MotionEvent.ACTION_CANCEL -> { + MotionEvent.ACTION_UP -> { if (System.currentTimeMillis() - mTouchDownTime < CLICK_MAX_DURATION) { callback() } From ef51271909959899cc9fe8cc6f5cd25ae57ebfa1 Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 9 Feb 2018 18:40:40 +0100 Subject: [PATCH 52/63] properly scale drag_threshold based on device density --- .../com/simplemobiletools/gallery/helpers/Constants.kt | 2 +- .../com/simplemobiletools/gallery/helpers/MediaSideScroll.kt | 5 +++-- .../com/simplemobiletools/gallery/views/InstantItemSwitch.kt | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt index ab16d130f..b4ecd1a6d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt @@ -65,7 +65,7 @@ const val NOMEDIA = ".nomedia" const val MAX_COLUMN_COUNT = 20 const val SHOW_TEMP_HIDDEN_DURATION = 600000L const val CLICK_MAX_DURATION = 150 -const val DRAG_THRESHOLD = 15 +const val DRAG_THRESHOLD = 8 const val DIRECTORY = "directory" const val MEDIUM = "medium" diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaSideScroll.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaSideScroll.kt index 0ac4801eb..eca4fb337 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaSideScroll.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaSideScroll.kt @@ -25,6 +25,7 @@ class MediaSideScroll(context: Context, attrs: AttributeSet) : RelativeLayout(co private var mLastTouchY = 0f private var mIsBrightnessScroll = false private var mPassTouches = false + private var dragThreshold = DRAG_THRESHOLD * context.resources.displayMetrics.density private var mSlideInfoText = "" private var mSlideInfoFadeHandler = Handler() @@ -76,7 +77,7 @@ class MediaSideScroll(context: Context, attrs: AttributeSet) : RelativeLayout(co val diffX = mTouchDownX - event.x val diffY = mTouchDownY - event.y - if (Math.abs(diffY) > DRAG_THRESHOLD && Math.abs(diffY) > Math.abs(diffX)) { + if (Math.abs(diffY) > dragThreshold && Math.abs(diffY) > Math.abs(diffX)) { var percent = ((diffY / ViewPagerActivity.screenHeight) * 100).toInt() * 3 percent = Math.min(100, Math.max(-100, percent)) @@ -86,7 +87,7 @@ class MediaSideScroll(context: Context, attrs: AttributeSet) : RelativeLayout(co } percentChanged(percent) - } else if (Math.abs(diffX) > DRAG_THRESHOLD || Math.abs(diffY) > DRAG_THRESHOLD) { + } else if (Math.abs(diffX) > dragThreshold || Math.abs(diffY) > dragThreshold) { if (!mPassTouches) { event.action = MotionEvent.ACTION_DOWN event.setLocation(event.rawX, event.y) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/views/InstantItemSwitch.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/views/InstantItemSwitch.kt index f0d642a85..bdfe1264a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/views/InstantItemSwitch.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/views/InstantItemSwitch.kt @@ -14,6 +14,7 @@ class InstantItemSwitch(context: Context, attrs: AttributeSet) : RelativeLayout( private var mTouchDownX = 0f private var mTouchDownY = 0f private var passTouches = false + private var dragThreshold = DRAG_THRESHOLD * context.resources.displayMetrics.density var parentView: ViewGroup? = null @@ -50,7 +51,7 @@ class InstantItemSwitch(context: Context, attrs: AttributeSet) : RelativeLayout( val diffX = mTouchDownX - event.x val diffY = mTouchDownY - event.y - if (Math.abs(diffX) > DRAG_THRESHOLD || Math.abs(diffY) > DRAG_THRESHOLD) { + if (Math.abs(diffX) > dragThreshold || Math.abs(diffY) > dragThreshold) { if (!passTouches) { event.action = MotionEvent.ACTION_DOWN event.setLocation(event.rawX, event.y) From db8a88cbfe78914dce684607b85a38e8d4cec48e Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 9 Feb 2018 18:41:22 +0100 Subject: [PATCH 53/63] remove path scanning on viewpager activity --- .../simplemobiletools/gallery/activities/ViewPagerActivity.kt | 1 - 1 file changed, 1 deletion(-) 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 0d1033a2f..80e41d7c5 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -213,7 +213,6 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View } refreshViewPager() - scanPath(mPath) if (config.blackBackground) { view_pager.background = ColorDrawable(Color.BLACK) From 0616117f368140e5e0e28d012b4e91235d1db428 Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 9 Feb 2018 19:14:48 +0100 Subject: [PATCH 54/63] send a more advanced click event with coordinates at clicking side slider --- .../simplemobiletools/gallery/extensions/View.kt | 13 +++++++++++++ .../gallery/fragments/PhotoFragment.kt | 6 +++--- .../gallery/fragments/VideoFragment.kt | 4 ++-- .../gallery/helpers/MediaSideScroll.kt | 6 +++--- 4 files changed, 21 insertions(+), 8 deletions(-) create mode 100644 app/src/main/kotlin/com/simplemobiletools/gallery/extensions/View.kt diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/View.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/View.kt new file mode 100644 index 000000000..cf1459c54 --- /dev/null +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/View.kt @@ -0,0 +1,13 @@ +package com.simplemobiletools.gallery.extensions + +import android.os.SystemClock +import android.view.MotionEvent +import android.view.View + +fun View.sendFakeClick(x: Float, y: Float) { + val uptime = SystemClock.uptimeMillis() + val event = MotionEvent.obtain(uptime, uptime, MotionEvent.ACTION_DOWN, x, y, 0) + dispatchTouchEvent(event) + event.action = MotionEvent.ACTION_UP + dispatchTouchEvent(event) +} 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 6c7ac8d6a..18a2d23a3 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt @@ -62,12 +62,12 @@ class PhotoFragment : ViewPagerFragment() { instant_prev_item.parentView = container instant_next_item.parentView = container - photo_brightness_controller.initialize(activity!!, slide_info, true, container) { + photo_brightness_controller.initialize(activity!!, slide_info, true, container) { x, y -> view.apply { if (subsampling_view.isVisible()) { - subsampling_view.performClick() + subsampling_view.sendFakeClick(x, y) } else { - gif_view.performClick() + gif_view.sendFakeClick(x, y) } } } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt index dfd152524..6eb5b4c96 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt @@ -85,12 +85,12 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee mView!!.apply { brightnessSideScroll = video_brightness_controller - brightnessSideScroll.initialize(activity!!, slide_info, true, container) { + brightnessSideScroll.initialize(activity!!, slide_info, true, container) { x, y -> video_holder.performClick() } volumeSideScroll = video_volume_controller - volumeSideScroll.initialize(activity!!, slide_info, false, container) { + volumeSideScroll.initialize(activity!!, slide_info, false, container) { x, y -> video_holder.performClick() } } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaSideScroll.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaSideScroll.kt index eca4fb337..91c5f0a3c 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaSideScroll.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaSideScroll.kt @@ -33,9 +33,9 @@ class MediaSideScroll(context: Context, attrs: AttributeSet) : RelativeLayout(co private lateinit var activity: Activity private lateinit var slideInfoView: TextView - private lateinit var callback: () -> Unit + private lateinit var callback: (Float, Float) -> Unit - fun initialize(activity: Activity, slideInfoView: TextView, isBrightness: Boolean, parentView: ViewGroup?, callback: () -> Unit) { + fun initialize(activity: Activity, slideInfoView: TextView, isBrightness: Boolean, parentView: ViewGroup?, callback: (x: Float, y: Float) -> Unit) { this.activity = activity this.slideInfoView = slideInfoView this.callback = callback @@ -101,7 +101,7 @@ class MediaSideScroll(context: Context, attrs: AttributeSet) : RelativeLayout(co } MotionEvent.ACTION_UP -> { if (System.currentTimeMillis() - mTouchDownTime < CLICK_MAX_DURATION) { - callback() + callback(event.rawX, event.rawY) } if (mIsBrightnessScroll) { From ace15c42487ac96f59074e9d00bd23130de783c8 Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 9 Feb 2018 20:29:49 +0100 Subject: [PATCH 55/63] allow skipping forward/backward by pressing curr/max time at videos --- .../gallery/extensions/Context.kt | 1 + .../gallery/fragments/VideoFragment.kt | 27 +++++++++++++------ app/src/main/res/layout/pager_video_item.xml | 20 +++++++------- app/src/main/res/values-sw600dp/dimens.xml | 1 - app/src/main/res/values/dimens.xml | 1 - 5 files changed, 31 insertions(+), 19 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/Context.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/Context.kt index 62c8f95c7..4d3ac9961 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/Context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/Context.kt @@ -23,6 +23,7 @@ val Context.windowManager: WindowManager get() = getSystemService(Context.WINDOW val Context.navigationBarRight: Boolean get() = usableScreenSize.x < realScreenSize.x val Context.navigationBarBottom: Boolean get() = usableScreenSize.y < realScreenSize.y val Context.navigationBarHeight: Int get() = if (navigationBarBottom) navigationBarSize.y else 0 +val Context.navigationBarWidth: Int get() = if (navigationBarRight) navigationBarSize.x else 0 internal val Context.navigationBarSize: Point get() = when { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt index 6eb5b4c96..5cf2dc092 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt @@ -16,10 +16,7 @@ import android.widget.TextView import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.activities.VideoActivity -import com.simplemobiletools.gallery.extensions.config -import com.simplemobiletools.gallery.extensions.navigationBarHeight -import com.simplemobiletools.gallery.extensions.usableScreenSize -import com.simplemobiletools.gallery.extensions.windowManager +import com.simplemobiletools.gallery.extensions.* import com.simplemobiletools.gallery.helpers.MEDIUM import com.simplemobiletools.gallery.helpers.MediaSideScroll import com.simplemobiletools.gallery.models.Medium @@ -93,6 +90,9 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee volumeSideScroll.initialize(activity!!, slide_info, false, container) { x, y -> video_holder.performClick() } + + video_curr_time.setOnClickListener { skip(false) } + video_duration.setOnClickListener { skip(true) } } return mView @@ -186,14 +186,14 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee val height = context!!.navigationBarHeight val left = mTimeHolder!!.paddingLeft val top = mTimeHolder!!.paddingTop - var right = res.getDimension(R.dimen.timer_padding).toInt() + var right = mTimeHolder!!.paddingRight var bottom = 0 if (hasNavBar()) { if (res.configuration.orientation == Configuration.ORIENTATION_PORTRAIT) { - bottom += height + bottom += context!!.navigationBarHeight } else { - right += height + right += context!!.navigationBarWidth bottom += context!!.navigationBarHeight } mTimeHolder!!.setPadding(left, top, right, bottom) @@ -203,8 +203,9 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee mSeekBar = mView!!.video_seekbar mSeekBar!!.setOnSeekBarChangeListener(this) - if (mIsFullscreen) + if (mIsFullscreen) { mTimeHolder!!.beInvisible() + } } private fun hasNavBar(): Boolean { @@ -469,6 +470,16 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee } } + private fun skip(forward: Boolean) { + val curr = mMediaPlayer!!.currentPosition + val twoPercents = mMediaPlayer!!.duration / 50 + val newProgress = if (forward) curr + twoPercents else curr - twoPercents + setProgress(Math.round(newProgress / 1000f)) + if (!mIsPlaying) { + togglePlayPause() + } + } + override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) { if (mMediaPlayer != null && fromUser) { setProgress(progress) diff --git a/app/src/main/res/layout/pager_video_item.xml b/app/src/main/res/layout/pager_video_item.xml index 8b3291419..1c19114cb 100644 --- a/app/src/main/res/layout/pager_video_item.xml +++ b/app/src/main/res/layout/pager_video_item.xml @@ -81,12 +81,11 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" - android:background="@drawable/gradient_background" - android:paddingLeft="@dimen/timer_padding" - android:paddingRight="@dimen/timer_padding"> + android:background="@drawable/gradient_background"> + android:paddingLeft="@dimen/activity_margin" + android:paddingRight="@dimen/activity_margin" + android:textColor="@android:color/white" + tools:text="00:00"/> + android:paddingLeft="@dimen/activity_margin" + android:paddingRight="@dimen/activity_margin" + android:textColor="@android:color/white" + tools:text="00:00"/> diff --git a/app/src/main/res/values-sw600dp/dimens.xml b/app/src/main/res/values-sw600dp/dimens.xml index a63e7ef7d..5ce6c1c68 100644 --- a/app/src/main/res/values-sw600dp/dimens.xml +++ b/app/src/main/res/values-sw600dp/dimens.xml @@ -5,6 +5,5 @@ 30dp 38dp 230dp - 32dp 60dp diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index 1e64de613..0a0cdcd24 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -6,7 +6,6 @@ 22dp 26dp 150dp - 24dp 60dp 60dp 30dp From 6a627ceff8a650210146c232915fc4b95f1d5e8f Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 9 Feb 2018 20:45:55 +0100 Subject: [PATCH 56/63] update commons to 3.11.1 --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 532123bb8..3bd4312b1 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -46,7 +46,7 @@ ext { } dependencies { - implementation 'com.simplemobiletools:commons:3.11.0' + implementation 'com.simplemobiletools:commons:3.11.1' implementation 'com.theartofdev.edmodo:android-image-cropper:2.6.0' implementation 'com.android.support:multidex:1.0.2' implementation 'com.google.code.gson:gson:2.8.2' From 23501a9be7f003bfbc543f0902301c05a4feae4d Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 9 Feb 2018 20:46:05 +0100 Subject: [PATCH 57/63] update version to 3.4.1 --- app/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 3bd4312b1..b02036847 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,8 +10,8 @@ android { applicationId "com.simplemobiletools.gallery" minSdkVersion 16 targetSdkVersion 27 - versionCode 160 - versionName "3.4.0" + versionCode 161 + versionName "3.4.1" multiDexEnabled true setProperty("archivesBaseName", "gallery") } From 5e2a1e054d6dc6f2d4b55c8c5cca3c53fbf22beb Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 9 Feb 2018 20:46:11 +0100 Subject: [PATCH 58/63] updating changelog --- CHANGELOG.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index cd18565eb..375d504a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,15 @@ Changelog ========== +Version 3.4.1 *(2018-02-09)* +---------------------------- + + * Fix some glitches around swiping fullscreen media with instant media switch or gesture brightness change enabled + * Make changing image brightness with gestures disabled by default + * Allow skipping forward/backward videos by pressing max/current time + * Fix some cases of editing third party images + * Couple other stability improvements + Version 3.4.0 *(2018-02-05)* ---------------------------- From 85bef7ab1d62b8ffc0ea417fc20b52e891bae30c Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 9 Feb 2018 21:49:39 +0100 Subject: [PATCH 59/63] use smaller side paddings at Settings items --- app/src/main/res/layout/activity_settings.xml | 159 ++++++++++++++---- 1 file changed, 126 insertions(+), 33 deletions(-) diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index 6d47e7ab8..215e3f23c 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -17,7 +17,10 @@ android:layout_height="wrap_content" android:layout_marginTop="@dimen/medium_margin" android:background="?attr/selectableItemBackground" - android:padding="@dimen/activity_margin"> + android:paddingBottom="@dimen/activity_margin" + android:paddingLeft="@dimen/normal_margin" + android:paddingRight="@dimen/normal_margin" + android:paddingTop="@dimen/activity_margin"> + android:paddingBottom="@dimen/activity_margin" + android:paddingLeft="@dimen/normal_margin" + android:paddingRight="@dimen/normal_margin" + android:paddingTop="@dimen/activity_margin"> + android:paddingBottom="@dimen/activity_margin" + android:paddingLeft="@dimen/normal_margin" + android:paddingRight="@dimen/normal_margin" + android:paddingTop="@dimen/activity_margin"> + android:paddingBottom="@dimen/activity_margin" + android:paddingLeft="@dimen/normal_margin" + android:paddingRight="@dimen/normal_margin" + android:paddingTop="@dimen/activity_margin"> + android:paddingBottom="@dimen/activity_margin" + android:paddingLeft="@dimen/normal_margin" + android:paddingRight="@dimen/normal_margin" + android:paddingTop="@dimen/activity_margin"> + android:paddingBottom="@dimen/activity_margin" + android:paddingLeft="@dimen/normal_margin" + android:paddingRight="@dimen/normal_margin" + android:paddingTop="@dimen/activity_margin"> + android:paddingBottom="@dimen/activity_margin" + android:paddingLeft="@dimen/normal_margin" + android:paddingRight="@dimen/normal_margin" + android:paddingTop="@dimen/activity_margin"> + android:paddingBottom="@dimen/activity_margin" + android:paddingLeft="@dimen/normal_margin" + android:paddingRight="@dimen/normal_margin" + android:paddingTop="@dimen/activity_margin"> + android:paddingBottom="@dimen/activity_margin" + android:paddingLeft="@dimen/normal_margin" + android:paddingRight="@dimen/normal_margin" + android:paddingTop="@dimen/activity_margin"> + android:paddingBottom="@dimen/activity_margin" + android:paddingLeft="@dimen/normal_margin" + android:paddingRight="@dimen/normal_margin" + android:paddingTop="@dimen/activity_margin"> + android:paddingBottom="@dimen/activity_margin" + android:paddingLeft="@dimen/normal_margin" + android:paddingRight="@dimen/normal_margin" + android:paddingTop="@dimen/activity_margin"> + android:paddingBottom="@dimen/activity_margin" + android:paddingLeft="@dimen/normal_margin" + android:paddingRight="@dimen/normal_margin" + android:paddingTop="@dimen/activity_margin"> + android:paddingBottom="@dimen/activity_margin" + android:paddingLeft="@dimen/normal_margin" + android:paddingRight="@dimen/normal_margin" + android:paddingTop="@dimen/activity_margin"> + android:paddingBottom="@dimen/activity_margin" + android:paddingLeft="@dimen/normal_margin" + android:paddingRight="@dimen/normal_margin" + android:paddingTop="@dimen/activity_margin"> + android:paddingBottom="@dimen/activity_margin" + android:paddingLeft="@dimen/normal_margin" + android:paddingRight="@dimen/normal_margin" + android:paddingTop="@dimen/activity_margin"> + android:paddingBottom="@dimen/activity_margin" + android:paddingLeft="@dimen/normal_margin" + android:paddingRight="@dimen/normal_margin" + android:paddingTop="@dimen/activity_margin"> + android:paddingBottom="@dimen/activity_margin" + android:paddingLeft="@dimen/normal_margin" + android:paddingRight="@dimen/normal_margin" + android:paddingTop="@dimen/activity_margin"> + android:paddingBottom="@dimen/activity_margin" + android:paddingLeft="@dimen/normal_margin" + android:paddingRight="@dimen/normal_margin" + android:paddingTop="@dimen/activity_margin"> + android:paddingBottom="@dimen/activity_margin" + android:paddingLeft="@dimen/normal_margin" + android:paddingRight="@dimen/normal_margin" + android:paddingTop="@dimen/activity_margin"> + android:paddingBottom="@dimen/activity_margin" + android:paddingLeft="@dimen/normal_margin" + android:paddingRight="@dimen/normal_margin" + android:paddingTop="@dimen/activity_margin"> + android:paddingBottom="@dimen/activity_margin" + android:paddingLeft="@dimen/normal_margin" + android:paddingRight="@dimen/normal_margin" + android:paddingTop="@dimen/activity_margin"> + android:paddingBottom="@dimen/activity_margin" + android:paddingLeft="@dimen/normal_margin" + android:paddingRight="@dimen/normal_margin" + android:paddingTop="@dimen/activity_margin"> + android:paddingBottom="@dimen/activity_margin" + android:paddingLeft="@dimen/normal_margin" + android:paddingRight="@dimen/normal_margin" + android:paddingTop="@dimen/activity_margin"> + android:paddingBottom="@dimen/activity_margin" + android:paddingLeft="@dimen/normal_margin" + android:paddingRight="@dimen/normal_margin" + android:paddingTop="@dimen/activity_margin"> + android:paddingBottom="@dimen/activity_margin" + android:paddingLeft="@dimen/normal_margin" + android:paddingRight="@dimen/normal_margin" + android:paddingTop="@dimen/activity_margin"> + android:paddingBottom="@dimen/activity_margin" + android:paddingLeft="@dimen/normal_margin" + android:paddingRight="@dimen/normal_margin" + android:paddingTop="@dimen/activity_margin"> + android:paddingBottom="@dimen/activity_margin" + android:paddingLeft="@dimen/normal_margin" + android:paddingRight="@dimen/normal_margin" + android:paddingTop="@dimen/activity_margin"> + android:paddingBottom="@dimen/activity_margin" + android:paddingLeft="@dimen/normal_margin" + android:paddingRight="@dimen/normal_margin" + android:paddingTop="@dimen/activity_margin"> + android:paddingBottom="@dimen/activity_margin" + android:paddingLeft="@dimen/normal_margin" + android:paddingRight="@dimen/normal_margin" + android:paddingTop="@dimen/activity_margin"> + android:paddingBottom="@dimen/activity_margin" + android:paddingLeft="@dimen/normal_margin" + android:paddingRight="@dimen/normal_margin" + android:paddingTop="@dimen/activity_margin"> + android:paddingBottom="@dimen/activity_margin" + android:paddingLeft="@dimen/normal_margin" + android:paddingRight="@dimen/normal_margin" + android:paddingTop="@dimen/activity_margin"> Date: Fri, 9 Feb 2018 22:01:29 +0100 Subject: [PATCH 60/63] reduce the padding of Settings section labels too --- app/src/main/res/layout/activity_settings.xml | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index 215e3f23c..98d195bbb 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -90,8 +90,8 @@ android:id="@+id/visibility_label" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginLeft="@dimen/big_margin" - android:layout_marginStart="@dimen/big_margin" + android:layout_marginLeft="@dimen/bigger_margin" + android:layout_marginStart="@dimen/bigger_margin" android:layout_marginTop="@dimen/activity_margin" android:text="@string/visibility" android:textAllCaps="true" @@ -220,8 +220,8 @@ android:id="@+id/videos_label" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginLeft="@dimen/big_margin" - android:layout_marginStart="@dimen/big_margin" + android:layout_marginLeft="@dimen/bigger_margin" + android:layout_marginStart="@dimen/bigger_margin" android:layout_marginTop="@dimen/activity_margin" android:text="@string/videos" android:textAllCaps="true" @@ -307,8 +307,8 @@ android:id="@+id/thumbnails_label" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginLeft="@dimen/big_margin" - android:layout_marginStart="@dimen/big_margin" + android:layout_marginLeft="@dimen/bigger_margin" + android:layout_marginStart="@dimen/bigger_margin" android:layout_marginTop="@dimen/activity_margin" android:text="@string/thumbnails" android:textAllCaps="true" @@ -394,8 +394,8 @@ android:id="@+id/scrolling_label" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginLeft="@dimen/big_margin" - android:layout_marginStart="@dimen/big_margin" + android:layout_marginLeft="@dimen/bigger_margin" + android:layout_marginStart="@dimen/bigger_margin" android:layout_marginTop="@dimen/activity_margin" android:text="@string/scrolling" android:textAllCaps="true" @@ -458,8 +458,8 @@ android:id="@+id/fullscreen_media_label" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginLeft="@dimen/big_margin" - android:layout_marginStart="@dimen/big_margin" + android:layout_marginLeft="@dimen/bigger_margin" + android:layout_marginStart="@dimen/bigger_margin" android:layout_marginTop="@dimen/activity_margin" android:text="@string/fullscreen_media" android:textAllCaps="true" @@ -695,8 +695,8 @@ android:id="@+id/extended_details_label" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginLeft="@dimen/big_margin" - android:layout_marginStart="@dimen/big_margin" + android:layout_marginLeft="@dimen/bigger_margin" + android:layout_marginStart="@dimen/bigger_margin" android:layout_marginTop="@dimen/activity_margin" android:text="@string/extended_details" android:textAllCaps="true" @@ -779,8 +779,8 @@ android:id="@+id/security_label" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginLeft="@dimen/big_margin" - android:layout_marginStart="@dimen/big_margin" + android:layout_marginLeft="@dimen/bigger_margin" + android:layout_marginStart="@dimen/bigger_margin" android:layout_marginTop="@dimen/activity_margin" android:text="@string/security" android:textAllCaps="true" @@ -843,8 +843,8 @@ android:id="@+id/file_operations_label" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginLeft="@dimen/big_margin" - android:layout_marginStart="@dimen/big_margin" + android:layout_marginLeft="@dimen/bigger_margin" + android:layout_marginStart="@dimen/bigger_margin" android:layout_marginTop="@dimen/activity_margin" android:text="@string/file_operations" android:textAllCaps="true" From caaac2d6c3e148c65d4dee20b72d7b2c5d440043 Mon Sep 17 00:00:00 2001 From: anthologist Date: Sat, 10 Feb 2018 11:40:19 +0100 Subject: [PATCH 61/63] Updated italian --- app/src/main/res/values-it/strings.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index c294d5ca2..a0bb6b6bd 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -126,7 +126,7 @@ Scorri le miniature orizzontalmente Nascondi UI di sistema con media a schermo intero Elimina cartelle vuote dopo averne eliminato il contenuto - Allow controlling photo brightness with vertical gestures + Controlla la luminosità delle foto con gesti verticali Gestisci il volume e la luminosità dei video con gesti verticali Mostra numero elementi nella cartella Sostituisci Condividi con Ruota a schermo intero @@ -136,7 +136,7 @@ Cambia media istantaneamente toccando sui lati dello schermo Sostituisci le immagini ingrandibili a fondo con altre di migliore qualità Nascondi i dettagli estesi quando la barra di stato è nascosta - Do an extra check to avoid showing invalid files + Fai un controllo ulteriore per evitare di mostrare file non validi Miniature From 5f47c2ae55aec4d98c3bd33dbc8aad90d3e3bc66 Mon Sep 17 00:00:00 2001 From: FTno <16176811+FTno@users.noreply.github.com> Date: Sat, 10 Feb 2018 16:51:42 +0100 Subject: [PATCH 62/63] Update strings.xml Norwegian translation update --- app/src/main/res/values-nb/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/values-nb/strings.xml b/app/src/main/res/values-nb/strings.xml index be3397d38..cf7e1d702 100644 --- a/app/src/main/res/values-nb/strings.xml +++ b/app/src/main/res/values-nb/strings.xml @@ -136,7 +136,7 @@ Tillat å skifte media øyeblikkelig ved å trykke på kanten av skjermen Erstatt dyp-zoombare bilder med bilder av bedre kvalitet Skjul utvidede detaljer når statuslinjen er skjult - Do an extra check to avoid showing invalid files + Gjør en ekstra sjekk for å unngå visning av ugyldige filer Minibilder From fafc7cebe031bbfa5cbce0e299c79663aed1e3f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Marques?= Date: Sat, 10 Feb 2018 16:07:41 +0000 Subject: [PATCH 63/63] Update strings.xml --- app/src/main/res/values-pt/strings.xml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index 0cd30703d..c158d291d 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -29,7 +29,7 @@ Filtrar multimédia Imagens Vídeos - GIFs + GIF Não foram encontrados ficheiros que cumpram os requisitos. Alterar filtros @@ -98,7 +98,7 @@ Intervalo (segundos): Incluir fotos Incluir vídeos - Incluir GIFs + Incluir GIF Ordem aleatória Usar animações Mover para trás @@ -115,7 +115,7 @@ Reproduzir vídeos automaticamente Mostrar/ocultar nome do ficheiro Vídeos em ciclo - Animação de GIFs nas miniaturas + Animação de GIF nas miniaturas Brilho máximo permitido Recortar miniaturas em quadrados Rodar em ecrã completo por @@ -126,22 +126,22 @@ Deslocação horizontal de miniaturas Ocultar interface do sistema se em ecrã completo Apagar as pastas vazias depois de remover o seu conteúdo - Allow controlling photo brightness with vertical gestures - Permitir controlo do volume e brilho dos vídeos através de gestos verticais + Permitir controlo do brilho das fotos com gestos verticais + Permitir controlo do volume e do brilho dos vídeos através de gestos verticais Mostrar número de ficheiros na vista principal Substituir a opção Partilhar pela opção Rodar se em ecrã completo Mostrar detalhes se em ecrã completo Gerir detalhes exibidos - Allow one finger zoom at fullscreen media - Allow instantly changing media by clicking on screen sides + Permitir ampliação com um dedo se em ecrã completo + Permitir troca imediata de ficheiro ao tocar nas margens do ecrã Replace deep zoomable images with better quality ones - Hide extended details when status bar is hidden - Do an extra check to avoid showing invalid files + Ocultar detalhes extra se a barra de estado estiver oculta + Efetuar uma dupla verificação para evitar mostrar os ficheiros inválidos - Thumbnails - Fullscreen media - Extended details + Miniaturas + Multimédia em ecrã completo + Detalhes extra