From e15d6d850785403f2abac3356f602dc420e1d72c Mon Sep 17 00:00:00 2001 From: Tibor Kaputa Date: Wed, 7 Jun 2017 16:07:01 +0200 Subject: [PATCH 01/47] properly open manually included folders --- .../gallery/extensions/context.kt | 54 +++++++++---------- 1 file changed, 26 insertions(+), 28 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 b8f37cf99..9df154732 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt @@ -139,35 +139,33 @@ private fun parseCursor(context: Context, cur: Cursor, isPickImage: Boolean, isP } } - if (curPath.isEmpty()) { - config.includedFolders.mapNotNull { File(it).listFiles() }.forEach { - for (file in it) { - val size = file.length() - if (size <= 0L) { - continue - } - - val filename = file.name - val isImage = filename.isImageFast() || filename.isGif() - val isVideo = if (isImage) false else filename.isVideoFast() - - if (!isImage && !isVideo) - continue - - if (isVideo && (isPickImage || showMedia == IMAGES)) - continue - - if (isImage && (isPickVideo || showMedia == VIDEOS)) - continue - - val dateTaken = file.lastModified() - val dateModified = file.lastModified() - - val medium = Medium(filename, file.absolutePath, isVideo, dateModified, dateTaken, size) - val isAlreadyAdded = curMedia.any { it.path == file.absolutePath } - if (!isAlreadyAdded) - curMedia.add(medium) + config.includedFolders.filter { it.isEmpty() || it == curPath }.mapNotNull { File(it).listFiles() }.forEach { + for (file in it) { + val size = file.length() + if (size <= 0L) { + continue } + + val filename = file.name + val isImage = filename.isImageFast() || filename.isGif() + val isVideo = if (isImage) false else filename.isVideoFast() + + if (!isImage && !isVideo) + continue + + if (isVideo && (isPickImage || showMedia == IMAGES)) + continue + + if (isImage && (isPickVideo || showMedia == VIDEOS)) + continue + + val dateTaken = file.lastModified() + val dateModified = file.lastModified() + + val medium = Medium(filename, file.absolutePath, isVideo, dateModified, dateTaken, size) + val isAlreadyAdded = curMedia.any { it.path == file.absolutePath } + if (!isAlreadyAdded) + curMedia.add(medium) } } From 4e8ec2acee8679a9639354fdc31ac2c67e662dbd Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 7 Jun 2017 20:06:23 +0200 Subject: [PATCH 02/47] do not stop temporarily showing hidden folders when leaving thumbnails view --- .../com/simplemobiletools/gallery/activities/MediaActivity.kt | 3 ++- 1 file changed, 2 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 fb254a7f6..f6cefa981 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -97,7 +97,8 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { override fun onDestroy() { super.onDestroy() - config.temporarilyShowHidden = false + if (config.showAll) + config.temporarilyShowHidden = false mMedia.clear() } From a127aa9b026971ca6fd0abb2f5ec3d0197697606 Mon Sep 17 00:00:00 2001 From: Marcio Zomb13 Date: Wed, 7 Jun 2017 20:11:24 -0300 Subject: [PATCH 03/47] Update strings.xml Added missed strings PT-BR --- app/src/main/res/values-pt-rBR/strings.xml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 5fd798068..13d33b588 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -20,9 +20,9 @@ Aumentar número de colunas Reduzir número de colunas Mostrar pastas ocultas temporariamente - Change cover image - Select photo - Use default + Trocar imagem de capa + Selecionar foto + Usar padrão Esta opção oculta uma pasta com a adição de um arquivo \'.nomedia\' dentro dela, e irá ocultar todas as subpastas que estejam dentro da mesma. Você poderá rever essas pastas com a opção \'Mostrar pastas ocultas\'. Continuar? @@ -70,12 +70,12 @@ Simple Wallpaper - Definir como fundo de tela - Falha ao definir como fundo de tela - Definir fundo de tela com: + Definir como papel de parede + Falha ao definir como papel de parede + Definir papel de parede com: Aplicativo não encontrado - A definir como fundo de tela; - Fundo de tela definido com sucesso + Definindo como papel de parede; + Papel de parede com sucesso Retrato Paisagem @@ -86,8 +86,8 @@ Mostrar mídia Apenas imagens Apenas vídeos - Gifs only - Images, videos, gifs + Apenas GIFS + Imagens, vídeos, gifs Imagens e vídeos Reproduzir vídeos em ciclo Animação de gifs nas miniaturas @@ -98,7 +98,7 @@ Sensor do aparelho Proporção da mídia Fundo de tela escuro em mídia tela cheia - Scroll thumbnails horizontally + Rolar miniaturas horizontalmente From 30b0516c7ca45f612eb660a14ca76621dcd1257c Mon Sep 17 00:00:00 2001 From: WanderMax Date: Thu, 8 Jun 2017 09:19:39 +0800 Subject: [PATCH 04/47] make fix for Chinese simplified translation --- app/src/main/res/values-zh-rCN/strings.xml | 78 +++++++++++----------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 42deb7bcc..96a8517fc 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -5,41 +5,41 @@ 编辑 打开相机 打开方式 - 没有可用的应用 - (隐藏) - 锁定目录 - 解除锁定目录 - 显示目录中所有内容 - 所有目录 - 切换到目录视图 - 其他目录 + 未找到可用应用 + (隐藏) + 锁定文件夹 + 解除锁定文件夹 + 显示文件夹中所有内容 + 所有文件夹 + 切换到文件夹视图 + 其他文件夹 在地图中显示 未知位置 - 未发现地图应用 - 未发现相机应用 - 增加一行 - 减少一行 - 显示/隐藏缓存内容 - Change cover image - Select photo - Use default + 未找到地图应用 + 未找到相机应用 + 增加一栏 + 减少一栏 + 显示/隐藏缓存内容 + 更改封面图片 + 选择图片 + 使用默认 - 通过添加一个 \'.nomedia\' 文件到目录下,该目录包括子目录下的所有媒体都不会被扫描。 你可以通过设置中的 \'Show hidden folders\' 选项改变设置, 继续? + 通过添加文件 \'.nomedia\' 到文件夹,可以防止文件夹及其子文件夹下的所有媒体被扫描。您可以通过设置中的 \'显示隐藏文件夹\' 选项改变设置,是否继续? 排除 - 排除目录 - 管理排除的目录 - 目录及其子目录中的媒体将不会在Simple Gallery中显示,你可以修改设置。 - Exclude a parent instead? - 此处的目录及其子目录中的媒体将不会在Simple Gallery中显示,但是其它应用可以访问。\\n\\n如果你想对其它应用隐藏,请使用隐藏功能。 + 排除文件夹 + 管理排除文件夹 + 文件夹及其子文件夹中的媒体将不会在 Simple Gallery 中显示,您可以在设置更改。 + 是否排除父文件夹? + 此文件夹及其子文件夹中的媒体将不会在 Simple Gallery 中显示,但是其它应用可以访问。\\n\\n如果您想对其它应用隐藏,请使用隐藏功能。 移除全部 - 移除列表中的全部目录?目录不会被删除。 + 是否移除列表中的全部文件夹?文件夹不会被物理删除。 - 包含目录 - 管理包含的目录 - 添加目录 - 如果你还有应用未扫描到的媒体文件,可以将所在目录路径添加到这里。 + 包含文件夹 + 管理包含文件夹 + 添加文件夹 + 如果您还有应用未扫描到的媒体文件,请添加所在文件夹路径。 缩放 @@ -47,17 +47,17 @@ 宽度 高度 保持纵横比 - 请输入合法的分辨率 + 请输入有效分辨率 编辑器 保存 旋转 路径 - 无效的图片路径 - 图像编辑失败 - 编辑方式: - 没有可用的图片编辑器 + 无效图片路径 + 图片编辑失败 + 编辑方式: + 未找到可用图片编辑器 未知的文件路径 不能覆盖源文件 向左旋转 @@ -66,16 +66,16 @@ 翻转 水平翻转 垂直翻转 - Out of memory error + 内存不足 Simple Wallpaper 设为壁纸 壁纸设置失败 设为壁纸... - 没有应用可用 - 壁纸应用中… - 壁纸应用成功 + 未找到可用应用 + 正在设置壁纸… + 壁纸设置成功 纵向长宽比 横向长宽比 @@ -84,10 +84,10 @@ 自动播放 显示文件名 显示多媒体文件 - 仅图像 + 仅图片 仅视频 仅 GIF - 图片, 视频, GIF + 图片,视频,GIF 图片和视频 循环播放视频 GIF 缩略图 @@ -98,7 +98,7 @@ 设备方向 根据长宽比 全屏时黑色背景 - Scroll thumbnails horizontally + 水平滚动缩略图 From 5246db797f052211e6fdf13c23d1234ff477b3d0 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 14 Jun 2017 22:36:39 +0200 Subject: [PATCH 05/47] update gradle to 2.3.3 --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index bfed59203..0a26ece58 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:2.3.2' + classpath 'com.android.tools.build:gradle:2.3.3' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files From 1123497341b078bda36db4cae46a9c5cd2d3077a Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 14 Jun 2017 22:46:13 +0200 Subject: [PATCH 06/47] update kotlin to 1.1.2-5 --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index cd03e6b5f..649d239a9 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -47,7 +47,7 @@ dependencies { } buildscript { - ext.kotlin_version = '1.1.2-3' + ext.kotlin_version = '1.1.2-5' repositories { mavenCentral() } From 067a205edf16d93c0df8c26b625315a7eae3817a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Marques?= Date: Wed, 14 Jun 2017 22:22:18 +0100 Subject: [PATCH 07/47] Create strings.xml --- app/src/main/res/values-pt/strings.xml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index 89c7bfd08..631e2f4c5 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -18,11 +18,11 @@ Não existe uma aplicação adequada Não existe uma aplicação adequeada Aumentar número de colunas - Reduzir número de colunas + Diminuir número de colunas Mostrar ocultas temporariamente - Change cover image - Select photo - Use default + Alterar imagem da capa + Selecionar foto + Predefinição Esta opção oculta uma pasta com a adição de um ficheiro \'.nomedia\' na pasta, e irá ocultar todas as subpastas existentes. Pode ver as pastas com a opção \'Mostrar pastas ocultas\'. Continuar? @@ -98,7 +98,7 @@ Rotação do dispositivo Proporção Usar sempre um fundo escuro se em ecrã completo - Scroll thumbnails horizontally + Deslocação horizontal de miniaturas From e7406110a1b5590be4b80e98f4101215d000f0e7 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 15 Jun 2017 21:27:43 +0200 Subject: [PATCH 08/47] send a notifyDataSetChanged to the viewpager adapter at fullscreen media --- .../simplemobiletools/gallery/activities/ViewPagerActivity.kt | 1 + 1 file changed, 1 insertion(+) 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 fbd122166..7f6ec0753 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -228,6 +228,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View adapter = pagerAdapter currentItem = mPos addOnPageChangeListener(this@ViewPagerActivity) + adapter!!.notifyDataSetChanged() } } } From 5d2528b415e5011ba07753d5b2cd8682449b2b63 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 15 Jun 2017 21:35:08 +0200 Subject: [PATCH 09/47] check for null mediaplayer at dragging video progress --- .../com/simplemobiletools/gallery/fragments/VideoFragment.kt | 3 +++ 1 file changed, 3 insertions(+) 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 5359bcc67..2563061d1 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt @@ -348,6 +348,9 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee override fun onStartTrackingTouch(seekBar: SeekBar) { initMediaPlayer() + if (mMediaPlayer == null) + return + mMediaPlayer!!.pause() mIsDragged = true } From 9452d96e755da8de6358bf6e1b2f1156817a5002 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 15 Jun 2017 21:39:19 +0200 Subject: [PATCH 10/47] catch FileNotFoundException at returning GetImageContent intent result --- .../simplemobiletools/gallery/activities/MainActivity.kt | 6 ++---- 1 file changed, 2 insertions(+), 4 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 8e5c99539..87d2d269f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -27,10 +27,7 @@ import com.simplemobiletools.gallery.helpers.* import com.simplemobiletools.gallery.models.Directory import com.simplemobiletools.gallery.views.MyScalableRecyclerView import kotlinx.android.synthetic.main.activity_main.* -import java.io.File -import java.io.FileInputStream -import java.io.InputStream -import java.io.OutputStream +import java.io.* import java.util.* class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { @@ -302,6 +299,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { inputStream = FileInputStream(File(path)) outputStream = contentResolver.openOutputStream(output) inputStream.copyTo(outputStream) + } catch (ignored: FileNotFoundException) { } finally { inputStream?.close() outputStream?.close() From b0be8c048138a0432c8757756157463efdf00fbd Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 15 Jun 2017 21:46:31 +0200 Subject: [PATCH 11/47] add an aditional check at determining if Edit menu button will be shown --- .../com/simplemobiletools/gallery/adapters/MediaAdapter.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt index b0d7be70d..7d4968bda 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt @@ -120,7 +120,7 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, override fun onPrepareActionMode(actionMode: ActionMode?, menu: Menu): Boolean { menu.findItem(R.id.cab_rename).isVisible = selectedPositions.size <= 1 - menu.findItem(R.id.cab_edit).isVisible = selectedPositions.size == 1 && media[selectedPositions.first()].isImage() + menu.findItem(R.id.cab_edit).isVisible = selectedPositions.size == 1 && media.size > selectedPositions.first() && media[selectedPositions.first()].isImage() checkHideBtnVisibility(menu) From 29de80ff795944bcde2c2303c01cebf7c06a03cd Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 15 Jun 2017 21:53:23 +0200 Subject: [PATCH 12/47] adding an extra size check at directory adapter --- .../gallery/adapters/DirectoryAdapter.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 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 7b76fb7a9..83d750475 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt @@ -294,9 +294,11 @@ class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableList it) { + val path = dirs[it].path + if (activity.needsStupidWritePermissions(path) && config.treeUri.isEmpty()) { + needPermissionForPath = path + } } } From 7772577883ba9c39619719605090792e34d6cfb8 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 15 Jun 2017 22:09:23 +0200 Subject: [PATCH 13/47] do not cache animated gif thumbnails --- .../kotlin/com/simplemobiletools/gallery/extensions/activity.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 b1663b850..d761777f2 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt @@ -304,7 +304,7 @@ fun Activity.loadAnimatedGif(path: String, target: MySquareImageView) { .load(path) .asGif() .signature(getFileSignature(path)) - .diskCacheStrategy(DiskCacheStrategy.SOURCE) + .diskCacheStrategy(DiskCacheStrategy.NONE) .crossFade() if (config.cropThumbnails) builder.centerCrop() else builder.fitCenter() From 68c6186fa70d17da0bbe1eee1040870eec811a0d Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 15 Jun 2017 22:33:11 +0200 Subject: [PATCH 14/47] dont do anything if an action menu is clicked at photoVideoActivity without media --- .../simplemobiletools/gallery/activities/PhotoVideoActivity.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt index 56e39f852..facded0d6 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt @@ -136,6 +136,9 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList } override fun onOptionsItemSelected(item: MenuItem): Boolean { + if (mMedium == null) + return true + when (item.itemId) { R.id.menu_set_as_wallpaper -> trySetAsWallpaper(File(mMedium!!.path)) R.id.menu_open_with -> openWith(File(mMedium!!.path)) From 0fcac3deff32f4ddc90231cf6e48e933fa35c1d7 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 15 Jun 2017 22:57:58 +0200 Subject: [PATCH 15/47] store column count separate for portrait and landscape --- .../gallery/helpers/Config.kt | 19 +++++++++++++++---- .../gallery/helpers/Constants.kt | 2 ++ 2 files changed, 17 insertions(+), 4 deletions(-) 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 424721c88..4348a2b49 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt @@ -1,6 +1,7 @@ package com.simplemobiletools.gallery.helpers import android.content.Context +import android.content.res.Configuration import com.google.gson.Gson import com.google.gson.reflect.TypeToken import com.simplemobiletools.commons.helpers.BaseConfig @@ -160,12 +161,22 @@ class Config(context: Context) : BaseConfig(context) { set(showMedia) = prefs.edit().putInt(SHOW_MEDIA, showMedia).apply() var dirColumnCnt: Int - get() = prefs.getInt(DIR_COLUMN_CNT, context.resources.getInteger(R.integer.directory_columns)) - set(dirColumnCnt) = prefs.edit().putInt(DIR_COLUMN_CNT, dirColumnCnt).apply() + get() = prefs.getInt(getDirectoryColumnsField(), context.resources.getInteger(R.integer.directory_columns)) + set(dirColumnCnt) = prefs.edit().putInt(getDirectoryColumnsField(), dirColumnCnt).apply() + + private fun getDirectoryColumnsField(): String { + val isPortrait = context.resources.configuration.orientation == Configuration.ORIENTATION_PORTRAIT + return if (isPortrait) DIR_COLUMN_CNT else DIR_LANDSCAPE_COLUMN_CNT + } var mediaColumnCnt: Int - get() = prefs.getInt(MEDIA_COLUMN_CNT, context.resources.getInteger(R.integer.media_columns)) - set(mediaColumnCnt) = prefs.edit().putInt(MEDIA_COLUMN_CNT, mediaColumnCnt).apply() + get() = prefs.getInt(getMediaColumnsField(), context.resources.getInteger(R.integer.media_columns)) + set(mediaColumnCnt) = prefs.edit().putInt(getMediaColumnsField(), mediaColumnCnt).apply() + + private fun getMediaColumnsField(): String { + val isPortrait = context.resources.configuration.orientation == Configuration.ORIENTATION_PORTRAIT + return if (isPortrait) MEDIA_COLUMN_CNT else MEDIA_LANDSCAPE_COLUMN_CNT + } var directories: String get() = prefs.getString(DIRECTORIES, "") 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 21dc7c6de..7b0ae967a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt @@ -16,7 +16,9 @@ val DISPLAY_FILE_NAMES = "display_file_names" val DARK_BACKGROUND = "dark_background" val PINNED_FOLDERS = "pinned_folders" val DIR_COLUMN_CNT = "dir_column_cnt" +val DIR_LANDSCAPE_COLUMN_CNT = "dir_landscape_column_cnt" val MEDIA_COLUMN_CNT = "media_column_cnt" +val MEDIA_LANDSCAPE_COLUMN_CNT = "media_landscape_column_cnt" val SHOW_ALL = "show_all" // display images and videos from all folders together val SHOW_MEDIA = "show_media" val SAVE_FOLDER_PREFIX = "folder2_" From 11ad99a202a60314e0ac34f35664149c0a9363c5 Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 16 Jun 2017 23:22:28 +0200 Subject: [PATCH 16/47] update commons to 2.20.2 --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 649d239a9..f9c254d61 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -32,7 +32,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.20.1' + compile 'com.simplemobiletools:commons:2.20.2' compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.6.0' compile 'com.theartofdev.edmodo:android-image-cropper:2.4.0' compile 'com.bignerdranch.android:recyclerview-multiselect:0.2' From 6ed5a003150dbba6fd05f4f20075805303dfbe43 Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 16 Jun 2017 23:30:04 +0200 Subject: [PATCH 17/47] change "Set as wallpaper" to "Set as" --- .../gallery/activities/PhotoVideoActivity.kt | 4 ++-- .../gallery/activities/ViewPagerActivity.kt | 6 +++--- .../gallery/extensions/activity.kt | 16 ++++++++-------- .../gallery/helpers/Constants.kt | 2 +- app/src/main/res/menu/menu_viewpager.xml | 4 ++-- app/src/main/res/menu/photo_video_menu.xml | 4 ++-- app/src/main/res/values-cs/strings.xml | 3 ++- app/src/main/res/values-de/strings.xml | 3 ++- app/src/main/res/values-es/strings.xml | 3 ++- app/src/main/res/values-fr/strings.xml | 3 ++- app/src/main/res/values-hu/strings.xml | 3 ++- app/src/main/res/values-it/strings.xml | 3 ++- app/src/main/res/values-ja/strings.xml | 3 ++- app/src/main/res/values-pl/strings.xml | 3 ++- app/src/main/res/values-pt-rBR/strings.xml | 3 ++- app/src/main/res/values-pt/strings.xml | 3 ++- app/src/main/res/values-ru/strings.xml | 3 ++- app/src/main/res/values-sk/strings.xml | 3 ++- app/src/main/res/values-sv/strings.xml | 3 ++- app/src/main/res/values-tr/strings.xml | 3 ++- app/src/main/res/values-zh-rCN/strings.xml | 3 ++- app/src/main/res/values-zh-rTW/strings.xml | 3 ++- app/src/main/res/values/strings.xml | 3 ++- 23 files changed, 52 insertions(+), 35 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt index facded0d6..8898e84fc 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt @@ -129,7 +129,7 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList override fun onCreateOptionsMenu(menu: Menu): Boolean { menuInflater.inflate(R.menu.photo_video_menu, menu) - menu.findItem(R.id.menu_set_as_wallpaper).isVisible = mMedium?.isImage() == true + menu.findItem(R.id.menu_set_as).isVisible = mMedium?.isImage() == true menu.findItem(R.id.menu_edit).isVisible = mMedium?.isImage() == true return true @@ -140,7 +140,7 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList return true when (item.itemId) { - R.id.menu_set_as_wallpaper -> trySetAsWallpaper(File(mMedium!!.path)) + R.id.menu_set_as -> trySetAs(File(mMedium!!.path)) R.id.menu_open_with -> openWith(File(mMedium!!.path)) R.id.menu_share -> shareUri(mMedium!!, mUri) R.id.menu_edit -> openEditor(File(mMedium!!.path)) 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 7f6ec0753..28f0bc57b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -176,7 +176,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View return true menu.apply { - findItem(R.id.menu_set_as_wallpaper).isVisible = getCurrentMedium()!!.isImage() == true + findItem(R.id.menu_set_as).isVisible = getCurrentMedium()!!.isImage() == true findItem(R.id.menu_edit).isVisible = getCurrentMedium()!!.isImage() == true findItem(R.id.menu_rotate).isVisible = getCurrentMedium()!!.isImage() == true findItem(R.id.menu_save_as).isVisible = mRotationDegrees != 0f @@ -199,7 +199,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View return true when (item.itemId) { - R.id.menu_set_as_wallpaper -> trySetAsWallpaper(getCurrentFile()) + R.id.menu_set_as -> trySetAs(getCurrentFile()) R.id.menu_copy_to -> copyMoveTo(true) R.id.menu_move_to -> copyMoveTo(false) R.id.menu_open_with -> openWith(getCurrentFile()) @@ -378,7 +378,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View mPos = -1 reloadViewPager() } - } else if (requestCode == REQUEST_SET_WALLPAPER) { + } else if (requestCode == REQUEST_SET_AS) { if (resultCode == Activity.RESULT_OK) { toast(R.string.wallpaper_set_successfully) } 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 d761777f2..0d98d0802 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt @@ -25,7 +25,7 @@ import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.activities.SimpleActivity import com.simplemobiletools.gallery.helpers.NOMEDIA import com.simplemobiletools.gallery.helpers.REQUEST_EDIT_IMAGE -import com.simplemobiletools.gallery.helpers.REQUEST_SET_WALLPAPER +import com.simplemobiletools.gallery.helpers.REQUEST_SET_AS import com.simplemobiletools.gallery.models.Directory import com.simplemobiletools.gallery.models.Medium import com.simplemobiletools.gallery.views.MySquareImageView @@ -71,32 +71,32 @@ fun Activity.shareMedia(media: List) { } } -fun Activity.trySetAsWallpaper(file: File) { +fun Activity.trySetAs(file: File) { try { var uri = Uri.fromFile(file) - if (!setAsWallpaper(uri, file)) { + if (!setAs(uri, file)) { uri = getFileContentUri(file) - setAsWallpaper(uri, file, false) + setAs(uri, file, false) } } catch (e: Exception) { toast(R.string.unknown_error_occurred) } } -fun Activity.setAsWallpaper(uri: Uri, file: File, showToast: Boolean = true): Boolean { +fun Activity.setAs(uri: Uri, file: File, showToast: Boolean = true): Boolean { var success = false Intent().apply { action = Intent.ACTION_ATTACH_DATA setDataAndType(uri, file.getMimeType("image/*")) addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) - val chooser = Intent.createChooser(this, getString(R.string.set_as_wallpaper_with)) + val chooser = Intent.createChooser(this, getString(R.string.set_as)) if (resolveActivity(packageManager) != null) { - startActivityForResult(chooser, REQUEST_SET_WALLPAPER) + startActivityForResult(chooser, REQUEST_SET_AS) success = true } else { if (showToast) { - toast(R.string.no_wallpaper_setter_found) + toast(R.string.no_capable_app_found) } success = false } 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 7b0ae967a..e04df96e4 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt @@ -39,7 +39,7 @@ val DIRECTORIES = "directories2" val IS_VIEW_INTENT = "is_view_intent" val REQUEST_EDIT_IMAGE = 1 -val REQUEST_SET_WALLPAPER = 2 +val REQUEST_SET_AS = 2 // show media val IMAGES_AND_VIDEOS = 0 diff --git a/app/src/main/res/menu/menu_viewpager.xml b/app/src/main/res/menu/menu_viewpager.xml index 96dd6b3c1..f5ffc6299 100644 --- a/app/src/main/res/menu/menu_viewpager.xml +++ b/app/src/main/res/menu/menu_viewpager.xml @@ -43,8 +43,8 @@ android:title="@string/move_to" app:showAsAction="never"/> Change cover image Select photo Use default + Nastavit jako Tato funkce skryje složku, včetně podsložek, přidáním souboru \'.nomedia\'. Zobrazíte je zvolením možnosti \'Zobrazit skryté složky\' v nastavení. Pokračovat? @@ -73,7 +74,7 @@ Nastavit jako tapetu Nastavení tapety selhalo Nastavit jako tapetu pomocí: - Nebyla nalezena žádná vhodná aplikace + Nebyla nalezena žádná vhodná aplikace Nastavuje se tapeta… Tapeta byla úspěšně změněna Portrait aspect ratio diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 5e8f7e578..2a16096f5 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -23,6 +23,7 @@ Change cover image Select photo Use default + Set as Diese Funktion versteckt ausgewählte Ordner (auch für andere Apps), indem dort im Dateisystem eine \'.nomedia\'-Datei abgelegt wird. Dadurch werden auch deren Unterordner versteckt. Solche Ordner werden nur gezeigt, wenn die Einstellung \'Versteckte Ordner zeigen\' aktiv ist (auch andere Apps bieten üblicherweise eine solche Option). Fortfahren? @@ -73,7 +74,7 @@ Als Hintergrund festlegen Hintergrundbild festlegen fehlgeschlagen Als Hintergrund festlegen mit: - Keine Hintergrundbild-App gefunden + Keine Hintergrundbild-App gefunden Hintergrund festlegen… Hintergrundbild erfolgreich festgelegt Hochformat diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index feea9961a..a7e18bdca 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -23,6 +23,7 @@ Change cover image Select photo Use default + Set as Esta función oculta la carpeta agregando un archivo \'.nomedia\' en ella, y ocultará también las subcarpetas. Puede mostrarlas cambiando la opción \'Mostrar carpetas ocultas\' en los Ajustes. ¿Continuar? @@ -73,7 +74,7 @@ Establecer como fondo de pantalla Error al establecer fondo de pantalla Establecer como fondo de pantalla con: - No se encontró aplicación para ello + No se encontró aplicación para ello Estableciendo fondo de pantalla… Fondo de pantalla establecido correctamente Relación de aspecto tipo retrato diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index e98176869..f41f33db5 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -23,6 +23,7 @@ Change cover image Select photo Use default + Set as Cette option masque le dossier en ajoutant un fichier \'.nomedia\' à l\'intérieur, cela masquera aussi tous les sous-dossiers. Vous pouvez les voir en modifiant l\'option \'Afficher les dossiers cachés\' dans les Paramètres. Continuer ? @@ -73,7 +74,7 @@ Définir comme fond d\'écran Échec de la définition en tant que fond d\'écran. Définir comme fond d\'écran avec : - Aucune application trouvée pour continuer cette action + Aucune application trouvée pour continuer cette action Paramètre de fond d\'écran… Fond d\'écran défini avec succès. Ratio aspect Portrait diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index 709a41f0d..16687a634 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -23,6 +23,7 @@ Change cover image Select photo Use default + Set as This function hides the folder by adding a \'.nomedia\' file into it, it will hide all subfolders too. You can see them by toggling the \'Show hidden folders\' option in Settings. Continue? @@ -73,7 +74,7 @@ Set as Wallpaper Setting as Wallpaper failed Set as wallpaper with: - No app capable of it has been found + No app capable of it has been found Setting wallpaper… Wallpaper set successfully Portrait aspect ratio diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 5087d0362..df0b575ed 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -23,6 +23,7 @@ Change cover image Select photo Use default + Set as Questa funzione nasconde la cartella aggiungendo un file \'.nomedia\' all\'interno, nasconderà anche tutte le sottocartelle. Puoi vederle attivando l\'opzione \'Mostra cartelle nascoste\' nelle impostazioni. Continuare? @@ -73,7 +74,7 @@ Imposta come sfondo Impostazione sfondo non riuscita Imposta come sfondo con: - Non sono disponibili app compatibili + Non sono disponibili app compatibili Impostazione sfondo… Sfondo impostato correttamente Proporzioni ritratto diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index d14c6d20f..90ee2e333 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -23,6 +23,7 @@ Change cover image Select photo Use default + Set as This function hides the folder by adding a \'.nomedia\' file into it, it will hide all subfolders too. You can see them by toggling the \'Show hidden folders\' option in Settings. Continue? @@ -73,7 +74,7 @@ 壁紙として設定 壁紙としての設定に失敗しました 壁紙として設定: - 対応できるアプリが見つかりません + 対応できるアプリが見つかりません 壁紙の設定… 壁紙を正常に設定しました Portrait aspect ratio diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index e850a9af4..ad83169dc 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -23,6 +23,7 @@ Change cover image Select photo Use default + Set as Ta funkcja ukrywa folder dodając \'. \' Nomedia plik do niego, można tak ukryć wszystkie podfoldery. Można je zobaczyć poprzez przełączanie \'Pokaż ukryte foldery \' opcję w ustawieniach. Kontyntynuj? @@ -73,7 +74,7 @@ Ustaw jako tapeta Ustawienie tapety nie powiodło się Ustaw jako tapetę w: - Brak odpowiednich ustawień + Brak odpowiednich ustawień Ustawianie tapety… Tapeta ustawiona Portrait aspect ratio diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 13d33b588..3f43a07d2 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -23,6 +23,7 @@ Trocar imagem de capa Selecionar foto Usar padrão + Set as Esta opção oculta uma pasta com a adição de um arquivo \'.nomedia\' dentro dela, e irá ocultar todas as subpastas que estejam dentro da mesma. Você poderá rever essas pastas com a opção \'Mostrar pastas ocultas\'. Continuar? @@ -73,7 +74,7 @@ Definir como papel de parede Falha ao definir como papel de parede Definir papel de parede com: - Aplicativo não encontrado + Aplicativo não encontrado Definindo como papel de parede; Papel de parede com sucesso Retrato diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index 631e2f4c5..0bb25522d 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -23,6 +23,7 @@ Alterar imagem da capa Selecionar foto Predefinição + Set as Esta opção oculta uma pasta com a adição de um ficheiro \'.nomedia\' na pasta, e irá ocultar todas as subpastas existentes. Pode ver as pastas com a opção \'Mostrar pastas ocultas\'. Continuar? @@ -73,7 +74,7 @@ Definir como fundo do ecrã Falha ao definir como fundo de ecrã Definir como fundo com: - Aplicação não encontrada + Aplicação não encontrada A definir como fundo de ecrã… Fundo definido com sucesso Proporção na vertical diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index bd5fb9684..e548d978a 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -23,6 +23,7 @@ Change cover image Select photo Use default + Set as Эта опция скрывает папку, добавляя в неё файл \'.nomedia\'; будут скрыты все подпапки. Можно показывать их, переключая \'Показать скрытые папки\' в настройках. Продолжить? @@ -73,7 +74,7 @@ Установить в качестве обоев Установить не удалось Установить в качестве обоев в: - Приложение не найдено + Приложение не найдено Установка обоев… Обои успешно установлены Формат изображения diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index cf7f93f41..50fa3a04d 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -23,6 +23,7 @@ Zmeniť obal albumu Zvoliť foto Použiť predvolený + Nastaviť ako Táto funkcia skryje priečinok pridaním súboru \'.nomedia\', skryté budú aj podpriečinky. Môžete ich vidieť zvolením možnosti \'Zobraziť skryté priečinky\' v nastaveniach. Pokračovať? @@ -73,7 +74,7 @@ Nastaviť ako tapetu Nastavovanie ako tapeta zlyhalo Nastaviť ako tapetu s: - Nenašla sa žiadna vhodná aplikácia No app capable of it has been found + Nenašla sa žiadna vhodná aplikácia Nastavuje sa tapeta… Tapeta bola úspešne zmenená Orientácia nastojato diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index a0c67d09e..f2bfb000a 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -23,6 +23,7 @@ Change cover image Select photo Use default + Set as This function hides the folder by adding a \'.nomedia\' file into it, it will hide all subfolders too. You can see them by toggling the \'Show hidden folders\' option in Settings. Continue? @@ -73,7 +74,7 @@ Ange som bakgrundsbild Det gick inte att byta bakgrundsbild Ange som bakgrundsbild med: - Hittade ingen app som klarar av detta + Hittade ingen app som klarar av detta Inställningar för bakgrundsbild… Bakgrundsbilden är ändrad Portrait aspect ratio diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index 61ef91e0d..2e8be70b8 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -23,6 +23,7 @@ Change cover image Select photo Use default + Set as Bu işlev, klasöre\'.medya yok\'dosyası ekleyerek gizler; tüm alt klasörleri de gizler. Bunları Ayarlar\'da\'Gizli klasörleri göster\'seçeneğine basarak görebilirsiniz. Devam et? @@ -73,7 +74,7 @@ Duvar kağıdı olarak ayarla Duvar Kağıdı Olarak Ayarlanılamıyor İle duvar kağıdı olarak ayarla: - Mümkün olan herhangi bir uygulama bulunamadı + Mümkün olan herhangi bir uygulama bulunamadı Duvar kağıdını ayarlama… Duvar kağıdı başarıyla ayarlandı Portrait aspect ratio diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 96a8517fc..6dace54b6 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -23,6 +23,7 @@ 更改封面图片 选择图片 使用默认 + Set as 通过添加文件 \'.nomedia\' 到文件夹,可以防止文件夹及其子文件夹下的所有媒体被扫描。您可以通过设置中的 \'显示隐藏文件夹\' 选项改变设置,是否继续? @@ -73,7 +74,7 @@ 设为壁纸 壁纸设置失败 设为壁纸... - 未找到可用应用 + 未找到可用应用 正在设置壁纸… 壁纸设置成功 纵向长宽比 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index fdd431271..141edc855 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -23,6 +23,7 @@ Change cover image Select photo Use default + Set as This function hides the folder by adding a \'.nomedia\' file into it, it will hide all subfolders too. You can see them by toggling the \'Show hidden folders\' option in Settings. Continue? @@ -73,7 +74,7 @@ 設定為桌布 桌布設定失敗 用其他應用軟體設定桌布…… - 沒有可用的應用軟體 + 沒有可用的應用軟體 正在應用軟體桌布… 成功應用軟體桌布 Portrait aspect ratio diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index a65e48784..8b89683e8 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -23,6 +23,7 @@ Change cover image Select photo Use default + Set as This function hides the folder by adding a \'.nomedia\' file into it, it will hide all subfolders too. You can see them by toggling the \'Show hidden folders\' option in Settings. Continue? @@ -73,7 +74,7 @@ Set as Wallpaper Setting as Wallpaper failed Set as wallpaper with: - No app capable of it has been found + No app capable of it has been found Setting wallpaper… Wallpaper set successfully Portrait aspect ratio From f6d494f7e229b04bc86a9b9db64350ea11c44b3e Mon Sep 17 00:00:00 2001 From: mueller-ma Date: Sat, 17 Jun 2017 23:38:44 +0200 Subject: [PATCH 18/47] change "Set as wallpaper" to "Set as" --- 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 2a16096f5..f1fae7026 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -23,7 +23,7 @@ Change cover image Select photo Use default - Set as + Setzen als Diese Funktion versteckt ausgewählte Ordner (auch für andere Apps), indem dort im Dateisystem eine \'.nomedia\'-Datei abgelegt wird. Dadurch werden auch deren Unterordner versteckt. Solche Ordner werden nur gezeigt, wenn die Einstellung \'Versteckte Ordner zeigen\' aktiv ist (auch andere Apps bieten üblicherweise eine solche Option). Fortfahren? From 0220901edb5b1383401381aecb7a31ce402232df Mon Sep 17 00:00:00 2001 From: mueller-ma Date: Sun, 18 Jun 2017 00:14:38 +0200 Subject: [PATCH 19/47] Update strings.xml --- app/src/main/res/values-de/strings.xml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index f1fae7026..542b403e2 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -21,9 +21,9 @@ Kacheln vergrößern Verstecktes temporär zeigen Change cover image - Select photo - Use default - Setzen als + Bild auswählen + Standard verwenden + Festlegen als Diese Funktion versteckt ausgewählte Ordner (auch für andere Apps), indem dort im Dateisystem eine \'.nomedia\'-Datei abgelegt wird. Dadurch werden auch deren Unterordner versteckt. Solche Ordner werden nur gezeigt, wenn die Einstellung \'Versteckte Ordner zeigen\' aktiv ist (auch andere Apps bieten üblicherweise eine solche Option). Fortfahren? @@ -40,7 +40,7 @@ Einbezogene Ordner Einbezogene Ordner verwalten Ordner hinzufügen - Sollten Sie weitere Medien-Ordner haben, die von der App nicht erkannt wurden, können Sie diese hier manuell hinzufügen. + Sollten Sie weitere Medienordner haben, die von der App nicht erkannt wurden, können Sie diese hier manuell hinzufügen. Größe ändern @@ -63,7 +63,7 @@ Konnte Quelldatei nicht überschreiben Nach links drehen Nach rechts drehen - Um 180º drehen + Um 180° drehen Spiegeln Horizontal spiegeln Vertikal spiegeln @@ -87,8 +87,8 @@ Medien auswählen Nur Bilder Nur Videos - Gifs only - Images, videos, gifs + Nur GIFs + Bilder, Videos und GIFs Bilder und Videos Videos in Endlosschleife spielen Kacheln bei GIFs animieren @@ -99,7 +99,7 @@ Gerätedrehung Seitenverhältnis Schwarzer Hintergrund im Vollbild - Scroll thumbnails horizontally + Kacheln horizontal scrollen From 861fafcc830755e1a285a6ff0ddb70c2b7b67d0f Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 18 Jun 2017 09:51:12 +0200 Subject: [PATCH 20/47] capitalize GIFs --- app/src/main/res/values-cs/strings.xml | 4 ++-- app/src/main/res/values-de/strings.xml | 4 ++-- app/src/main/res/values-es/strings.xml | 6 +++--- app/src/main/res/values-fr/strings.xml | 6 +++--- app/src/main/res/values-hu/strings.xml | 6 +++--- app/src/main/res/values-it/strings.xml | 6 +++--- app/src/main/res/values-ja/strings.xml | 6 +++--- app/src/main/res/values-pl/strings.xml | 6 +++--- app/src/main/res/values-pt-rBR/strings.xml | 4 ++-- app/src/main/res/values-pt/strings.xml | 6 +++--- app/src/main/res/values-ru/strings.xml | 6 +++--- app/src/main/res/values-sk/strings.xml | 6 +++--- app/src/main/res/values-sv/strings.xml | 6 +++--- app/src/main/res/values-tr/strings.xml | 6 +++--- app/src/main/res/values-zh-rTW/strings.xml | 6 +++--- app/src/main/res/values/strings.xml | 6 +++--- 16 files changed, 45 insertions(+), 45 deletions(-) diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index d4ba5f286..47ba2b8ba 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -87,8 +87,8 @@ Zobrazit média Jen obrázky Jen videa - Gifs only - Images, videos, gifs + GIFs only + Images, videos, GIFs Obrázky i videa Přehrávat videa ve smyčce Animovat náhledy souborů GIF diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 2a16096f5..c0ef0f5e5 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -87,8 +87,8 @@ Medien auswählen Nur Bilder Nur Videos - Gifs only - Images, videos, gifs + GIFs only + Images, videos, GIFs Bilder und Videos Videos in Endlosschleife spielen Kacheln bei GIFs animieren diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index a7e18bdca..9b326b8f2 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -87,11 +87,11 @@ Mostrar multimedia Solo imágenes Solo vídeos - Gifs only - Images, videos, gifs + GIFs only + Images, videos, GIFs Imágenes y vídeos Reproducción continua de vídeos - Animar las miniaturas de gifs + Animar las miniaturas de GIFs Brillo máximo cuando se muestra multimedia Recortar miniaturas en cuadrados Rotar multimedia en pantalla completa según diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index f41f33db5..470971c4e 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -87,11 +87,11 @@ Afficher les médias Seulement les images Vidéos uniquement - Gifs only - Images, videos, gifs + GIFs only + Images, videos, GIFs Images et vidéos Tourner en boucle les vidéos - Gifs animés sur les miniatures + GIFs animés sur les miniatures Luminosité maximale lors de l\'affichage de media Rogner les miniatures en carrés Pivoter les medias plen écran selon diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index 16687a634..f1692241a 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -87,11 +87,11 @@ Show media Images only Videos only - Gifs only - Images, videos, gifs + GIFs only + Images, videos, GIFs Images and videos Loop videos - Animate gifs at thumbnails + Animate GIFs at thumbnails Max brightness when viewing media Crop thumbnails into squares Rotate fullscreen media by diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index df0b575ed..e85869135 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -87,11 +87,11 @@ Mostra tipo di media Solo immagini Solo video - Gifs only - Images, videos, gifs + GIFs only + Images, videos, GIFs Immagini e video Ripeti i video - Anima le gif in miniatura + Anima le GIF in miniatura Luminosità max durante visualizzazione Ritaglia le miniature in quadrati Ruota a schermo intero per diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 90ee2e333..2ce8f8489 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -87,11 +87,11 @@ Show media Images only Videos only - Gifs only - Images, videos, gifs + GIFs only + Images, videos, GIFs Images and videos Loop videos - Animate gifs at thumbnails + Animate GIFs at thumbnails Max brightness when viewing media Crop thumbnails into squares Rotate fullscreen media by diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index ad83169dc..02410dc9d 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -87,11 +87,11 @@ Wybierz co pokazywać Tylko Zdjęcia Tylko Filmy - Gifs only - Images, videos, gifs + GIFs only + Images, videos, GIFs Obrazy i wideo Pętla wideo - Animowanie gify z miniaturkami + Animowanie GIFy z miniaturkami Max brightness when viewing media Crop thumbnails into squares Rotate fullscreen media by diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 3f43a07d2..08a35a87a 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -88,10 +88,10 @@ Apenas imagens Apenas vídeos Apenas GIFS - Imagens, vídeos, gifs + Imagens, vídeos, GIFs Imagens e vídeos Reproduzir vídeos em ciclo - Animação de gifs nas miniaturas + Animação de GIFs nas miniaturas    Brilho máximo ao visualizar mídia Recortar miniaturas em quadrados Critério para rotação de tela diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index 0bb25522d..b9add0c44 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -87,11 +87,11 @@ Mostrar multimédia Apenas imagens Apenas vídeos - Apenas gifs - Imagens, vídeos e gifs + Apenas GIFs + Imagens, vídeos e GIFs Imagens e vídeos Vídeos em ciclo - Animação de gifs nas miniaturas + Animação de GIFs nas miniaturas Brilho máximo permitido Recortar miniaturas em quadrados Rodar em ecrã completo por diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index e548d978a..3a1f00272 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -87,11 +87,11 @@ Отображать Только изображения Только видео - Gifs only - Images, videos, gifs + GIFs only + Images, videos, GIFs Изображения и видео Повторять видео - Анимировать эскизы gif-файлов + Анимировать эскизы GIF-файлов Максимальная яркость при просмотре файлов Нарезать миниатюры в квадраты Полноэкранный поворот diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index 50fa3a04d..52b19f1e9 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -87,11 +87,11 @@ Zobraziť médiá Iba obrázky Iba videá - Iba gifká - Obrázky, videá, gifká + Iba GIFká + Obrázky, videá, GIFká Obrázky aj videá Automaticky reštartovať videá - Animovať gif súbory pri náhľade + Animovať GIF súbory pri náhľade Maximálny jas pri prezeraní médií Orezať náhľady na štvorce Otáčať obrazovku podľa Rotate fullscreen media by diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index f2bfb000a..a46dd4c16 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -87,11 +87,11 @@ Visa media Endast bilder Endast videos - Gifs only - Images, videos, gifs + GIFs only + Images, videos, GIFs Bilder och videos Återspela videos - Animate gifs at thumbnails + Animate GIFs at thumbnails Max brightness when viewing media Crop thumbnails into squares Rotate fullscreen media by diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index 2e8be70b8..409d5a350 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -87,11 +87,11 @@ Medyayı göster Yalnızca resimler Yalnızca videolar - Gifs only - Images, videos, gifs + GIFs only + Images, videos, GIFs Resimler ve videolar Videolar döngüsü - Küçük resimlerde gif\'leri canlandırın + Küçük resimlerde GIF\'leri canlandırın Ortam görüntülerken azami parlaklık Küçük resimleri karelere kırp Tarafından tam ekran medyayı döndür diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 141edc855..d8d5ac078 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -87,11 +87,11 @@ 秀出多媒體檔案 僅圖片 僅影片 - Gifs only - Images, videos, gifs + GIFs only + Images, videos, GIFs 圖片和影片 迴圈播放影片 - Animate gifs at thumbnails + Animate GIFs at thumbnails Max brightness when viewing media Crop thumbnails into squares Rotate fullscreen media by diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 8b89683e8..f98362003 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -87,11 +87,11 @@ Show media Images only Videos only - Gifs only - Images, videos, gifs + GIFs only + Images, videos, GIFs Images and videos Loop videos - Animate gifs at thumbnails + Animate GIFs at thumbnails Max brightness when viewing media Crop thumbnails into squares Rotate fullscreen media by From 4cc38a792761e2e7758231c4ff153b5c5e602c5f Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 18 Jun 2017 13:00:07 +0200 Subject: [PATCH 21/47] update commons to 2.21.0 --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index f9c254d61..8d2ecbb99 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -32,7 +32,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.20.2' + compile 'com.simplemobiletools:commons:2.21.0' compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.6.0' compile 'com.theartofdev.edmodo:android-image-cropper:2.4.0' compile 'com.bignerdranch.android:recyclerview-multiselect:0.2' From db9ddac55de5b16b18992aab37bc84c4558500b0 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 18 Jun 2017 13:18:07 +0200 Subject: [PATCH 22/47] update commons to 2.21.3 --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 8d2ecbb99..ee1e0eae3 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -32,7 +32,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.21.0' + compile 'com.simplemobiletools:commons:2.21.3' compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.6.0' compile 'com.theartofdev.edmodo:android-image-cropper:2.4.0' compile 'com.bignerdranch.android:recyclerview-multiselect:0.2' From 5f4a926faac3a52a6989d76b5d939961f2053548 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 18 Jun 2017 16:01:45 +0200 Subject: [PATCH 23/47] calculate double click scaling factor differently --- .../simplemobiletools/gallery/extensions/context.kt | 3 +++ .../gallery/fragments/PhotoFragment.kt | 11 ++++++----- 2 files changed, 9 insertions(+), 5 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 9df154732..ebbf2772f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt @@ -2,6 +2,7 @@ package com.simplemobiletools.gallery.extensions import android.content.Context import android.content.Intent +import android.content.res.Configuration import android.database.Cursor import android.net.Uri import android.provider.MediaStore @@ -19,6 +20,8 @@ import com.simplemobiletools.gallery.models.Medium import java.io.File import java.util.* +val Context.portrait get() = resources.configuration.orientation == Configuration.ORIENTATION_PORTRAIT + fun Context.getRealPathFromURI(uri: Uri): String? { var cursor: Cursor? = null try { 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 eaa7bfc91..e1fc50186 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt @@ -27,6 +27,7 @@ import com.simplemobiletools.gallery.activities.ViewPagerActivity import com.simplemobiletools.gallery.extensions.config import com.simplemobiletools.gallery.extensions.getFileSignature import com.simplemobiletools.gallery.extensions.getRealPathFromURI +import com.simplemobiletools.gallery.extensions.portrait import com.simplemobiletools.gallery.helpers.GlideRotateTransformation import com.simplemobiletools.gallery.helpers.MEDIUM import com.simplemobiletools.gallery.models.Medium @@ -238,12 +239,12 @@ class PhotoFragment : ViewPagerFragment() { val height = bitmapOptions.outHeight val bitmapAspectRatio = height / (width).toFloat() - return if (Math.abs(displayAspectRatio - bitmapAspectRatio) < RATIO_THRESHOLD) { - 2f - } else if (bitmapAspectRatio > 1f) { - width / (height).toFloat() + return if (context.portrait && bitmapAspectRatio <= 1f) { + ViewPagerActivity.screenHeight / height.toFloat() + } else if (!context.portrait && bitmapAspectRatio >= 1f) { + ViewPagerActivity.screenWidth / width.toFloat() } else { - bitmapAspectRatio + 2f } } From 7850b13d4fd1c22cf4b4b390bc122acd2dd5f4da Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 18 Jun 2017 18:17:33 +0200 Subject: [PATCH 24/47] update commons to 2.21.4 --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index ee1e0eae3..83a3424e4 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -32,7 +32,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.21.3' + compile 'com.simplemobiletools:commons:2.21.4' compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.6.0' compile 'com.theartofdev.edmodo:android-image-cropper:2.4.0' compile 'com.bignerdranch.android:recyclerview-multiselect:0.2' From 77b7608636a4578d8c5754ead053452e4c98a62c Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 18 Jun 2017 18:19:03 +0200 Subject: [PATCH 25/47] remove the unused displayAspectRatio variable --- .../com/simplemobiletools/gallery/fragments/PhotoFragment.kt | 2 -- 1 file changed, 2 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 e1fc50186..e3122eef4 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt @@ -230,8 +230,6 @@ class PhotoFragment : ViewPagerFragment() { } private fun getDoubleTapZoomScale(): Float { - val displayAspectRatio = ViewPagerActivity.screenHeight / (ViewPagerActivity.screenWidth).toFloat() - val bitmapOptions = BitmapFactory.Options() bitmapOptions.inJustDecodeBounds = true BitmapFactory.decodeFile(medium.path, bitmapOptions) From 99f14bfee1acde63413ffc4c3638fc36eecf29b9 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 18 Jun 2017 19:06:14 +0200 Subject: [PATCH 26/47] try reinitializing the mediaplayer when it becomes the selected fragment --- .../com/simplemobiletools/gallery/fragments/VideoFragment.kt | 1 + 1 file changed, 1 insertion(+) 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 2563061d1..ebc0acdee 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt @@ -95,6 +95,7 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee super.setMenuVisibility(menuVisible) mIsFragmentVisible = menuVisible if (menuVisible) { + initMediaPlayer() if (context?.config?.autoplayVideos == true) { playVideo() } From 47ec461139befa5c9498a42c84a8da1f1a89a2ba Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 18 Jun 2017 19:08:53 +0200 Subject: [PATCH 27/47] release the mediaplayer if something goes wrong at init --- .../gallery/fragments/VideoFragment.kt | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) 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 ebc0acdee..c5a556f82 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt @@ -229,6 +229,7 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee } } catch (e: IOException) { Log.e(TAG, "init media player failed $e") + releaseMediaPlayer() } } @@ -259,12 +260,16 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee private fun cleanup() { pauseVideo() mCurrTimeView?.text = 0.getFormattedDuration() - mMediaPlayer?.release() - mMediaPlayer = null + releaseMediaPlayer() mSeekBar?.progress = 0 mTimerHandler?.removeCallbacksAndMessages(null) } + private fun releaseMediaPlayer() { + mMediaPlayer?.release() + mMediaPlayer = null + } + private fun videoPrepared(mediaPlayer: MediaPlayer) { mDuration = mediaPlayer.duration / 1000 addPreviewImage() @@ -295,8 +300,7 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee } override fun surfaceDestroyed(holder: SurfaceHolder) { - mMediaPlayer?.release() - mMediaPlayer = null + releaseMediaPlayer() } private fun setVideoSize() { From 1d04e60dff44d012647fe56b63f3d0b14770cce7 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 18 Jun 2017 19:56:45 +0200 Subject: [PATCH 28/47] allow opening the image with a different editor from our editor --- .../gallery/activities/EditActivity.kt | 7 +++++++ .../gallery/activities/PhotoVideoActivity.kt | 2 +- .../gallery/activities/ViewPagerActivity.kt | 2 +- .../gallery/adapters/MediaAdapter.kt | 2 +- .../simplemobiletools/gallery/extensions/activity.kt | 12 ++++++++---- app/src/main/res/menu/menu_editor.xml | 4 ++++ 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-fr/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-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 + 23 files changed, 39 insertions(+), 7 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 d69eb1393..8ce60f1f5 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt @@ -18,6 +18,7 @@ import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.dialogs.ResizeDialog import com.simplemobiletools.gallery.dialogs.SaveAsDialog import com.simplemobiletools.gallery.extensions.getRealPathFromURI +import com.simplemobiletools.gallery.extensions.openEditor import com.theartofdev.edmodo.cropper.CropImageView import kotlinx.android.synthetic.main.view_crop_image.* import java.io.* @@ -75,6 +76,7 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener R.id.resize -> resizeImage() R.id.flip_horizontally -> flipImage(true) R.id.flip_vertically -> flipImage(false) + R.id.edit -> editWith() else -> return super.onOptionsItemSelected(item) } return true @@ -189,6 +191,11 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener crop_image_view.flipImageVertically() } + private fun editWith() { + openEditor(uri, true) + finish() + } + private fun scanFinalPath(path: String) { scanPath(path) { setResult(Activity.RESULT_OK, intent) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt index 8898e84fc..0aa50ac78 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt @@ -143,7 +143,7 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList R.id.menu_set_as -> trySetAs(File(mMedium!!.path)) R.id.menu_open_with -> openWith(File(mMedium!!.path)) R.id.menu_share -> shareUri(mMedium!!, mUri) - R.id.menu_edit -> openEditor(File(mMedium!!.path)) + R.id.menu_edit -> openFileEditor(File(mMedium!!.path)) else -> return super.onOptionsItemSelected(item) } return true 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 28f0bc57b..7ac0c413a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -208,7 +208,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View R.id.menu_share -> shareMedium(getCurrentMedium()!!) R.id.menu_delete -> askConfirmDelete() R.id.menu_rename -> renameFile() - R.id.menu_edit -> openEditor(getCurrentFile()) + R.id.menu_edit -> openFileEditor(getCurrentFile()) R.id.menu_properties -> showProperties() R.id.menu_save_as -> saveImageAs() R.id.show_on_map -> showOnMap() diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt index 7d4968bda..caa3358cd 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt @@ -172,7 +172,7 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, } private fun editFile() { - activity.openEditor(getCurrentFile()) + activity.openFileEditor(getCurrentFile()) actMode?.finish() } 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 0d98d0802..40c91d4cb 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt @@ -130,9 +130,9 @@ fun Activity.openWith(file: File, forceChooser: Boolean = true) { action = Intent.ACTION_VIEW setDataAndType(uri, file.getMimeType()) addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) - val chooser = Intent.createChooser(this, getString(R.string.open_with)) if (resolveActivity(packageManager) != null) { + val chooser = Intent.createChooser(this, getString(R.string.open_with)) startActivity(if (forceChooser) chooser else this) } else { toast(R.string.no_app_found) @@ -140,15 +140,19 @@ fun Activity.openWith(file: File, forceChooser: Boolean = true) { } } -fun Activity.openEditor(file: File) { - val uri = Uri.fromFile(file) +fun Activity.openFileEditor(file: File) { + openEditor(Uri.fromFile(file)) +} + +fun Activity.openEditor(uri: Uri, forceChooser: Boolean = false) { Intent().apply { action = Intent.ACTION_EDIT setDataAndType(uri, "image/*") addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) if (resolveActivity(packageManager) != null) { - startActivityForResult(this, REQUEST_EDIT_IMAGE) + val chooser = Intent.createChooser(this, getString(R.string.edit_image_with)) + startActivityForResult(if (forceChooser) chooser else this, REQUEST_EDIT_IMAGE) } else { toast(R.string.no_editor_found) } diff --git a/app/src/main/res/menu/menu_editor.xml b/app/src/main/res/menu/menu_editor.xml index eeeb84d73..01aad0437 100644 --- a/app/src/main/res/menu/menu_editor.xml +++ b/app/src/main/res/menu/menu_editor.xml @@ -30,4 +30,8 @@ android:title="@string/flip_vertically"/> + diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index 47ba2b8ba..eab90b817 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -68,6 +68,7 @@ Překlopit vodorovně Překlopit svisle Zařízení nemá dostatek paměti + Edit with Jednoduchá tapeta diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 542b403e2..949a72095 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -68,6 +68,7 @@ Horizontal spiegeln Vertikal spiegeln Fehler: Zuwenig Speicher + Edit with Schlichter Hintergrund diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 9b326b8f2..b5694df3c 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -68,6 +68,7 @@ Horizontalmente Verticalmente Error: sin memoria + Edit with Fondos de pantalla Simple Gallery diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 470971c4e..4f32096b2 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -68,6 +68,7 @@ Retourner horizontalement Retourner verticallement Erreur excès de mémoire + Edit with Simple fond d\'écran diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index f1692241a..d0120b7d9 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -68,6 +68,7 @@ Flip horizontally Flip vertically Out of memory error + Edit with Simple Wallpaper diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index e85869135..fa274c077 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -68,6 +68,7 @@ Capovolgi orizzontalmente Capovolgi verticalmente Errore memoria esaurita + Edit with Sfondo semplice diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 2ce8f8489..67eed51b2 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -68,6 +68,7 @@ Flip horizontally Flip vertically Out of memory error + Edit with シンプル壁紙 diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index 02410dc9d..b8fafa6ff 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -68,6 +68,7 @@ Flip poziomo Flip pionowo Błąd pamięci + Edit with Tapeta diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 08a35a87a..9c09d69f6 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -68,6 +68,7 @@ Horizontalmente Verticalmente Memória insuficiente + Edit with Simple Wallpaper diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index b9add0c44..07d1e99fa 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -68,6 +68,7 @@ Horizontalmente Verticalmente Memória insuficiente + Edit with Simple Wallpaper diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 3a1f00272..fd09fae47 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -68,6 +68,7 @@ По горизонтали По вертикали Память переполнена + Edit with Простые обои diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index 52b19f1e9..68beaf6cc 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -68,6 +68,7 @@ Preklopiť vodorovne Preklopiť zvisle Došlo k chybe s nedostatkom pamäte + Upraviť s Jednoduchá tapeta diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index a46dd4c16..7e3133464 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -68,6 +68,7 @@ Flip horizontally Flip vertically Out of memory error + Edit with Bakgrundsbild diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index 409d5a350..80f72abb2 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -68,6 +68,7 @@ Yatay Dikey Yetersiz bellek hatası + Edit with Basit Duvar Kağıdı diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 6dace54b6..66e2d9d7f 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -68,6 +68,7 @@ 水平翻转 垂直翻转 内存不足 + Edit with Simple Wallpaper diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index d8d5ac078..fdd1155a7 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -68,6 +68,7 @@ Flip horizontally Flip vertically Out of memory error + Edit with 簡易桌布 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index f98362003..26b9fc2f8 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -68,6 +68,7 @@ Flip horizontally Flip vertically Out of memory error + Edit with Simple Wallpaper From 561c81dd42c9ab5bcb490127c3d482a224a0f674 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 18 Jun 2017 20:05:47 +0200 Subject: [PATCH 29/47] finish the editor activity only if another editor has been picked --- .../gallery/activities/EditActivity.kt | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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 8ce60f1f5..ac8cdb4dc 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt @@ -34,6 +34,7 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener var resizeWidth = 0 var resizeHeight = 0 var isCropIntent = false + var isEditingWithThirdParty = false override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -63,6 +64,17 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener } } + override fun onResume() { + super.onResume() + isEditingWithThirdParty = false + } + + override fun onStop() { + super.onStop() + if (isEditingWithThirdParty) + finish() + } + override fun onCreateOptionsMenu(menu: Menu): Boolean { menuInflater.inflate(R.menu.menu_editor, menu) menu.findItem(R.id.resize).isVisible = !isCropIntent @@ -193,7 +205,7 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener private fun editWith() { openEditor(uri, true) - finish() + isEditingWithThirdParty = true } private fun scanFinalPath(path: String) { From f740150d49263e8ca275e58150382215a76f0cec Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 18 Jun 2017 20:36:37 +0200 Subject: [PATCH 30/47] set MySquareImageView size depending on the thumbnail scrolling orientation --- .../com/simplemobiletools/gallery/activities/EditActivity.kt | 1 - .../com/simplemobiletools/gallery/views/MySquareImageView.kt | 5 ++++- 2 files changed, 4 insertions(+), 2 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 ac8cdb4dc..ca9cf9bf6 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt @@ -23,7 +23,6 @@ import com.theartofdev.edmodo.cropper.CropImageView import kotlinx.android.synthetic.main.view_crop_image.* import java.io.* - class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener { val TAG = EditActivity::class.java.simpleName val ASPECT_X = "aspectX" diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/views/MySquareImageView.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/views/MySquareImageView.kt index 54c26947c..c7b40e61f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/views/MySquareImageView.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/views/MySquareImageView.kt @@ -1,10 +1,12 @@ package com.simplemobiletools.gallery.views import android.content.Context +import android.support.v7.widget.OrientationHelper import android.util.AttributeSet import android.widget.ImageView class MySquareImageView : ImageView { + var orientation = OrientationHelper.VERTICAL constructor(context: Context) : super(context) @@ -14,6 +16,7 @@ class MySquareImageView : ImageView { override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) { super.onMeasure(widthMeasureSpec, heightMeasureSpec) - setMeasuredDimension(measuredWidth, measuredWidth) + val spec = if (orientation == OrientationHelper.VERTICAL) measuredWidth else measuredHeight + setMeasuredDimension(spec, spec) } } From 88de8a4d2a61aa9edb3ce6e04cc01c5c409e66c3 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 18 Jun 2017 20:52:21 +0200 Subject: [PATCH 31/47] set scrolling orientation based on the user setting --- .../com/simplemobiletools/gallery/activities/MainActivity.kt | 1 + .../com/simplemobiletools/gallery/activities/MediaActivity.kt | 1 + .../kotlin/com/simplemobiletools/gallery/helpers/Config.kt | 4 ++++ .../kotlin/com/simplemobiletools/gallery/helpers/Constants.kt | 1 + 4 files changed, 7 insertions(+) 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 87d2d269f..24107cc95 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -220,6 +220,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { private fun handleZooming() { val layoutManager = directories_grid.layoutManager as GridLayoutManager + layoutManager.orientation = if (config.scrollHorizontally) GridLayoutManager.HORIZONTAL else GridLayoutManager.VERTICAL layoutManager.spanCount = config.dirColumnCnt MyScalableRecyclerView.mListener = object : MyScalableRecyclerView.MyScalableRecyclerViewListener { override fun zoomIn() { 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 f6cefa981..fd7449061 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -296,6 +296,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { private fun handleZooming() { val layoutManager = media_grid.layoutManager as GridLayoutManager + layoutManager.orientation = if (config.scrollHorizontally) GridLayoutManager.HORIZONTAL else GridLayoutManager.VERTICAL layoutManager.spanCount = config.mediaColumnCnt MyScalableRecyclerView.mListener = object : MyScalableRecyclerView.MyScalableRecyclerViewListener { override fun zoomIn() { 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 4348a2b49..f7708fc7e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt @@ -190,4 +190,8 @@ class Config(context: Context) : BaseConfig(context) { val listType = object : TypeToken>() {}.type return Gson().fromJson>(albumCovers, listType) ?: ArrayList(1) } + + var scrollHorizontally: Boolean + get() = prefs.getBoolean(SCROLL_HORIZONTALLY, false) + set(scrollHorizontally) = prefs.edit().putBoolean(SCROLL_HORIZONTALLY, scrollHorizontally).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 e04df96e4..6a16bb9ff 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt @@ -26,6 +26,7 @@ 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 NOMEDIA = ".nomedia" From 5be34f27eea021493390bd699d3e5ee2d468d10d Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 18 Jun 2017 21:12:50 +0200 Subject: [PATCH 32/47] set thumbnail holder properties based on the scroll orientation --- .../gallery/activities/MainActivity.kt | 15 ++++++++++++--- .../gallery/activities/MediaActivity.kt | 15 ++++++++++++--- 2 files changed, 24 insertions(+), 6 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 24107cc95..a8efedb8a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -14,6 +14,8 @@ import android.support.v4.app.ActivityCompat import android.support.v7.widget.GridLayoutManager import android.view.Menu import android.view.MenuItem +import android.view.ViewGroup +import android.widget.FrameLayout import com.google.gson.Gson import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.models.Release @@ -138,7 +140,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { showAllMedia() else getDirectories() - handleZooming() + setupLayoutManager() checkIfColorChanged() } else { ActivityCompat.requestPermissions(this, arrayOf(Manifest.permission.WRITE_EXTERNAL_STORAGE), STORAGE_PERMISSION) @@ -218,9 +220,16 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { private fun getRecyclerAdapter() = (directories_grid.adapter as DirectoryAdapter) - private fun handleZooming() { + private fun setupLayoutManager() { val layoutManager = directories_grid.layoutManager as GridLayoutManager - layoutManager.orientation = if (config.scrollHorizontally) GridLayoutManager.HORIZONTAL else GridLayoutManager.VERTICAL + if (config.scrollHorizontally) { + layoutManager.orientation = GridLayoutManager.HORIZONTAL + directories_refresh_layout.layoutParams = FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT) + } else { + layoutManager.orientation = GridLayoutManager.VERTICAL + directories_refresh_layout.layoutParams = FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT) + } + layoutManager.spanCount = config.dirColumnCnt MyScalableRecyclerView.mListener = object : MyScalableRecyclerView.MyScalableRecyclerViewListener { override fun zoomIn() { 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 fd7449061..3967ed214 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -12,6 +12,8 @@ import android.support.v7.widget.GridLayoutManager import android.util.Log import android.view.Menu import android.view.MenuItem +import android.view.ViewGroup +import android.widget.FrameLayout import com.bumptech.glide.Glide import com.bumptech.glide.request.animation.GlideAnimation import com.bumptech.glide.request.target.SimpleTarget @@ -107,7 +109,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { val dirName = getHumanizedFilename(mPath) title = if (mShowAll) resources.getString(R.string.all_folders) else dirName getMedia() - handleZooming() + setupLayoutManager() checkIfColorChanged() } else { finish() @@ -294,9 +296,16 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { private fun getRecyclerAdapter() = (media_grid.adapter as MediaAdapter) - private fun handleZooming() { + private fun setupLayoutManager() { val layoutManager = media_grid.layoutManager as GridLayoutManager - layoutManager.orientation = if (config.scrollHorizontally) GridLayoutManager.HORIZONTAL else GridLayoutManager.VERTICAL + if (config.scrollHorizontally) { + layoutManager.orientation = GridLayoutManager.HORIZONTAL + media_refresh_layout.layoutParams = FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT) + } else { + layoutManager.orientation = GridLayoutManager.VERTICAL + media_refresh_layout.layoutParams = FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT) + } + layoutManager.spanCount = config.mediaColumnCnt MyScalableRecyclerView.mListener = object : MyScalableRecyclerView.MyScalableRecyclerViewListener { override fun zoomIn() { From 2734fe961596db12085c8af9303bb87e76189578 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 18 Jun 2017 21:16:40 +0200 Subject: [PATCH 33/47] add a toggle for scrolling thumbnails horizontally --- .../gallery/activities/SettingsActivity.kt | 9 +++++++++ app/src/main/res/layout/activity_settings.xml | 20 +++++++++++++++++++ 2 files changed, 29 insertions(+) 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 dfcb59d95..0d8720b55 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() { setupMaxBrightness() setupCropThumbnails() setupDarkBackground() + setupScrollHorizontally() setupScreenRotation() setupShowMedia() updateTextColors(settings_holder) @@ -112,6 +113,14 @@ class SettingsActivity : SimpleActivity() { } } + private fun setupScrollHorizontally() { + settings_scroll_horizontally.isChecked = config.scrollHorizontally + settings_scroll_horizontally_holder.setOnClickListener { + settings_scroll_horizontally.toggle() + config.scrollHorizontally = settings_scroll_horizontally.isChecked + } + } + private fun setupScreenRotation() { settings_screen_rotation.text = getScreenRotationText() settings_screen_rotation_holder.setOnClickListener { diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index c1ec5d18a..94881326b 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -208,6 +208,26 @@ + + + + + + Date: Sun, 18 Jun 2017 21:40:00 +0200 Subject: [PATCH 34/47] small cleanup at thumbnail adapters --- .../gallery/adapters/DirectoryAdapter.kt | 40 ++++++++++--------- .../gallery/adapters/MediaAdapter.kt | 39 +++++++++--------- .../gallery/extensions/activity.kt | 3 +- .../gallery/views/MySquareImageView.kt | 5 +-- 4 files changed, 45 insertions(+), 42 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 83d750475..f7c940b0a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt @@ -361,12 +361,12 @@ class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableList (Unit)) : SwappingHolder(view, MultiSelector()) { - fun bindView(activity: SimpleActivity, multiSelectorCallback: ModalMultiSelectorCallback, multiSelector: MultiSelector, directory: Directory, - isPinned: Boolean, listener: DirOperationsListener?): View { + class ViewHolder(val view: View, val adapter: MyAdapterListener, val activity: SimpleActivity, val multiSelectorCallback: ModalMultiSelectorCallback, + val multiSelector: MultiSelector, val listener: DirOperationsListener?, val itemClick: (Directory) -> (Unit)) : + SwappingHolder(view, MultiSelector()) { + fun bindView(directory: Directory, isPinned: Boolean): View { itemView.apply { dir_name.text = directory.name photo_cnt.text = directory.mediaCnt.toString() dir_pin.visibility = if (isPinned) View.VISIBLE else View.GONE - activity.loadImage(directory.tmb, dir_thumbnail) + activity.loadImage(directory.tmb, dir_thumbnail, true) - setOnClickListener { viewClicked(multiSelector, directory) } - setOnLongClickListener { - if (listener != null) { - if (!multiSelector.isSelectable) { - activity.startSupportActionMode(multiSelectorCallback) - adapter.toggleItemSelectionAdapter(true, layoutPosition) - } - - listener.itemLongClicked(layoutPosition) - } - true - } + setOnClickListener { viewClicked(directory) } + setOnLongClickListener { viewLongClicked(); true } adapter.setupItemForeground(this) } return itemView } - fun viewClicked(multiSelector: MultiSelector, directory: Directory) { + fun viewClicked(directory: Directory) { if (multiSelector.isSelectable) { val isSelected = adapter.getSelectedPositions().contains(layoutPosition) adapter.toggleItemSelectionAdapter(!isSelected, layoutPosition) @@ -458,6 +449,17 @@ class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableList, override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): ViewHolder { val view = LayoutInflater.from(parent?.context).inflate(R.layout.photo_video_item, parent, false) - return ViewHolder(view, adapterListener, itemClick) + return ViewHolder(view, adapterListener, activity, multiSelectorMode, multiSelector, listener, itemClick) } override fun onBindViewHolder(holder: ViewHolder, position: Int) { - itemViews.put(position, holder.bindView(activity, multiSelectorMode, multiSelector, media[position], listener, displayFilenames)) + itemViews.put(position, holder.bindView(media[position], displayFilenames)) toggleItemSelection(selectedPositions.contains(position), position) holder.itemView.tag = holder } @@ -335,34 +335,24 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, } } - class ViewHolder(val view: View, val adapter: MyAdapterListener, val itemClick: (Medium) -> (Unit)) : SwappingHolder(view, MultiSelector()) { - fun bindView(activity: SimpleActivity, multiSelectorCallback: ModalMultiSelectorCallback, multiSelector: MultiSelector, medium: Medium, - listener: MediaOperationsListener?, displayFilenames: Boolean): View { + class ViewHolder(val view: View, val adapter: MyAdapterListener, val activity: SimpleActivity, val multiSelectorCallback: ModalMultiSelectorCallback, + val multiSelector: MultiSelector, val listener: MediaOperationsListener?, val itemClick: (Medium) -> (Unit)) : SwappingHolder(view, MultiSelector()) { + fun bindView(medium: Medium, displayFilenames: Boolean): View { itemView.apply { play_outline.visibility = if (medium.video) View.VISIBLE else View.GONE photo_name.beVisibleIf(displayFilenames) photo_name.text = medium.name - activity.loadImage(medium.path, medium_thumbnail) + activity.loadImage(medium.path, medium_thumbnail, true) - setOnClickListener { viewClicked(multiSelector, medium) } - setOnLongClickListener { - if (listener != null) { - if (!multiSelector.isSelectable) { - activity.startSupportActionMode(multiSelectorCallback) - adapter.toggleItemSelectionAdapter(true, layoutPosition) - } - - listener.itemLongClicked(layoutPosition) - } - true - } + setOnClickListener { viewClicked(medium) } + setOnLongClickListener { viewLongClicked(); true } adapter.setupItemForeground(this) } return itemView } - fun viewClicked(multiSelector: MultiSelector, medium: Medium) { + fun viewClicked(medium: Medium) { if (multiSelector.isSelectable) { val isSelected = adapter.getSelectedPositions().contains(layoutPosition) adapter.toggleItemSelectionAdapter(!isSelected, layoutPosition) @@ -371,6 +361,17 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, } } + fun viewLongClicked() { + if (listener != null) { + if (!multiSelector.isSelectable) { + activity.startSupportActionMode(multiSelectorCallback) + adapter.toggleItemSelectionAdapter(true, layoutPosition) + } + + listener.itemLongClicked(layoutPosition) + } + } + fun stopLoad() { Glide.clear(view.medium_thumbnail) } 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 40c91d4cb..cc9125a8e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt @@ -264,7 +264,8 @@ fun SimpleActivity.toggleFileVisibility(oldFile: File, hide: Boolean, callback: fun Activity.getFileSignature(path: String) = StringSignature(File(path).lastModified().toString()) -fun Activity.loadImage(path: String, target: MySquareImageView) { +fun Activity.loadImage(path: String, target: MySquareImageView, verticalScroll: Boolean) { + target.isVerticalScrolling = verticalScroll if (path.isImageFast() || path.isVideoFast()) { if (path.isPng()) { loadPng(path, target) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/views/MySquareImageView.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/views/MySquareImageView.kt index c7b40e61f..3e0c79df1 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/views/MySquareImageView.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/views/MySquareImageView.kt @@ -1,12 +1,11 @@ package com.simplemobiletools.gallery.views import android.content.Context -import android.support.v7.widget.OrientationHelper import android.util.AttributeSet import android.widget.ImageView class MySquareImageView : ImageView { - var orientation = OrientationHelper.VERTICAL + var isVerticalScrolling = true constructor(context: Context) : super(context) @@ -16,7 +15,7 @@ class MySquareImageView : ImageView { override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) { super.onMeasure(widthMeasureSpec, heightMeasureSpec) - val spec = if (orientation == OrientationHelper.VERTICAL) measuredWidth else measuredHeight + val spec = if (isVerticalScrolling) measuredWidth else measuredHeight setMeasuredDimension(spec, spec) } } From 435a7693e54e0f8980f34e09944b265de28b217a Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 18 Jun 2017 21:44:53 +0200 Subject: [PATCH 35/47] send the scroll orientation to thumbnails --- .../simplemobiletools/gallery/adapters/DirectoryAdapter.kt | 7 ++++--- .../com/simplemobiletools/gallery/adapters/MediaAdapter.kt | 7 ++++--- 2 files changed, 8 insertions(+), 6 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 f7c940b0a..02abb93f7 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt @@ -41,6 +41,7 @@ class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableList() var foregroundColor = 0 var pinnedFolders = config.pinnedFolders + var scrollVertically = !config.scrollHorizontally fun toggleItemSelection(select: Boolean, pos: Int) { if (itemViews[pos] != null) @@ -366,7 +367,7 @@ class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableList (Unit)) : SwappingHolder(view, MultiSelector()) { - fun bindView(directory: Directory, isPinned: Boolean): View { + fun bindView(directory: Directory, isPinned: Boolean, scrollVertically: Boolean): View { itemView.apply { dir_name.text = directory.name photo_cnt.text = directory.mediaCnt.toString() dir_pin.visibility = if (isPinned) View.VISIBLE else View.GONE - activity.loadImage(directory.tmb, dir_thumbnail, true) + activity.loadImage(directory.tmb, dir_thumbnail, scrollVertically) setOnClickListener { viewClicked(directory) } setOnLongClickListener { viewLongClicked(); true } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt index c757dd671..1f0d72042 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt @@ -34,6 +34,7 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, val selectedPositions = HashSet() var foregroundColor = 0 var displayFilenames = config.displayFileNames + var scrollVertically = !config.scrollHorizontally fun toggleItemSelection(select: Boolean, pos: Int) { if (itemViews[pos] != null) @@ -274,7 +275,7 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, } override fun onBindViewHolder(holder: ViewHolder, position: Int) { - itemViews.put(position, holder.bindView(media[position], displayFilenames)) + itemViews.put(position, holder.bindView(media[position], displayFilenames, scrollVertically)) toggleItemSelection(selectedPositions.contains(position), position) holder.itemView.tag = holder } @@ -337,12 +338,12 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, class ViewHolder(val view: View, val adapter: MyAdapterListener, val activity: SimpleActivity, val multiSelectorCallback: ModalMultiSelectorCallback, val multiSelector: MultiSelector, val listener: MediaOperationsListener?, val itemClick: (Medium) -> (Unit)) : SwappingHolder(view, MultiSelector()) { - fun bindView(medium: Medium, displayFilenames: Boolean): View { + fun bindView(medium: Medium, displayFilenames: Boolean, scrollVertically: Boolean): View { itemView.apply { play_outline.visibility = if (medium.video) View.VISIBLE else View.GONE photo_name.beVisibleIf(displayFilenames) photo_name.text = medium.name - activity.loadImage(medium.path, medium_thumbnail, true) + activity.loadImage(medium.path, medium_thumbnail, scrollVertically) setOnClickListener { viewClicked(medium) } setOnLongClickListener { viewLongClicked(); true } From 048acd9b03aec3d64087e48bd8defa9c767ceaf0 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 18 Jun 2017 22:15:16 +0200 Subject: [PATCH 36/47] properly refresh thumbnails at changing column count --- .../com/simplemobiletools/gallery/activities/MainActivity.kt | 2 ++ .../com/simplemobiletools/gallery/activities/MediaActivity.kt | 2 ++ app/src/main/res/layout/directory_item.xml | 2 +- app/src/main/res/layout/photo_video_item.xml | 2 +- 4 files changed, 6 insertions(+), 2 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 a8efedb8a..54f4bf8c9 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -259,11 +259,13 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { private fun increaseColumnCount() { config.dirColumnCnt = ++(directories_grid.layoutManager as GridLayoutManager).spanCount invalidateOptionsMenu() + directories_grid.adapter.notifyDataSetChanged() } private fun reduceColumnCount() { config.dirColumnCnt = --(directories_grid.layoutManager as GridLayoutManager).spanCount invalidateOptionsMenu() + directories_grid.adapter.notifyDataSetChanged() } private fun isPickImageIntent(intent: Intent) = isPickIntent(intent) && (hasImageContentData(intent) || isImageType(intent)) 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 3967ed214..5934b96e8 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -335,11 +335,13 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { private fun increaseColumnCount() { config.mediaColumnCnt = ++(media_grid.layoutManager as GridLayoutManager).spanCount invalidateOptionsMenu() + media_grid.adapter.notifyDataSetChanged() } private fun reduceColumnCount() { config.mediaColumnCnt = --(media_grid.layoutManager as GridLayoutManager).spanCount invalidateOptionsMenu() + media_grid.adapter.notifyDataSetChanged() } private fun isSetWallpaperIntent() = intent.getBooleanExtra(SET_WALLPAPER_INTENT, false) diff --git a/app/src/main/res/layout/directory_item.xml b/app/src/main/res/layout/directory_item.xml index 9d4ef8a46..63642099d 100644 --- a/app/src/main/res/layout/directory_item.xml +++ b/app/src/main/res/layout/directory_item.xml @@ -2,7 +2,7 @@ diff --git a/app/src/main/res/layout/photo_video_item.xml b/app/src/main/res/layout/photo_video_item.xml index f5a4bfea3..cb52c8f10 100644 --- a/app/src/main/res/layout/photo_video_item.xml +++ b/app/src/main/res/layout/photo_video_item.xml @@ -2,7 +2,7 @@ From 6dd4be62d8ee788d94a20dbae831159273b233b5 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 18 Jun 2017 22:21:54 +0200 Subject: [PATCH 37/47] avoid refetching media at changing some settings --- .../com/simplemobiletools/gallery/activities/MainActivity.kt | 4 ++-- .../com/simplemobiletools/gallery/activities/MediaActivity.kt | 4 ++-- 2 files changed, 4 insertions(+), 4 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 54f4bf8c9..0520b8d99 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -107,11 +107,11 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { override fun onResume() { super.onResume() if (mStoredAnimateGifs != config.animateGifs) { - mDirs.clear() + directories_grid.adapter.notifyDataSetChanged() } if (mStoredCropThumbnails != config.cropThumbnails) { - mDirs.clear() + directories_grid.adapter.notifyDataSetChanged() } tryloadGallery() invalidateOptionsMenu() 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 5934b96e8..9e5f7ccc1 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -77,11 +77,11 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { override fun onResume() { super.onResume() if (mShowAll && mStoredAnimateGifs != config.animateGifs) { - mMedia.clear() + media_grid.adapter.notifyDataSetChanged() } if (mStoredCropThumbnails != config.cropThumbnails) { - mMedia.clear() + media_grid.adapter.notifyDataSetChanged() } tryloadGallery() invalidateOptionsMenu() From 1402de7a3d3491b3c53a21bc70e7973bda08d4ed Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 18 Jun 2017 23:13:06 +0200 Subject: [PATCH 38/47] check thumbnail scrolling on resume --- .../simplemobiletools/gallery/activities/MainActivity.kt | 9 +++++++++ .../gallery/activities/MediaActivity.kt | 9 +++++++++ 2 files changed, 18 insertions(+) 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 0520b8d99..85d5bc3f6 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -50,6 +50,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { private var mIsGettingDirs = false private var mStoredAnimateGifs = true private var mStoredCropThumbnails = true + private var mStoredScrollHorizontally = true private var mLoadedInitialPhotos = false private var mLastMediaModified = 0 private var mLastMediaHandler = Handler() @@ -73,6 +74,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { mDirs = ArrayList() mStoredAnimateGifs = config.animateGifs mStoredCropThumbnails = config.cropThumbnails + mStoredScrollHorizontally = config.scrollHorizontally storeStoragePaths() checkWhatsNewDialog() } @@ -113,6 +115,12 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { if (mStoredCropThumbnails != config.cropThumbnails) { directories_grid.adapter.notifyDataSetChanged() } + + if (mStoredScrollHorizontally != config.scrollHorizontally) { + (directories_grid.adapter as DirectoryAdapter).scrollVertically = !config.scrollHorizontally + directories_grid.adapter.notifyDataSetChanged() + } + tryloadGallery() invalidateOptionsMenu() } @@ -125,6 +133,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { mIsGettingDirs = false mStoredAnimateGifs = config.animateGifs mStoredCropThumbnails = config.cropThumbnails + mStoredScrollHorizontally = config.scrollHorizontally MyScalableRecyclerView.mListener = null mLastMediaHandler.removeCallbacksAndMessages(null) } 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 9e5f7ccc1..2d90e98c7 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -48,6 +48,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { private var mLoadedInitialPhotos = false private var mStoredAnimateGifs = true private var mStoredCropThumbnails = true + private var mStoredScrollHorizontally = true private var mLastDrawnHashCode = 0 private var mLastMediaModified = 0 private var mLastMediaHandler = Handler() @@ -69,6 +70,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { mPath = intent.getStringExtra(DIRECTORY) mStoredAnimateGifs = config.animateGifs mStoredCropThumbnails = config.cropThumbnails + mStoredScrollHorizontally = config.scrollHorizontally mShowAll = config.showAll if (mShowAll) supportActionBar?.setDisplayHomeAsUpEnabled(false) @@ -83,6 +85,12 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { if (mStoredCropThumbnails != config.cropThumbnails) { media_grid.adapter.notifyDataSetChanged() } + + if (mStoredScrollHorizontally != config.scrollHorizontally) { + (media_grid.adapter as MediaAdapter).scrollVertically = !config.scrollHorizontally + media_grid.adapter.notifyDataSetChanged() + } + tryloadGallery() invalidateOptionsMenu() } @@ -93,6 +101,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { media_refresh_layout.isRefreshing = false mStoredAnimateGifs = config.animateGifs mStoredCropThumbnails = config.cropThumbnails + mStoredScrollHorizontally = config.scrollHorizontally MyScalableRecyclerView.mListener = null mLastMediaHandler.removeCallbacksAndMessages(null) } From a2e9c53d8e2eb10a12ae9b458a5979c67fc04514 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 18 Jun 2017 23:18:50 +0200 Subject: [PATCH 39/47] update some counts of default columns --- .../kotlin/com/simplemobiletools/gallery/helpers/Config.kt | 4 ++-- app/src/main/res/layout/activity_main.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 +- app/src/main/res/values-w480dp/integers.xml | 6 ++++-- app/src/main/res/values-w600dp/integers.xml | 6 ++++-- app/src/main/res/values/integers.xml | 6 ++++-- 8 files changed, 18 insertions(+), 12 deletions(-) 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 f7708fc7e..8e111a9b4 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt @@ -161,7 +161,7 @@ class Config(context: Context) : BaseConfig(context) { set(showMedia) = prefs.edit().putInt(SHOW_MEDIA, showMedia).apply() var dirColumnCnt: Int - get() = prefs.getInt(getDirectoryColumnsField(), context.resources.getInteger(R.integer.directory_columns)) + get() = prefs.getInt(getDirectoryColumnsField(), context.resources.getInteger(R.integer.directory_columns_vertical_scroll)) set(dirColumnCnt) = prefs.edit().putInt(getDirectoryColumnsField(), dirColumnCnt).apply() private fun getDirectoryColumnsField(): String { @@ -170,7 +170,7 @@ class Config(context: Context) : BaseConfig(context) { } var mediaColumnCnt: Int - get() = prefs.getInt(getMediaColumnsField(), context.resources.getInteger(R.integer.media_columns)) + get() = prefs.getInt(getMediaColumnsField(), context.resources.getInteger(R.integer.media_columns_vertical_scroll)) set(mediaColumnCnt) = prefs.edit().putInt(getMediaColumnsField(), mediaColumnCnt).apply() private fun getMediaColumnsField(): String { diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 8390ab0bc..6fdf71aac 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -17,7 +17,7 @@ android:layout_height="wrap_content" android:scrollbars="none" app:layoutManager="android.support.v7.widget.GridLayoutManager" - app:spanCount="@integer/directory_columns"/> + app:spanCount="@integer/directory_columns_vertical_scroll"/> + app:spanCount="@integer/media_columns_vertical_scroll"/> + app:spanCount="@integer/directory_columns_vertical_scroll"/> diff --git a/app/src/main/res/layout/dialog_medium_picker.xml b/app/src/main/res/layout/dialog_medium_picker.xml index f2aebbd17..60207b4c9 100644 --- a/app/src/main/res/layout/dialog_medium_picker.xml +++ b/app/src/main/res/layout/dialog_medium_picker.xml @@ -7,4 +7,4 @@ android:layout_height="wrap_content" android:paddingTop="@dimen/activity_margin" app:layoutManager="android.support.v7.widget.GridLayoutManager" - app:spanCount="@integer/media_columns"/> + app:spanCount="@integer/media_columns_vertical_scroll"/> diff --git a/app/src/main/res/values-w480dp/integers.xml b/app/src/main/res/values-w480dp/integers.xml index 2bfaa32f7..1d3ca8c44 100644 --- a/app/src/main/res/values-w480dp/integers.xml +++ b/app/src/main/res/values-w480dp/integers.xml @@ -1,4 +1,6 @@ - 3 - 5 + 3 + 5 + 5 + 6 diff --git a/app/src/main/res/values-w600dp/integers.xml b/app/src/main/res/values-w600dp/integers.xml index a98204fd4..ca1cfb86b 100644 --- a/app/src/main/res/values-w600dp/integers.xml +++ b/app/src/main/res/values-w600dp/integers.xml @@ -1,4 +1,6 @@ - 4 - 7 + 4 + 7 + 7 + 8 diff --git a/app/src/main/res/values/integers.xml b/app/src/main/res/values/integers.xml index 3d424225f..5f21fbd2c 100644 --- a/app/src/main/res/values/integers.xml +++ b/app/src/main/res/values/integers.xml @@ -1,4 +1,6 @@ - 2 - 3 + 2 + 4 + 3 + 4 From a3876f67cd204f3d247f7a69782418eafa9a7d33 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 18 Jun 2017 23:33:52 +0200 Subject: [PATCH 40/47] update the way of retrieving default column counts --- .../gallery/helpers/Config.kt | 38 +++++++++++++++++-- .../gallery/helpers/Constants.kt | 4 ++ app/src/main/res/values-w480dp/integers.xml | 4 +- app/src/main/res/values/integers.xml | 2 +- 4 files changed, 41 insertions(+), 7 deletions(-) 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 8e111a9b4..b144682c4 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt @@ -161,23 +161,53 @@ class Config(context: Context) : BaseConfig(context) { set(showMedia) = prefs.edit().putInt(SHOW_MEDIA, showMedia).apply() var dirColumnCnt: Int - get() = prefs.getInt(getDirectoryColumnsField(), context.resources.getInteger(R.integer.directory_columns_vertical_scroll)) + get() = prefs.getInt(getDirectoryColumnsField(), getDefaultDirectoryColumnCount()) set(dirColumnCnt) = prefs.edit().putInt(getDirectoryColumnsField(), dirColumnCnt).apply() private fun getDirectoryColumnsField(): String { val isPortrait = context.resources.configuration.orientation == Configuration.ORIENTATION_PORTRAIT - return if (isPortrait) DIR_COLUMN_CNT else DIR_LANDSCAPE_COLUMN_CNT + return if (isPortrait) { + if (scrollHorizontally) { + DIR_HORIZONTAL_COLUMN_CNT + } else { + DIR_COLUMN_CNT + } + } else { + if (scrollHorizontally) { + DIR_LANDSCAPE_HORIZONTAL_COLUMN_CNT + } else { + DIR_LANDSCAPE_COLUMN_CNT + } + } } + private fun getDefaultDirectoryColumnCount() = context.resources.getInteger(if (scrollHorizontally) R.integer.directory_columns_horizontal_scroll + else R.integer.directory_columns_vertical_scroll) + var mediaColumnCnt: Int - get() = prefs.getInt(getMediaColumnsField(), context.resources.getInteger(R.integer.media_columns_vertical_scroll)) + get() = prefs.getInt(getMediaColumnsField(), getDefaultMediaColumnCount()) set(mediaColumnCnt) = prefs.edit().putInt(getMediaColumnsField(), mediaColumnCnt).apply() private fun getMediaColumnsField(): String { val isPortrait = context.resources.configuration.orientation == Configuration.ORIENTATION_PORTRAIT - return if (isPortrait) MEDIA_COLUMN_CNT else MEDIA_LANDSCAPE_COLUMN_CNT + return if (isPortrait) { + if (scrollHorizontally) { + MEDIA_HORIZONTAL_COLUMN_CNT + } else { + MEDIA_COLUMN_CNT + } + } else { + if (scrollHorizontally) { + MEDIA_LANDSCAPE_HORIZONTAL_COLUMN_CNT + } else { + MEDIA_LANDSCAPE_COLUMN_CNT + } + } } + private fun getDefaultMediaColumnCount() = context.resources.getInteger(if (scrollHorizontally) R.integer.media_columns_horizontal_scroll + else R.integer.media_columns_vertical_scroll) + var directories: String get() = prefs.getString(DIRECTORIES, "") set(directories) = prefs.edit().putString(DIRECTORIES, directories).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 6a16bb9ff..70fe30c1b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt @@ -17,8 +17,12 @@ val DARK_BACKGROUND = "dark_background" val PINNED_FOLDERS = "pinned_folders" 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 SHOW_MEDIA = "show_media" val SAVE_FOLDER_PREFIX = "folder2_" diff --git a/app/src/main/res/values-w480dp/integers.xml b/app/src/main/res/values-w480dp/integers.xml index 1d3ca8c44..2f22506b5 100644 --- a/app/src/main/res/values-w480dp/integers.xml +++ b/app/src/main/res/values-w480dp/integers.xml @@ -1,6 +1,6 @@ 3 - 5 + 3 5 - 6 + 5 diff --git a/app/src/main/res/values/integers.xml b/app/src/main/res/values/integers.xml index 5f21fbd2c..e27e3e8f5 100644 --- a/app/src/main/res/values/integers.xml +++ b/app/src/main/res/values/integers.xml @@ -1,6 +1,6 @@ 2 - 4 + 3 3 4 From 74aa953cc538e2b4f7b86ba57d341179f7f9392b Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 18 Jun 2017 23:37:55 +0200 Subject: [PATCH 41/47] hide the horizontal scrolling toggle for now --- app/src/main/res/layout/activity_settings.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index 94881326b..078bfe2ca 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -214,7 +214,8 @@ android:layout_height="wrap_content" android:layout_marginTop="@dimen/medium_margin" android:background="?attr/selectableItemBackground" - android:padding="@dimen/activity_margin"> + android:padding="@dimen/activity_margin" + android:visibility="gone"> Date: Sun, 18 Jun 2017 23:39:25 +0200 Subject: [PATCH 42/47] update version to 2.11.0 --- app/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 83a3424e4..c1ab1f892 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,8 +10,8 @@ android { applicationId "com.simplemobiletools.gallery" minSdkVersion 16 targetSdkVersion 23 - versionCode 109 - versionName "2.10.10" + versionCode 110 + versionName "2.11.0" } signingConfigs { From 98b426d21e1d2ebccde52a0e55d49b0eef8cb414 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 18 Jun 2017 23:41:55 +0200 Subject: [PATCH 43/47] updating changelog --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e7657fb9e..5635c475b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,14 @@ Changelog ========== +Version 2.11.0 *(2017-06-18)* +---------------------------- + + * Store column count separately for portrait and landscape modes + * Improve zooming at double taping fullscreen images + * Allow opening a third party editor from our Editor screen + * Many crashfixes and smaller improvements + Version 2.10.10 *(2017-06-07)* ---------------------------- From 034f3b5c568357464c51dee1c09be03650ab692a Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 19 Jun 2017 07:44:10 +0200 Subject: [PATCH 44/47] make sure mSurfaceView isnt null when initing media player --- .../com/simplemobiletools/gallery/fragments/VideoFragment.kt | 4 +++- 1 file changed, 3 insertions(+), 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 c5a556f82..f9b3a604c 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt @@ -95,7 +95,9 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee super.setMenuVisibility(menuVisible) mIsFragmentVisible = menuVisible if (menuVisible) { - initMediaPlayer() + if (mSurfaceView != null) + initMediaPlayer() + if (context?.config?.autoplayVideos == true) { playVideo() } From 12a0cb9f0ad904d75571b9ca660fde5b2a8ea324 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 19 Jun 2017 07:45:36 +0200 Subject: [PATCH 45/47] add a null check at photo fragment --- .../com/simplemobiletools/gallery/fragments/PhotoFragment.kt | 3 +++ 1 file changed, 3 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 e3122eef4..7f82ae47f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt @@ -237,6 +237,9 @@ class PhotoFragment : ViewPagerFragment() { val height = bitmapOptions.outHeight val bitmapAspectRatio = height / (width).toFloat() + if (context == null) + return 2f + return if (context.portrait && bitmapAspectRatio <= 1f) { ViewPagerActivity.screenHeight / height.toFloat() } else if (!context.portrait && bitmapAspectRatio >= 1f) { From c956832d98dbc101da625ebc7d92e505588835fd Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 19 Jun 2017 07:46:25 +0200 Subject: [PATCH 46/47] update version to 2.11.1 --- app/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index c1ab1f892..a1e12bdab 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,8 +10,8 @@ android { applicationId "com.simplemobiletools.gallery" minSdkVersion 16 targetSdkVersion 23 - versionCode 110 - versionName "2.11.0" + versionCode 111 + versionName "2.11.1" } signingConfigs { From d85f140e51fdf19e14389dcac4bd89f4ce4df162 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 19 Jun 2017 07:46:53 +0200 Subject: [PATCH 47/47] updating changelog --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5635c475b..442f658f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ Changelog ========== +Version 2.11.1 *(2017-06-19)* +---------------------------- + + * Fixed a crash at starting video + Version 2.11.0 *(2017-06-18)* ----------------------------