diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d017dc06..38dadd51b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,114 @@ Changelog ========== +Version 6.17.1 *(2020-11-03)* +---------------------------- + + * Reverting to the previous UI of the main screen, but keep rounded corners at list view + * Some UI and stability improvements + +Version 6.17.0 *(2020-11-02)* +---------------------------- + + * Redesigning the main folders screen, try making it moderner (!) + * Fix some glitches with deep zoomable fullscreen images not loading in well + * Couple other UX, stability and translation improvements + +Version 6.16.5 *(2020-10-28)* +---------------------------- + + * Added some hidden folder handling related improvements + * Fixed saving files on the SD card after editing + * Couple other UX, translation and performance improvements + +Version 6.16.4 *(2020-10-24)* +---------------------------- + + * Fixed an editor glitch occurring if the file path contained spaces + * Added some stability improvements + +Version 6.16.3 *(2020-10-16)* +---------------------------- + + * Updated the photo editor to fix some issues, mostly related to Android 11 + * Make sure file moving doesn't block the UI in any case + +Version 6.16.2 *(2020-10-10)* +---------------------------- + + * Fix sorting by Date Taken + * Properly display some wrongly named WebP files + +Version 6.16.1 *(2020-09-27)* +---------------------------- + + * Fixed a bug with some folders not being recognized + * Improved thumbnail loading performance in some cases + +Version 6.16.0 *(2020-09-25)* +---------------------------- + + * Adding support for animated WebP files + * Fixed a permissions glitch after upgrading to Android 11 + * Added many performance related improvements + +Version 6.15.6 *(2020-09-22)* +---------------------------- + + * Fixed the file loading performance in some cases + * Fixed some photo editor related glitches + * Fixed the Use English language settings toggle + +Version 6.15.5 *(2020-09-16)* +---------------------------- + + * Properly fetch the latest available Last Modified of files + +Version 6.15.4 *(2020-09-16)* +---------------------------- + + * Improved file loading performance + +Version 6.15.3 *(2020-09-09)* +---------------------------- + + * Improved file loading performance in some cases + * Some UX, translation and stability improvements + +Version 6.15.2 *(2020-06-17)* +---------------------------- + + * Fixed a glitch at caching fullscreen images + * Properly recognize a new type of panoramic images + +Version 6.15.1 *(2020-06-12)* +---------------------------- + + * Fixed a glitch at caching fullscreen images + * Improved batch renaming with patterns + +Version 6.15.0 *(2020-06-07)* +---------------------------- + + * Rescan the internal storage from time to time, look for new folders containing media + * Improve the Search user experience, do not reset it at opening an item + * Fixed some editor glitches + * Speed up fullscreen image loading + +Version 6.14.10 *(2020-05-29)* +---------------------------- + + * Updated the image editor, fix a glitch with black preview + * Show Portrait images by default on Android 10 + * Use a nicer icon on older devices + * Some translation and stability improvements + +Version 6.14.9 *(2020-05-18)* +---------------------------- + + * Fixing some glitches with hidden folders not being shown when appropriate + * Added some stability and translation improvements + Version 6.14.8 *(2020-05-05)* ---------------------------- diff --git a/app/build.gradle b/app/build.gradle index f76bd1d69..f8424da7e 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -17,9 +17,8 @@ android { applicationId "com.simplemobiletools.gallery.pro" minSdkVersion 21 targetSdkVersion 29 - versionCode 309 - versionName "6.14.8" - multiDexEnabled true + versionCode 326 + versionName "6.17.1" setProperty("archivesBaseName", "gallery-$versionCode") vectorDrawables.useSupportLibrary = true } @@ -78,12 +77,11 @@ android { } dependencies { - implementation 'com.simplemobiletools:commons:5.28.4' + implementation 'com.simplemobiletools:commons:5.31.19' implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0' - implementation 'androidx.multidex:multidex:2.0.1' implementation 'it.sephiroth.android.exif:library:1.0.1' implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.19' - implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta4' + implementation 'androidx.constraintlayout:constraintlayout:2.0.1' implementation 'com.google.android.exoplayer:exoplayer-core:2.9.6' implementation 'com.google.vr:sdk-panowidget:1.180.0' implementation 'com.google.vr:sdk-videowidget:1.180.0' @@ -92,7 +90,9 @@ dependencies { implementation 'com.squareup.picasso:picasso:2.71828' implementation 'com.caverock:androidsvg-aar:1.3' implementation 'com.github.tibbi:gestureviews:512f929d82' - implementation 'com.github.tibbi:subsampling-scale-image-view:381878c078' + implementation 'com.github.tibbi:subsampling-scale-image-view:81c021514c' + implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0' + implementation 'com.github.penfeizhou.android.animation:awebp:2.5.1' kapt 'com.github.bumptech.glide:compiler:4.10.0' diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index de8fca45c..2cbbf2613 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -5,7 +5,12 @@ package="com.simplemobiletools.gallery.pro" android:installLocation="auto"> - + + + { - override fun onLoadFailed(e: GlideException?, model: Any?, target: Target?, isFirstResource: Boolean): Boolean { - if (uri != originalUri) { - uri = originalUri - Handler().post { - loadDefaultImageView() - } + .asBitmap() + .load(uri) + .apply(options) + .listener(object : RequestListener { + override fun onLoadFailed(e: GlideException?, model: Any?, target: Target?, isFirstResource: Boolean): Boolean { + if (uri != originalUri) { + uri = originalUri + Handler().post { + loadDefaultImageView() } - return false + } + return false + } + + override fun onResourceReady(bitmap: Bitmap?, model: Any?, target: Target?, dataSource: DataSource?, isFirstResource: Boolean): Boolean { + val currentFilter = getFiltersAdapter()?.getCurrentFilter() + if (filterInitialBitmap == null) { + loadCropImageView() + bottomCropRotateClicked() } - override fun onResourceReady(bitmap: Bitmap?, model: Any?, target: Target?, dataSource: DataSource?, isFirstResource: Boolean): Boolean { - val currentFilter = getFiltersAdapter()?.getCurrentFilter() - if (filterInitialBitmap == null) { - loadCropImageView() - bottomCropRotateClicked() + if (filterInitialBitmap != null && currentFilter != null && currentFilter.filter.name != getString(R.string.none)) { + default_image_view.onGlobalLayout { + applyFilter(currentFilter) } - - if (filterInitialBitmap != null && currentFilter != null && currentFilter.filter.name != getString(R.string.none)) { - default_image_view.onGlobalLayout { - applyFilter(currentFilter) - } - } else { - filterInitialBitmap = bitmap - } - - if (isCropIntent) { - bottom_primary_filter.beGone() - bottom_primary_draw.beGone() - } - - return false + } else { + filterInitialBitmap = bitmap } - }).into(default_image_view) + + if (isCropIntent) { + bottom_primary_filter.beGone() + bottom_primary_draw.beGone() + } + + return false + } + }).into(default_image_view) } private fun loadCropImageView() { @@ -275,17 +276,17 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener val size = Point() windowManager.defaultDisplay.getSize(size) val options = RequestOptions() - .format(DecodeFormat.PREFER_ARGB_8888) - .skipMemoryCache(true) - .diskCacheStrategy(DiskCacheStrategy.NONE) - .fitCenter() + .format(DecodeFormat.PREFER_ARGB_8888) + .skipMemoryCache(true) + .diskCacheStrategy(DiskCacheStrategy.NONE) + .fitCenter() try { val builder = Glide.with(applicationContext) - .asBitmap() - .load(uri) - .apply(options) - .into(editor_draw_canvas.width, editor_draw_canvas.height) + .asBitmap() + .load(uri) + .apply(options) + .into(editor_draw_canvas.width, editor_draw_canvas.height) val bitmap = builder.get() runOnUiThread { @@ -304,16 +305,7 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener @TargetApi(Build.VERSION_CODES.N) private fun saveImage() { - var inputStream: InputStream? = null - try { - if (isNougatPlus()) { - inputStream = contentResolver.openInputStream(uri!!) - oldExif = ExifInterface(inputStream!!) - } - } catch (e: Exception) { - } finally { - inputStream?.close() - } + setOldExif() if (crop_image_view.isVisible()) { crop_image_view.getCroppedImageAsync() @@ -354,6 +346,20 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener } } + @TargetApi(Build.VERSION_CODES.N) + private fun setOldExif() { + var inputStream: InputStream? = null + try { + if (isNougatPlus()) { + inputStream = contentResolver.openInputStream(uri!!) + oldExif = ExifInterface(inputStream!!) + } + } catch (e: Exception) { + } finally { + inputStream?.close() + } + } + private fun shareImage() { ensureBackgroundThread { when { @@ -591,17 +597,17 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener val bitmap = try { Glide.with(this) - .asBitmap() - .load(uri).listener(object : RequestListener { - override fun onLoadFailed(e: GlideException?, model: Any?, target: Target?, isFirstResource: Boolean): Boolean { - showErrorToast(e.toString()) - return false - } + .asBitmap() + .load(uri).listener(object : RequestListener { + override fun onLoadFailed(e: GlideException?, model: Any?, target: Target?, isFirstResource: Boolean): Boolean { + showErrorToast(e.toString()) + return false + } - override fun onResourceReady(resource: Bitmap?, model: Any?, target: Target?, dataSource: DataSource?, isFirstResource: Boolean) = false - }) - .submit(thumbnailSize, thumbnailSize) - .get() + override fun onResourceReady(resource: Bitmap?, model: Any?, target: Target?, dataSource: DataSource?, isFirstResource: Boolean) = false + }) + .submit(thumbnailSize, thumbnailSize) + .get() } catch (e: GlideException) { showErrorToast(e) finish() @@ -742,6 +748,8 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener override fun onCropImageComplete(view: CropImageView, result: CropImageView.CropResult) { if (result.error == null) { + setOldExif() + val bitmap = result.bitmap if (isSharingBitmap) { isSharingBitmap = false @@ -862,7 +870,7 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener try { if (isNougatPlus()) { val newExif = ExifInterface(file.absolutePath) - oldExif?.copyTo(newExif, false) + oldExif?.copyNonDimensionAttributesTo(newExif) } } catch (e: Exception) { } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt index 161e89604..42ef17836 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt @@ -23,7 +23,6 @@ import androidx.recyclerview.widget.RecyclerView import com.simplemobiletools.commons.dialogs.ConfirmationDialog import com.simplemobiletools.commons.dialogs.CreateNewFolderDialog import com.simplemobiletools.commons.dialogs.FilePickerDialog -import com.simplemobiletools.commons.dialogs.NewAppsIconsDialog import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.helpers.* import com.simplemobiletools.commons.models.FileDirItem @@ -84,7 +83,6 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { private var mStoredCropThumbnails = true private var mStoredScrollHorizontally = true private var mStoredShowMediaCount = true - private var mStoredShowInfoBubble = true private var mStoredTextColor = 0 private var mStoredPrimaryColor = 0 @@ -155,12 +153,6 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { finish() } } - - // notify some users about the Dialer, SMS Messenger and Voice Recorder apps - if (!config.wasMessengerRecorderShown && config.appRunCount > 35) { - NewAppsIconsDialog(this) - config.wasMessengerRecorderShown = true - } } override fun onStart() { @@ -204,28 +196,28 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { directories_horizontal_fastscroller.updateBubbleColors() directories_vertical_fastscroller.updateBubbleColors() - directories_horizontal_fastscroller.allowBubbleDisplay = config.showInfoBubble - directories_vertical_fastscroller.allowBubbleDisplay = config.showInfoBubble directories_refresh_layout.isEnabled = config.enablePullToRefresh - invalidateOptionsMenu() directories_empty_placeholder.setTextColor(config.textColor) directories_empty_placeholder_2.setTextColor(getAdjustedPrimaryColor()) directories_switch_searching.setTextColor(getAdjustedPrimaryColor()) directories_switch_searching.underlineText() - if (mIsPasswordProtectionPending && !mWasProtectionHandled) { - handleAppPasswordProtection { - mWasProtectionHandled = it - if (it) { - mIsPasswordProtectionPending = false - tryLoadGallery() - } else { - finish() + if (!mIsSearchOpen) { + invalidateOptionsMenu() + if (mIsPasswordProtectionPending && !mWasProtectionHandled) { + handleAppPasswordProtection { + mWasProtectionHandled = it + if (it) { + mIsPasswordProtectionPending = false + tryLoadGallery() + } else { + finish() + } } + } else { + tryLoadGallery() } - } else { - tryLoadGallery() } } @@ -239,7 +231,6 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { override fun onStop() { super.onStop() - mSearchMenuItem?.collapseActionView() if (config.temporarilyShowHidden || config.tempSkipDeleteConfirmation) { mTempShowHiddenHandler.postDelayed({ @@ -342,7 +333,6 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { mStoredCropThumbnails = cropThumbnails mStoredScrollHorizontally = scrollHorizontally mStoredShowMediaCount = showMediaCount - mStoredShowInfoBubble = showInfoBubble mStoredTextColor = textColor mStoredPrimaryColor = primaryColor } @@ -439,22 +429,27 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { } private fun tryLoadGallery() { - if (hasPermission(PERMISSION_WRITE_STORAGE)) { - if (!config.wasUpgradedFromFreeShown && isPackageInstalled("com.simplemobiletools.gallery")) { - ConfirmationDialog(this, "", R.string.upgraded_from_free, R.string.ok, 0) {} - config.wasUpgradedFromFreeShown = true - } + handlePermission(PERMISSION_WRITE_STORAGE) { + if (it) { + if (!config.wasUpgradedFromFreeShown && isPackageInstalled("com.simplemobiletools.gallery")) { + ConfirmationDialog(this, "", R.string.upgraded_from_free, R.string.ok, 0) {} + config.wasUpgradedFromFreeShown = true + } - checkOTGPath() - checkDefaultSpamFolders() + checkOTGPath() + checkDefaultSpamFolders() - if (config.showAll) { - showAllMedia() + if (config.showAll) { + showAllMedia() + } else { + getDirectories() + } + + setupLayoutManager() } else { - getDirectories() + toast(R.string.no_storage_permissions) + finish() } - - setupLayoutManager() } } @@ -638,6 +633,21 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { layoutManager.spanCount = config.dirColumnCnt } + private fun setupListLayoutManager() { + val layoutManager = directories_grid.layoutManager as MyGridLayoutManager + layoutManager.spanCount = 1 + layoutManager.orientation = RecyclerView.VERTICAL + directories_refresh_layout.layoutParams = FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT) + + val smallMargin = resources.getDimension(R.dimen.small_margin).toInt() + (directories_grid.layoutParams as RelativeLayout.LayoutParams).apply { + topMargin = smallMargin + bottomMargin = smallMargin + } + + mZoomListener = null + } + private fun measureRecyclerViewContent(directories: ArrayList) { directories_grid.onGlobalLayout { if (config.scrollHorizontally) { @@ -687,21 +697,6 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { } } - private fun setupListLayoutManager() { - val layoutManager = directories_grid.layoutManager as MyGridLayoutManager - layoutManager.spanCount = 1 - layoutManager.orientation = RecyclerView.VERTICAL - directories_refresh_layout.layoutParams = FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT) - - val smallMargin = resources.getDimension(R.dimen.small_margin).toInt() - (directories_grid.layoutParams as RelativeLayout.LayoutParams).apply { - topMargin = smallMargin - bottomMargin = smallMargin - } - - mZoomListener = null - } - private fun toggleRecycleBin(show: Boolean) { config.showRecycleBinAtFolders = show invalidateOptionsMenu() @@ -907,10 +902,13 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { val hiddenString = getString(R.string.hidden) val albumCovers = config.parseAlbumCovers() val includedFolders = config.includedFolders + val noMediaFolders = getNoMediaFoldersSync() val tempFolderPath = config.tempFolderPath val getProperFileSize = config.directorySorting and SORT_BY_SIZE != 0 val favoritePaths = getFavoritePaths() val dirPathsToRemove = ArrayList() + val lastModifieds = if (isRPlus()) mLastMediaFetcher!!.getLastModifieds() else HashMap() + val dateTakens = mLastMediaFetcher!!.getDateTakens() try { for (directory in dirs) { @@ -930,14 +928,16 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { grouping and GROUP_BY_LAST_MODIFIED_DAILY != 0 || grouping and GROUP_BY_LAST_MODIFIED_MONTHLY != 0 - val curMedia = mLastMediaFetcher!!.getFilesFrom(directory.path, getImagesOnly, getVideosOnly, getProperDateTaken, getProperLastModified, getProperFileSize, favoritePaths, false) + val curMedia = mLastMediaFetcher!!.getFilesFrom(directory.path, getImagesOnly, getVideosOnly, getProperDateTaken, getProperLastModified, + getProperFileSize, favoritePaths, false, lastModifieds, dateTakens) + val newDir = if (curMedia.isEmpty()) { if (directory.path != tempFolderPath) { dirPathsToRemove.add(directory.path) } directory } else { - createDirectoryFromMedia(directory.path, curMedia, albumCovers, hiddenString, includedFolders, getProperFileSize) + createDirectoryFromMedia(directory.path, curMedia, albumCovers, hiddenString, includedFolders, getProperFileSize, noMediaFolders) } // we are looping through the already displayed folders looking for changes, do not do anything if nothing changed @@ -969,14 +969,19 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { }.start() } - getCachedMedia(directory.path, getVideosOnly, getImagesOnly) { - it.forEach { - if (!curMedia.contains(it)) { - val path = (it as? Medium)?.path - if (path != null) { - deleteDBPath(path) + if (!directory.isRecycleBin()) { + getCachedMedia(directory.path, getVideosOnly, getImagesOnly) { + val mediaToDelete = ArrayList() + it.forEach { + if (!curMedia.contains(it)) { + val medium = it as? Medium + val path = medium?.path + if (path != null) { + mediaToDelete.add(medium) + } } } + mediaDB.deleteMedia(*mediaToDelete.toTypedArray()) } } } @@ -1022,7 +1027,9 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { grouping and GROUP_BY_LAST_MODIFIED_DAILY != 0 || grouping and GROUP_BY_LAST_MODIFIED_MONTHLY != 0 - val newMedia = mLastMediaFetcher!!.getFilesFrom(folder, getImagesOnly, getVideosOnly, getProperDateTaken, getProperLastModified, getProperFileSize, favoritePaths, false) + val newMedia = mLastMediaFetcher!!.getFilesFrom(folder, getImagesOnly, getVideosOnly, getProperDateTaken, getProperLastModified, + getProperFileSize, favoritePaths, false, lastModifieds, dateTakens) + if (newMedia.isEmpty()) { continue } @@ -1036,7 +1043,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { } } - val newDir = createDirectoryFromMedia(folder, newMedia, albumCovers, hiddenString, includedFolders, getProperFileSize) + val newDir = createDirectoryFromMedia(folder, newMedia, albumCovers, hiddenString, includedFolders, getProperFileSize, noMediaFolders) dirs.add(newDir) setupAdapter(dirs) @@ -1077,6 +1084,11 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { }.mapTo(everShownFolders) { it.path } try { + // scan the internal storage from time to time for new folders + if (config.appRunCount == 1 || config.appRunCount % 30 == 0) { + everShownFolders.addAll(getFoldersWithMedia(config.internalStoragePath)) + } + // catch some extreme exceptions like too many everShownFolders for storing, shouldnt really happen config.everShownFolders = everShownFolders } catch (e: Exception) { @@ -1171,12 +1183,10 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { directories_horizontal_fastscroller.beVisibleIf(allowHorizontalScroll) if (allowHorizontalScroll) { - directories_horizontal_fastscroller.allowBubbleDisplay = config.showInfoBubble directories_horizontal_fastscroller.setViews(directories_grid, directories_refresh_layout) { directories_horizontal_fastscroller.updateBubbleText(getBubbleTextItem(it)) } } else { - directories_vertical_fastscroller.allowBubbleDisplay = config.showInfoBubble directories_vertical_fastscroller.setViews(directories_grid, directories_refresh_layout) { directories_vertical_fastscroller.updateBubbleText(getBubbleTextItem(it)) } @@ -1326,6 +1336,27 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { } } + private fun getFoldersWithMedia(path: String): HashSet { + val folders = HashSet() + try { + val files = File(path).listFiles() + if (files != null) { + files.sortBy { !it.isDirectory } + for (file in files) { + if (file.isDirectory && !file.startsWith("${config.internalStoragePath}/Android")) { + folders.addAll(getFoldersWithMedia(file.absolutePath)) + } else if (file.isFile && file.isMediaFile()) { + folders.add(file.parent ?: "") + break + } + } + } + } catch (ignored: Exception) { + } + + return folders + } + override fun refreshItems() { getDirectories() } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MediaActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MediaActivity.kt index 5ac44db95..532af9486 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MediaActivity.kt @@ -24,10 +24,7 @@ import com.bumptech.glide.request.target.SimpleTarget import com.bumptech.glide.request.transition.Transition import com.simplemobiletools.commons.dialogs.CreateNewFolderDialog 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.helpers.SORT_BY_RANDOM -import com.simplemobiletools.commons.helpers.ensureBackgroundThread +import com.simplemobiletools.commons.helpers.* import com.simplemobiletools.commons.models.FileDirItem import com.simplemobiletools.commons.views.MyGridLayoutManager import com.simplemobiletools.commons.views.MyRecyclerView @@ -76,7 +73,6 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener { private var mStoredAnimateGifs = true private var mStoredCropThumbnails = true private var mStoredScrollHorizontally = true - private var mStoredShowInfoBubble = true private var mStoredShowFileTypes = true private var mStoredTextColor = 0 private var mStoredPrimaryColor = 0 @@ -159,13 +155,14 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener { media_horizontal_fastscroller.updateBubbleColors() media_vertical_fastscroller.updateBubbleColors() - media_horizontal_fastscroller.allowBubbleDisplay = config.showInfoBubble - media_vertical_fastscroller.allowBubbleDisplay = config.showInfoBubble media_refresh_layout.isEnabled = config.enablePullToRefresh - invalidateOptionsMenu() media_empty_text_placeholder.setTextColor(config.textColor) media_empty_text_placeholder_2.setTextColor(getAdjustedPrimaryColor()) + if (!mIsSearchOpen) { + invalidateOptionsMenu() + } + if (mMedia.isEmpty() || config.getFolderSorting(mPath) and SORT_BY_RANDOM == 0) { if (shouldSkipAuthentication()) { tryLoadGallery() @@ -195,7 +192,6 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener { override fun onStop() { super.onStop() - mSearchMenuItem?.collapseActionView() if (config.temporarilyShowHidden || config.tempSkipDeleteConfirmation) { mTempShowHiddenHandler.postDelayed({ @@ -292,7 +288,6 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener { mStoredAnimateGifs = animateGifs mStoredCropThumbnails = cropThumbnails mStoredScrollHorizontally = scrollHorizontally - mStoredShowInfoBubble = showInfoBubble mStoredShowFileTypes = showThumbnailFileTypes mStoredTextColor = textColor mStoredPrimaryColor = primaryColor @@ -393,7 +388,7 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener { initZoomListener() val fastscroller = if (config.scrollHorizontally) media_horizontal_fastscroller else media_vertical_fastscroller MediaAdapter(this, mMedia.clone() as ArrayList, this, mIsGetImageIntent || mIsGetVideoIntent || mIsGetAnyIntent, - mAllowPickingMultiple, mPath, media_grid, fastscroller) { + mAllowPickingMultiple, mPath, media_grid, fastscroller) { if (it is Medium && !isFinishing) { itemClicked(it.path) } @@ -424,12 +419,10 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener { val sorting = config.getFolderSorting(if (mShowAll) SHOW_ALL else mPath) if (allowHorizontalScroll) { - media_horizontal_fastscroller.allowBubbleDisplay = config.showInfoBubble media_horizontal_fastscroller.setViews(media_grid, media_refresh_layout) { media_horizontal_fastscroller.updateBubbleText(getBubbleTextItem(it, sorting)) } } else { - media_vertical_fastscroller.allowBubbleDisplay = config.showInfoBubble media_vertical_fastscroller.setViews(media_grid, media_refresh_layout) { media_vertical_fastscroller.updateBubbleText(getBubbleTextItem(it, sorting)) } @@ -799,24 +792,24 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener { val ratio = wantedWidth.toFloat() / wantedHeight val options = RequestOptions() - .override((wantedWidth * ratio).toInt(), wantedHeight) - .fitCenter() + .override((wantedWidth * ratio).toInt(), wantedHeight) + .fitCenter() Glide.with(this) - .asBitmap() - .load(File(path)) - .apply(options) - .into(object : SimpleTarget() { - override fun onResourceReady(resource: Bitmap, transition: Transition?) { - try { - WallpaperManager.getInstance(applicationContext).setBitmap(resource) - setResult(Activity.RESULT_OK) - } catch (ignored: IOException) { - } - - finish() + .asBitmap() + .load(File(path)) + .apply(options) + .into(object : SimpleTarget() { + override fun onResourceReady(resource: Bitmap, transition: Transition?) { + try { + WallpaperManager.getInstance(applicationContext).setBitmap(resource) + setResult(Activity.RESULT_OK) + } catch (ignored: IOException) { } - }) + + finish() + } + }) } else if (mIsGetImageIntent || mIsGetVideoIntent || mIsGetAnyIntent) { Intent().apply { data = Uri.parse(path) @@ -872,12 +865,12 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener { mLatestMediaDateId = getLatestMediaByDateId() if (!isFromCache) { val mediaToInsert = (mMedia).filter { it is Medium && it.deletedTS == 0L }.map { it as Medium } - try { - Thread { + Thread { + try { mediaDB.insertAll(mediaToInsert) - }.start() - } catch (e: Exception) { - } + } catch (e: Exception) { + } + }.start() } } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SearchActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SearchActivity.kt index 4eea261ac..d79790cb3 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SearchActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SearchActivity.kt @@ -13,6 +13,7 @@ import androidx.core.view.MenuItemCompat import androidx.recyclerview.widget.GridLayoutManager import androidx.recyclerview.widget.RecyclerView import com.simplemobiletools.commons.extensions.* +import com.simplemobiletools.commons.helpers.VIEW_TYPE_GRID import com.simplemobiletools.commons.helpers.ensureBackgroundThread import com.simplemobiletools.commons.models.FileDirItem import com.simplemobiletools.commons.views.MyGridLayoutManager @@ -218,12 +219,10 @@ class SearchActivity : SimpleActivity(), MediaOperationsListener { val sorting = config.getFolderSorting(SHOW_ALL) if (allowHorizontalScroll) { - media_horizontal_fastscroller.allowBubbleDisplay = config.showInfoBubble media_horizontal_fastscroller.setViews(media_grid) { media_horizontal_fastscroller.updateBubbleText(getBubbleTextItem(it, sorting)) } } else { - media_vertical_fastscroller.allowBubbleDisplay = config.showInfoBubble media_vertical_fastscroller.setViews(media_grid) { media_vertical_fastscroller.updateBubbleText(getBubbleTextItem(it, sorting)) } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SettingsActivity.kt index 8d43b89a8..b53113727 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SettingsActivity.kt @@ -70,7 +70,6 @@ class SettingsActivity : SimpleActivity() { setupThumbnailFileTypes() setupShowMediaCount() setupKeepLastModified() - setupShowInfoBubble() setupEnablePullToRefresh() setupAllowZoomingImages() setupShowHighestQuality() @@ -428,14 +427,6 @@ class SettingsActivity : SimpleActivity() { } } - private fun setupShowInfoBubble() { - settings_show_info_bubble.isChecked = config.showInfoBubble - settings_show_info_bubble_holder.setOnClickListener { - settings_show_info_bubble.toggle() - config.showInfoBubble = settings_show_info_bubble.isChecked - } - } - private fun setupEnablePullToRefresh() { settings_enable_pull_to_refresh.isChecked = config.enablePullToRefresh settings_enable_pull_to_refresh_holder.setOnClickListener { @@ -650,7 +641,6 @@ class SettingsActivity : SimpleActivity() { put(CROP_THUMBNAILS, config.cropThumbnails) put(SHOW_THUMBNAIL_VIDEO_DURATION, config.showThumbnailVideoDuration) put(SHOW_MEDIA_COUNT, config.showMediaCount) - put(SHOW_INFO_BUBBLE, config.showInfoBubble) put(SCROLL_HORIZONTALLY, config.scrollHorizontally) put(ENABLE_PULL_TO_REFRESH, config.enablePullToRefresh) put(MAX_BRIGHTNESS, config.maxBrightness) @@ -786,7 +776,6 @@ class SettingsActivity : SimpleActivity() { CROP_THUMBNAILS -> config.cropThumbnails = value.toBoolean() SHOW_THUMBNAIL_VIDEO_DURATION -> config.showThumbnailVideoDuration = value.toBoolean() SHOW_MEDIA_COUNT -> config.showMediaCount = value.toBoolean() - SHOW_INFO_BUBBLE -> config.showInfoBubble = value.toBoolean() SCROLL_HORIZONTALLY -> config.scrollHorizontally = value.toBoolean() ENABLE_PULL_TO_REFRESH -> config.enablePullToRefresh = value.toBoolean() MAX_BRIGHTNESS -> config.maxBrightness = value.toBoolean() diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt index a29be1226..232c07f5b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt @@ -187,11 +187,11 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View findItem(R.id.menu_change_orientation).isVisible = rotationDegrees == 0 && visibleBottomActions and BOTTOM_ACTION_CHANGE_ORIENTATION == 0 findItem(R.id.menu_change_orientation).icon = resources.getDrawable(getChangeOrientationIcon()) findItem(R.id.menu_rotate).setShowAsAction( - if (rotationDegrees != 0) { - MenuItem.SHOW_AS_ACTION_ALWAYS - } else { - MenuItem.SHOW_AS_ACTION_IF_ROOM - }) + if (rotationDegrees != 0) { + MenuItem.SHOW_AS_ACTION_ALWAYS + } else { + MenuItem.SHOW_AS_ACTION_IF_ROOM + }) } if (visibleBottomActions != 0) { @@ -718,10 +718,10 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View } val shortcut = ShortcutInfo.Builder(this, path) - .setShortLabel(medium.name) - .setIcon(Icon.createWithBitmap(drawable.convertToBitmap())) - .setIntent(intent) - .build() + .setShortLabel(medium.name) + .setIcon(Icon.createWithBitmap(drawable.convertToBitmap())) + .setIntent(intent) + .build() manager.requestPinShortcut(shortcut, null) } @@ -915,27 +915,27 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View } val options = RequestOptions() - .skipMemoryCache(true) - .diskCacheStrategy(DiskCacheStrategy.NONE) + .skipMemoryCache(true) + .diskCacheStrategy(DiskCacheStrategy.NONE) Glide.with(this) - .asBitmap() - .load(path) - .apply(options) - .listener(object : RequestListener { - override fun onLoadFailed(e: GlideException?, model: Any?, target: Target?, isFirstResource: Boolean): Boolean { - showErrorToast(e?.localizedMessage ?: "") - return false + .asBitmap() + .load(path) + .apply(options) + .listener(object : RequestListener { + override fun onLoadFailed(e: GlideException?, model: Any?, target: Target?, isFirstResource: Boolean): Boolean { + showErrorToast(e?.localizedMessage ?: "") + return false + } + + override fun onResourceReady(bitmap: Bitmap?, model: Any?, target: Target?, dataSource: DataSource?, isFirstResource: Boolean): Boolean { + if (bitmap != null) { + printHelper.printBitmap(path.getFilenameFromPath(), bitmap) } - override fun onResourceReady(bitmap: Bitmap?, model: Any?, target: Target?, dataSource: DataSource?, isFirstResource: Boolean): Boolean { - if (bitmap != null) { - printHelper.printBitmap(path.getFilenameFromPath(), bitmap) - } - - return false - } - }).submit(requestedWidth, requestedHeight) + return false + } + }).submit(requestedWidth, requestedHeight) } catch (e: Exception) { } } @@ -986,7 +986,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View if (isNougatPlus()) { val newExif = ExifInterface(file.absolutePath) - oldExif?.copyTo(newExif, false) + oldExif?.copyNonDimensionAttributesTo(newExif) } } catch (e: Exception) { } @@ -1261,8 +1261,8 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View if (bottom_actions.isVisible()) { bottom_actions.animate().alpha(newAlpha).start() arrayOf(bottom_favorite, bottom_edit, bottom_share, bottom_delete, bottom_rotate, bottom_properties, bottom_change_orientation, - bottom_slideshow, bottom_show_on_map, bottom_toggle_file_visibility, bottom_rename, bottom_set_as, bottom_copy, bottom_move, - bottom_resize).forEach { + bottom_slideshow, bottom_show_on_map, bottom_toggle_file_visibility, bottom_rename, bottom_set_as, bottom_copy, bottom_move, + bottom_resize).forEach { it.isClickable = !mIsFullScreen } } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/WidgetConfigureActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/WidgetConfigureActivity.kt index 3f0c66912..34d427655 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/WidgetConfigureActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/WidgetConfigureActivity.kt @@ -15,6 +15,7 @@ import com.simplemobiletools.gallery.pro.R import com.simplemobiletools.gallery.pro.dialogs.PickDirectoryDialog import com.simplemobiletools.gallery.pro.extensions.* import com.simplemobiletools.gallery.pro.helpers.MyWidgetProvider +import com.simplemobiletools.gallery.pro.helpers.ROUNDED_CORNERS_NONE import com.simplemobiletools.gallery.pro.models.Directory import com.simplemobiletools.gallery.pro.models.Widget import kotlinx.android.synthetic.main.activity_widget_config.* @@ -166,7 +167,7 @@ class WidgetConfigureActivity : SimpleActivity() { val path = directoryDao.getDirectoryThumbnail(folderPath) if (path != null) { runOnUiThread { - loadJpg(path, config_image, config.cropThumbnails) + loadJpg(path, config_image, config.cropThumbnails, ROUNDED_CORNERS_NONE) } } } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/DirectoryAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/DirectoryAdapter.kt index 224c6556c..c85b0927c 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/DirectoryAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/DirectoryAdapter.kt @@ -15,9 +15,7 @@ import com.simplemobiletools.commons.activities.BaseSimpleActivity import com.simplemobiletools.commons.adapters.MyRecyclerViewAdapter import com.simplemobiletools.commons.dialogs.* import com.simplemobiletools.commons.extensions.* -import com.simplemobiletools.commons.helpers.SHOW_ALL_TABS -import com.simplemobiletools.commons.helpers.ensureBackgroundThread -import com.simplemobiletools.commons.helpers.isOreoPlus +import com.simplemobiletools.commons.helpers.* import com.simplemobiletools.commons.models.FileDirItem import com.simplemobiletools.commons.views.FastScroller import com.simplemobiletools.commons.views.MyRecyclerView @@ -37,7 +35,6 @@ import kotlinx.android.synthetic.main.directory_item_grid.view.dir_lock import kotlinx.android.synthetic.main.directory_item_grid.view.dir_name import kotlinx.android.synthetic.main.directory_item_grid.view.dir_pin import kotlinx.android.synthetic.main.directory_item_grid.view.dir_thumbnail -import kotlinx.android.synthetic.main.directory_item_grid.view.photo_cnt import kotlinx.android.synthetic.main.directory_item_list.view.* import java.io.File @@ -304,7 +301,7 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList