From 608292a357e9870952c3b798a3df2cec11c3f810 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 22 Oct 2017 22:57:53 +0200 Subject: [PATCH 01/21] update Commons and use its way of getting mimetype of multiple uris --- app/build.gradle | 2 +- .../kotlin/com/simplemobiletools/gallery/extensions/activity.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index d09181550..3d9d663c6 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,7 +37,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.30.6' + compile 'com.simplemobiletools:commons:2.30.13' 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' 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 0a2140a6d..75e291505 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt @@ -65,7 +65,7 @@ fun Activity.shareMedia(media: List) { Intent().apply { action = Intent.ACTION_SEND_MULTIPLE - type = "image/* video/*" + type = uris.getMimeType() addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris) startActivity(Intent.createChooser(this, shareTitle)) From c39ad62fbf1c27fdac0d13481cb7b7559c3ace32 Mon Sep 17 00:00:00 2001 From: Rodrigo Date: Sun, 22 Oct 2017 23:10:55 -0200 Subject: [PATCH 02/21] Update strings.xml --- app/src/main/res/values-pt-rBR/strings.xml | 56 +++++++++++----------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 30662f1d9..df37a70f0 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -22,18 +22,18 @@ Trocar imagem de capa Selecionar foto Usar padrão - Set as + Definir como Volume - Brightness - Do not ask again in this session + Brilho + Não perguntar novamente por enquanto - Filter media - Images - Videos + Filtrar mídia + Imagens + Vídeos GIFs - No media files have been found with the selected filters. - Change filters + Nenhum arquivo de mídia encontrado a partir dos filtros selecionados. + Mudar filtros 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? @@ -77,7 +77,7 @@ Inverter Horizontalmente Verticalmente - Edit with + Editar com Simple Wallpaper @@ -92,21 +92,21 @@ Slideshow - Interval (seconds): - Include photos - Include videos - Include GIFs - Random order - Use fade animations - Move backwards - Loop slideshow - The slideshow ended - No media for the slideshow have been found + Intervalo (segundos): + Incluir fotos + Incluir videos + Incluir GIFs + Ordem aleatória + Usar animação de esmaecimento + Retroceder + Apresentação em ciclo + Fim da apresentação + Nenhuma mídia encontrada para a apresentação - Change view type - Grid - List + Mudar tipo da vista + Grade + Lista Mostrar pastas ocultas @@ -122,12 +122,12 @@ Proporção da mídia Fundo de tela escuro em mídia tela cheia Rolar miniaturas horizontalmente - Automatically hide system UI at fullscreen media - Delete empty folders after deleting their content - Allow controlling video volume and brightness with vertical gestures - Replace Share with Rotate at fullscreen menu - Show extended details over fullscreen media - Manage extended details + Esconder interface do sistema automaticamente quando em tela cheia + Apagar pastas vazias após deleter seu conteúdo + Permitir controle do volume e brilho com gestos na vertical + Substituir botão "Compartilhar" por "Rotação de tela" quando em tela cheia + Exibir detalhes extendidos quando em tela cheia + Gerenciar detalhes extendidos From 4738d833401dcd97ff778bc62a267137f7bacae4 Mon Sep 17 00:00:00 2001 From: Rodrigo Date: Sun, 22 Oct 2017 23:29:46 -0200 Subject: [PATCH 03/21] Update strings.xml --- app/src/main/res/values-pt-rBR/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 30662f1d9..23cecc9f1 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -104,7 +104,7 @@ No media for the slideshow have been found - Change view type + Alterar modo de visualização Grid List From 208d005139de8ed1fc8329aedbc8b9b3b8a57bc3 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 23 Oct 2017 12:09:55 +0200 Subject: [PATCH 04/21] update commons to 2.31.1 --- app/build.gradle | 2 +- .../gallery/activities/EditActivity.kt | 6 +----- .../gallery/activities/PhotoVideoActivity.kt | 1 + .../gallery/extensions/context.kt | 19 ------------------- 4 files changed, 3 insertions(+), 25 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 3d9d663c6..5d0a8fe7d 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,7 +37,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.30.13' + compile 'com.simplemobiletools:commons:2.31.1' 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' 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 0da6c4bef..dc09ee11e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt @@ -10,14 +10,10 @@ import android.provider.MediaStore import android.util.Log import android.view.Menu import android.view.MenuItem -import com.simplemobiletools.commons.extensions.getCompressionFormat -import com.simplemobiletools.commons.extensions.getFileOutputStream -import com.simplemobiletools.commons.extensions.scanPath -import com.simplemobiletools.commons.extensions.toast +import com.simplemobiletools.commons.extensions.* 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.* 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 eb6c13fb2..97b3e12c5 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt @@ -10,6 +10,7 @@ import android.provider.MediaStore import android.view.Menu import android.view.MenuItem import android.view.View +import com.simplemobiletools.commons.extensions.getRealPathFromURI import com.simplemobiletools.commons.extensions.scanPath import com.simplemobiletools.commons.extensions.toast import com.simplemobiletools.commons.helpers.PERMISSION_WRITE_STORAGE 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 f7cd61529..cdda71ab7 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt @@ -3,12 +3,9 @@ package com.simplemobiletools.gallery.extensions import android.content.Context import android.content.Intent import android.content.res.Configuration -import android.database.Cursor import android.graphics.Point import android.media.AudioManager -import android.net.Uri import android.os.Build -import android.provider.MediaStore import android.view.WindowManager import com.simplemobiletools.commons.extensions.humanizePath import com.simplemobiletools.gallery.activities.SettingsActivity @@ -44,22 +41,6 @@ val Context.realScreenSize: Point return size } -fun Context.getRealPathFromURI(uri: Uri): String? { - var cursor: Cursor? = null - try { - val projection = arrayOf(MediaStore.Images.Media.DATA) - cursor = contentResolver.query(uri, projection, null, null, null) - if (cursor?.moveToFirst() == true) { - val index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA) - return cursor.getString(index) - } - } catch (e: Exception) { - } finally { - cursor?.close() - } - return null -} - fun Context.getHumanizedFilename(path: String): String { val humanized = humanizePath(path) return humanized.substring(humanized.lastIndexOf("/") + 1) From 11e60390cf9d3fc1ec62cf1e9a977ac144c49cba Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 23 Oct 2017 17:03:20 +0200 Subject: [PATCH 05/21] revert a chinese translation, it messes the string order This reverts commit 83d4e75f0e051f0de16952b938bfa0262e31c94a. --- app/src/main/res/values-zh-rCN/strings.xml | 458 ++++++--------------- 1 file changed, 133 insertions(+), 325 deletions(-) diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 2a6d8d78e..b43f3c294 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -1,341 +1,149 @@ - 转到主屏幕 - %1$s:%2$s - %1$s - %2$s:%3$s - 转到上一层级 - 更多选项 - 完成 - 查看全部 - 选择应用 - 关闭 - 开启 - 搜索… - 清除查询 - 搜索查询 - 搜索 - 提交查询 - 语音搜索 - 分享方式 - 通过%s分享 - 收起 - 指纹传感器有脏污。请擦拭干净,然后重试。 - 无法处理指纹,请重试。 - 仅检测到部分指纹,请重试。 - 手指移动太快,请重试。 - 手指移动太慢,请重试。 - 指纹操作已取消。 - 指纹硬件无法使用。 - 尝试次数过多,请稍后重试。 - 无法存储指纹。请移除一个现有的指纹。 - 指纹录入操作超时,请重试。 - 请重试。 - 无法识别 - 指纹: - 搜索 - 999+ - 关于 - 添加指纹 - 添加目录 - 额外信息 - 专辑 - 所有目录 - 使用纵向滑动手势控制视频音量和亮度 - 啊哦,出错啦: %s - GIF 缩略图 + Simple Gallery 简约图库 - 一个观看照片和视频的简单实用工具。项目可以根据日期、大小、名称来递增或递减排序,照片可以缩放。媒体文件根据屏幕的大小排列在多个方格中,您可以使用缩放手势来调整每一列的方格数量。媒体文件可以被重命名、分享、删除、复制以及移动。照片亦可被剪切、旋转或是直接在应用中设为壁纸。 相册亦提供能让第三方应用预览图片/视频、向电子邮件客户端添加附件等的功能。非常适合日常使用。 应用不包含广告与不必要的权限。它是完全开放源代码的,并内置自定义颜色主题。 这个应用只是一系列应用中的一小部份。您可以在 http://www.simplemobiletools.com 找到其余的应用。 - 简约图库 - 一个没有广告,用来观看照片及视频的相册。 - 应用版本:%1$s - "应用到 '_1'" - 应用到全部冲突项 - 艺术家 - 递增 - 验证已被阻止,请稍后再试 - 验证失败 - 自动播放 - 背景色 - 亮度 - 相机 - 取消 - 更改封面图片 - 更改过滤器 - 更改视图类型 - 更改颜色将切换到自定义主题 - 点击此处以设置目标路径 - 确认选择 - 请选择 SD 卡根目录并授予写权限 - 如果您未找到 SD 卡目录,请尝试 - 确认外部存储器访问权限 - 复制 - 无法复制文件 - 复制/移动 - 操作失败 - 复制到 - 正在复制… - 复制成功 - 无法复制相同文件 - v %1$s Copyright © Simple Mobile Tools %2$d - 创建文件 %s 失败 - 创建文件夹 %s 失败 - 新建 - 新建文件夹 - 裁剪缩略图 - Android Image Cropper(图像裁剪和旋转) - 自定义 - 自定义颜色 - 全屏时黑色背景 - 深色主题 - 拍摄日期 - 删除 - 删除没有内容的空文件夹 - 递减 - 目标路径 - 设备系统:%1$s - 子目录数 - 丢弃 - 不再询问 - 捐赠 - "您已使用此应用一段时间了。 - -可您知道么,我并不就职于一个大公司。开发应用耗时耗力,且我想依旧保持免费,您的捐赠会给我更多动力。 - -您可以通过购买付费应用 Simple Thank You 或捐赠比特币来支持我。 - -更多信息请查阅 http://simplemobiletools.com/donate. - -非常感谢!" - 捐赠 - 时长 编辑 - 编辑方式: - 编辑方式 - 编辑器 - 发送反馈 - 请输入名称 - 输入密码 - 不能覆盖源文件 + 打开相机 + 打开方式 + 未找到可用应用 + (隐藏) + 锁定目录 + 解除锁定目录 + 文件视图 + 所有目录 + 目录视图 + 其他目录 + 在地图中显示 + 未知位置 + 未找到地图应用 + 未找到相机应用 + 增加一栏 + 减少一栏 + 更改封面图片 + 选择图片 + 使用默认 + 设置为 + 音量 + 亮度 + Do not ask again in this session + + + Filter media + Images + Videos + GIFs + No media files have been found with the selected filters. + Change filters + + + 通过添加文件 \'.nomedia\' 到目录,可以防止目录及其子目录下的所有媒体被扫描。您可以通过设置中的 \'显示隐藏目录\' 选项改变设置,是否继续? 排除 + 排除目录 + 管理排除目录 目录及其子目录中的媒体将不会在 Simple Gallery 中显示,您可以在设置更改。 是否排除父目录? 此目录及其子目录中的媒体将不会在 Simple Gallery 中显示,但是其它应用可以访问。如果您想对其它应用隐藏,请使用隐藏功能。 - 排除目录 - EXIF - 曝光时间 - 扩展名 - 扩展名不能为空 - 超大 - 光圈 - 文件 - 文件 %1$s 已存在 - 文件 %1$s 已存在。是否覆盖? - 文件保存成功 - 文件名 - 文件名不能为空 - 文件名包含非法字符 - 总文件数 - 要显示的媒体文件 - 指纹 - 保护设置成功。请重新安装本应用,以防复位时出现问题。 + 移除全部 + 是否移除列表中的全部目录?目录不会被物理删除。 + + + 包含目录 + 管理包含目录 + 添加目录 + 如果您还有应用未扫描到的媒体文件,请添加所在目录路径。 + + + 缩放 + 缩放选定区域并保存 + 宽度 + 高度 + 保持纵横比 + 请输入有效分辨率 + + + 编辑器 + 保存 + 旋转 + 路径 + 无效图片路径 + 图片编辑失败 + 编辑方式: + 未找到可用图片编辑器 + 未知的文件路径 + 不能覆盖源文件 + 向左旋转 + 向右旋转 + 旋转 180º 翻转 水平翻转 垂直翻转 - 焦距 - 文件夹 - 目录视图 - 关注我们: - 字体大小 - GIFs - 滑动(图像加载和缓存) - 去设置 - - 你在寻找一个简单而匿名的视频通话应用吗?请尝试我的另一个项目 - 高度 - (隐藏) - 隐藏 - 隐藏文件夹 - "通过添加文件 '.nomedia' 到目录,可以防止目录及其子目录下的所有媒体被扫描。您可以通过设置中的 '显示隐藏目录' 选项改变设置,是否继续?" - 全屏时自动隐藏状态栏 - 图片编辑失败 - 图片 - 包含目录 - 包含 GIFs - 包含照片 - 包含视频 - 如果您还有应用未扫描到的媒体文件,请添加所在目录路径。 - 增加一栏 - 绘制图案 - 内部存储器 - 间隔(秒): - 无法写入到选中目标路径 - 无效文件格式 - 无效图片路径 - 名称包含非法字符 - 请输入有效分辨率 - 分享给好友 - 分享到 - ISO 速度 - 已选择项目 - Joda-Time(Java日期替换) - 保持纵横比 - Kotlin(编程语言) - 横向长宽比 - - 修改日期 - 浅色主题 - 列表 - 循环幻灯片 - 循环播放视频 - 管理排除目录 - 要显示的详细信息项目 - 管理包含目录 - 浏览时最大亮度 - - 更多应用 - 移动 - 倒播 - 移动到 - 正在移动… - 文件移动成功 - 无法移动相同文件 - RecyclerView MultiSelect(选择多个列表项) - 名称 - 同名文件夹或文件已存在 - - 未找到可用应用 - 未找到相机应用 - 未找到可用应用 - 未找到可用图片编辑器 - 未选择文件 - 您还没有注册指纹,请先给你的设备添加一些指纹 - 未找到地图应用 - 未发现可用媒体 - 所选的过滤器没有找到的媒体文件。 - 请授予权限以访问您的存储器 - 此应用使用了以下三方库。谢谢。 - 确认 - 打开相机 - 打开方式 - 其他目录 - Otto (event bus) - 内存不足 - 覆盖 - 使用密码保护隐藏项 - 路径 - 图案 - PatternLockView(图案保护) - PhotoView(可缩放 gifs) - Picasso(图像加载和缓存) - 密码 - 锁定目录 - 请将手指放在指纹传感器上 - 请输入密码 - 请选择目标路径 - 纵向长宽比 - 主体色 - 是否执行此删除操作? - 属性 - 密码设置成功。为防止遗忘,请重新安装本应用。 - 随机顺序 - 为我们打分 - 减少一栏 - 移除全部 - 是否移除列表中的全部目录?目录不会被物理删除。 - 重命名 - 重命名文件 - 无法重命名文件 - 重命名文件夹 - 文件夹名不能为空 - 无法重命名文件夹 - 文件夹名已存在 - 文件夹重命名成功 - 无法重命名存储器的根目录 - 重命名中... - 重复图案 - 重复密码 - 替换全屏时菜单栏的“分享”为“旋转” - 缩放 - 缩放选定区域并保存 - 分辨率 - 恢复默认 - 根目录 - 旋转 - 向左旋转 - 旋转 180º - 向右旋转 - RtlViewPager(从右到左滑动) - 保存 - 保存 - 您尚未保存更改,是否保存? - 正在保存… - 根据长宽比 - 全屏方向 - 设备方向 - 系统设置 - 水平滚动缩略图 - SD 卡 - 搜索 - 全选 - 选择操作 - 选择目标路径 - 选择文件 - 选择文件夹 - 选择图片 - 选择存储器 - 设置为 + 编辑方式 + + + Simple Wallpaper 设为壁纸 壁纸设置失败 设为壁纸... - 正在设置壁纸… - 设置 - 分享 - 请前往 %2$s 看看我们的 %1$s 吧! - 分享到 - 文件视图 - 全屏浏览媒体时显示详细信息 - 显示隐藏文件和文件夹 - 显示所有 - 在地图中显示 - 简约壁纸 - 大小 - 跳过 - 幻灯片 - 幻灯片结束 - - 排序方式 - 原始路径 - 原始路径和目标路径不能相同 - Stetho(调试数据库) - 不显示隐藏的媒体文件 - Subsampling Scale Image View(可缩放图像浏览) - 显示/隐藏缓存内容 - 文本颜色 - 主题 - 开放源代码 - 开放源代码 - 标题 - 显示文件名 - 撤销更改 - 是否撤销您的更改? - 取消隐藏 - 取消隐藏文件夹 - 未知错误 - 未知的文件路径 - 未知位置 - 解除锁定目录 - 使用默认 - 使用渐变动画 - 仅应用于此文件夹 - 视频 - 音量 + 未找到可用应用 + 正在设置壁纸… 壁纸设置成功 - 应用源码 - 更新日志 - * 此处仅列举了重大更新,更多修正可在使用中体验 - 宽度 - 图案错误 - 密码错误 - 目录选择错误,请选择 SD 卡 - + 纵向长宽比 + 横向长宽比 + + + 幻灯片 + 间隔(秒): + Include photos + 包含视频 + Include GIFs + 随机顺序 + 使用渐变动画 + 倒播 + Loop slideshow + 幻灯片结束 + 未发现可用媒体 + + + Change view type + Grid + List + + + 显示所有 + 自动播放 + 显示文件名 + 循环播放视频 + GIF 缩略图 + 浏览时最大亮度 + 裁剪缩略图 + 全屏时方向 + 系统设置 + 设备方向 + 根据长宽比 + 全屏时黑色背景 + 水平滚动缩略图 + 全屏时自动隐藏状态栏 + Delete empty folders after deleting their content + Allow controlling video volume and brightness with vertical gestures + 替换全屏时菜单栏的“分享”为“旋转” + Show extended details over fullscreen media + Manage extended details + + + + 一个没有广告,用来观看照片及视频的相册。 + + 一个观看照片和视频的简单实用工具。项目可以根据日期、大小、名称来递增或递减排序,照片可以缩放。媒体文件根据屏幕的大小排列在多个方格中,您可以使用缩放手势来调整每一列的方格数量。媒体文件可以被重命名、分享、删除、复制以及移动。照片亦可被剪切、旋转或是直接在应用中设为壁纸。 + + 相册亦提供能让第三方应用预览图片/视频、向电子邮件客户端添加附件等的功能。非常适合日常使用。 + + 应用不包含广告与不必要的权限。它是完全开放源代码的,并内置自定义颜色主题。 + + 这个应用只是一系列应用中的一小部份。您可以在 http://www.simplemobiletools.com 找到其余的应用。 + + + From 2a2b77fc6b12953530f008a7cdc7f0c10d356c42 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 23 Oct 2017 17:04:44 +0200 Subject: [PATCH 06/21] add a string for toggling media count visibility on main screen --- app/src/main/res/values-ca/strings.xml | 1 + app/src/main/res/values-cs/strings.xml | 1 + app/src/main/res/values-de/strings.xml | 1 + app/src/main/res/values-es/strings.xml | 1 + app/src/main/res/values-fi/strings.xml | 1 + app/src/main/res/values-fr/strings.xml | 1 + app/src/main/res/values-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 + 19 files changed, 19 insertions(+) diff --git a/app/src/main/res/values-ca/strings.xml b/app/src/main/res/values-ca/strings.xml index fac61048c..b2b1b6986 100644 --- a/app/src/main/res/values-ca/strings.xml +++ b/app/src/main/res/values-ca/strings.xml @@ -125,6 +125,7 @@ Automatically hide system UI at fullscreen media Delete empty folders after deleting their content Allow controlling video volume and brightness with vertical gestures + Show folder media count on the main view Replace Share with Rotate at fullscreen menu Show extended details over fullscreen media Manage extended details diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index c6ba60327..48f819337 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -125,6 +125,7 @@ Automatically hide system UI at fullscreen media Delete empty folders after deleting their content Allow controlling video volume and brightness with vertical gestures + Show folder media count on the main view Replace Share with Rotate at fullscreen menu Show extended details over fullscreen media Manage extended details diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 3a524eca2..da95fadc3 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -125,6 +125,7 @@ Systemleisten ausblenden im Vollbild Nach Löschen leere Ordner löschen Gesten für Videolautstärke/Helligkeit + Show folder media count on the main view Teilen/Drehen im Vollbild-Menü vertauschen Eigenschaften anzeigen im Vollbild Eigenschaften auswählen diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 8a364e187..8f9bb7813 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -125,6 +125,7 @@ Ocultar automáticamente la interfaz de usuario del sistema en medios de pantalla completa Delete empty folders after deleting their content Allow controlling video volume and brightness with vertical gestures + Show folder media count on the main view Reemplazar Compartir con Girar en el menú de pantalla completa Show extended details over fullscreen media Manage extended details diff --git a/app/src/main/res/values-fi/strings.xml b/app/src/main/res/values-fi/strings.xml index a4edf365a..57e76daec 100644 --- a/app/src/main/res/values-fi/strings.xml +++ b/app/src/main/res/values-fi/strings.xml @@ -125,6 +125,7 @@ Piilota järjestelmän UI automaattisesti koko näytön mediassa Poista tyhjät kansiot kansion tyhjennyksen jälkeen Salli videon äänenvoimakkuuden ja kirkkauden säätö pystysuorilla eleillä + Show folder media count on the main view Korvaa jakaminen kääntämisellä koko näytön tilassa Show extended details over fullscreen media Manage extended details diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 4fd96a948..efa023339 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -125,6 +125,7 @@ Masquer automatiquement l\'interface utilisateur si média plein écran Supprimer les dossiers vides après avoir supprimé leur contenu Permettre le contrôle du volume vidéo et de la luminosité avec des gestes verticaux + Show folder media count on the main view Remplacer Partager par Pivoter si menu en plein écran Afficher les détails supplémentaires par dessus le média en plein écran Gérer les détails supplémentaires diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index b04301122..2eb9d22d0 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -125,6 +125,7 @@ Automatically hide system UI at fullscreen media Delete empty folders after deleting their content Allow controlling video volume and brightness with vertical gestures + Show folder media count on the main view Replace Share with Rotate at fullscreen menu Show extended details over fullscreen media Manage extended details diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 2b187ae34..66c2fd1f3 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -125,6 +125,7 @@ Nascondi UI di sistema con media a schermo intero Elimina cartelle vuote dopo averne eliminato il contenuto Gestisci il volume e la luminosità dei video con gesti verticali + Show folder media count on the main view Sostituisci Condividi con Ruota a schermo intero Show extended details over fullscreen media Manage extended details diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 93b6e616e..dc2413462 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -125,6 +125,7 @@ フルスクリーン時にシステムUIを非表示にする メディアの削除後にフォルダーが空になった場合、そのフォルダーを削除する ビデオ再生中に、音量と明るさを縦方向のジェスチャーで変更する + Show folder media count on the main view フルスクリーンメニューの「共有」を「回転」に置き換える Show extended details over fullscreen media Manage extended details diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index a148c3a0e..45144c60c 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -125,6 +125,7 @@ Ukrywaj interfejs przy pełnoekranowym podglądzie Usuwaj puste foldery po usunięciu ich zawartości Zezwalaj na kontrolę jasności i głośności filmów pionowymi gestami + Show folder media count on the main view Zamień funkcję udostępniania na obracanie w menu pełnoekranowym Show extended details over fullscreen media Manage extended details diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 61b8ab94f..8c391f4b7 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -125,6 +125,7 @@ Esconder interface do sistema automaticamente quando em tela cheia Apagar pastas vazias após deleter seu conteúdo Permitir controle do volume e brilho com gestos na vertical + Show folder media count on the main view Substituir botão "Compartilhar" por "Rotação de tela" quando em tela cheia Exibir detalhes extendidos quando em tela cheia Gerenciar detalhes extendidos diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index 51ba03b5c..bdbf21597 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -125,6 +125,7 @@ Ocultar interface do sistema se em ecrã completo Apagar as pastas vazias depois de remover o seu conteúdo Permitir controlo do volume e brilho dos vídeos através de gestos verticais + Show folder media count on the main view Substituir a opção Partilhar pela opção Rodar se em ecrã completo Show extended details over fullscreen media Manage extended details diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 34ffc082c..d62e8711d 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -125,6 +125,7 @@ Автоматически скрывать системный интерфейс в полноэкранном режиме Удалять пустые папки после удаления их содержимого Управлять громкостью и яркостью видео с помощью вертикальных жестов + Show folder media count on the main view Заменить \'Поделиться\' на \'Повернуть\' в меню полноэкранного режима Show extended details over fullscreen media Manage extended details diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index 50eeece79..f562dff8d 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -125,6 +125,7 @@ Automaticky skrývať systémové lišty pri celoobrazovkových médiách Odstrániť prázdne priečinky po vymazaní ich obsahu Povoliť ovládanie hlasitosti a jasu videí vertikálnymi ťahmi + Zobraziť počet médií v priečinku na hlavnej obrazovke Nahradiť Zdieľanie s Otočením v celoobrazovkovom menu Zobraziť rozšírené vlastnosti ponad celoobrazovkové médiá Spravovať rozšírené vlastnosti diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index 2ba4fc87d..106063a54 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -125,6 +125,7 @@ Dölj systemanvändargränssnittet automatiskt när media visas i helskärmsläge Ta bort tomma mappar när deras innehåll tas bort Tillåt styrning av videovolym och videoljusstyrka med vertikala gester + Show folder media count on the main view Ersätt Dela med Rotera i helskärmsmenyn Show extended details over fullscreen media Manage extended details diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index 6263ca620..a9ac2f748 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -125,6 +125,7 @@ Automatically hide system UI at fullscreen media Delete empty folders after deleting their content Allow controlling video volume and brightness with vertical gestures + Show folder media count on the main view Replace Share with Rotate at fullscreen menu Show extended details over fullscreen media Manage extended details diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index b43f3c294..deb5176e0 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -125,6 +125,7 @@ 全屏时自动隐藏状态栏 Delete empty folders after deleting their content Allow controlling video volume and brightness with vertical gestures + Show folder media count on the main view 替换全屏时菜单栏的“分享”为“旋转” Show extended details over fullscreen media Manage extended details diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 1ec71fd20..bc5042450 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -125,6 +125,7 @@ 全螢幕時自動隱藏系統介面 刪除內容後刪除空白資料夾 允許用上下手勢來控制影片的音量和亮度 + Show folder media count on the main view 將全螢幕選單的分享取代為旋轉 Show extended details over fullscreen media Manage extended details diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index fac61048c..b2b1b6986 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -125,6 +125,7 @@ Automatically hide system UI at fullscreen media Delete empty folders after deleting their content Allow controlling video volume and brightness with vertical gestures + Show folder media count on the main view Replace Share with Rotate at fullscreen menu Show extended details over fullscreen media Manage extended details From 5cd3fdf57f3ee86574ee2f51bb34a8f611e80b2f Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 23 Oct 2017 17:26:33 +0200 Subject: [PATCH 07/21] implement the Show Media Count toggle functionality --- .../gallery/activities/MainActivity.kt | 38 +++++++++++++------ .../gallery/activities/SettingsActivity.kt | 9 +++++ .../gallery/adapters/DirectoryAdapter.kt | 20 +++++----- .../gallery/helpers/Config.kt | 4 ++ .../gallery/helpers/Constants.kt | 1 + app/src/main/res/layout/activity_settings.xml | 20 ++++++++++ 6 files changed, 71 insertions(+), 21 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 8baa4fa20..ef6cae120 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -56,6 +56,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { private var mStoredAnimateGifs = true private var mStoredCropThumbnails = true private var mStoredScrollHorizontally = true + private var mStoredShowMediaCount = true private var mStoredTextColor = 0 private var mLoadedInitialPhotos = false private var mLatestMediaId = 0L @@ -80,10 +81,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { removeTempFolder() directories_refresh_layout.setOnRefreshListener({ getDirectories() }) mDirs = ArrayList() - mStoredAnimateGifs = config.animateGifs - mStoredCropThumbnails = config.cropThumbnails - mStoredScrollHorizontally = config.scrollHorizontally - mStoredTextColor = config.textColor + storeStateVariables() checkWhatsNewDialog() directories_empty_text.setOnClickListener { @@ -134,6 +132,13 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { directories_grid.adapter?.notifyDataSetChanged() } + if (mStoredShowMediaCount != config.showMediaCount) { + (directories_grid.adapter as? DirectoryAdapter)?.apply { + showMediaCount = config.showMediaCount + notifyDataSetChanged() + } + } + if (mStoredScrollHorizontally != config.scrollHorizontally) { (directories_grid.adapter as? DirectoryAdapter)?.apply { scrollVertically = config.viewTypeFolders == VIEW_TYPE_LIST || !config.scrollHorizontally @@ -157,10 +162,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { storeDirectories() directories_refresh_layout.isRefreshing = false mIsGettingDirs = false - mStoredAnimateGifs = config.animateGifs - mStoredCropThumbnails = config.cropThumbnails - mStoredScrollHorizontally = config.scrollHorizontally - mStoredTextColor = config.textColor + storeStateVariables() directories_grid.listener = null mLastMediaHandler.removeCallbacksAndMessages(null) @@ -175,6 +177,16 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { removeTempFolder() } + private fun storeStateVariables() { + config.apply { + mStoredAnimateGifs = animateGifs + mStoredCropThumbnails = cropThumbnails + mStoredScrollHorizontally = scrollHorizontally + mStoredShowMediaCount = showMediaCount + mStoredTextColor = textColor + } + } + private fun removeTempFolder() { val newFolder = File(config.tempFolderPath) if (newFolder.exists() && newFolder.isDirectory) { @@ -188,10 +200,11 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { private fun tryloadGallery() { handlePermission(PERMISSION_WRITE_STORAGE) { if (it) { - if (config.showAll) + if (config.showAll) { showAllMedia() - else + } else { getDirectories() + } setupLayoutManager() checkIfColorChanged() @@ -305,10 +318,11 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { private fun getRecyclerAdapter() = (directories_grid.adapter as DirectoryAdapter) private fun setupLayoutManager() { - if (config.viewTypeFolders == VIEW_TYPE_GRID) + if (config.viewTypeFolders == VIEW_TYPE_GRID) { setupGridLayoutManager() - else + } else { setupListLayoutManager() + } } private fun setupGridLayoutManager() { 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 8851b6bd3..7c0b7b60b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt @@ -49,6 +49,7 @@ class SettingsActivity : SimpleActivity() { setupPasswordProtection() setupDeleteEmptyFolders() setupAllowVideoGestures() + setupShowMediaCount() setupShowExtendedDetails() setupManageExtendedDetails() updateTextColors(settings_holder) @@ -198,6 +199,14 @@ class SettingsActivity : SimpleActivity() { } } + private fun setupShowMediaCount() { + settings_show_media_count.isChecked = config.showMediaCount + settings_show_media_count_holder.setOnClickListener { + settings_show_media_count.toggle() + config.showMediaCount = settings_show_media_count.isChecked + } + } + private fun setupScreenRotation() { settings_screen_rotation.text = getScreenRotationText() settings_screen_rotation_holder.setOnClickListener { 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 54565ee11..8edb4c9b5 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt @@ -30,17 +30,18 @@ import java.util.* class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableList, val listener: DirOperationsListener?, val isPickIntent: Boolean, val itemClick: (Directory) -> Unit) : RecyclerView.Adapter() { - val multiSelector = MultiSelector() val config = activity.config - val isListViewType = config.viewTypeFolders == VIEW_TYPE_LIST - var actMode: ActionMode? = null - var itemViews = SparseArray() - val selectedPositions = HashSet() var primaryColor = config.primaryColor - var textColor = config.textColor - var pinnedFolders = config.pinnedFolders var scrollVertically = !config.scrollHorizontally + var showMediaCount = config.showMediaCount + + private val multiSelector = MultiSelector() + private val isListViewType = config.viewTypeFolders == VIEW_TYPE_LIST + private var itemViews = SparseArray() + private val selectedPositions = HashSet() + private var textColor = config.textColor + private var pinnedFolders = config.pinnedFolders fun toggleItemSelection(select: Boolean, pos: Int) { if (select) { @@ -350,7 +351,7 @@ class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableList (Unit)) : SwappingHolder(view, MultiSelector()) { - fun bindView(directory: Directory, isPinned: Boolean, scrollVertically: Boolean, isListView: Boolean, textColor: Int): View { + fun bindView(directory: Directory, isPinned: Boolean, scrollVertically: Boolean, isListView: Boolean, textColor: Int, showMediaCount: Boolean): View { itemView.apply { dir_name.text = directory.name dir_path?.text = "${directory.path.substringBeforeLast("/")}/" @@ -423,6 +424,7 @@ class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableList + + + + + + Date: Tue, 24 Oct 2017 01:16:52 +0800 Subject: [PATCH 08/21] Update strings.xml --- app/src/main/res/values-zh-rCN/strings.xml | 46 +++++++++++----------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index deb5176e0..90412da97 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -1,6 +1,6 @@ - Simple Gallery + 简约图库 简约图库 编辑 打开相机 @@ -25,26 +25,26 @@ 设置为 音量 亮度 - Do not ask again in this session + 不再提醒 - Filter media - Images - Videos + 要显示的媒体文件 + 图片 + 适配 GIFs - No media files have been found with the selected filters. - Change filters + 所选的过滤器没有找到媒体文件。 + 更改过滤器 通过添加文件 \'.nomedia\' 到目录,可以防止目录及其子目录下的所有媒体被扫描。您可以通过设置中的 \'显示隐藏目录\' 选项改变设置,是否继续? 排除 排除目录 管理排除目录 - 目录及其子目录中的媒体将不会在 Simple Gallery 中显示,您可以在设置更改。 + 目录及其子目录中的媒体将不会在“简约图库”中显示,您可以在设置更改。 是否排除父目录? - 此目录及其子目录中的媒体将不会在 Simple Gallery 中显示,但是其它应用可以访问。如果您想对其它应用隐藏,请使用隐藏功能。 + 此目录及其子目录中的媒体将不会在“简约图库”中显示,但是其它应用可以访问。如果您想对其它应用隐藏,请使用隐藏功能。 移除全部 - 是否移除列表中的全部目录?目录不会被物理删除。 + 是否删除排除列表中的所有文件夹?此操作不会删除文件夹。 包含目录 @@ -80,7 +80,7 @@ 编辑方式 - Simple Wallpaper + 简约壁纸 设为壁纸 壁纸设置失败 设为壁纸... @@ -93,20 +93,20 @@ 幻灯片 间隔(秒): - Include photos - 包含视频 - Include GIFs + 包括照片 + 包括视频 + 包括 GIFs 随机顺序 使用渐变动画 倒播 - Loop slideshow + 循环幻灯片 幻灯片结束 未发现可用媒体 - Change view type - Grid - List + 更改视图类型 + 网格 + 列表 显示所有 @@ -123,12 +123,12 @@ 全屏时黑色背景 水平滚动缩略图 全屏时自动隐藏状态栏 - Delete empty folders after deleting their content - Allow controlling video volume and brightness with vertical gestures - Show folder media count on the main view + 删除没有内容的空文件夹 + 使用纵向滑动手势控制视频音量和亮度 + 在主界面显示文件夹媒体计数 替换全屏时菜单栏的“分享”为“旋转” - Show extended details over fullscreen media - Manage extended details + 全屏浏览媒体时显示详细信息 + 要显示的详细信息项目 From 012e091349994ab76c073c60df75b8581eedd6f2 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 23 Oct 2017 19:39:43 +0200 Subject: [PATCH 09/21] minor code cleanup at videofragment --- .../gallery/activities/ViewPagerActivity.kt | 1 - .../simplemobiletools/gallery/fragments/VideoFragment.kt | 8 +------- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt index 64c315ba4..df2a14722 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -273,7 +273,6 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1 || !isDestroyed) { view_pager.apply { adapter = pagerAdapter - adapter!!.notifyDataSetChanged() currentItem = mPos addOnPageChangeListener(this@ViewPagerActivity) } 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 9d2e395f1..86db872a9 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt @@ -9,7 +9,6 @@ import android.os.Bundle import android.os.Handler import android.provider.Settings import android.util.DisplayMetrics -import android.util.Log import android.view.* import android.view.animation.AnimationUtils import android.widget.SeekBar @@ -26,6 +25,7 @@ import java.io.IOException class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSeekBarChangeListener { private val CLICK_MAX_DURATION = 150 private val SLIDE_INFO_FADE_DELAY = 1000L + private val PROGRESS = "progress" private var mMediaPlayer: MediaPlayer? = null private var mSurfaceView: SurfaceView? = null @@ -59,11 +59,6 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee lateinit var medium: Medium lateinit var mTimeHolder: View - companion object { - private val TAG = VideoFragment::class.java.simpleName - private val PROGRESS = "progress" - } - override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { mView = inflater.inflate(R.layout.pager_video_item, container, false) mTimeHolder = mView.video_time_holder @@ -397,7 +392,6 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee prepareAsync() } } catch (e: IOException) { - Log.e(TAG, "init media player failed $e") releaseMediaPlayer() } } From baed126550cb14467a3109d3a0f482b4cada9ee8 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 23 Oct 2017 21:30:24 +0200 Subject: [PATCH 10/21] fix some video playback issues on Android 7 --- .../gallery/activities/ViewPagerActivity.kt | 4 +-- .../gallery/fragments/VideoFragment.kt | 31 +++++++++++-------- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt index df2a14722..cc996366f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -742,9 +742,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View private fun getCurrentFile() = File(getCurrentPath()) - override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) { - - } + override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {} override fun onPageSelected(position: Int) { if (view_pager.offscreenPageLimit == 1) { 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 86db872a9..af1f02067 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt @@ -20,7 +20,6 @@ import com.simplemobiletools.gallery.extensions.* import com.simplemobiletools.gallery.helpers.MEDIUM import com.simplemobiletools.gallery.models.Medium import kotlinx.android.synthetic.main.pager_video_item.view.* -import java.io.IOException class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSeekBarChangeListener { private val CLICK_MAX_DURATION = 150 @@ -40,6 +39,7 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee private var mIsFragmentVisible = false private var mPlayOnPrepare = false private var mStoredShowExtendedDetails = false + private var wasInit = false private var mStoredExtendedDetails = 0 private var mCurrTime = 0 private var mDuration = 0 @@ -71,6 +71,7 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee mIsFullscreen = activity.window.decorView.systemUiVisibility and View.SYSTEM_UI_FLAG_FULLSCREEN == View.SYSTEM_UI_FLAG_FULLSCREEN checkFullscreen() + wasInit = true return mView } @@ -124,21 +125,21 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee initTimeHolder() checkExtendedDetails() + initMediaPlayer() } override fun setMenuVisibility(menuVisible: Boolean) { super.setMenuVisibility(menuVisible) + if (mIsFragmentVisible && !menuVisible) { + pauseVideo() + releaseMediaPlayer() + } mIsFragmentVisible = menuVisible - if (menuVisible) { - if (mSurfaceView != null && mSurfaceHolder!!.surface.isValid) { - initMediaPlayer() - } - + if (menuVisible && wasInit) { + initMediaPlayer() if (context?.config?.autoplayVideos == true) { playVideo() } - } else if (mIsPlaying) { - pauseVideo() } } @@ -351,6 +352,8 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee if (activity == null || !isAdded) return + initMediaPlayer() + mIsPlaying = !mIsPlaying if (mIsPlaying) { playVideo() @@ -378,8 +381,9 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee } private fun initMediaPlayer() { - if (mMediaPlayer != null) + if (mMediaPlayer != null || !mIsFragmentVisible) { return + } try { mMediaPlayer = MediaPlayer().apply { @@ -389,9 +393,9 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee setOnVideoSizeChangedListener({ mediaPlayer, width, height -> setVideoSize() }) setOnPreparedListener { videoPrepared(it) } setAudioStreamType(AudioManager.STREAM_MUSIC) - prepareAsync() + prepare() } - } catch (e: IOException) { + } catch (e: Exception) { releaseMediaPlayer() } } @@ -441,7 +445,9 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee } override fun surfaceCreated(holder: SurfaceHolder) { - + mSurfaceHolder = holder + if (mIsFragmentVisible) + initMediaPlayer() } override fun surfaceChanged(holder: SurfaceHolder, format: Int, width: Int, height: Int) { @@ -462,7 +468,6 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee initMediaPlayer() if (mMediaPlayer == null) { - activity.toast(R.string.unknown_error_occurred) return } From 06b3c728ce27848794381df8d10e3b46682b5791 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 23 Oct 2017 23:52:37 +0200 Subject: [PATCH 11/21] no need to update last modified manually afer renaming on internal storage --- app/build.gradle | 2 +- .../kotlin/com/simplemobiletools/gallery/extensions/activity.kt | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 5d0a8fe7d..44b5233f4 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,7 +37,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.31.1' + compile 'com.simplemobiletools:commons:2.31.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' 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 75e291505..a856ca11f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt @@ -261,7 +261,6 @@ fun SimpleActivity.toggleFileVisibility(oldFile: File, hide: Boolean, callback: } val newFile = File(path, filename) renameFile(oldFile, newFile) { - newFile.setLastModified(System.currentTimeMillis()) callback(newFile) } } From aca83d7fadf3dde5864a0dce76f00aecba4b4e27 Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 24 Oct 2017 21:18:33 +0200 Subject: [PATCH 12/21] hide the Extended details if text is empty --- .../com/simplemobiletools/gallery/fragments/PhotoFragment.kt | 2 +- .../com/simplemobiletools/gallery/fragments/VideoFragment.kt | 2 +- 2 files changed, 2 insertions(+), 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 a96db9a4a..b865282d3 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt @@ -275,7 +275,7 @@ class PhotoFragment : ViewPagerFragment() { view.photo_details.apply { text = getMediumExtendedDetails(medium) setTextColor(context.config.textColor) - beVisible() + beVisibleIf(text.isNotEmpty()) onGlobalLayout { if (height != 0) { val smallMargin = resources.getDimension(R.dimen.small_margin) 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 af1f02067..e271e0b90 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt @@ -505,7 +505,7 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee mView.video_details.apply { text = getMediumExtendedDetails(medium) setTextColor(context.config.textColor) - beVisible() + beVisibleIf(text.isNotEmpty()) onGlobalLayout { if (height != 0) { val smallMargin = resources.getDimension(R.dimen.small_margin) From 498cd10ba6016a37264e38de6d956a3fd4adaf6d Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 24 Oct 2017 21:53:28 +0200 Subject: [PATCH 13/21] add a medium null check at scrollStateChanged trigger --- .../gallery/activities/ViewPagerActivity.kt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt index cc996366f..e9af326b0 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -730,10 +730,11 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View } private fun getCurrentMedium(): Medium? { - return if (getCurrentMedia().isEmpty() || mPos == -1) + return if (getCurrentMedia().isEmpty() || mPos == -1) { null - else + } else { getCurrentMedia()[Math.min(mPos, getCurrentMedia().size - 1)] + } } private fun getCurrentMedia() = if (mAreSlideShowMediaVisible) mSlideshowMedia else mMedia @@ -756,7 +757,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View } override fun onPageScrollStateChanged(state: Int) { - if (state == ViewPager.SCROLL_STATE_IDLE) { + if (state == ViewPager.SCROLL_STATE_IDLE && getCurrentMedium() != null) { checkOrientation() } } From 7ad578ec2e13587011e8213aabe03b3d698d607f Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 24 Oct 2017 22:20:50 +0200 Subject: [PATCH 14/21] make sure we are selecting existing indexes at media and directory adapters --- .../simplemobiletools/gallery/adapters/DirectoryAdapter.kt | 6 ++++-- .../com/simplemobiletools/gallery/adapters/MediaAdapter.kt | 6 ++++-- 2 files changed, 8 insertions(+), 4 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 8edb4c9b5..7f36dfd26 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt @@ -45,8 +45,10 @@ class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableList, fun toggleItemSelection(select: Boolean, pos: Int) { if (select) { - itemViews[pos]?.medium_check?.background?.setColorFilter(primaryColor, PorterDuff.Mode.SRC_IN) - selectedPositions.add(pos) + if (itemViews[pos] != null) { + itemViews[pos].medium_check?.background?.setColorFilter(primaryColor, PorterDuff.Mode.SRC_IN) + selectedPositions.add(pos) + } } else { selectedPositions.remove(pos) } From 3e7d67a3a2317b98ff3db5901f9c6fdcdc62e362 Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 24 Oct 2017 22:57:04 +0200 Subject: [PATCH 15/21] update commons, use our custom map for determining file mimetype --- app/build.gradle | 2 +- .../com/simplemobiletools/gallery/activities/MainActivity.kt | 2 +- .../com/simplemobiletools/gallery/extensions/activity.kt | 2 +- .../kotlin/com/simplemobiletools/gallery/models/Medium.kt | 5 ++--- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 44b5233f4..4296e2ac2 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,7 +37,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.31.4' + compile 'com.simplemobiletools:commons:2.31.10' 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' 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 ef6cae120..08a8aafbd 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -480,7 +480,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { private fun fillIntentPath(resultData: Intent, resultIntent: Intent) { val path = resultData.data.path val uri = Uri.fromFile(File(path)) - val type = File(path).getMimeType("image/jpeg") + val type = path.getMimeTypeFromPath() resultIntent.setDataAndTypeAndNormalize(uri, type) resultIntent.flags = Intent.FLAG_GRANT_READ_URI_PERMISSION or Intent.FLAG_GRANT_WRITE_URI_PERMISSION } 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 a856ca11f..4fe4d6180 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt @@ -88,7 +88,7 @@ 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/*")) + setDataAndType(uri, file.getMimeType()) addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) val chooser = Intent.createChooser(this, getString(R.string.set_as)) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/models/Medium.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/models/Medium.kt index fadf715ea..bf15cd20c 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/models/Medium.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/models/Medium.kt @@ -1,10 +1,9 @@ package com.simplemobiletools.gallery.models -import com.simplemobiletools.commons.extensions.getMimeType +import com.simplemobiletools.commons.extensions.getMimeTypeFromPath import com.simplemobiletools.commons.extensions.isGif import com.simplemobiletools.commons.extensions.isPng import com.simplemobiletools.commons.helpers.* -import java.io.File import java.io.Serializable data class Medium(var name: String, var path: String, val video: Boolean, val modified: Long, val taken: Long, val size: Long) : Serializable, Comparable { @@ -21,7 +20,7 @@ data class Medium(var name: String, var path: String, val video: Boolean, val mo fun isImage() = !isGif() && !video - fun getMimeType() = File(path).getMimeType() + fun getMimeType() = path.getMimeTypeFromPath() override fun compareTo(other: Medium): Int { var result: Int From fc9cb7565258848cc3106c55b4eed3fa9f1fca78 Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 24 Oct 2017 23:33:15 +0200 Subject: [PATCH 16/21] update commons to 2.31.11 --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 4296e2ac2..4375ae451 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,7 +37,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.31.10' + compile 'com.simplemobiletools:commons:2.31.11' 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 54515b47d8bb470d7b50213c707933944a715696 Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 24 Oct 2017 23:36:44 +0200 Subject: [PATCH 17/21] adding the Folder media count toggle to Whats new --- .../com/simplemobiletools/gallery/activities/MainActivity.kt | 1 + app/src/main/res/values/donottranslate.xml | 1 + 2 files changed, 2 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 08a8aafbd..62f6ffa6f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -638,6 +638,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { add(Release(127, R.string.release_127)) add(Release(133, R.string.release_133)) add(Release(136, R.string.release_136)) + add(Release(137, R.string.release_137)) checkWhatsNew(this, BuildConfig.VERSION_CODE) } } diff --git a/app/src/main/res/values/donottranslate.xml b/app/src/main/res/values/donottranslate.xml index 6aa0e6205..de109b996 100644 --- a/app/src/main/res/values/donottranslate.xml +++ b/app/src/main/res/values/donottranslate.xml @@ -2,6 +2,7 @@ + Added an option to hide folder media count on the main screen Added an option to show customizable extended details over fullscreen media Added fingerprint to hidden item protection\n From b225e2a5e588111be1208392a506f954b9679388 Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 24 Oct 2017 23:39:35 +0200 Subject: [PATCH 18/21] updated version to 2.16.1 --- app/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 4375ae451..f63fcf375 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,8 +10,8 @@ android { applicationId "com.simplemobiletools.gallery" minSdkVersion 16 targetSdkVersion 23 - versionCode 136 - versionName "2.16.0" + versionCode 137 + versionName "2.16.1" } signingConfigs { From 97b24509f1abef1c1f4565546c68aaaac7621089 Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 24 Oct 2017 23:39:40 +0200 Subject: [PATCH 19/21] updating changelog --- CHANGELOG.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 07b808103..11500d8ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,15 @@ Changelog ========== +Version 2.16.1 *(2017-10-24)* +---------------------------- + + * Added a toggle for hiding folder media count on the main screen + * Fixed SD card folders not being visible on some devices + * Fixed videos not playing properly in some cases + * Do not modify last_modified at copy/move/rename + * Added support for 3gpp videos + Version 2.16.0 *(2017-10-19)* ---------------------------- From 0140d222dd64c5d84065469f4e69b539cd234405 Mon Sep 17 00:00:00 2001 From: gregory678 Date: Wed, 25 Oct 2017 00:28:28 +0200 Subject: [PATCH 20/21] Updates for 2.16 --- app/src/main/res/values-pl/strings.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index 45144c60c..977281918 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -25,7 +25,7 @@ Ustaw jako Głośność Jasność - Do not ask again in this session + Nie pytaj więcej w tej sesji Filtruj multimedia @@ -125,10 +125,10 @@ Ukrywaj interfejs przy pełnoekranowym podglądzie Usuwaj puste foldery po usunięciu ich zawartości Zezwalaj na kontrolę jasności i głośności filmów pionowymi gestami - Show folder media count on the main view + Pokazuj liczbę elementów w folderach w głównym widoku Zamień funkcję udostępniania na obracanie w menu pełnoekranowym - Show extended details over fullscreen media - Manage extended details + Dodatkowe szczegóły przy podglądzie pełnoekranowym< + Zarządzaj dodatkowymi szczegółami From 4220d32bfcbfd8feead70cafea15d2b7df0481cc Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 25 Oct 2017 09:38:22 +0200 Subject: [PATCH 21/21] remove a double closing tag at polish translation --- app/src/main/res/values-pl/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index 977281918..c77a32cad 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -127,7 +127,7 @@ Zezwalaj na kontrolę jasności i głośności filmów pionowymi gestami Pokazuj liczbę elementów w folderach w głównym widoku Zamień funkcję udostępniania na obracanie w menu pełnoekranowym - Dodatkowe szczegóły przy podglądzie pełnoekranowym< + Dodatkowe szczegóły przy podglądzie pełnoekranowym Zarządzaj dodatkowymi szczegółami