diff --git a/app/build.gradle b/app/build.gradle index 205e7ff6a..19eb2c665 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -43,7 +43,7 @@ ext { } dependencies { - implementation 'com.simplemobiletools:commons:3.8.11' + implementation 'com.simplemobiletools:commons:3.8.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' 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 82d85fffd..6bb06015e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -239,8 +239,9 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { } private fun getDirectories() { - if (mIsGettingDirs) + if (mIsGettingDirs) { return + } mIsGettingDirs = true val dirs = getCachedDirectories() 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 e9b36642f..0be1d39e6 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -42,7 +42,7 @@ import java.io.File import java.io.IOException class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { - private val SAVE_MEDIA_CNT = 100 + private val SAVE_MEDIA_CNT = 80 private val LAST_MEDIA_CHECK_PERIOD = 3000L private var mPath = "" @@ -611,9 +611,14 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { private fun storeFolder() { if (!config.temporarilyShowHidden) { - val subList = mMedia.subList(0, Math.min(SAVE_MEDIA_CNT, mMedia.size)) - val json = Gson().toJson(subList) - config.saveFolderMedia(mPath, json) + Thread { + try { + val subList = mMedia.subList(0, Math.min(SAVE_MEDIA_CNT, mMedia.size)) + val json = Gson().toJson(subList) + config.saveFolderMedia(mPath, json) + } catch (ignored: OutOfMemoryError) { + } + }.start() } } 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 4b08f6971..0e75cdddd 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt @@ -56,7 +56,9 @@ class SettingsActivity : SimpleActivity() { setupShowInfoBubble() setupOneFingerZoom() setupAllowInstantChange() + setupReplaceZoomableImages() setupShowExtendedDetails() + setupHideExtendedDetails() setupManageExtendedDetails() updateTextColors(settings_holder) setupSectionColors() @@ -64,7 +66,8 @@ class SettingsActivity : SimpleActivity() { private fun setupSectionColors() { val adjustedPrimaryColor = getAdjustedPrimaryColor() - arrayListOf(visibility_label, videos_label, thumbnails_label, scrolling_label, fullscreen_media_label, security_label, file_operations_label).forEach { + arrayListOf(visibility_label, videos_label, thumbnails_label, scrolling_label, fullscreen_media_label, security_label, + file_operations_label, extended_details_label).forEach { it.setTextColor(adjustedPrimaryColor) } } @@ -295,12 +298,30 @@ class SettingsActivity : SimpleActivity() { } } + private fun setupReplaceZoomableImages() { + settings_replace_zoomable_images.isChecked = config.replaceZoomableImages + settings_replace_zoomable_images_holder.setOnClickListener { + settings_replace_zoomable_images.toggle() + config.replaceZoomableImages = settings_replace_zoomable_images.isChecked + } + } + private fun setupShowExtendedDetails() { settings_show_extended_details.isChecked = config.showExtendedDetails settings_show_extended_details_holder.setOnClickListener { settings_show_extended_details.toggle() config.showExtendedDetails = settings_show_extended_details.isChecked settings_manage_extended_details_holder.beVisibleIf(config.showExtendedDetails) + settings_hide_extended_details_holder.beVisibleIf(config.showExtendedDetails) + } + } + + private fun setupHideExtendedDetails() { + settings_hide_extended_details_holder.beVisibleIf(config.showExtendedDetails) + settings_hide_extended_details.isChecked = config.hideExtendedDetails + settings_hide_extended_details_holder.setOnClickListener { + settings_hide_extended_details.toggle() + config.hideExtendedDetails = settings_hide_extended_details.isChecked } } 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 26104988a..f9a813d6d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -68,6 +68,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View private var mIsOrientationLocked = false private var mStoredUseEnglish = false + private var mStoredReplaceZoomableImages = false private var mMediaFiles = ArrayList() companion object { @@ -106,6 +107,11 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View return } + if (mStoredReplaceZoomableImages != config.replaceZoomableImages) { + mPrevHashcode = 0 + refreshViewPager() + } + supportActionBar?.setBackgroundDrawable(resources.getDrawable(R.drawable.actionbar_gradient_background)) if (config.maxBrightness) { @@ -204,7 +210,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View } } - reloadViewPager() + refreshViewPager() scanPath(mPath) if (config.blackBackground) { @@ -291,7 +297,10 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View } private fun storeStateVariables() { - mStoredUseEnglish = config.useEnglish + config.apply { + mStoredUseEnglish = useEnglish + mStoredReplaceZoomableImages = replaceZoomableImages + } } private fun updatePagerItems(media: MutableList) { @@ -456,7 +465,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View tryCopyMoveFilesTo(files, isCopyOperation) { config.tempFolderPath = "" if (!isCopyOperation) { - reloadViewPager() + refreshViewPager() } } } @@ -605,8 +614,9 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View private fun isShowHiddenFlagNeeded(): Boolean { val file = File(mPath) - if (file.isHidden) + if (file.isHidden) { return true + } var parent = file.parentFile ?: return false while (true) { @@ -692,7 +702,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View if (requestCode == REQUEST_EDIT_IMAGE) { if (resultCode == Activity.RESULT_OK && resultData != null) { mPos = -1 - reloadViewPager() + refreshViewPager() } } else if (requestCode == REQUEST_SET_AS) { if (resultCode == Activity.RESULT_OK) { @@ -719,7 +729,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View private fun deleteConfirmed() { deleteFile(File(getCurrentMedia()[mPos].path)) { - reloadViewPager() + refreshViewPager() } } @@ -758,7 +768,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View } } - private fun reloadViewPager() { + private fun refreshViewPager() { GetMediaAsynctask(applicationContext, mDirectory, false, false, mShowAll) { gotMedia(it) }.execute() 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 4bbc7ef34..1cb1d5e23 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt @@ -8,6 +8,7 @@ import android.graphics.Matrix import android.graphics.drawable.ColorDrawable import android.media.ExifInterface.* import android.net.Uri +import android.os.AsyncTask import android.os.Bundle import android.view.LayoutInflater import android.view.View @@ -41,10 +42,13 @@ class PhotoFragment : ViewPagerFragment() { private var isFragmentVisible = false private var isFullscreen = false private var wasInit = false - private var storedShowExtendedDetails = false - private var storedExtendedDetails = 0 + private var imageOrientation = -1 private var gifDrawable: GifDrawable? = null + private var storedShowExtendedDetails = false + private var storedHideExtendedDetails = false + private var storedExtendedDetails = 0 + lateinit var view: ViewGroup lateinit var medium: Medium @@ -56,6 +60,7 @@ class PhotoFragment : ViewPagerFragment() { instant_next_item.setOnClickListener { listener?.goToNextItem() } } + storeStateVariables() if (!isFragmentVisible && activity is PhotoActivity) { isFragmentVisible = true } @@ -102,8 +107,7 @@ class PhotoFragment : ViewPagerFragment() { override fun onPause() { super.onPause() - storedShowExtendedDetails = context!!.config.showExtendedDetails - storedExtendedDetails = context!!.config.extendedDetails + storeStateVariables() } override fun onResume() { @@ -115,6 +119,7 @@ class PhotoFragment : ViewPagerFragment() { val allowInstantChange = context!!.config.allowInstantChange view.instant_prev_item.beVisibleIf(allowInstantChange) view.instant_next_item.beVisibleIf(allowInstantChange) + storeStateVariables() } override fun setMenuVisibility(menuVisible: Boolean) { @@ -129,6 +134,14 @@ class PhotoFragment : ViewPagerFragment() { } } + private fun storeStateVariables() { + context!!.config.apply { + storedShowExtendedDetails = showExtendedDetails + storedHideExtendedDetails = hideExtendedDetails + storedExtendedDetails = extendedDetails + } + } + private fun gifFragmentVisibilityChanged(isVisible: Boolean) { if (isVisible) { gifDrawable?.start() @@ -162,6 +175,7 @@ class PhotoFragment : ViewPagerFragment() { } private fun loadImage() { + imageOrientation = getImageOrientation() if (medium.isGif()) { loadGif() } else { @@ -193,8 +207,12 @@ class PhotoFragment : ViewPagerFragment() { private fun loadBitmap(degrees: Float = 0f) { if (degrees == 0f) { - val targetWidth = if (ViewPagerActivity.screenWidth == 0) Target.SIZE_ORIGINAL else ViewPagerActivity.screenWidth - val targetHeight = if (ViewPagerActivity.screenHeight == 0) Target.SIZE_ORIGINAL else ViewPagerActivity.screenHeight + var targetWidth = if (ViewPagerActivity.screenWidth == 0) Target.SIZE_ORIGINAL else ViewPagerActivity.screenWidth + var targetHeight = if (ViewPagerActivity.screenHeight == 0) Target.SIZE_ORIGINAL else ViewPagerActivity.screenHeight + if (imageOrientation == ORIENTATION_ROTATE_90) { + targetWidth = targetHeight + targetHeight = Target.SIZE_ORIGINAL + } val options = RequestOptions() .signature(medium.path.getFileSignature()) @@ -230,39 +248,24 @@ class PhotoFragment : ViewPagerFragment() { } private fun addZoomableView() { - if ((medium.isImage()) && isFragmentVisible && view.subsampling_view.isGone() && !medium.isDng()) { - val defaultOrientation = -1 - var orient = defaultOrientation - - try { - val exif = android.media.ExifInterface(medium.path) - orient = exif.getAttributeInt(android.media.ExifInterface.TAG_ORIENTATION, defaultOrientation) - - if (orient == defaultOrientation) { - val uri = if (medium.path.startsWith("content:/")) Uri.parse(medium.path) else Uri.fromFile(File(medium.path)) - val inputStream = context!!.contentResolver.openInputStream(uri) - val exif2 = ExifInterface() - exif2.readExif(inputStream, ExifInterface.Options.OPTION_ALL) - orient = exif2.getTag(ExifInterface.TAG_ORIENTATION)?.getValueAsInt(defaultOrientation) ?: defaultOrientation - } - } catch (ignored: Exception) { - } - + if (!context!!.config.replaceZoomableImages && medium.isImage() && isFragmentVisible && view.subsampling_view.isGone() && !medium.isDng()) { ViewPagerActivity.wasDecodedByGlide = false view.subsampling_view.apply { maxScale = 10f beVisible() isQuickScaleEnabled = context.config.oneFingerZoom setImage(ImageSource.uri(medium.path)) - orientation = if (orient == -1) SubsamplingScaleImageView.ORIENTATION_USE_EXIF else degreesForRotation(orient) + orientation = if (imageOrientation == -1) SubsamplingScaleImageView.ORIENTATION_USE_EXIF else degreesForRotation(imageOrientation) + setEagerLoadingEnabled(false) + setExecutor(AsyncTask.SERIAL_EXECUTOR) setOnImageEventListener(object : SubsamplingScaleImageView.OnImageEventListener { override fun onImageLoaded() { } override fun onReady() { background = ColorDrawable(if (context.config.blackBackground) Color.BLACK else context.config.backgroundColor) - val useWidth = if (orient == ORIENTATION_ROTATE_90 || orient == ORIENTATION_ROTATE_270) sHeight else sWidth - val useHeight = if (orient == ORIENTATION_ROTATE_90 || orient == ORIENTATION_ROTATE_270) sWidth else sHeight + val useWidth = if (imageOrientation == ORIENTATION_ROTATE_90 || imageOrientation == ORIENTATION_ROTATE_270) sHeight else sWidth + val useHeight = if (imageOrientation == ORIENTATION_ROTATE_90 || imageOrientation == ORIENTATION_ROTATE_270) sWidth else sHeight setDoubleTapZoomScale(getDoubleTapZoomScale(useWidth, useHeight)) } @@ -286,6 +289,26 @@ class PhotoFragment : ViewPagerFragment() { } } + private fun getImageOrientation(): Int { + val defaultOrientation = -1 + var orient = defaultOrientation + + try { + val exif = android.media.ExifInterface(medium.path) + orient = exif.getAttributeInt(android.media.ExifInterface.TAG_ORIENTATION, defaultOrientation) + + if (orient == defaultOrientation) { + val uri = if (medium.path.startsWith("content:/")) Uri.parse(medium.path) else Uri.fromFile(File(medium.path)) + val inputStream = context!!.contentResolver.openInputStream(uri) + val exif2 = ExifInterface() + exif2.readExif(inputStream, ExifInterface.Options.OPTION_ALL) + orient = exif2.getTag(ExifInterface.TAG_ORIENTATION)?.getValueAsInt(defaultOrientation) ?: defaultOrientation + } + } catch (ignored: Exception) { + } + return orient + } + private fun getDoubleTapZoomScale(width: Int, height: Int): Float { val bitmapAspectRatio = height / width.toFloat() val screenAspectRatio = ViewPagerActivity.screenHeight / ViewPagerActivity.screenWidth.toFloat() @@ -350,8 +373,12 @@ class PhotoFragment : ViewPagerFragment() { override fun fullscreenToggled(isFullscreen: Boolean) { this.isFullscreen = isFullscreen view.photo_details.apply { - if (isVisible()) { + if (storedShowExtendedDetails) { animate().y(getExtendedDetailsY(height)) + + if (storedHideExtendedDetails) { + animate().alpha(if (isFullscreen) 0f else 1f).start() + } } } } 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 8b3099e43..0ee831121 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt @@ -43,11 +43,9 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee private var mIsFullscreen = false private var mIsFragmentVisible = false private var mPlayOnPrepare = false - private var mStoredShowExtendedDetails = false private var wasEncoded = false private var wasInit = false private var isPrepared = false - private var mStoredExtendedDetails = 0 private var mCurrTime = 0 private var mDuration = 0 private var mEncodedPath = "" @@ -63,6 +61,10 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee private var mSlideInfoText = "" private var mSlideInfoFadeHandler = Handler() + private var mStoredShowExtendedDetails = false + private var mStoredHideExtendedDetails = false + private var mStoredExtendedDetails = 0 + lateinit var medium: Medium override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { @@ -72,6 +74,7 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee mTimeHolder = video_time_holder } + storeStateVariables() medium = arguments!!.getSerializable(MEDIUM) as Medium // setMenuVisibility is not called at VideoActivity (third party intent) @@ -107,13 +110,13 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee if (context!!.config.showExtendedDetails != mStoredShowExtendedDetails || context!!.config.extendedDetails != mStoredExtendedDetails) { checkExtendedDetails() } + storeStateVariables() } override fun onPause() { super.onPause() pauseVideo() - mStoredShowExtendedDetails = context!!.config.showExtendedDetails - mStoredExtendedDetails = context!!.config.extendedDetails + storeStateVariables() } override fun onDestroy() { @@ -123,6 +126,14 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee } } + private fun storeStateVariables() { + context!!.config.apply { + mStoredShowExtendedDetails = showExtendedDetails + mStoredHideExtendedDetails = hideExtendedDetails + mStoredExtendedDetails = extendedDetails + } + } + private fun setupPlayer() { if (activity == null) return @@ -614,8 +625,12 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee mIsFullscreen = isFullscreen checkFullscreen() mView!!.video_details.apply { - if (isVisible()) { + if (mStoredShowExtendedDetails) { animate().y(getExtendedDetailsY(height)) + + if (mStoredHideExtendedDetails) { + animate().alpha(if (isFullscreen) 0f else 1f).start() + } } } } 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 e76e02c38..5002bf781 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt @@ -176,6 +176,10 @@ class Config(context: Context) : BaseConfig(context) { get() = prefs.getBoolean(ALLOW_INSTANT_CHANGE, false) set(allowInstantChange) = prefs.edit().putBoolean(ALLOW_INSTANT_CHANGE, allowInstantChange).apply() + var replaceZoomableImages: Boolean + get() = prefs.getBoolean(REPLACE_ZOOMABLE_IMAGES, false) + set(replaceZoomableImages) = prefs.edit().putBoolean(REPLACE_ZOOMABLE_IMAGES, replaceZoomableImages).apply() + private fun getDirectoryColumnsField(): String { val isPortrait = context.resources.configuration.orientation == Configuration.ORIENTATION_PORTRAIT return if (isPortrait) { @@ -305,6 +309,10 @@ class Config(context: Context) : BaseConfig(context) { get() = prefs.getBoolean(SHOW_EXTENDED_DETAILS, false) set(showExtendedDetails) = prefs.edit().putBoolean(SHOW_EXTENDED_DETAILS, showExtendedDetails).apply() + var hideExtendedDetails: Boolean + get() = prefs.getBoolean(HIDE_EXTENDED_DETAILS, false) + set(hideExtendedDetails) = prefs.edit().putBoolean(HIDE_EXTENDED_DETAILS, hideExtendedDetails).apply() + 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() 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 1ef5d45b1..821d9f1e8 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt @@ -1,109 +1,107 @@ package com.simplemobiletools.gallery.helpers // shared preferences -val SORT_ORDER = "sort_order" -val DIRECTORY_SORT_ORDER = "directory_sort_order" -val SORT_FOLDER_PREFIX = "sort_folder_" -val SHOW_HIDDEN_MEDIA = "show_hidden_media" -val TEMPORARILY_SHOW_HIDDEN = "temporarily_show_hidden" -val IS_THIRD_PARTY_INTENT = "is_third_party_intent" -val AUTOPLAY_VIDEOS = "autoplay_videos" -val LOOP_VIDEOS = "loop_videos" -val ANIMATE_GIFS = "animate_gifs" -val MAX_BRIGHTNESS = "max_brightness" -val CROP_THUMBNAILS = "crop_thumbnails" -val SCREEN_ROTATION = "screen_rotation" -val DISPLAY_FILE_NAMES = "display_file_names" -val DARK_BACKGROUND = "dark_background" -val PINNED_FOLDERS = "pinned_folders" -val FILTER_MEDIA = "filter_media" -val DIR_COLUMN_CNT = "dir_column_cnt" -val DIR_LANDSCAPE_COLUMN_CNT = "dir_landscape_column_cnt" -val DIR_HORIZONTAL_COLUMN_CNT = "dir_horizontal_column_cnt" -val DIR_LANDSCAPE_HORIZONTAL_COLUMN_CNT = "dir_landscape_horizontal_column_cnt" -val MEDIA_COLUMN_CNT = "media_column_cnt" -val MEDIA_LANDSCAPE_COLUMN_CNT = "media_landscape_column_cnt" -val MEDIA_HORIZONTAL_COLUMN_CNT = "media_horizontal_column_cnt" -val MEDIA_LANDSCAPE_HORIZONTAL_COLUMN_CNT = "media_landscape_horizontal_column_cnt" -val SHOW_ALL = "show_all" // display images and videos from all folders together -val SAVE_FOLDER_PREFIX = "folder2_" -val HIDE_FOLDER_TOOLTIP_SHOWN = "hide_folder_tooltip_shown" -val EXCLUDED_FOLDERS = "excluded_folders" -val INCLUDED_FOLDERS = "included_folders" -val ALBUM_COVERS = "album_covers" -val SCROLL_HORIZONTALLY = "scroll_horizontally" -val HIDE_SYSTEM_UI = "hide_system_ui" -val REPLACE_SHARE_WITH_ROTATE = "replace_share_with_rotate" -val DELETE_EMPTY_FOLDERS = "delete_empty_folders" -val ALLOW_VIDEO_GESTURES = "allow_video_gestures" -val SHOW_MEDIA_COUNT = "show_media_count" -val TEMP_FOLDER_PATH = "temp_folder_path" -val VIEW_TYPE_FOLDERS = "view_type_folders" -val VIEW_TYPE_FILES = "view_type_files" -val SHOW_EXTENDED_DETAILS = "show_extended_details" -val EXTENDED_DETAILS = "extended_details" -val LAST_FILE_CLEANUP = "last_file_cleanup" -val ONE_FINGER_ZOOM = "one_finger_zoom" -val ALLOW_INSTANT_CHANGE = "allow_instant_change" +const val SORT_ORDER = "sort_order" +const val DIRECTORY_SORT_ORDER = "directory_sort_order" +const val SORT_FOLDER_PREFIX = "sort_folder_" +const val SHOW_HIDDEN_MEDIA = "show_hidden_media" +const val TEMPORARILY_SHOW_HIDDEN = "temporarily_show_hidden" +const val IS_THIRD_PARTY_INTENT = "is_third_party_intent" +const val AUTOPLAY_VIDEOS = "autoplay_videos" +const val LOOP_VIDEOS = "loop_videos" +const val ANIMATE_GIFS = "animate_gifs" +const val MAX_BRIGHTNESS = "max_brightness" +const val CROP_THUMBNAILS = "crop_thumbnails" +const val SCREEN_ROTATION = "screen_rotation" +const val DISPLAY_FILE_NAMES = "display_file_names" +const val DARK_BACKGROUND = "dark_background" +const val PINNED_FOLDERS = "pinned_folders" +const val FILTER_MEDIA = "filter_media" +const val DIR_COLUMN_CNT = "dir_column_cnt" +const val DIR_LANDSCAPE_COLUMN_CNT = "dir_landscape_column_cnt" +const val DIR_HORIZONTAL_COLUMN_CNT = "dir_horizontal_column_cnt" +const val DIR_LANDSCAPE_HORIZONTAL_COLUMN_CNT = "dir_landscape_horizontal_column_cnt" +const val MEDIA_COLUMN_CNT = "media_column_cnt" +const val MEDIA_LANDSCAPE_COLUMN_CNT = "media_landscape_column_cnt" +const val MEDIA_HORIZONTAL_COLUMN_CNT = "media_horizontal_column_cnt" +const val MEDIA_LANDSCAPE_HORIZONTAL_COLUMN_CNT = "media_landscape_horizontal_column_cnt" +const val SHOW_ALL = "show_all" // display images and videos from all folders together +const val SAVE_FOLDER_PREFIX = "folder2_" +const val HIDE_FOLDER_TOOLTIP_SHOWN = "hide_folder_tooltip_shown" +const val EXCLUDED_FOLDERS = "excluded_folders" +const val INCLUDED_FOLDERS = "included_folders" +const val ALBUM_COVERS = "album_covers" +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_VIDEO_GESTURES = "allow_video_gestures" +const val SHOW_MEDIA_COUNT = "show_media_count" +const val TEMP_FOLDER_PATH = "temp_folder_path" +const val VIEW_TYPE_FOLDERS = "view_type_folders" +const val VIEW_TYPE_FILES = "view_type_files" +const val SHOW_EXTENDED_DETAILS = "show_extended_details" +const val EXTENDED_DETAILS = "extended_details" +const val HIDE_EXTENDED_DETAILS = "hide_extended_details" +const val LAST_FILE_CLEANUP = "last_file_cleanup" +const val ONE_FINGER_ZOOM = "one_finger_zoom" +const val ALLOW_INSTANT_CHANGE = "allow_instant_change" +const val REPLACE_ZOOMABLE_IMAGES = "replace_zoomable_images" // slideshow -val SLIDESHOW_INTERVAL = "slideshow_interval" -val SLIDESHOW_INCLUDE_PHOTOS = "slideshow_include_photos" -val SLIDESHOW_INCLUDE_VIDEOS = "slideshow_include_videos" -val SLIDESHOW_INCLUDE_GIFS = "slideshow_include_gifs" -val SLIDESHOW_RANDOM_ORDER = "slideshow_random_order" -val SLIDESHOW_USE_FADE = "slideshow_use_fade" -val SLIDESHOW_MOVE_BACKWARDS = "slideshow_move_backwards" -val SLIDESHOW_LOOP = "loop_slideshow" -val SLIDESHOW_DEFAULT_INTERVAL = 5 -val SLIDESHOW_SCROLL_DURATION = 500L +const val SLIDESHOW_INTERVAL = "slideshow_interval" +const val SLIDESHOW_INCLUDE_PHOTOS = "slideshow_include_photos" +const val SLIDESHOW_INCLUDE_VIDEOS = "slideshow_include_videos" +const val SLIDESHOW_INCLUDE_GIFS = "slideshow_include_gifs" +const val SLIDESHOW_RANDOM_ORDER = "slideshow_random_order" +const val SLIDESHOW_USE_FADE = "slideshow_use_fade" +const val SLIDESHOW_MOVE_BACKWARDS = "slideshow_move_backwards" +const val SLIDESHOW_LOOP = "loop_slideshow" +const val SLIDESHOW_DEFAULT_INTERVAL = 5 +const val SLIDESHOW_SCROLL_DURATION = 500L -val NOMEDIA = ".nomedia" -val MAX_COLUMN_COUNT = 20 +const val NOMEDIA = ".nomedia" +const val MAX_COLUMN_COUNT = 20 -val DIRECTORY = "directory" -val MEDIUM = "medium" -val PATH = "path" -val GET_IMAGE_INTENT = "get_image_intent" -val GET_VIDEO_INTENT = "get_video_intent" -val GET_ANY_INTENT = "get_any_intent" -val SET_WALLPAPER_INTENT = "set_wallpaper_intent" -val DIRECTORIES = "directories2" -val IS_VIEW_INTENT = "is_view_intent" -val PICKED_PATHS = "picked_paths" +const val DIRECTORY = "directory" +const val MEDIUM = "medium" +const val PATH = "path" +const val GET_IMAGE_INTENT = "get_image_intent" +const val GET_VIDEO_INTENT = "get_video_intent" +const val GET_ANY_INTENT = "get_any_intent" +const val SET_WALLPAPER_INTENT = "set_wallpaper_intent" +const val DIRECTORIES = "directories2" +const val IS_VIEW_INTENT = "is_view_intent" +const val PICKED_PATHS = "picked_paths" // rotations -val ROTATE_BY_SYSTEM_SETTING = 0 -val ROTATE_BY_DEVICE_ROTATION = 1 -val ROTATE_BY_ASPECT_RATIO = 2 - -val ORIENT_PORTRAIT = 0 -val ORIENT_LANDSCAPE_LEFT = 1 -val ORIENT_LANDSCAPE_RIGHT = 2 +const val ROTATE_BY_SYSTEM_SETTING = 0 +const val ROTATE_BY_DEVICE_ROTATION = 1 +const val ROTATE_BY_ASPECT_RATIO = 2 // filter media -val IMAGES = 1 -val VIDEOS = 2 -val GIFS = 4 +const val IMAGES = 1 +const val VIDEOS = 2 +const val GIFS = 4 // view types -val VIEW_TYPE_GRID = 1 -val VIEW_TYPE_LIST = 2 +const val VIEW_TYPE_GRID = 1 +const val VIEW_TYPE_LIST = 2 // extended details values -val EXT_NAME = 1 -val EXT_PATH = 2 -val EXT_SIZE = 4 -val EXT_RESOLUTION = 8 -val EXT_LAST_MODIFIED = 16 -val EXT_DATE_TAKEN = 32 -val EXT_CAMERA_MODEL = 64 -val EXT_EXIF_PROPERTIES = 128 -val EXT_DURATION = 256 -val EXT_ARTIST = 512 -val EXT_ALBUM = 1024 +const val EXT_NAME = 1 +const val EXT_PATH = 2 +const val EXT_SIZE = 4 +const val EXT_RESOLUTION = 8 +const val EXT_LAST_MODIFIED = 16 +const val EXT_DATE_TAKEN = 32 +const val EXT_CAMERA_MODEL = 64 +const val EXT_EXIF_PROPERTIES = 128 +const val EXT_DURATION = 256 +const val EXT_ARTIST = 512 +const val EXT_ALBUM = 1024 // media types -val TYPE_IMAGE = 1 -val TYPE_VIDEO = 2 -val TYPE_GIF = 3 +const val TYPE_IMAGE = 1 +const val TYPE_VIDEO = 2 +const val TYPE_GIF = 3 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 8f5eb9dec..e0e797f0f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt @@ -43,8 +43,11 @@ class MediaFetcher(val context: Context) { Thread { val ONE_WEEK = 7 * 24 * 60 * 60 * 1000 if (System.currentTimeMillis() - context.config.lastFileCleanup > ONE_WEEK) { - media.filter { !File(it.path).exists() }.forEach { - context.deleteFromMediaStore(File(it.path)) + media.forEach { + val file = File(it.path) + if (!it.path.contains("/.thumbnails") && !file.exists() && file.length() == 0L) { + context.deleteFromMediaStore(file) + } } context.config.lastFileCleanup = System.currentTimeMillis() } diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index 00563ba86..6558a9fb1 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -498,7 +498,7 @@ - - - - - + android:text="@string/replace_zoomable_images"/> @@ -570,6 +552,81 @@ + + + + + + + + + + + + + + + + + + + + إدارة المجلدات المستبعدة 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 Thumbnails Fullscreen media + Extended details diff --git a/app/src/main/res/values-ca/strings.xml b/app/src/main/res/values-ca/strings.xml index 6f1726843..3a9d14765 100644 --- a/app/src/main/res/values-ca/strings.xml +++ b/app/src/main/res/values-ca/strings.xml @@ -133,10 +133,13 @@ Gestioneu els detalls ampliats 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 + Replace deep zoomable images with better quality ones + Hide extended details when status bar is hidden Miniatures Mitjans a pantalla completa + Extended details diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index 59d2f5b5b..859adbd5f 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -133,10 +133,13 @@ Manage extended details 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 Thumbnails Fullscreen media + Extended details diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 0dbe9ba7c..f8312ab60 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -133,10 +133,13 @@ Eigenschaften auswählen Erlaube Ein-Finger-Zoom im Vollbild Wechsle sofort zwischen Medien beim Klicken auf eine Bildschirmseite + Replace deep zoomable images with better quality ones + Hide extended details when status bar is hidden Thumbnails Vollbild-Medien + Extended details diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 6b5bba3b3..48d62891a 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -133,10 +133,13 @@ Administrar detalles ampliados Permitir zoom con un dedo en pantalla completa Permitir el cambio instantáneo de medios haciendo clic en los lados de la pantalla + Replace deep zoomable images with better quality ones + Hide extended details when status bar is hidden Miniaturas Medios a pantalla compelta + Extended details diff --git a/app/src/main/res/values-fi/strings.xml b/app/src/main/res/values-fi/strings.xml index 0ebfd563c..45386c324 100644 --- a/app/src/main/res/values-fi/strings.xml +++ b/app/src/main/res/values-fi/strings.xml @@ -133,10 +133,13 @@ Manage extended details 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 Thumbnails Fullscreen media + Extended details diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 8bf9120cc..51702b67f 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -133,10 +133,13 @@ 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 Thumbnails Fullscreen media + Extended details diff --git a/app/src/main/res/values-gl/strings.xml b/app/src/main/res/values-gl/strings.xml index d20147d76..31b8eb039 100644 --- a/app/src/main/res/values-gl/strings.xml +++ b/app/src/main/res/values-gl/strings.xml @@ -133,10 +133,13 @@ Xestionar información polo miúdo Permitir zoom con un dedo a pantalla completa 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 Thumbnails Fullscreen media + Extended details diff --git a/app/src/main/res/values-hr/strings.xml b/app/src/main/res/values-hr/strings.xml index c3fa34712..9de39af66 100644 --- a/app/src/main/res/values-hr/strings.xml +++ b/app/src/main/res/values-hr/strings.xml @@ -133,10 +133,13 @@ Upravljaj detaljnim informacijama 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 Thumbnails Fullscreen media + Extended details diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index b170b2ae3..d2ff7481a 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -133,10 +133,13 @@ Manage extended details 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 Thumbnails Fullscreen media + Extended details diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 341c91f91..a040ee80d 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -133,10 +133,13 @@ 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 Thumbnails Fullscreen media + Extended details diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 4ec08d44e..c2d4de191 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -133,10 +133,13 @@ Manage extended details 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 Thumbnails Fullscreen media + Extended details diff --git a/app/src/main/res/values-ko-rKR/strings.xml b/app/src/main/res/values-ko-rKR/strings.xml index 4e8b1eb70..03a188346 100644 --- a/app/src/main/res/values-ko-rKR/strings.xml +++ b/app/src/main/res/values-ko-rKR/strings.xml @@ -133,10 +133,13 @@ 확장된 세부정보 관리 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 Thumbnails Fullscreen media + Extended details diff --git a/app/src/main/res/values-nb/strings.xml b/app/src/main/res/values-nb/strings.xml index e88d5fff1..342bb2f27 100644 --- a/app/src/main/res/values-nb/strings.xml +++ b/app/src/main/res/values-nb/strings.xml @@ -132,11 +132,14 @@ Vis flere detaljer i mediavisningen Velg detaljer Tillat en-finger-zoom i mediavisningen - Tillat å skifte media øyeblikkelig ved å klikke på kanten av skjermen + 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 Minibilder Mediavisning + Utvidede detaljer diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index 321d551ff..620635981 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -133,10 +133,13 @@ Uitgebreide informatie Met één vinger zoomen in volledig scherm Direct naar vorige/volgende door op de zijkanten van het scherm te tikken + Replace deep zoomable images with better quality ones + Hide extended details when status bar is hidden Miniatuurvoorbeelden Volledig scherm + Extended details diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index 8ae734ff3..5b5505b85 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -133,10 +133,13 @@ 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 Thumbnails Fullscreen media + Extended details diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index f902c70b9..f7e31c054 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -133,10 +133,13 @@ Gerenciar detalhes extendidos 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 Thumbnails Fullscreen media + Extended details diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index 4fb410d4d..8afac4e8d 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -133,10 +133,13 @@ Gerir detalhes exibidos 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 Thumbnails Fullscreen media + Extended details diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 2f7181162..69b3df690 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -133,10 +133,13 @@ Выбрать подробности файла Масштабирование одним пальцем в полноэкранном режиме Мгновенное переключение медиафайлов нажатием по краю экрана + Заменить масштабируемые изображения высококачественными + Не показывать подробности, если скрыта строка состояния Миниатюры Полноэкранное отображение медиафайлов + Подробности diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index 879c506ab..aeb067881 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -133,10 +133,13 @@ Spravovať rozšírené vlastnosti Povoliť približovanie jedným prstom v celoobrazovkovom režime 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 - Thumbnails - Fullscreen media + Náhľady + Celoobrazovkový režim + Rozšírené vlastnosti diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index 3f16c064c..a4c380455 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -133,10 +133,13 @@ Hantera utökad information 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 Thumbnails Fullscreen media + Extended details diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index d93037695..fdb8ddf11 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -133,10 +133,13 @@ Manage extended details 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 Thumbnails Fullscreen media + Extended details diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 2f2102a94..31a2665d4 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -133,10 +133,13 @@ 要显示的详细信息项目 单指缩放 通过单击屏幕边缘来切换媒体 + 用质量更好的图像替换可深度缩放的图像 + Hide extended details when status bar is hidden 缩略图 全屏显示媒体 + Extended details diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index b73db9377..d59ddb4f4 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -133,10 +133,13 @@ 管理詳細資訊 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 Thumbnails Fullscreen media + Extended details diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index b5415b8b3..5cea74dfe 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -133,10 +133,13 @@ Manage extended details 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 Thumbnails Fullscreen media + Extended details