From f3d1feb141e0f2e1dabc1b6d8dec5d04d526775a Mon Sep 17 00:00:00 2001 From: gcalzo <26879397+gcalzo@users.noreply.github.com> Date: Wed, 25 Oct 2017 11:27:52 +0200 Subject: [PATCH 01/66] Update strings.xml Translated the newest strings --- app/src/main/res/values-it/strings.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 66c2fd1f3..f6c210722 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -25,7 +25,7 @@ Imposta come Volume Luminosità - Do not ask again in this session + Non chiedere nuovamente in questa sessione Filtra i media @@ -125,10 +125,10 @@ 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 + Mostra numero elementi nella cartella Sostituisci Condividi con Ruota a schermo intero - Show extended details over fullscreen media - Manage extended details + Mostra informazioni estese su media a schermo intero + Gestisci le informazioni estese From ba014d329354af2a40e1bbe36e957bf90f7dedfb Mon Sep 17 00:00:00 2001 From: fiepi Date: Wed, 25 Oct 2017 18:17:58 +0800 Subject: [PATCH 02/66] add oreo adaptive icon --- app/build.gradle | 6 +++--- .../main/res/mipmap-anydpi-v26/ic_launcher.xml | 5 +++++ .../res/mipmap-anydpi-v26/ic_launcher_round.xml | 5 +++++ .../res/mipmap-nodpi/ic_launcher_foreground.png | Bin 0 -> 2304 bytes app/src/main/res/values/colors.xml | 2 ++ 5 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml create mode 100644 app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml create mode 100644 app/src/main/res/mipmap-nodpi/ic_launcher_foreground.png diff --git a/app/build.gradle b/app/build.gradle index f63fcf375..2cb3f22b5 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -3,13 +3,13 @@ apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' android { - compileSdkVersion 25 - buildToolsVersion "25.0.3" + compileSdkVersion 26 + buildToolsVersion "26.0.1" defaultConfig { applicationId "com.simplemobiletools.gallery" minSdkVersion 16 - targetSdkVersion 23 + targetSdkVersion 26 versionCode 137 versionName "2.16.1" } diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 000000000..f4091292b --- /dev/null +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 000000000..f4091292b --- /dev/null +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/app/src/main/res/mipmap-nodpi/ic_launcher_foreground.png b/app/src/main/res/mipmap-nodpi/ic_launcher_foreground.png new file mode 100644 index 0000000000000000000000000000000000000000..24b7f2986dcc07995d09f09e72083440da827ca3 GIT binary patch literal 2304 zcmc&$`8U-28~;qEvCkyNmNjE5ds7kP>ssPtY`KW6*#|MkZrn1Ii5B^c-B7ajRp_E9 z#*iuFDW)g}0DvUu zVCxP5F!;|DK?s<)B91=`@C0knLqrf6BB56WSd{4ClK=q7mp>C$bQF0=Kq@5Kc_;oF z7oM1Mo)iY8q@)-SVxtp6&J)87;z$t{%NB|NAo3e%`-?{^o%i8FW0c*-jhxGo_{oNFTlJ21494y z8FtH5Wk>^v74Um>dbJC38$CoGQOeLD&8q) z+LOElrNfm_7Jx;E%VBTA%rKcD5%XUh5>$r8`IMtAP6nHJ$09oqO?r_npgwrFV(ML+ z!``v5Ezx(QDkZg2FkcFlg2QRTBTG%vSssk;7N6T~M&bl=wBdf?Joeeqs@ZlGLA z7yq_Qg{yN#~Iz{ZU3O115K7Zmxb$(tAgCu5 zO?_9y*$EX|Ei!X9lTX=3vN*b&Qx^JQ`9)?jhl&qe`b`6q)j$~X+=}EGJA76k%C7X+ zy=)!-_}qn^?b#w65MUn5o0oC!5elGf94JE7_JE&CF+-R%3ziTVi(mU%PjK{qQn+pr zB+mJe1s&wznYStK{dBM#fnVI(uDf)*MLECLF;caC=k@QEyJ>gU<0Bv~sg>ga-l$g8 zmNwCWH;IuHNi}bh6V?Z28kKL?QULSJ{_)P`|Dd{ilj#rwnC`|(d%vMEjXOe$JPr__ zxsT1HSHUiNnFoMZ0DJu(f6X+SafaFP_#;4P_WL1?QlSiyJS;x*+R082Zvu*_>SgTM zM%j?aGUzYi^&L4)I05t`WX&<~NJG0SAF>{F3NVQ1u6yn%(2Yo#-fIY5v1pR7Bfw+! z?b<%ooz(sbg#3Q#ZOi`aesE#^exl-HiB`&abPcqn^Eg*nsgP?AK9XGukA@Oj^UjpV zFvk+fbI)`HS}ioOFOvnZCExVAb>~o8rl{CoBlB(e!Zo<9T2z8eb16=}nXwh)z;xU+_CE#+3#6F!>1t)OVo zEK0cxNdZreu|UBERBBND_QLTMD?S7Qr{ga%@>Zp57zN1+L|^E|iIuerV6$=uiZHkG z93M}M;vPB88EJn*xv};>p{Ogg@%o0r3o4`(U|yWG=Oi7Bd*Dz5ZT`j{jXqq)9tA((uxCe_pjraLN-?2Y< zRHbt6Qzlkx@Lrg;ygV@qGQ>=sF)zM}1WD5TCixa;k~@2_pP^L1O~5^BNJ^cGw`%XN z{!qdlUFW~L7iP@DfeeV-|B2z@J!s8-b1Ppa()VcT0R-HyD7nih7o9s>?piVZ2px6F z6`H|1e_gibMJq@@x5^x$eK!c(%^N@czl+6lG{0%=pz?mco0CYkH(Q>p#>!odux#F| z?b#+UlGWM)icI*`Igu$vReP_MEB zVs{^Wx}?L3?+7WA;tvPZrA3cmN0H&OU7#_>WUVGamya}7;ejL2%y7trZ;7K$YK3&AEBz&2l zFq(t98H95CXkim^y81f26U#C)R*>LvFcTBVU@udf1sKtqO-4^U+z+v230Kr_d-AO6 zD@Cg{*wljWCsu=ZR6rBJ7 literal 0 HcmV?d00001 diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 8cb25a2bb..9a1b0498f 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -7,4 +7,6 @@ @color/default_dark_theme_text_color @color/default_dark_theme_background_color + + #f68630 From ed74780a5047c76dc96084e36256a0cda7752acd Mon Sep 17 00:00:00 2001 From: fiepi Date: Wed, 25 Oct 2017 22:57:04 +0800 Subject: [PATCH 03/66] back target sdk 23 --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 2cb3f22b5..54a7bb0ef 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -9,7 +9,7 @@ android { defaultConfig { applicationId "com.simplemobiletools.gallery" minSdkVersion 16 - targetSdkVersion 26 + targetSdkVersion 23 versionCode 137 versionName "2.16.1" } From 57be5717a1ada47d06f8acc5daee2378dcc49ef7 Mon Sep 17 00:00:00 2001 From: Tibor Kaputa Date: Wed, 25 Oct 2017 17:54:18 +0200 Subject: [PATCH 04/66] do not update the build tools and compile sdk version --- app/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 54a7bb0ef..f63fcf375 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -3,8 +3,8 @@ apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' android { - compileSdkVersion 26 - buildToolsVersion "26.0.1" + compileSdkVersion 25 + buildToolsVersion "25.0.3" defaultConfig { applicationId "com.simplemobiletools.gallery" From e8645f34b72e43b008a8474d37e5f08fcf74e7f4 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 25 Oct 2017 17:57:10 +0200 Subject: [PATCH 05/66] use a color constant for setting adaptive icon background color --- app/src/main/res/values/colors.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 9a1b0498f..ee1e5614a 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -8,5 +8,5 @@ @color/default_dark_theme_text_color @color/default_dark_theme_background_color - #f68630 + @color/color_primary From 65f147bc016f70136d7a3df1b6baf32a76d93f08 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 25 Oct 2017 22:06:34 +0200 Subject: [PATCH 06/66] updating Show Media Count german trnaslation --- 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 da95fadc3..4f3e23a51 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -125,7 +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 + Medienanzahl bei Ordnern anzeigen Teilen/Drehen im Vollbild-Menü vertauschen Eigenschaften anzeigen im Vollbild Eigenschaften auswählen From 8e99cd5364527f4e97c3dc1f9ca4ff4e3e7bebfa Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 26 Oct 2017 09:34:26 +0200 Subject: [PATCH 07/66] update commons to 2.32.0 --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index f63fcf375..e5b802d48 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,7 +37,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.31.11' + compile 'com.simplemobiletools:commons:2.32.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 7f10f67c7b42771fbcd30176715bef8b710c01d9 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 26 Oct 2017 10:10:11 +0200 Subject: [PATCH 08/66] fix #386, automatically append "_1" after the filename when saving in editor --- .../simplemobiletools/gallery/activities/EditActivity.kt | 4 ++-- .../gallery/activities/ViewPagerActivity.kt | 2 +- .../com/simplemobiletools/gallery/dialogs/SaveAsDialog.kt | 6 +++++- 3 files changed, 8 insertions(+), 4 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 dc09ee11e..61359be9e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt @@ -141,13 +141,13 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener setResult(RESULT_OK) finish() } else if (uri.scheme == "file") { - SaveAsDialog(this, uri.path) { + SaveAsDialog(this, uri.path, true) { saveBitmapToFile(result.bitmap, it) } } else if (uri.scheme == "content") { val newPath = applicationContext.getRealPathFromURI(uri) ?: "" if (!newPath.isEmpty()) { - SaveAsDialog(this, newPath) { + SaveAsDialog(this, newPath, true) { saveBitmapToFile(result.bitmap, it) } } else { 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 e9af326b0..c56d37d31 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -446,7 +446,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View private fun saveImageAs() { val currPath = getCurrentPath() - SaveAsDialog(this, currPath) { + SaveAsDialog(this, currPath, false) { Thread({ toast(R.string.saving) val selectedFile = File(it) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/SaveAsDialog.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/SaveAsDialog.kt index 503e0f741..f97e2fb99 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/SaveAsDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/SaveAsDialog.kt @@ -11,7 +11,7 @@ import com.simplemobiletools.gallery.activities.SimpleActivity import kotlinx.android.synthetic.main.dialog_save_as.view.* import java.io.File -class SaveAsDialog(val activity: SimpleActivity, val path: String, val callback: (savePath: String) -> Unit) { +class SaveAsDialog(val activity: SimpleActivity, val path: String, val appendFilename: Boolean, val callback: (savePath: String) -> Unit) { init { var realPath = File(path).parent.trimEnd('/') @@ -28,6 +28,10 @@ class SaveAsDialog(val activity: SimpleActivity, val path: String, val callback: save_as_extension.setText(extension) } + if (appendFilename) { + name += "_1" + } + save_as_name.setText(name) save_as_path.setOnClickListener { FilePickerDialog(activity, realPath, false, false, true) { From 1d3ac6afb9998f5f7a5c8807363f66b32abe6c57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Marques?= Date: Thu, 26 Oct 2017 13:28:01 +0100 Subject: [PATCH 09/66] Update strings.xml --- app/src/main/res/values-pt/strings.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index bdbf21597..09e7a83d3 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -25,7 +25,7 @@ Definir como Volume Brilho - Do not ask again in this session + Não perguntar de novo para esta sessão Filtrar multimédia @@ -127,8 +127,8 @@ 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 + Mostrar detalhes se em ecrã completo + Gerir detalhes exibidos From 8686022c8995a01129c6a1cfa4e3ec73bcfa903c Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 26 Oct 2017 17:24:52 +0200 Subject: [PATCH 10/66] set initial mIsFragmentVisible to true at third party intents --- .../com/simplemobiletools/gallery/fragments/VideoFragment.kt | 2 ++ 1 file changed, 2 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 e271e0b90..f5603c222 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt @@ -15,6 +15,7 @@ import android.widget.SeekBar import android.widget.TextView import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.gallery.R +import com.simplemobiletools.gallery.activities.VideoActivity import com.simplemobiletools.gallery.activities.ViewPagerActivity import com.simplemobiletools.gallery.extensions.* import com.simplemobiletools.gallery.helpers.MEDIUM @@ -64,6 +65,7 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee mTimeHolder = mView.video_time_holder medium = arguments.getSerializable(MEDIUM) as Medium + mIsFragmentVisible = activity is VideoActivity // setMenuVisibility is not called at VideoActivity (third party intent) setupPlayer() if (savedInstanceState != null) { mCurrTime = savedInstanceState.getInt(PROGRESS) From fa2a237593967760cecb4e5ff1ef7cdc821da360 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 26 Oct 2017 23:43:13 +0200 Subject: [PATCH 11/66] update target SDK to 26 and handle fileprovider --- app/build.gradle | 8 +- app/src/main/AndroidManifest.xml | 10 +- .../gallery/activities/EditActivity.kt | 7 +- .../gallery/activities/MainActivity.kt | 6 +- .../gallery/activities/MediaActivity.kt | 4 +- .../gallery/activities/PhotoActivity.kt | 2 +- .../gallery/activities/PhotoVideoActivity.kt | 34 ++---- .../gallery/activities/VideoActivity.kt | 2 +- .../gallery/activities/ViewPagerActivity.kt | 6 +- .../gallery/adapters/MediaAdapter.kt | 3 +- .../gallery/extensions/activity.kt | 108 +++--------------- .../gallery/extensions/context.kt | 24 ++++ .../gallery/fragments/PhotoFragment.kt | 10 +- .../gallery/fragments/VideoFragment.kt | 32 +++++- 14 files changed, 110 insertions(+), 146 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index e5b802d48..784e54418 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -3,13 +3,13 @@ apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' android { - compileSdkVersion 25 - buildToolsVersion "25.0.3" + compileSdkVersion 26 + buildToolsVersion "26.0.2" defaultConfig { applicationId "com.simplemobiletools.gallery" minSdkVersion 16 - targetSdkVersion 23 + targetSdkVersion 26 versionCode 137 versionName "2.16.1" } @@ -37,7 +37,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.32.0' + compile 'com.simplemobiletools:commons:2.32.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/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index fb8ba91aa..ff7ff3399 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -83,16 +83,16 @@ android:label="@string/third_party_licences" android:parentActivityName="com.simplemobiletools.commons.activities.AboutActivity"/> - - + + @@ -137,10 +121,10 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList return true when (item.itemId) { - 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 -> openFileEditor(File(mMedium!!.path)) + R.id.menu_set_as -> setAs(mUri) + R.id.menu_open_with -> openFile(mUri) + R.id.menu_share -> shareUri(mUri) + R.id.menu_edit -> openEditor(mUri) else -> return super.onOptionsItemSelected(item) } return true diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/VideoActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/VideoActivity.kt index fa38734e3..7ca92e902 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/VideoActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/VideoActivity.kt @@ -5,7 +5,7 @@ import android.os.Bundle class VideoActivity : PhotoVideoActivity() { override fun onCreate(savedInstanceState: Bundle?) { - PhotoVideoActivity.mIsVideo = true + mIsVideo = true super.onCreate(savedInstanceState) } } 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 c56d37d31..5db29688f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -246,18 +246,18 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View return true when (item.itemId) { - R.id.menu_set_as -> trySetAs(getCurrentFile()) + R.id.menu_set_as -> setAs(Uri.fromFile(getCurrentFile())) R.id.slideshow -> initSlideshow() R.id.menu_copy_to -> copyMoveTo(true) R.id.menu_move_to -> copyMoveTo(false) - R.id.menu_open_with -> openWith(getCurrentFile()) + R.id.menu_open_with -> openFile(Uri.fromFile(getCurrentFile())) R.id.menu_hide -> toggleFileVisibility(true) R.id.menu_unhide -> toggleFileVisibility(false) R.id.menu_share_1 -> shareMedium(getCurrentMedium()!!) R.id.menu_share_2 -> shareMedium(getCurrentMedium()!!) R.id.menu_delete -> checkDeleteConfirmation() R.id.menu_rename -> renameFile() - R.id.menu_edit -> openFileEditor(getCurrentFile()) + R.id.menu_edit -> openEditor(Uri.fromFile(getCurrentFile())) R.id.menu_properties -> showProperties() R.id.show_on_map -> showOnMap() R.id.menu_rotate -> rotateImage() 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 d1918aaad..1be8d7856 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt @@ -1,6 +1,7 @@ package com.simplemobiletools.gallery.adapters import android.graphics.PorterDuff +import android.net.Uri import android.os.Build import android.support.v7.view.ActionMode import android.support.v7.widget.RecyclerView @@ -159,7 +160,7 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, } private fun editFile() { - activity.openFileEditor(getCurrentFile()) + activity.openEditor(Uri.fromFile(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 4fe4d6180..32cd94836 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt @@ -2,16 +2,10 @@ package com.simplemobiletools.gallery.extensions import android.app.Activity import android.content.Intent -import android.database.Cursor import android.net.Uri -import android.os.Build import android.provider.MediaStore import android.support.v7.app.AppCompatActivity -import android.util.DisplayMetrics -import android.view.KeyCharacterMap -import android.view.KeyEvent import android.view.View -import android.view.ViewConfiguration import com.bumptech.glide.Glide import com.bumptech.glide.load.DecodeFormat import com.bumptech.glide.load.engine.DiskCacheStrategy @@ -34,12 +28,12 @@ import com.simplemobiletools.gallery.views.MySquareImageView import java.io.File import java.util.* -fun Activity.shareUri(medium: Medium, uri: Uri) { +fun Activity.shareUri(uri: Uri) { val shareTitle = resources.getString(R.string.share_via) Intent().apply { action = Intent.ACTION_SEND - putExtra(Intent.EXTRA_STREAM, uri) - type = medium.getMimeType() + putExtra(Intent.EXTRA_STREAM, ensurePublicUri(uri)) + type = getMimeTypeFromUri(uri) addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) startActivity(Intent.createChooser(this, shareTitle)) } @@ -48,12 +42,12 @@ fun Activity.shareUri(medium: Medium, uri: Uri) { fun Activity.shareMedium(medium: Medium) { val shareTitle = resources.getString(R.string.share_via) val file = File(medium.path) - val uri = Uri.fromFile(file) + val uri = getFilePublicUri(file, BuildConfig.APPLICATION_ID) Intent().apply { action = Intent.ACTION_SEND putExtra(Intent.EXTRA_STREAM, uri) - type = medium.getMimeType() + type = getMimeTypeFromUri(uri) addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) startActivity(Intent.createChooser(this, shareTitle)) } @@ -61,7 +55,7 @@ fun Activity.shareMedium(medium: Medium) { fun Activity.shareMedia(media: List) { val shareTitle = resources.getString(R.string.share_via) - val uris = media.map { Uri.fromFile(File(it.path)) } as ArrayList + val uris = media.map { getFilePublicUri(File(it.path), BuildConfig.APPLICATION_ID) } as ArrayList Intent().apply { action = Intent.ACTION_SEND_MULTIPLE @@ -72,119 +66,55 @@ fun Activity.shareMedia(media: List) { } } -fun Activity.trySetAs(file: File) { - try { - var uri = Uri.fromFile(file) - if (!setAs(uri, file)) { - uri = getFileContentUri(file) - setAs(uri, file, false) - } - } catch (e: Exception) { - toast(R.string.unknown_error_occurred) - } -} - -fun Activity.setAs(uri: Uri, file: File, showToast: Boolean = true): Boolean { - var success = false +fun Activity.setAs(uri: Uri) { + val newUri = ensurePublicUri(uri) Intent().apply { action = Intent.ACTION_ATTACH_DATA - setDataAndType(uri, file.getMimeType()) + setDataAndType(newUri, getMimeTypeFromUri(newUri)) addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) val chooser = Intent.createChooser(this, getString(R.string.set_as)) - success = if (resolveActivity(packageManager) != null) { + if (resolveActivity(packageManager) != null) { startActivityForResult(chooser, REQUEST_SET_AS) - true } else { - if (showToast) { - toast(R.string.no_capable_app_found) - } - false + toast(R.string.no_capable_app_found) } } - - return success } -fun Activity.getFileContentUri(file: File): Uri? { - val uri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI - val projection = arrayOf(MediaStore.Images.Media._ID) - val selection = "${MediaStore.Images.Media.DATA} = ?" - val selectionArgs = arrayOf(file.absolutePath) - - var cursor: Cursor? = null - try { - cursor = contentResolver.query(uri, projection, selection, selectionArgs, null) - if (cursor?.moveToFirst() == true) { - val id = cursor.getIntValue(MediaStore.Images.Media._ID) - return Uri.withAppendedPath(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, "$id") - } - } finally { - cursor?.close() - } - return null -} - -fun Activity.openWith(file: File, forceChooser: Boolean = true) { - val uri = Uri.fromFile(file) +fun Activity.openFile(uri: Uri) { + val newUri = ensurePublicUri(uri) Intent().apply { action = Intent.ACTION_VIEW - setDataAndType(uri, file.getMimeType()) + setDataAndType(newUri, getMimeTypeFromUri(newUri)) addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) putExtra(IS_FROM_GALLERY, true) if (resolveActivity(packageManager) != null) { val chooser = Intent.createChooser(this, getString(R.string.open_with)) - startActivity(if (forceChooser) chooser else this) + startActivity(chooser) } else { toast(R.string.no_app_found) } } } -fun Activity.openFileEditor(file: File) { - openEditor(Uri.fromFile(file)) -} - -fun Activity.openEditor(uri: Uri, forceChooser: Boolean = false) { +fun Activity.openEditor(uri: Uri) { + val newUri = ensurePublicUri(uri) Intent().apply { action = Intent.ACTION_EDIT - setDataAndType(uri, "image/*") + setDataAndType(newUri, getMimeTypeFromUri(newUri)) addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) if (resolveActivity(packageManager) != null) { val chooser = Intent.createChooser(this, getString(R.string.edit_image_with)) - startActivityForResult(if (forceChooser) chooser else this, REQUEST_EDIT_IMAGE) + startActivityForResult(chooser, REQUEST_EDIT_IMAGE) } else { toast(R.string.no_editor_found) } } } -fun Activity.hasNavBar(): Boolean { - return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { - val display = windowManager.defaultDisplay - - val realDisplayMetrics = DisplayMetrics() - display.getRealMetrics(realDisplayMetrics) - - val realHeight = realDisplayMetrics.heightPixels - val realWidth = realDisplayMetrics.widthPixels - - val displayMetrics = DisplayMetrics() - display.getMetrics(displayMetrics) - - val displayHeight = displayMetrics.heightPixels - val displayWidth = displayMetrics.widthPixels - - realWidth - displayWidth > 0 || realHeight - displayHeight > 0 - } else { - val hasMenuKey = ViewConfiguration.get(applicationContext).hasPermanentMenuKey() - val hasBackKey = KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_BACK) - !hasMenuKey && !hasBackKey - } -} - fun Activity.launchCamera() { val intent = Intent(MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA) if (intent.resolveActivity(packageManager) != null) { 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 cdda71ab7..82c101a89 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt @@ -5,12 +5,18 @@ import android.content.Intent import android.content.res.Configuration import android.graphics.Point import android.media.AudioManager +import android.net.Uri import android.os.Build import android.view.WindowManager +import com.simplemobiletools.commons.extensions.getFilePublicUri +import com.simplemobiletools.commons.extensions.getMimeTypeFromPath +import com.simplemobiletools.commons.extensions.getRealPathFromURI import com.simplemobiletools.commons.extensions.humanizePath +import com.simplemobiletools.gallery.BuildConfig import com.simplemobiletools.gallery.activities.SettingsActivity import com.simplemobiletools.gallery.helpers.Config import com.simplemobiletools.gallery.models.Directory +import java.io.File val Context.portrait get() = resources.configuration.orientation == Configuration.ORIENTATION_PORTRAIT val Context.audioManager get() = getSystemService(Context.AUDIO_SERVICE) as AudioManager @@ -73,3 +79,21 @@ fun Context.getSortedDirectories(source: ArrayList): ArrayList= Build.VERSION_CODES.JELLY_BEAN_MR1) { + val display = context.windowManager.defaultDisplay + + val realDisplayMetrics = DisplayMetrics() + display.getRealMetrics(realDisplayMetrics) + + val realHeight = realDisplayMetrics.heightPixels + val realWidth = realDisplayMetrics.widthPixels + + val displayMetrics = DisplayMetrics() + display.getMetrics(displayMetrics) + + val displayHeight = displayMetrics.heightPixels + val displayWidth = displayMetrics.widthPixels + + realWidth - displayWidth > 0 || realHeight - displayHeight > 0 + } else { + val hasMenuKey = ViewConfiguration.get(context).hasPermanentMenuKey() + val hasBackKey = KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_BACK) + !hasMenuKey && !hasBackKey + } + } + private fun setupTimeHolder() { mSeekBar!!.max = mDuration mView.video_duration.text = mDuration.getFormattedDuration() From 8e8c0b127d1fea0a7e8a2ef7bc531ee6abeccc27 Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 27 Oct 2017 09:33:17 +0200 Subject: [PATCH 12/66] add an Open With menu button to media thumbnails view --- .../com/simplemobiletools/gallery/adapters/MediaAdapter.kt | 4 +++- app/src/main/res/menu/cab_media.xml | 4 ++++ 2 files changed, 7 insertions(+), 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 1be8d7856..64ea45c2a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt @@ -87,6 +87,7 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, R.id.cab_copy_to -> copyMoveTo(true) R.id.cab_move_to -> copyMoveTo(false) R.id.cab_select_all -> selectAll() + R.id.cab_open_with -> activity.openFile(Uri.fromFile(getCurrentFile())) R.id.cab_delete -> checkDeleteConfirmation() else -> return false } @@ -101,7 +102,8 @@ 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_rename).isVisible = selectedPositions.size == 1 + menu.findItem(R.id.cab_open_with).isVisible = selectedPositions.size == 1 menu.findItem(R.id.cab_edit).isVisible = selectedPositions.size == 1 && media.size > selectedPositions.first() && media[selectedPositions.first()].isImage() menu.findItem(R.id.cab_confirm_selection).isVisible = isPickIntent && allowMultiplePicks && selectedPositions.size > 0 diff --git a/app/src/main/res/menu/cab_media.xml b/app/src/main/res/menu/cab_media.xml index fa787d520..bcf08f106 100644 --- a/app/src/main/res/menu/cab_media.xml +++ b/app/src/main/res/menu/cab_media.xml @@ -46,6 +46,10 @@ android:icon="@drawable/ic_select_all" android:title="@string/select_all" app:showAsAction="ifRoom"/> + Date: Fri, 27 Oct 2017 09:36:41 +0200 Subject: [PATCH 13/66] add Set As to the media thumbnails view --- .../com/simplemobiletools/gallery/adapters/MediaAdapter.kt | 6 +++++- app/src/main/res/menu/cab_media.xml | 4 ++++ 2 files changed, 9 insertions(+), 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 64ea45c2a..b71a694a7 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt @@ -88,6 +88,7 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, R.id.cab_move_to -> copyMoveTo(false) R.id.cab_select_all -> selectAll() R.id.cab_open_with -> activity.openFile(Uri.fromFile(getCurrentFile())) + R.id.cab_set_as -> activity.setAs(Uri.fromFile(getCurrentFile())) R.id.cab_delete -> checkDeleteConfirmation() else -> return false } @@ -104,7 +105,8 @@ 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_open_with).isVisible = selectedPositions.size == 1 - menu.findItem(R.id.cab_edit).isVisible = selectedPositions.size == 1 && media.size > selectedPositions.first() && media[selectedPositions.first()].isImage() + menu.findItem(R.id.cab_edit).isVisible = isOneImageSelected() + menu.findItem(R.id.cab_set_as).isVisible = isOneImageSelected() menu.findItem(R.id.cab_confirm_selection).isVisible = isPickIntent && allowMultiplePicks && selectedPositions.size > 0 checkHideBtnVisibility(menu) @@ -135,6 +137,8 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, menu.findItem(R.id.cab_hide).isVisible = unhiddenCnt > 0 menu.findItem(R.id.cab_unhide).isVisible = hiddenCnt > 0 } + + private fun isOneImageSelected() = selectedPositions.size == 1 && media.size > selectedPositions.first() && media[selectedPositions.first()].isImage() } private fun confirmSelection() { diff --git a/app/src/main/res/menu/cab_media.xml b/app/src/main/res/menu/cab_media.xml index bcf08f106..8ebb87f08 100644 --- a/app/src/main/res/menu/cab_media.xml +++ b/app/src/main/res/menu/cab_media.xml @@ -50,6 +50,10 @@ android:id="@+id/cab_open_with" android:title="@string/open_with" app:showAsAction="never"/> + Date: Fri, 27 Oct 2017 10:07:58 +0200 Subject: [PATCH 14/66] send the real file path with edit intent --- .../gallery/activities/EditActivity.kt | 36 ++++++++++--------- .../gallery/extensions/activity.kt | 9 ++--- .../gallery/extensions/context.kt | 2 -- .../gallery/helpers/Constants.kt | 1 + 4 files changed, 25 insertions(+), 23 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 2f02fd847..b0391e7a8 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt @@ -7,7 +7,6 @@ import android.graphics.Point import android.net.Uri import android.os.Bundle import android.provider.MediaStore -import android.util.Log import android.view.Menu import android.view.MenuItem import com.simplemobiletools.commons.extensions.* @@ -15,15 +14,15 @@ import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.dialogs.ResizeDialog import com.simplemobiletools.gallery.dialogs.SaveAsDialog import com.simplemobiletools.gallery.extensions.openEditor +import com.simplemobiletools.gallery.helpers.REAL_FILE_PATH 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" - val ASPECT_Y = "aspectY" - val CROP = "crop" + private val ASPECT_X = "aspectX" + private val ASPECT_Y = "aspectY" + private val CROP = "crop" lateinit var uri: Uri var resizeWidth = 0 @@ -41,18 +40,24 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener return } - uri = intent.data - if (uri.scheme != "file" && uri.scheme != "content") { - toast(R.string.unknown_file_location) - finish() - return + val realPath = intent.extras?.get(REAL_FILE_PATH)?.toString() ?: "" + if (realPath.isNotEmpty()) { + val file = File(realPath) + uri = Uri.fromFile(file) + } else { + uri = intent.data + if (uri.scheme != "file" && uri.scheme != "content") { + toast(R.string.unknown_file_location) + finish() + return + } } isCropIntent = intent.extras?.get(CROP) == "true" crop_image_view.apply { setOnCropImageCompleteListener(this@EditActivity) - setImageUriAsync(intent.data) + setImageUriAsync(uri) if (isCropIntent && shouldCropSquare()) setFixedAspectRatio(true) @@ -66,8 +71,9 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener override fun onStop() { super.onStop() - if (isEditingWithThirdParty) + if (isEditingWithThirdParty) { finish() + } } override fun onCreateOptionsMenu(menu: Menu): Boolean { @@ -152,11 +158,9 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener } } else { toast(R.string.image_editing_failed) - finish() } } else { toast(R.string.unknown_file_location) - finish() } } else { toast("${getString(R.string.image_editing_failed)}: ${result.error.message}") @@ -175,9 +179,7 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener } } } catch (e: Exception) { - Log.e(TAG, "Crop compressing failed $path $e") - toast(R.string.image_editing_failed) - finish() + showErrorToast(e) } catch (e: OutOfMemoryError) { toast(R.string.out_of_memory_error) } 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 32cd94836..84165cca9 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt @@ -18,10 +18,7 @@ import com.simplemobiletools.commons.helpers.* import com.simplemobiletools.gallery.BuildConfig import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.activities.SimpleActivity -import com.simplemobiletools.gallery.helpers.IS_FROM_GALLERY -import com.simplemobiletools.gallery.helpers.NOMEDIA -import com.simplemobiletools.gallery.helpers.REQUEST_EDIT_IMAGE -import com.simplemobiletools.gallery.helpers.REQUEST_SET_AS +import com.simplemobiletools.gallery.helpers.* import com.simplemobiletools.gallery.models.Directory import com.simplemobiletools.gallery.models.Medium import com.simplemobiletools.gallery.views.MySquareImageView @@ -106,6 +103,10 @@ fun Activity.openEditor(uri: Uri) { setDataAndType(newUri, getMimeTypeFromUri(newUri)) addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) + if (uri.scheme == "file" && isNougatPlus()) { + putExtra(REAL_FILE_PATH, uri.path) + } + if (resolveActivity(packageManager) != null) { val chooser = Intent.createChooser(this, getString(R.string.edit_image_with)) startActivityForResult(chooser, REQUEST_EDIT_IMAGE) 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 82c101a89..922ad88ff 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt @@ -10,7 +10,6 @@ import android.os.Build import android.view.WindowManager import com.simplemobiletools.commons.extensions.getFilePublicUri import com.simplemobiletools.commons.extensions.getMimeTypeFromPath -import com.simplemobiletools.commons.extensions.getRealPathFromURI import com.simplemobiletools.commons.extensions.humanizePath import com.simplemobiletools.gallery.BuildConfig import com.simplemobiletools.gallery.activities.SettingsActivity @@ -81,7 +80,6 @@ fun Context.getSortedDirectories(source: ArrayList): ArrayList Date: Fri, 27 Oct 2017 10:34:16 +0200 Subject: [PATCH 15/66] replace sending real_file_path with extra_output at the editor --- .../gallery/activities/EditActivity.kt | 35 +++++++++---------- .../gallery/extensions/activity.kt | 9 +++-- 2 files changed, 22 insertions(+), 22 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 b0391e7a8..db8277eba 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt @@ -14,7 +14,6 @@ import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.dialogs.ResizeDialog import com.simplemobiletools.gallery.dialogs.SaveAsDialog import com.simplemobiletools.gallery.extensions.openEditor -import com.simplemobiletools.gallery.helpers.REAL_FILE_PATH import com.theartofdev.edmodo.cropper.CropImageView import kotlinx.android.synthetic.main.view_crop_image.* import java.io.* @@ -25,6 +24,7 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener private val CROP = "crop" lateinit var uri: Uri + var saveUri: Uri? = null var resizeWidth = 0 var resizeHeight = 0 var isCropIntent = false @@ -40,17 +40,15 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener return } - val realPath = intent.extras?.get(REAL_FILE_PATH)?.toString() ?: "" - if (realPath.isNotEmpty()) { - val file = File(realPath) - uri = Uri.fromFile(file) - } else { - uri = intent.data - if (uri.scheme != "file" && uri.scheme != "content") { - toast(R.string.unknown_file_location) - finish() - return - } + uri = intent.data + if (uri.scheme != "file" && uri.scheme != "content") { + toast(R.string.unknown_file_location) + finish() + return + } + + if (intent.extras?.containsKey(MediaStore.EXTRA_OUTPUT) == true) { + saveUri = intent.extras!!.get(MediaStore.EXTRA_OUTPUT) as Uri } isCropIntent = intent.extras?.get(CROP) == "true" @@ -130,15 +128,14 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener override fun onCropImageComplete(view: CropImageView, result: CropImageView.CropResult) { if (result.error == null) { - if (isCropIntent && intent.extras?.containsKey(MediaStore.EXTRA_OUTPUT) == true) { - val targetUri = intent.extras!!.get(MediaStore.EXTRA_OUTPUT) as Uri + if (isCropIntent && saveUri != null) { var inputStream: InputStream? = null var outputStream: OutputStream? = null try { val stream = ByteArrayOutputStream() result.bitmap.compress(CompressFormat.JPEG, 100, stream) inputStream = ByteArrayInputStream(stream.toByteArray()) - outputStream = contentResolver.openOutputStream(targetUri) + outputStream = contentResolver.openOutputStream(saveUri) inputStream.copyTo(outputStream) } finally { inputStream?.close() @@ -146,12 +143,12 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener } setResult(RESULT_OK) finish() - } else if (uri.scheme == "file") { - SaveAsDialog(this, uri.path, true) { + } else if (saveUri?.scheme == "file") { + SaveAsDialog(this, saveUri!!.path, true) { saveBitmapToFile(result.bitmap, it) } - } else if (uri.scheme == "content") { - val newPath = applicationContext.getRealPathFromURI(uri) ?: "" + } else if (saveUri?.scheme == "content") { + val newPath = applicationContext.getRealPathFromURI(saveUri!!) ?: "" if (!newPath.isEmpty()) { SaveAsDialog(this, newPath, true) { saveBitmapToFile(result.bitmap, it) 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 84165cca9..454c05955 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt @@ -18,7 +18,10 @@ import com.simplemobiletools.commons.helpers.* import com.simplemobiletools.gallery.BuildConfig import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.activities.SimpleActivity -import com.simplemobiletools.gallery.helpers.* +import com.simplemobiletools.gallery.helpers.IS_FROM_GALLERY +import com.simplemobiletools.gallery.helpers.NOMEDIA +import com.simplemobiletools.gallery.helpers.REQUEST_EDIT_IMAGE +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 @@ -103,8 +106,8 @@ fun Activity.openEditor(uri: Uri) { setDataAndType(newUri, getMimeTypeFromUri(newUri)) addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) - if (uri.scheme == "file" && isNougatPlus()) { - putExtra(REAL_FILE_PATH, uri.path) + if (isNougatPlus()) { + putExtra(MediaStore.EXTRA_OUTPUT, uri) } if (resolveActivity(packageManager) != null) { From 4c0b773e94905e73c4c7bda2e5e49295e7d6918c Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 27 Oct 2017 10:40:21 +0200 Subject: [PATCH 16/66] handle sd card files with the fileprovider too --- app/src/main/res/xml/provider_paths.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/res/xml/provider_paths.xml b/app/src/main/res/xml/provider_paths.xml index 8d13fa177..ad4a8140d 100644 --- a/app/src/main/res/xml/provider_paths.xml +++ b/app/src/main/res/xml/provider_paths.xml @@ -1,4 +1,5 @@ + From c520c8c557ae10846920fbab46cac785ab78981f Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 27 Oct 2017 10:54:49 +0200 Subject: [PATCH 17/66] send real filepath as an extra with View intent --- .../gallery/activities/MediaActivity.kt | 4 +--- .../gallery/activities/PhotoVideoActivity.kt | 5 +++++ .../com/simplemobiletools/gallery/extensions/activity.kt | 9 +++++---- 3 files changed, 11 insertions(+), 7 deletions(-) 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 3c262657d..f20aa4c39 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -24,7 +24,6 @@ import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.helpers.PERMISSION_WRITE_STORAGE import com.simplemobiletools.commons.models.RadioItem import com.simplemobiletools.commons.views.MyScalableRecyclerView -import com.simplemobiletools.gallery.BuildConfig import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.adapters.MediaAdapter import com.simplemobiletools.gallery.asynctasks.GetMediaAsynctask @@ -505,8 +504,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { val file = File(path) val isVideo = file.isVideoFast() if (isVideo) { - val uri = getFilePublicUri(file, BuildConfig.APPLICATION_ID) - openFile(uri) + openFile(Uri.fromFile(file)) } else { Intent(this, ViewPagerActivity::class.java).apply { putExtra(MEDIUM, path) 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 1f79262f0..732ca17a6 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt @@ -21,6 +21,7 @@ import com.simplemobiletools.gallery.fragments.ViewPagerFragment import com.simplemobiletools.gallery.helpers.IS_FROM_GALLERY import com.simplemobiletools.gallery.helpers.IS_VIEW_INTENT import com.simplemobiletools.gallery.helpers.MEDIUM +import com.simplemobiletools.gallery.helpers.REAL_FILE_PATH import com.simplemobiletools.gallery.models.Medium import kotlinx.android.synthetic.main.fragment_holder.* import java.io.File @@ -50,6 +51,10 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList private fun checkIntent(savedInstanceState: Bundle? = null) { mUri = intent.data ?: return + if (intent.extras.containsKey(REAL_FILE_PATH)) { + mUri = intent.extras.get(REAL_FILE_PATH) as Uri + } + mIsFromGallery = intent.getBooleanExtra(IS_FROM_GALLERY, false) if (mUri.scheme == "file") { 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 454c05955..b2b64e339 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt @@ -18,10 +18,7 @@ import com.simplemobiletools.commons.helpers.* import com.simplemobiletools.gallery.BuildConfig import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.activities.SimpleActivity -import com.simplemobiletools.gallery.helpers.IS_FROM_GALLERY -import com.simplemobiletools.gallery.helpers.NOMEDIA -import com.simplemobiletools.gallery.helpers.REQUEST_EDIT_IMAGE -import com.simplemobiletools.gallery.helpers.REQUEST_SET_AS +import com.simplemobiletools.gallery.helpers.* import com.simplemobiletools.gallery.models.Directory import com.simplemobiletools.gallery.models.Medium import com.simplemobiletools.gallery.views.MySquareImageView @@ -90,6 +87,10 @@ fun Activity.openFile(uri: Uri) { addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) putExtra(IS_FROM_GALLERY, true) + if (isNougatPlus()) { + putExtra(REAL_FILE_PATH, uri) + } + if (resolveActivity(packageManager) != null) { val chooser = Intent.createChooser(this, getString(R.string.open_with)) startActivity(chooser) From 0b352f1bc09da6cf88d834f346dfa7342648f67b Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 27 Oct 2017 10:56:36 +0200 Subject: [PATCH 18/66] add a null check to intent extras at photovideoactivity --- .../simplemobiletools/gallery/activities/PhotoVideoActivity.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 732ca17a6..e50d61f99 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt @@ -51,7 +51,7 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList private fun checkIntent(savedInstanceState: Bundle? = null) { mUri = intent.data ?: return - if (intent.extras.containsKey(REAL_FILE_PATH)) { + if (intent.extras?.containsKey(REAL_FILE_PATH) == true) { mUri = intent.extras.get(REAL_FILE_PATH) as Uri } From b3427c57abd1ff38333d91eee0c8728449cc9dd5 Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 27 Oct 2017 11:47:00 +0200 Subject: [PATCH 19/66] adding a properties menu button to photovideoactivity --- app/build.gradle | 2 +- .../gallery/activities/PhotoVideoActivity.kt | 8 ++++++++ .../gallery/activities/ViewPagerActivity.kt | 3 ++- app/src/main/res/menu/photo_video_menu.xml | 5 +++++ 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 784e54418..4b5446f43 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,7 +37,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.32.4' + compile 'com.simplemobiletools:commons:2.32.5' 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/PhotoVideoActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt index e50d61f99..cd2bf4902 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt @@ -8,6 +8,7 @@ import android.os.Bundle import android.view.Menu import android.view.MenuItem import android.view.View +import com.simplemobiletools.commons.dialogs.PropertiesDialog import com.simplemobiletools.commons.extensions.getFilenameFromUri import com.simplemobiletools.commons.extensions.getRealPathFromURI import com.simplemobiletools.commons.extensions.scanPath @@ -26,6 +27,7 @@ import com.simplemobiletools.gallery.models.Medium import kotlinx.android.synthetic.main.fragment_holder.* import java.io.File + open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentListener { private var mMedium: Medium? = null private var mIsFullScreen = false @@ -117,6 +119,7 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList menu.findItem(R.id.menu_set_as).isVisible = mMedium?.isImage() == true menu.findItem(R.id.menu_edit).isVisible = mMedium?.isImage() == true + menu.findItem(R.id.menu_edit).isVisible = mUri.scheme == "file" return true } @@ -130,11 +133,16 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList R.id.menu_open_with -> openFile(mUri) R.id.menu_share -> shareUri(mUri) R.id.menu_edit -> openEditor(mUri) + R.id.menu_properties -> showProperties() else -> return super.onOptionsItemSelected(item) } return true } + private fun showProperties() { + PropertiesDialog(this, mUri.path) + } + override fun fragmentClicked() { mIsFullScreen = !mIsFullScreen if (mIsFullScreen) { 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 5db29688f..7214b6a00 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -515,8 +515,9 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View private fun getCurrentFragment() = (view_pager.adapter as MyPagerAdapter).getCurrentFragment(view_pager.currentItem) private fun showProperties() { - if (getCurrentMedium() != null) + if (getCurrentMedium() != null) { PropertiesDialog(this, getCurrentPath(), false) + } } private fun showOnMap() { diff --git a/app/src/main/res/menu/photo_video_menu.xml b/app/src/main/res/menu/photo_video_menu.xml index 5911eebf5..584e40c29 100644 --- a/app/src/main/res/menu/photo_video_menu.xml +++ b/app/src/main/res/menu/photo_video_menu.xml @@ -6,6 +6,11 @@ android:icon="@drawable/ic_share" android:title="@string/share" app:showAsAction="ifRoom"/> + Date: Fri, 27 Oct 2017 14:02:11 +0200 Subject: [PATCH 20/66] always set saveUri at editor activity --- .../gallery/activities/EditActivity.kt | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 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 db8277eba..53c278d5e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt @@ -24,7 +24,7 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener private val CROP = "crop" lateinit var uri: Uri - var saveUri: Uri? = null + lateinit var saveUri: Uri var resizeWidth = 0 var resizeHeight = 0 var isCropIntent = false @@ -47,8 +47,10 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener return } - if (intent.extras?.containsKey(MediaStore.EXTRA_OUTPUT) == true) { - saveUri = intent.extras!!.get(MediaStore.EXTRA_OUTPUT) as Uri + saveUri = if (intent.extras?.containsKey(MediaStore.EXTRA_OUTPUT) == true) { + intent.extras!!.get(MediaStore.EXTRA_OUTPUT) as Uri + } else { + uri } isCropIntent = intent.extras?.get(CROP) == "true" @@ -128,7 +130,7 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener override fun onCropImageComplete(view: CropImageView, result: CropImageView.CropResult) { if (result.error == null) { - if (isCropIntent && saveUri != null) { + if (isCropIntent) { var inputStream: InputStream? = null var outputStream: OutputStream? = null try { @@ -143,12 +145,12 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener } setResult(RESULT_OK) finish() - } else if (saveUri?.scheme == "file") { - SaveAsDialog(this, saveUri!!.path, true) { + } else if (saveUri.scheme == "file") { + SaveAsDialog(this, saveUri.path, true) { saveBitmapToFile(result.bitmap, it) } - } else if (saveUri?.scheme == "content") { - val newPath = applicationContext.getRealPathFromURI(saveUri!!) ?: "" + } else if (saveUri.scheme == "content") { + val newPath = applicationContext.getRealPathFromURI(saveUri) ?: "" if (!newPath.isEmpty()) { SaveAsDialog(this, newPath, true) { saveBitmapToFile(result.bitmap, it) From c9f6668fc1a0df8dd1cdaeb1836533c718bda8f7 Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 27 Oct 2017 14:08:33 +0200 Subject: [PATCH 21/66] force an app chooser at some openFile intents --- .../com/simplemobiletools/gallery/activities/MediaActivity.kt | 2 +- .../gallery/activities/PhotoVideoActivity.kt | 2 +- .../simplemobiletools/gallery/activities/ViewPagerActivity.kt | 2 +- .../com/simplemobiletools/gallery/adapters/MediaAdapter.kt | 2 +- .../com/simplemobiletools/gallery/extensions/activity.kt | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) 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 f20aa4c39..facb606a7 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -504,7 +504,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { val file = File(path) val isVideo = file.isVideoFast() if (isVideo) { - openFile(Uri.fromFile(file)) + openFile(Uri.fromFile(file), false) } else { Intent(this, ViewPagerActivity::class.java).apply { putExtra(MEDIUM, path) 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 cd2bf4902..ca6d1c0a0 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt @@ -130,7 +130,7 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList when (item.itemId) { R.id.menu_set_as -> setAs(mUri) - R.id.menu_open_with -> openFile(mUri) + R.id.menu_open_with -> openFile(mUri, true) R.id.menu_share -> shareUri(mUri) R.id.menu_edit -> openEditor(mUri) R.id.menu_properties -> showProperties() 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 7214b6a00..18eb2f5df 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -250,7 +250,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View R.id.slideshow -> initSlideshow() R.id.menu_copy_to -> copyMoveTo(true) R.id.menu_move_to -> copyMoveTo(false) - R.id.menu_open_with -> openFile(Uri.fromFile(getCurrentFile())) + R.id.menu_open_with -> openFile(Uri.fromFile(getCurrentFile()), true) R.id.menu_hide -> toggleFileVisibility(true) R.id.menu_unhide -> toggleFileVisibility(false) R.id.menu_share_1 -> shareMedium(getCurrentMedium()!!) 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 b71a694a7..6ede29e0d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt @@ -87,7 +87,7 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, R.id.cab_copy_to -> copyMoveTo(true) R.id.cab_move_to -> copyMoveTo(false) R.id.cab_select_all -> selectAll() - R.id.cab_open_with -> activity.openFile(Uri.fromFile(getCurrentFile())) + R.id.cab_open_with -> activity.openFile(Uri.fromFile(getCurrentFile()), true) R.id.cab_set_as -> activity.setAs(Uri.fromFile(getCurrentFile())) R.id.cab_delete -> checkDeleteConfirmation() else -> return false 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 b2b64e339..b721d60cf 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt @@ -79,7 +79,7 @@ fun Activity.setAs(uri: Uri) { } } -fun Activity.openFile(uri: Uri) { +fun Activity.openFile(uri: Uri, forceChooser: Boolean) { val newUri = ensurePublicUri(uri) Intent().apply { action = Intent.ACTION_VIEW @@ -93,7 +93,7 @@ fun Activity.openFile(uri: Uri) { if (resolveActivity(packageManager) != null) { val chooser = Intent.createChooser(this, getString(R.string.open_with)) - startActivity(chooser) + startActivity(if (forceChooser) chooser else this) } else { toast(R.string.no_app_found) } From 84263a3b10551a474776983dbcff341c542f42ca Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 27 Oct 2017 14:08:50 +0200 Subject: [PATCH 22/66] never force chooser at Edit intent --- .../com/simplemobiletools/gallery/extensions/activity.kt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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 b721d60cf..513aaca5d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt @@ -112,8 +112,7 @@ fun Activity.openEditor(uri: Uri) { } if (resolveActivity(packageManager) != null) { - val chooser = Intent.createChooser(this, getString(R.string.edit_image_with)) - startActivityForResult(chooser, REQUEST_EDIT_IMAGE) + startActivityForResult(this, REQUEST_EDIT_IMAGE) } else { toast(R.string.no_editor_found) } From 286955ab831bd8fa295aa2e93081bfbdc37a617f Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 28 Oct 2017 11:02:02 +0200 Subject: [PATCH 23/66] replace PhotoView with GifDrawable it will replace zoomable gifs with smooth gifs --- app/build.gradle | 4 +- .../gallery/extensions/activity.kt | 2 +- .../gallery/fragments/PhotoFragment.kt | 67 ++++++++++--------- app/src/main/res/layout/pager_photo_item.xml | 4 +- 4 files changed, 39 insertions(+), 38 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 4b5446f43..0bd65828a 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,13 +37,13 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.32.5' + compile 'com.simplemobiletools:commons:2.32.6' 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' compile 'com.google.code.gson:gson:2.8.0' - compile 'com.github.chrisbanes:PhotoView:2.1.2' compile 'it.sephiroth.android.exif:library:1.0.1' + compile 'pl.droidsonroids.gif:android-gif-drawable:1.2.8' compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5.1' 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 513aaca5d..7d76be8a3 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt @@ -130,7 +130,7 @@ fun Activity.launchCamera() { fun SimpleActivity.launchAbout() { startAboutActivity(R.string.app_name, LICENSE_KOTLIN or LICENSE_GLIDE or LICENSE_CROPPER or LICENSE_MULTISELECT or LICENSE_RTL - or LICENSE_PHOTOVIEW or LICENSE_SUBSAMPLING or LICENSE_PATTERN, BuildConfig.VERSION_NAME) + or LICENSE_SUBSAMPLING or LICENSE_PATTERN or LICENSE_REPRINT or LICENSE_GIF_DRAWABLE, BuildConfig.VERSION_NAME) } fun AppCompatActivity.showSystemUI() { 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 c1d9090d7..20037228e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt @@ -13,12 +13,10 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import com.bumptech.glide.Glide -import com.bumptech.glide.Priority import com.bumptech.glide.load.DataSource import com.bumptech.glide.load.DecodeFormat import com.bumptech.glide.load.engine.DiskCacheStrategy import com.bumptech.glide.load.engine.GlideException -import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions import com.bumptech.glide.request.RequestListener import com.bumptech.glide.request.RequestOptions import com.bumptech.glide.request.target.Target @@ -33,6 +31,7 @@ import com.simplemobiletools.gallery.helpers.MEDIUM import com.simplemobiletools.gallery.models.Medium import it.sephiroth.android.library.exif2.ExifInterface import kotlinx.android.synthetic.main.pager_photo_item.view.* +import pl.droidsonroids.gif.GifDrawable import java.io.File import java.io.FileOutputStream @@ -41,6 +40,7 @@ class PhotoFragment : ViewPagerFragment() { private var wasInit = false private var storedShowExtendedDetails = false private var storedExtendedDetails = 0 + private var gifDrawable: GifDrawable? = null lateinit var view: ViewGroup lateinit var medium: Medium @@ -80,18 +80,8 @@ class PhotoFragment : ViewPagerFragment() { } } - view.subsampling_view.setOnClickListener({ photoClicked() }) - view.photo_view.apply { - maximumScale = 8f - mediumScale = 3f - setOnOutsidePhotoTapListener { - photoClicked() - } - - setOnPhotoTapListener { view, x, y -> - photoClicked() - } - } + view.subsampling_view.setOnClickListener { photoClicked() } + view.gif_view.setOnClickListener { photoClicked() } loadImage() checkExtendedDetails() @@ -117,14 +107,30 @@ class PhotoFragment : ViewPagerFragment() { super.setMenuVisibility(menuVisible) isFragmentVisible = menuVisible if (wasInit) { - if (menuVisible) { - addZoomableView() + if (medium.isGif()) { + gifFragmentVisibilityChanged(menuVisible) } else { - view.subsampling_view.apply { - recycle() - beGone() - background = ColorDrawable(Color.TRANSPARENT) - } + photoFragmentVisibilityChanged(menuVisible) + } + } + } + + private fun gifFragmentVisibilityChanged(isVisible: Boolean) { + if (isVisible) { + gifDrawable?.start() + } else { + gifDrawable?.stop() + } + } + + private fun photoFragmentVisibilityChanged(isVisible: Boolean) { + if (isVisible) { + addZoomableView() + } else { + view.subsampling_view.apply { + recycle() + beGone() + background = ColorDrawable(Color.TRANSPARENT) } } } @@ -149,16 +155,11 @@ class PhotoFragment : ViewPagerFragment() { private fun loadImage() { if (medium.isGif()) { - val options = RequestOptions() - .priority(if (isFragmentVisible) Priority.IMMEDIATE else Priority.LOW) - .diskCacheStrategy(DiskCacheStrategy.DATA) + gifDrawable = GifDrawable(medium.path) + if (!isFragmentVisible) + gifDrawable!!.stop() - Glide.with(this) - .asGif() - .load(medium.path) - .transition(DrawableTransitionOptions.withCrossFade()) - .apply(options) - .into(view.photo_view) + view.gif_view.setImageDrawable(gifDrawable) } else { loadBitmap() } @@ -187,7 +188,7 @@ class PhotoFragment : ViewPagerFragment() { addZoomableView() return false } - }).into(view.photo_view) + }).into(view.gif_view) } else { val options = RequestOptions() .diskCacheStrategy(DiskCacheStrategy.NONE) @@ -198,7 +199,7 @@ class PhotoFragment : ViewPagerFragment() { .load(medium.path) .thumbnail(0.2f) .apply(options) - .into(view.photo_view) + .into(view.gif_view) } } @@ -286,7 +287,7 @@ class PhotoFragment : ViewPagerFragment() { super.onDestroyView() context.isKitkatPlus() if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 && !activity.isDestroyed) { - Glide.with(context).clear(view.photo_view) + Glide.with(context).clear(view.gif_view) } } diff --git a/app/src/main/res/layout/pager_photo_item.xml b/app/src/main/res/layout/pager_photo_item.xml index e48b6b90a..5f170ca80 100644 --- a/app/src/main/res/layout/pager_photo_item.xml +++ b/app/src/main/res/layout/pager_photo_item.xml @@ -6,8 +6,8 @@ android:layout_width="match_parent" android:layout_height="match_parent"> - From 1c3aab82ff456038be6959118580dcd383ce1a88 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 28 Oct 2017 12:56:57 +0200 Subject: [PATCH 24/66] use a simple ImageView at photo fragments --- .../com/simplemobiletools/gallery/fragments/PhotoFragment.kt | 3 ++- app/src/main/res/layout/pager_photo_item.xml | 2 +- 2 files changed, 3 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 20037228e..4bb52fdb1 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt @@ -156,8 +156,9 @@ class PhotoFragment : ViewPagerFragment() { private fun loadImage() { if (medium.isGif()) { gifDrawable = GifDrawable(medium.path) - if (!isFragmentVisible) + if (!isFragmentVisible) { gifDrawable!!.stop() + } view.gif_view.setImageDrawable(gifDrawable) } else { diff --git a/app/src/main/res/layout/pager_photo_item.xml b/app/src/main/res/layout/pager_photo_item.xml index 5f170ca80..152c24684 100644 --- a/app/src/main/res/layout/pager_photo_item.xml +++ b/app/src/main/res/layout/pager_photo_item.xml @@ -6,7 +6,7 @@ android:layout_width="match_parent" android:layout_height="match_parent"> - From 4fedc0557111786a19ce42e0284ea7d2624d00e7 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 28 Oct 2017 13:27:50 +0200 Subject: [PATCH 25/66] use GifDrawables at thumbnails too --- .../gallery/activities/MainActivity.kt | 10 +++- .../gallery/activities/MediaActivity.kt | 12 +++-- .../gallery/adapters/DirectoryAdapter.kt | 11 ++-- .../gallery/adapters/MediaAdapter.kt | 28 +++++----- .../gallery/extensions/activity.kt | 52 ++++++------------- app/src/main/res/layout/pager_photo_item.xml | 3 +- 6 files changed, 58 insertions(+), 58 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 6dfa6ef7a..108f34310 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -125,11 +125,17 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { super.onResume() config.isThirdPartyIntent = false if (mStoredAnimateGifs != config.animateGifs) { - directories_grid.adapter?.notifyDataSetChanged() + (directories_grid.adapter as? DirectoryAdapter)?.apply { + animateGifs = config.animateGifs + notifyDataSetChanged() + } } if (mStoredCropThumbnails != config.cropThumbnails) { - directories_grid.adapter?.notifyDataSetChanged() + (directories_grid.adapter as? DirectoryAdapter)?.apply { + cropThumbnails = config.cropThumbnails + notifyDataSetChanged() + } } if (mStoredShowMediaCount != config.showMediaCount) { 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 facb606a7..ca3df1126 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -89,12 +89,18 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { override fun onResume() { super.onResume() - if (mShowAll && mStoredAnimateGifs != config.animateGifs) { - media_grid.adapter?.notifyDataSetChanged() + if (mStoredAnimateGifs != config.animateGifs) { + (media_grid.adapter as? MediaAdapter)?.apply { + animateGifs = config.animateGifs + notifyDataSetChanged() + } } if (mStoredCropThumbnails != config.cropThumbnails) { - media_grid.adapter?.notifyDataSetChanged() + (media_grid.adapter as? MediaAdapter)?.apply { + cropThumbnails = config.cropThumbnails + notifyDataSetChanged() + } } if (mStoredScrollHorizontally != config.scrollHorizontally) { 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 7f36dfd26..ed836f91d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt @@ -30,11 +30,13 @@ import java.util.* class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableList, val listener: DirOperationsListener?, val isPickIntent: Boolean, val itemClick: (Directory) -> Unit) : RecyclerView.Adapter() { - val config = activity.config + private val config = activity.config var actMode: ActionMode? = null var primaryColor = config.primaryColor var scrollVertically = !config.scrollHorizontally var showMediaCount = config.showMediaCount + var animateGifs = config.animateGifs + var cropThumbnails = config.cropThumbnails private val multiSelector = MultiSelector() private val isListViewType = config.viewTypeFolders == VIEW_TYPE_LIST @@ -353,7 +355,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, showMediaCount: Boolean): View { + fun bindView(directory: Directory, isPinned: Boolean, scrollVertically: Boolean, isListView: Boolean, textColor: Int, showMediaCount: Boolean, + animateGifs: Boolean, cropThumbnails: Boolean): View { itemView.apply { dir_name.text = directory.name dir_path?.text = "${directory.path.substringBeforeLast("/")}/" photo_cnt.text = directory.mediaCnt.toString() - activity.loadImage(directory.tmb, dir_thumbnail, scrollVertically) + activity.loadImage(directory.tmb, dir_thumbnail, scrollVertically, animateGifs, cropThumbnails) dir_pin.beVisibleIf(isPinned) dir_sd_card.beVisibleIf(activity.isPathOnSD(directory.path)) photo_cnt.beVisibleIf(showMediaCount) 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 6ede29e0d..82e9d9fae 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt @@ -28,18 +28,21 @@ import java.util.* class MediaAdapter(val activity: SimpleActivity, var media: MutableList, val listener: MediaOperationsListener?, val isPickIntent: Boolean, val allowMultiplePicks: Boolean, val itemClick: (Medium) -> Unit) : RecyclerView.Adapter() { - val multiSelector = MultiSelector() - val config = activity.config - val isListViewType = config.viewTypeFiles == VIEW_TYPE_LIST - var skipConfirmationDialog = false - + private val config = activity.config var actMode: ActionMode? = null - var itemViews = SparseArray() - val selectedPositions = HashSet() var primaryColor = config.primaryColor - var textColor = config.textColor - var displayFilenames = config.displayFileNames var scrollVertically = !config.scrollHorizontally + var animateGifs = config.animateGifs + var cropThumbnails = config.cropThumbnails + + private val multiSelector = MultiSelector() + private val isListViewType = config.viewTypeFiles == VIEW_TYPE_LIST + private var skipConfirmationDialog = false + + private var itemViews = SparseArray() + private val selectedPositions = HashSet() + private var textColor = config.textColor + private var displayFilenames = config.displayFileNames fun toggleItemSelection(select: Boolean, pos: Int) { if (select) { @@ -284,7 +287,7 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, } override fun onBindViewHolder(holder: ViewHolder, position: Int) { - itemViews.put(position, holder.bindView(media[position], displayFilenames, scrollVertically, isListViewType, textColor)) + itemViews.put(position, holder.bindView(media[position], displayFilenames, scrollVertically, isListViewType, textColor, animateGifs, cropThumbnails)) toggleItemSelection(selectedPositions.contains(position), position) holder.itemView.tag = holder } @@ -355,12 +358,13 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, val multiSelector: MultiSelector, val listener: MediaOperationsListener?, val allowMultiplePicks: Boolean, val itemClick: (Medium) -> (Unit)) : SwappingHolder(view, MultiSelector()) { - fun bindView(medium: Medium, displayFilenames: Boolean, scrollVertically: Boolean, isListViewType: Boolean, textColor: Int): View { + fun bindView(medium: Medium, displayFilenames: Boolean, scrollVertically: Boolean, isListViewType: Boolean, textColor: Int, + animateGifs: Boolean, cropThumbnails: Boolean): View { itemView.apply { play_outline.visibility = if (medium.video) View.VISIBLE else View.GONE photo_name.beVisibleIf(displayFilenames || isListViewType) photo_name.text = medium.name - activity.loadImage(medium.path, medium_thumbnail, scrollVertically) + activity.loadImage(medium.path, medium_thumbnail, scrollVertically, animateGifs, cropThumbnails) if (isListViewType) { photo_name.setTextColor(textColor) 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 7d76be8a3..c7fd3b5e9 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt @@ -6,6 +6,7 @@ import android.net.Uri import android.provider.MediaStore import android.support.v7.app.AppCompatActivity import android.view.View +import android.widget.ImageView import com.bumptech.glide.Glide import com.bumptech.glide.load.DecodeFormat import com.bumptech.glide.load.engine.DiskCacheStrategy @@ -22,6 +23,7 @@ import com.simplemobiletools.gallery.helpers.* import com.simplemobiletools.gallery.models.Directory import com.simplemobiletools.gallery.models.Medium import com.simplemobiletools.gallery.views.MySquareImageView +import pl.droidsonroids.gif.GifDrawable import java.io.File import java.util.* @@ -199,24 +201,28 @@ fun SimpleActivity.toggleFileVisibility(oldFile: File, hide: Boolean, callback: } } -fun Activity.loadImage(path: String, target: MySquareImageView, verticalScroll: Boolean) { +fun Activity.loadImage(path: String, target: MySquareImageView, verticalScroll: Boolean, animateGifs: Boolean, cropThumbnails: Boolean) { target.isVerticalScrolling = verticalScroll if (path.isImageFast() || path.isVideoFast()) { if (path.isPng()) { - loadPng(path, target) + loadPng(path, target, cropThumbnails) } else { - loadJpg(path, target) + loadJpg(path, target, cropThumbnails) } } else if (path.isGif()) { - if (config.animateGifs) { - loadAnimatedGif(path, target) + val gifDrawable = GifDrawable(path) + target.setImageDrawable(gifDrawable) + if (animateGifs) { + gifDrawable.start() } else { - loadStaticGif(path, target) + gifDrawable.stop() } + + target.scaleType = if (cropThumbnails) ImageView.ScaleType.CENTER_CROP else ImageView.ScaleType.FIT_CENTER } } -fun Activity.loadPng(path: String, target: MySquareImageView) { +fun Activity.loadPng(path: String, target: MySquareImageView, cropThumbnails: Boolean) { val options = RequestOptions() .signature(path.getFileSignature()) .diskCacheStrategy(DiskCacheStrategy.RESOURCE) @@ -226,11 +232,11 @@ fun Activity.loadPng(path: String, target: MySquareImageView) { .asBitmap() .load(path) - if (config.cropThumbnails) options.centerCrop() else options.fitCenter() + if (cropThumbnails) options.centerCrop() else options.fitCenter() builder.apply(options).into(target) } -fun Activity.loadJpg(path: String, target: MySquareImageView) { +fun Activity.loadJpg(path: String, target: MySquareImageView, cropThumbnails: Boolean) { val options = RequestOptions() .signature(path.getFileSignature()) .diskCacheStrategy(DiskCacheStrategy.RESOURCE) @@ -238,36 +244,10 @@ fun Activity.loadJpg(path: String, target: MySquareImageView) { val builder = Glide.with(applicationContext) .load(path) - if (config.cropThumbnails) options.centerCrop() else options.fitCenter() + if (cropThumbnails) options.centerCrop() else options.fitCenter() builder.apply(options).transition(DrawableTransitionOptions.withCrossFade()).into(target) } -fun Activity.loadAnimatedGif(path: String, target: MySquareImageView) { - val options = RequestOptions() - .signature(path.getFileSignature()) - .diskCacheStrategy(DiskCacheStrategy.NONE) - - val builder = Glide.with(applicationContext) - .asGif() - .load(path) - - if (config.cropThumbnails) options.centerCrop() else options.fitCenter() - builder.apply(options).transition(DrawableTransitionOptions.withCrossFade()).into(target) -} - -fun Activity.loadStaticGif(path: String, target: MySquareImageView) { - val options = RequestOptions() - .signature(path.getFileSignature()) - .diskCacheStrategy(DiskCacheStrategy.DATA) - - val builder = Glide.with(applicationContext) - .asBitmap() - .load(path) - - if (config.cropThumbnails) options.centerCrop() else options.fitCenter() - builder.apply(options).into(target) -} - fun Activity.getCachedDirectories(): ArrayList { val token = object : TypeToken>() {}.type return Gson().fromJson>(config.directories, token) ?: ArrayList(1) diff --git a/app/src/main/res/layout/pager_photo_item.xml b/app/src/main/res/layout/pager_photo_item.xml index 152c24684..6e2f333c8 100644 --- a/app/src/main/res/layout/pager_photo_item.xml +++ b/app/src/main/res/layout/pager_photo_item.xml @@ -9,7 +9,8 @@ + android:layout_height="match_parent" + android:scaleType="fitCenter"/> Date: Sat, 28 Oct 2017 13:46:53 +0200 Subject: [PATCH 26/66] init the viewpager orientation listener earlier --- .../simplemobiletools/gallery/activities/ViewPagerActivity.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt index 18eb2f5df..a6d91c38b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -85,6 +85,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View } private fun initViewPager() { + setupOrientationEventListener() measureScreen() val uri = intent.data if (uri != null) { @@ -140,7 +141,6 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View reloadViewPager() scanPath(mPath) {} - setupOrientationEventListener() if (config.darkBackground) view_pager.background = ColorDrawable(Color.BLACK) From 977edc1f34974643bc546128e86e2237a124de56 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 28 Oct 2017 14:11:01 +0200 Subject: [PATCH 27/66] some cleanup around thumbnail loading --- .../gallery/activities/MainActivity.kt | 24 ++++--------- .../gallery/activities/MediaActivity.kt | 19 ++++------- .../gallery/adapters/DirectoryAdapter.kt | 34 +++++++++++++++---- .../gallery/adapters/MediaAdapter.kt | 27 +++++++++++---- .../gallery/extensions/activity.kt | 4 +-- .../gallery/views/MySquareImageView.kt | 4 +-- 6 files changed, 65 insertions(+), 47 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 108f34310..172317755 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -125,36 +125,24 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { super.onResume() config.isThirdPartyIntent = false if (mStoredAnimateGifs != config.animateGifs) { - (directories_grid.adapter as? DirectoryAdapter)?.apply { - animateGifs = config.animateGifs - notifyDataSetChanged() - } + getDirectoryAdapter()?.updateAnimateGifs(config.animateGifs) } if (mStoredCropThumbnails != config.cropThumbnails) { - (directories_grid.adapter as? DirectoryAdapter)?.apply { - cropThumbnails = config.cropThumbnails - notifyDataSetChanged() - } + getDirectoryAdapter()?.updateCropThumbnails(config.cropThumbnails) } if (mStoredShowMediaCount != config.showMediaCount) { - (directories_grid.adapter as? DirectoryAdapter)?.apply { - showMediaCount = config.showMediaCount - notifyDataSetChanged() - } + getDirectoryAdapter()?.updateShowMediaCount(config.showMediaCount) } if (mStoredScrollHorizontally != config.scrollHorizontally) { - (directories_grid.adapter as? DirectoryAdapter)?.apply { - scrollVertically = config.viewTypeFolders == VIEW_TYPE_LIST || !config.scrollHorizontally - notifyDataSetChanged() - } + getDirectoryAdapter()?.updateScrollHorizontally(config.viewTypeFolders != VIEW_TYPE_LIST && config.scrollHorizontally) setupScrollDirection() } if (mStoredTextColor != config.textColor) { - (directories_grid.adapter as? DirectoryAdapter)?.updateTextColor(config.textColor) + getDirectoryAdapter()?.updateTextColor(config.textColor) } tryloadGallery() @@ -183,6 +171,8 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { removeTempFolder() } + private fun getDirectoryAdapter() = directories_grid.adapter as? DirectoryAdapter + private fun storeStateVariables() { config.apply { mStoredAnimateGifs = animateGifs 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 ca3df1126..1b1040443 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -90,29 +90,20 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { override fun onResume() { super.onResume() if (mStoredAnimateGifs != config.animateGifs) { - (media_grid.adapter as? MediaAdapter)?.apply { - animateGifs = config.animateGifs - notifyDataSetChanged() - } + getMediaAdapter()?.updateAnimateGifs(config.animateGifs) } if (mStoredCropThumbnails != config.cropThumbnails) { - (media_grid.adapter as? MediaAdapter)?.apply { - cropThumbnails = config.cropThumbnails - notifyDataSetChanged() - } + getMediaAdapter()?.updateCropThumbnails(config.cropThumbnails) } if (mStoredScrollHorizontally != config.scrollHorizontally) { - (media_grid.adapter as? MediaAdapter)?.apply { - scrollVertically = config.viewTypeFiles == VIEW_TYPE_LIST || !config.scrollHorizontally - notifyDataSetChanged() - } + getMediaAdapter()?.updateScrollHorizontally(config.viewTypeFiles != VIEW_TYPE_LIST || !config.scrollHorizontally) setupScrollDirection() } if (mStoredTextColor != config.textColor) { - (media_grid.adapter as? MediaAdapter)?.updateTextColor(config.textColor) + getMediaAdapter()?.updateTextColor(config.textColor) } tryloadGallery() @@ -159,6 +150,8 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { } } + private fun getMediaAdapter() = media_grid.adapter as? MediaAdapter + private fun checkIfColorChanged() { if (media_grid.adapter != null && getRecyclerAdapter().primaryColor != config.primaryColor) { getRecyclerAdapter().primaryColor = config.primaryColor 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 ed836f91d..b2f585e07 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt @@ -33,10 +33,6 @@ class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableList() private var textColor = config.textColor private var pinnedFolders = config.pinnedFolders + private var scrollHorizontally = config.scrollHorizontally + private var showMediaCount = config.showMediaCount + private var animateGifs = config.animateGifs + private var cropThumbnails = config.cropThumbnails fun toggleItemSelection(select: Boolean, pos: Int) { if (select) { @@ -355,7 +355,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, showMediaCount: Boolean, + fun bindView(directory: Directory, isPinned: Boolean, scrollHorizontally: Boolean, isListView: Boolean, textColor: Int, showMediaCount: Boolean, animateGifs: Boolean, cropThumbnails: Boolean): View { itemView.apply { dir_name.text = directory.name dir_path?.text = "${directory.path.substringBeforeLast("/")}/" photo_cnt.text = directory.mediaCnt.toString() - activity.loadImage(directory.tmb, dir_thumbnail, scrollVertically, animateGifs, cropThumbnails) + activity.loadImage(directory.tmb, dir_thumbnail, scrollHorizontally, animateGifs, cropThumbnails) dir_pin.beVisibleIf(isPinned) dir_sd_card.beVisibleIf(activity.isPathOnSD(directory.path)) photo_cnt.beVisibleIf(showMediaCount) 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 82e9d9fae..c4f8b2e09 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt @@ -31,9 +31,6 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, private val config = activity.config var actMode: ActionMode? = null var primaryColor = config.primaryColor - var scrollVertically = !config.scrollHorizontally - var animateGifs = config.animateGifs - var cropThumbnails = config.cropThumbnails private val multiSelector = MultiSelector() private val isListViewType = config.viewTypeFiles == VIEW_TYPE_LIST @@ -41,6 +38,9 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, private var itemViews = SparseArray() private val selectedPositions = HashSet() + private var scrollHorizontally = config.scrollHorizontally + private var animateGifs = config.animateGifs + private var cropThumbnails = config.cropThumbnails private var textColor = config.textColor private var displayFilenames = config.displayFileNames @@ -287,7 +287,7 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, } override fun onBindViewHolder(holder: ViewHolder, position: Int) { - itemViews.put(position, holder.bindView(media[position], displayFilenames, scrollVertically, isListViewType, textColor, animateGifs, cropThumbnails)) + itemViews.put(position, holder.bindView(media[position], displayFilenames, scrollHorizontally, isListViewType, textColor, animateGifs, cropThumbnails)) toggleItemSelection(selectedPositions.contains(position), position) holder.itemView.tag = holder } @@ -310,6 +310,21 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, notifyDataSetChanged() } + fun updateAnimateGifs(animateGifs: Boolean) { + this.animateGifs = animateGifs + notifyDataSetChanged() + } + + fun updateCropThumbnails(cropThumbnails: Boolean) { + this.cropThumbnails = cropThumbnails + notifyDataSetChanged() + } + + fun updateScrollHorizontally(scrollHorizontally: Boolean) { + this.scrollHorizontally = scrollHorizontally + notifyDataSetChanged() + } + fun updateTextColor(textColor: Int) { this.textColor = textColor notifyDataSetChanged() @@ -358,13 +373,13 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, val multiSelector: MultiSelector, val listener: MediaOperationsListener?, val allowMultiplePicks: Boolean, val itemClick: (Medium) -> (Unit)) : SwappingHolder(view, MultiSelector()) { - fun bindView(medium: Medium, displayFilenames: Boolean, scrollVertically: Boolean, isListViewType: Boolean, textColor: Int, + fun bindView(medium: Medium, displayFilenames: Boolean, scrollHorizontally: Boolean, isListViewType: Boolean, textColor: Int, animateGifs: Boolean, cropThumbnails: Boolean): View { itemView.apply { play_outline.visibility = if (medium.video) View.VISIBLE else View.GONE photo_name.beVisibleIf(displayFilenames || isListViewType) photo_name.text = medium.name - activity.loadImage(medium.path, medium_thumbnail, scrollVertically, animateGifs, cropThumbnails) + activity.loadImage(medium.path, medium_thumbnail, scrollHorizontally, animateGifs, cropThumbnails) if (isListViewType) { photo_name.setTextColor(textColor) 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 c7fd3b5e9..5423a0777 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt @@ -201,8 +201,8 @@ fun SimpleActivity.toggleFileVisibility(oldFile: File, hide: Boolean, callback: } } -fun Activity.loadImage(path: String, target: MySquareImageView, verticalScroll: Boolean, animateGifs: Boolean, cropThumbnails: Boolean) { - target.isVerticalScrolling = verticalScroll +fun Activity.loadImage(path: String, target: MySquareImageView, horizontalScroll: Boolean, animateGifs: Boolean, cropThumbnails: Boolean) { + target.isHorizontalScrolling = horizontalScroll if (path.isImageFast() || path.isVideoFast()) { if (path.isPng()) { loadPng(path, target, cropThumbnails) 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 f254d4183..39a2f74be 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/views/MySquareImageView.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/views/MySquareImageView.kt @@ -5,7 +5,7 @@ import android.util.AttributeSet import android.widget.ImageView class MySquareImageView : ImageView { - var isVerticalScrolling = true + var isHorizontalScrolling = false constructor(context: Context) : super(context) @@ -14,7 +14,7 @@ class MySquareImageView : ImageView { constructor(context: Context, attrs: AttributeSet, defStyle: Int) : super(context, attrs, defStyle) override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) { - val spec = if (isVerticalScrolling) widthMeasureSpec else heightMeasureSpec + val spec = if (isHorizontalScrolling) heightMeasureSpec else widthMeasureSpec super.onMeasure(spec, spec) } } From f3eec9135c41dc1357d76d70ee06368dc9ee1d81 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 28 Oct 2017 14:16:40 +0200 Subject: [PATCH 28/66] add a string for keeping old last-modified at copy/move/rename --- 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-nl/strings.xml | 1 + app/src/main/res/values-pl/strings.xml | 1 + app/src/main/res/values-pt-rBR/strings.xml | 1 + app/src/main/res/values-pt/strings.xml | 1 + app/src/main/res/values-ru/strings.xml | 1 + app/src/main/res/values-sk/strings.xml | 1 + app/src/main/res/values-sv/strings.xml | 1 + app/src/main/res/values-tr/strings.xml | 1 + app/src/main/res/values-zh-rCN/strings.xml | 1 + app/src/main/res/values-zh-rTW/strings.xml | 1 + app/src/main/res/values/strings.xml | 1 + 20 files changed, 20 insertions(+) diff --git a/app/src/main/res/values-ca/strings.xml b/app/src/main/res/values-ca/strings.xml index b2b1b6986..7d13156d9 100644 --- a/app/src/main/res/values-ca/strings.xml +++ b/app/src/main/res/values-ca/strings.xml @@ -129,6 +129,7 @@ Replace Share with Rotate at fullscreen menu Show extended details over fullscreen media Manage extended details + Keep old last-modified value at file copy/move/rename diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index 48f819337..0a789d2b9 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -129,6 +129,7 @@ Replace Share with Rotate at fullscreen menu Show extended details over fullscreen media Manage extended details + Keep old last-modified value at file copy/move/rename diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 4f3e23a51..cc3cf7217 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -129,6 +129,7 @@ Teilen/Drehen im Vollbild-Menü vertauschen Eigenschaften anzeigen im Vollbild Eigenschaften auswählen + Keep old last-modified value at file copy/move/rename diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 8f9bb7813..a734b1cd3 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -129,6 +129,7 @@ Reemplazar Compartir con Girar en el menú de pantalla completa Show extended details over fullscreen media Manage extended details + Keep old last-modified value at file copy/move/rename diff --git a/app/src/main/res/values-fi/strings.xml b/app/src/main/res/values-fi/strings.xml index 57e76daec..9e037de4c 100644 --- a/app/src/main/res/values-fi/strings.xml +++ b/app/src/main/res/values-fi/strings.xml @@ -129,6 +129,7 @@ Korvaa jakaminen kääntämisellä koko näytön tilassa Show extended details over fullscreen media Manage extended details + Keep old last-modified value at file copy/move/rename diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index efa023339..eb5ff60f6 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -129,6 +129,7 @@ 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 + Keep old last-modified value at file copy/move/rename diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index 2eb9d22d0..7db801366 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -129,6 +129,7 @@ Replace Share with Rotate at fullscreen menu Show extended details over fullscreen media Manage extended details + Keep old last-modified value at file copy/move/rename diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index f6c210722..cc6924dc3 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -129,6 +129,7 @@ Sostituisci Condividi con Ruota a schermo intero Mostra informazioni estese su media a schermo intero Gestisci le informazioni estese + Keep old last-modified value at file copy/move/rename diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index dc2413462..f91558821 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -129,6 +129,7 @@ フルスクリーンメニューの「共有」を「回転」に置き換える Show extended details over fullscreen media Manage extended details + Keep old last-modified value at file copy/move/rename diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index ec4df3365..3c7b31a69 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -129,6 +129,7 @@ Menu-item Draaien vastzetten in volledige weergave (in plaats van Delen) Uitgebreide informatie tonen in volledige weergave Uitgebreide informatie + Keep old last-modified value at file copy/move/rename diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index c77a32cad..c5ab80af2 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -129,6 +129,7 @@ Zamień funkcję udostępniania na obracanie w menu pełnoekranowym Dodatkowe szczegóły przy podglądzie pełnoekranowym Zarządzaj dodatkowymi szczegółami + Keep old last-modified value at file copy/move/rename diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 8c391f4b7..1e39213db 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -129,6 +129,7 @@ Substituir botão "Compartilhar" por "Rotação de tela" quando em tela cheia Exibir detalhes extendidos quando em tela cheia Gerenciar detalhes extendidos + Keep old last-modified value at file copy/move/rename diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index 09e7a83d3..bf1efa4af 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -129,6 +129,7 @@ Substituir a opção Partilhar pela opção Rodar se em ecrã completo Mostrar detalhes se em ecrã completo Gerir detalhes exibidos + Keep old last-modified value at file copy/move/rename diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index d62e8711d..b66903eef 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -129,6 +129,7 @@ Заменить \'Поделиться\' на \'Повернуть\' в меню полноэкранного режима Show extended details over fullscreen media Manage extended details + Keep old last-modified value at file copy/move/rename diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index f562dff8d..8f004a004 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -129,6 +129,7 @@ Nahradiť Zdieľanie s Otočením v celoobrazovkovom menu Zobraziť rozšírené vlastnosti ponad celoobrazovkové médiá Spravovať rozšírené vlastnosti + Ponechať starú hodnotu naposledy-upravené pri kopírovaní/presúvaní/premenúvaní súborov diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index 106063a54..b4c2aef0d 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -129,6 +129,7 @@ Ersätt Dela med Rotera i helskärmsmenyn Show extended details over fullscreen media Manage extended details + Keep old last-modified value at file copy/move/rename diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index a9ac2f748..811d06fb6 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -129,6 +129,7 @@ Replace Share with Rotate at fullscreen menu Show extended details over fullscreen media Manage extended details + Keep old last-modified value at file copy/move/rename diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 90412da97..a33042254 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -129,6 +129,7 @@ 替换全屏时菜单栏的“分享”为“旋转” 全屏浏览媒体时显示详细信息 要显示的详细信息项目 + Keep old last-modified value at file copy/move/rename diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index bc5042450..0bae980b9 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -129,6 +129,7 @@ 將全螢幕選單的分享取代為旋轉 Show extended details over fullscreen media Manage extended details + Keep old last-modified value at file copy/move/rename diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index b2b1b6986..7d13156d9 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -129,6 +129,7 @@ Replace Share with Rotate at fullscreen menu Show extended details over fullscreen media Manage extended details + Keep old last-modified value at file copy/move/rename From 729eb36ca5c94ea0d3106cd2d0898b0278222a1f Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 28 Oct 2017 16:22:44 +0200 Subject: [PATCH 29/66] do not set videoFragment visibility to false on pause --- .../com/simplemobiletools/gallery/fragments/VideoFragment.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt index d130e81c1..470e2b986 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt @@ -96,7 +96,6 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee override fun onPause() { super.onPause() pauseVideo() - mIsFragmentVisible = false mStoredShowExtendedDetails = context.config.showExtendedDetails mStoredExtendedDetails = context.config.extendedDetails } From 05dfced1bc0e18bbc43c9f4ece701214fa5194c4 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 28 Oct 2017 17:50:50 +0200 Subject: [PATCH 30/66] add a toggle in Settings to set keeping last-modified value --- app/build.gradle | 2 +- .../gallery/activities/SettingsActivity.kt | 11 ++++++++++ app/src/main/res/layout/activity_settings.xml | 20 +++++++++++++++++++ 3 files changed, 32 insertions(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 0bd65828a..19c2a6d38 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,7 +37,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.32.6' + compile 'com.simplemobiletools:commons:2.32.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' 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 7c0b7b60b..c01ad9ea5 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt @@ -3,6 +3,7 @@ package com.simplemobiletools.gallery.activities import android.content.Intent import android.content.res.Resources import android.os.Bundle +import android.support.v4.content.ContextCompat.startActivity import com.simplemobiletools.commons.dialogs.ConfirmationDialog import com.simplemobiletools.commons.dialogs.RadioGroupDialog import com.simplemobiletools.commons.dialogs.SecurityDialog @@ -13,6 +14,7 @@ import com.simplemobiletools.commons.helpers.PROTECTION_FINGERPRINT import com.simplemobiletools.commons.helpers.SHOW_ALL_TABS import com.simplemobiletools.commons.models.RadioItem import com.simplemobiletools.gallery.R +import com.simplemobiletools.gallery.R.id.* import com.simplemobiletools.gallery.dialogs.ManageExtendedDetailsDialog import com.simplemobiletools.gallery.extensions.config import com.simplemobiletools.gallery.helpers.ROTATE_BY_ASPECT_RATIO @@ -50,6 +52,7 @@ class SettingsActivity : SimpleActivity() { setupDeleteEmptyFolders() setupAllowVideoGestures() setupShowMediaCount() + setupKeepLastModified() setupShowExtendedDetails() setupManageExtendedDetails() updateTextColors(settings_holder) @@ -207,6 +210,14 @@ class SettingsActivity : SimpleActivity() { } } + private fun setupKeepLastModified() { + settings_keep_last_modified.isChecked = config.keepLastModified + settings_keep_last_modified_holder.setOnClickListener { + settings_keep_last_modified.toggle() + config.keepLastModified = settings_keep_last_modified.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 192ef7050..0090560db 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -348,6 +348,26 @@ + + + + + + Date: Sat, 28 Oct 2017 17:55:36 +0200 Subject: [PATCH 31/66] remove some redundant imports --- .../simplemobiletools/gallery/activities/SettingsActivity.kt | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt index c01ad9ea5..6e988b0e3 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt @@ -3,7 +3,6 @@ package com.simplemobiletools.gallery.activities import android.content.Intent import android.content.res.Resources import android.os.Bundle -import android.support.v4.content.ContextCompat.startActivity import com.simplemobiletools.commons.dialogs.ConfirmationDialog import com.simplemobiletools.commons.dialogs.RadioGroupDialog import com.simplemobiletools.commons.dialogs.SecurityDialog @@ -14,7 +13,6 @@ import com.simplemobiletools.commons.helpers.PROTECTION_FINGERPRINT import com.simplemobiletools.commons.helpers.SHOW_ALL_TABS import com.simplemobiletools.commons.models.RadioItem import com.simplemobiletools.gallery.R -import com.simplemobiletools.gallery.R.id.* import com.simplemobiletools.gallery.dialogs.ManageExtendedDetailsDialog import com.simplemobiletools.gallery.extensions.config import com.simplemobiletools.gallery.helpers.ROTATE_BY_ASPECT_RATIO From 049d84e05407a3cc591a2bb9f2f1409be2f201d0 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 28 Oct 2017 18:39:04 +0200 Subject: [PATCH 32/66] update commons to 2.32.12 --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 19c2a6d38..2941b290c 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,7 +37,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.32.11' + compile 'com.simplemobiletools:commons:2.32.12' 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 b1019af51b34c8cae3eb50f58acc733d18798d61 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 28 Oct 2017 18:39:26 +0200 Subject: [PATCH 33/66] fix #320, make orientation by "Device rotation" less sensitive --- .../simplemobiletools/gallery/activities/ViewPagerActivity.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt index a6d91c38b..d8d814da1 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -176,8 +176,8 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View mOrientationEventListener = object : OrientationEventListener(this, SensorManager.SENSOR_DELAY_NORMAL) { override fun onOrientationChanged(orientation: Int) { val currOrient = when (orientation) { - in 45..134 -> ORIENT_LANDSCAPE_RIGHT - in 225..314 -> ORIENT_LANDSCAPE_LEFT + in 75..134 -> ORIENT_LANDSCAPE_RIGHT + in 225..289 -> ORIENT_LANDSCAPE_LEFT else -> ORIENT_PORTRAIT } From 883e3ad6c1819537ac7df5e018a92603de4a8ea0 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 28 Oct 2017 19:04:30 +0200 Subject: [PATCH 34/66] add a check if the owner file from extended details exists --- .../simplemobiletools/gallery/fragments/ViewPagerFragment.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/ViewPagerFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/ViewPagerFragment.kt index 31a2888c4..e495e4168 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/ViewPagerFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/ViewPagerFragment.kt @@ -20,6 +20,9 @@ abstract class ViewPagerFragment : Fragment() { fun getMediumExtendedDetails(medium: Medium): String { val file = File(medium.path) + if (!file.exists()) + return "" + val path = "${file.parent.trimEnd('/')}/" val exif = android.media.ExifInterface(medium.path) val details = StringBuilder() From 75c9d28547b754cb9438b9132f253358487e9123 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 28 Oct 2017 19:05:51 +0200 Subject: [PATCH 35/66] make sure the video fragment still exists when the video completes --- .../com/simplemobiletools/gallery/fragments/VideoFragment.kt | 4 ++++ .../simplemobiletools/gallery/fragments/ViewPagerFragment.kt | 3 ++- 2 files changed, 6 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 470e2b986..8985628c1 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt @@ -464,6 +464,10 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee } private fun videoCompleted() { + if (!isAdded) { + return + } + if (listener?.videoEnded() == false && context.config.loopVideos) { playVideo() } else { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/ViewPagerFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/ViewPagerFragment.kt index e495e4168..20a73b886 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/ViewPagerFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/ViewPagerFragment.kt @@ -20,8 +20,9 @@ abstract class ViewPagerFragment : Fragment() { fun getMediumExtendedDetails(medium: Medium): String { val file = File(medium.path) - if (!file.exists()) + if (!file.exists()) { return "" + } val path = "${file.parent.trimEnd('/')}/" val exif = android.media.ExifInterface(medium.path) From 1dad41fdf71150d5f88754c98d3b3e6b7d7bb90d Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 28 Oct 2017 19:56:33 +0200 Subject: [PATCH 36/66] show an error if the user tries sharing too much data --- app/build.gradle | 2 +- .../com/simplemobiletools/gallery/extensions/activity.kt | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 2941b290c..53da5228b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,7 +37,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.32.12' + compile 'com.simplemobiletools:commons:2.32.15' 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 5423a0777..3e4c91de9 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt @@ -3,6 +3,7 @@ package com.simplemobiletools.gallery.extensions import android.app.Activity import android.content.Intent import android.net.Uri +import android.os.TransactionTooLargeException import android.provider.MediaStore import android.support.v7.app.AppCompatActivity import android.view.View @@ -61,7 +62,11 @@ fun Activity.shareMedia(media: List) { type = uris.getMimeType() addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris) - startActivity(Intent.createChooser(this, shareTitle)) + try { + startActivity(Intent.createChooser(this, shareTitle)) + } catch (e: TransactionTooLargeException) { + toast(R.string.maximum_share_reached) + } } } From 4d913527f531d4b65e4b4a10f2297995b7f29fb9 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 28 Oct 2017 21:51:23 +0200 Subject: [PATCH 37/66] update commons to 2.33.0 --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 53da5228b..2e26e25e5 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,7 +37,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.32.15' + compile 'com.simplemobiletools:commons:2.33.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 788885227ae54bbb95370f1632aa152621324146 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 28 Oct 2017 22:02:17 +0200 Subject: [PATCH 38/66] added a fake drag check at slideshow --- .../gallery/activities/ViewPagerActivity.kt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 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 d8d814da1..a99a66b4d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -327,10 +327,12 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View animator.addUpdateListener(object : ValueAnimator.AnimatorUpdateListener { var oldDragPosition = 0 override fun onAnimationUpdate(animation: ValueAnimator) { - val dragPosition = animation.animatedValue as Int - val dragOffset = dragPosition - oldDragPosition - oldDragPosition = dragPosition - view_pager?.fakeDragBy(dragOffset * (if (forward) 1f else -1f)) + if (view_pager?.isFakeDragging == true) { + val dragPosition = animation.animatedValue as Int + val dragOffset = dragPosition - oldDragPosition + oldDragPosition = dragPosition + view_pager.fakeDragBy(dragOffset * (if (forward) 1f else -1f)) + } } }) From 4f2b05c2a0a2fecd11b96ebd8760693084e1aa09 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 28 Oct 2017 22:04:53 +0200 Subject: [PATCH 39/66] adding the new 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 172317755..259d564bf 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -635,6 +635,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { add(Release(133, R.string.release_133)) add(Release(136, R.string.release_136)) add(Release(137, R.string.release_137)) + add(Release(138, R.string.release_138)) checkWhatsNew(this, BuildConfig.VERSION_CODE) } } diff --git a/app/src/main/res/values/donottranslate.xml b/app/src/main/res/values/donottranslate.xml index de109b996..a8c998266 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 keep last-modified field at file copy/move/rename Added an option to hide folder media count on the main screen Added an option to show customizable extended details over fullscreen media From fc7626d2979094773ad97996dacaf614cc0162cc Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 28 Oct 2017 22:05:04 +0200 Subject: [PATCH 40/66] update version to 2.17.0 --- app/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 2e26e25e5..c5e620f2d 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,8 +10,8 @@ android { applicationId "com.simplemobiletools.gallery" minSdkVersion 16 targetSdkVersion 26 - versionCode 137 - versionName "2.16.1" + versionCode 138 + versionName "2.17.0" } signingConfigs { From 59b2d9136927fd5f759972e8c085da37309adc13 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 28 Oct 2017 22:08:11 +0200 Subject: [PATCH 41/66] updating changelog --- CHANGELOG.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 11500d8ac..ac69815dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,18 @@ Changelog ========== +Version 2.17.0 *(2017-10-28)* +---------------------------- + + * Added a toggle for keeping last-modified field at file copy/move/rename + * Improved GIF animation speed + * Implemented fileprovider support to third party intents + * Make rotation by "Device rotation" less sensitive + * Automatically append "_1" to filename after saving through the Editor + * Added support for Adaptive icons for Android 8 (by fiepi) + * Added Dutch translation (by ltGuillaume) + * Many other smaller improvements + Version 2.16.1 *(2017-10-24)* ---------------------------- From b966b79b7378b945bf917ab5af9d974e221bc77a Mon Sep 17 00:00:00 2001 From: Guillaume Date: Sun, 29 Oct 2017 05:55:11 +0100 Subject: [PATCH 42/66] New string --- app/src/main/res/values-nl/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index 3c7b31a69..82f9b4bff 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -129,7 +129,7 @@ Menu-item Draaien vastzetten in volledige weergave (in plaats van Delen) Uitgebreide informatie tonen in volledige weergave Uitgebreide informatie - Keep old last-modified value at file copy/move/rename + Datum laatst gewijzigd behouden bij bestandsoperaties From de1c418f7830c7048e94de23657fcb9c49d9e498 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 29 Oct 2017 10:29:57 +0100 Subject: [PATCH 43/66] catch exceptions thrown at getting mimetype from uri --- .../com/simplemobiletools/gallery/extensions/context.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 922ad88ff..9bbbf9acf 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt @@ -82,7 +82,10 @@ fun Context.getSortedDirectories(source: ArrayList): ArrayList Date: Sun, 29 Oct 2017 10:34:37 +0100 Subject: [PATCH 44/66] make mUri in PhotoVideoActivity nullable --- .../gallery/activities/PhotoVideoActivity.kt | 27 +++++++++---------- 1 file changed, 13 insertions(+), 14 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 ca6d1c0a0..29850ebfa 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt @@ -33,8 +33,7 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList private var mIsFullScreen = false private var mIsFromGallery = false private var mFragment: ViewPagerFragment? = null - - lateinit var mUri: Uri + private var mUri: Uri? = null var mIsVideo = false @@ -59,15 +58,15 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList mIsFromGallery = intent.getBooleanExtra(IS_FROM_GALLERY, false) - if (mUri.scheme == "file") { - scanPath(mUri.path) {} - sendViewPagerIntent(mUri.path) + if (mUri!!.scheme == "file") { + scanPath(mUri!!.path) {} + sendViewPagerIntent(mUri!!.path) finish() return } else { - val path = applicationContext.getRealPathFromURI(mUri) ?: "" + val path = applicationContext.getRealPathFromURI(mUri!!) ?: "" if (path != mUri.toString()) { - scanPath(mUri.path) {} + scanPath(mUri!!.path) {} if (path.isNotEmpty()) { sendViewPagerIntent(path) finish() @@ -79,7 +78,7 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList showSystemUI() val bundle = Bundle() val file = File(mUri.toString()) - mMedium = Medium(getFilenameFromUri(mUri), mUri.toString(), mIsVideo, 0, 0, file.length()) + mMedium = Medium(getFilenameFromUri(mUri!!), mUri.toString(), mIsVideo, 0, 0, file.length()) title = mMedium!!.name bundle.putSerializable(MEDIUM, mMedium) @@ -119,7 +118,7 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList menu.findItem(R.id.menu_set_as).isVisible = mMedium?.isImage() == true menu.findItem(R.id.menu_edit).isVisible = mMedium?.isImage() == true - menu.findItem(R.id.menu_edit).isVisible = mUri.scheme == "file" + menu.findItem(R.id.menu_edit).isVisible = mUri?.scheme == "file" return true } @@ -129,10 +128,10 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList return true when (item.itemId) { - R.id.menu_set_as -> setAs(mUri) - R.id.menu_open_with -> openFile(mUri, true) - R.id.menu_share -> shareUri(mUri) - R.id.menu_edit -> openEditor(mUri) + R.id.menu_set_as -> setAs(mUri!!) + R.id.menu_open_with -> openFile(mUri!!, true) + R.id.menu_share -> shareUri(mUri!!) + R.id.menu_edit -> openEditor(mUri!!) R.id.menu_properties -> showProperties() else -> return super.onOptionsItemSelected(item) } @@ -140,7 +139,7 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList } private fun showProperties() { - PropertiesDialog(this, mUri.path) + PropertiesDialog(this, mUri!!.path) } override fun fragmentClicked() { From b154ee77edd2911314697827ac40c8a703d24826 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 29 Oct 2017 10:34:44 +0100 Subject: [PATCH 45/66] update commons to 2.33.1 --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index c5e620f2d..86025a798 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,7 +37,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.33.0' + compile 'com.simplemobiletools:commons:2.33.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' From d52eb60611f3824a90ce9c3040bca7f00ad68032 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 29 Oct 2017 11:26:14 +0100 Subject: [PATCH 46/66] use REAL_FILE_PATH from the commons library --- app/build.gradle | 2 +- .../simplemobiletools/gallery/activities/PhotoVideoActivity.kt | 2 +- .../kotlin/com/simplemobiletools/gallery/helpers/Constants.kt | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 86025a798..3705db051 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,7 +37,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.33.1' + compile 'com.simplemobiletools:commons:2.33.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' 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 29850ebfa..0d9e054dc 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt @@ -14,6 +14,7 @@ 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 +import com.simplemobiletools.commons.helpers.REAL_FILE_PATH import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.extensions.* import com.simplemobiletools.gallery.fragments.PhotoFragment @@ -22,7 +23,6 @@ import com.simplemobiletools.gallery.fragments.ViewPagerFragment import com.simplemobiletools.gallery.helpers.IS_FROM_GALLERY import com.simplemobiletools.gallery.helpers.IS_VIEW_INTENT import com.simplemobiletools.gallery.helpers.MEDIUM -import com.simplemobiletools.gallery.helpers.REAL_FILE_PATH import com.simplemobiletools.gallery.models.Medium import kotlinx.android.synthetic.main.fragment_holder.* import java.io.File 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 710ac22b1..663cf7706 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt @@ -67,7 +67,6 @@ val DIRECTORIES = "directories2" val IS_VIEW_INTENT = "is_view_intent" val IS_FROM_GALLERY = "is_from_gallery" val PICKED_PATHS = "picked_paths" -val REAL_FILE_PATH = "real_file_path" val REQUEST_EDIT_IMAGE = 1 val REQUEST_SET_AS = 2 From b421dc273fe7f41e557245e942bbb332d4b04fc8 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 29 Oct 2017 11:41:31 +0100 Subject: [PATCH 47/66] replace MEDIUM constant with PATH in some intents --- .../simplemobiletools/gallery/activities/MediaActivity.kt | 2 +- .../gallery/activities/PhotoVideoActivity.kt | 3 ++- .../gallery/activities/ViewPagerActivity.kt | 2 +- .../simplemobiletools/gallery/adapters/MyPagerAdapter.kt | 6 +++--- .../com/simplemobiletools/gallery/helpers/Constants.kt | 1 + 5 files changed, 8 insertions(+), 6 deletions(-) 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 1b1040443..990ae5c9c 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -506,7 +506,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { openFile(Uri.fromFile(file), false) } else { Intent(this, ViewPagerActivity::class.java).apply { - putExtra(MEDIUM, path) + putExtra(PATH, path) putExtra(SHOW_ALL, mShowAll) startActivity(this) } 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 0d9e054dc..9867df395 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt @@ -23,6 +23,7 @@ import com.simplemobiletools.gallery.fragments.ViewPagerFragment import com.simplemobiletools.gallery.helpers.IS_FROM_GALLERY import com.simplemobiletools.gallery.helpers.IS_VIEW_INTENT import com.simplemobiletools.gallery.helpers.MEDIUM +import com.simplemobiletools.gallery.helpers.PATH import com.simplemobiletools.gallery.models.Medium import kotlinx.android.synthetic.main.fragment_holder.* import java.io.File @@ -108,7 +109,7 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList Intent(this, ViewPagerActivity::class.java).apply { putExtra(IS_VIEW_INTENT, true) putExtra(IS_FROM_GALLERY, mIsFromGallery) - putExtra(MEDIUM, path) + putExtra(PATH, path) startActivity(this) } } 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 a99a66b4d..57946761e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -101,7 +101,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View } } else { try { - mPath = intent.getStringExtra(MEDIUM) + mPath = intent.getStringExtra(PATH) mShowAll = config.showAll } catch (e: Exception) { showErrorToast(e) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MyPagerAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MyPagerAdapter.kt index b7e5640ad..b4be25e37 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MyPagerAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MyPagerAdapter.kt @@ -23,10 +23,10 @@ class MyPagerAdapter(val activity: ViewPagerActivity, fm: FragmentManager, val m bundle.putSerializable(MEDIUM, medium) val fragment: ViewPagerFragment - if (medium.video) { - fragment = VideoFragment() + fragment = if (medium.video) { + VideoFragment() } else { - fragment = PhotoFragment() + PhotoFragment() } fragment.arguments = bundle 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 663cf7706..6e24d3fc4 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt @@ -59,6 +59,7 @@ val NOMEDIA = ".nomedia" val DIRECTORY = "directory" val MEDIUM = "medium" +val PATH = "path" val GET_IMAGE_INTENT = "get_image_intent" val GET_VIDEO_INTENT = "get_video_intent" val GET_ANY_INTENT = "get_any_intent" From 809d9b81a2f13d3ee1ad48438c861eb5975b9fe0 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 29 Oct 2017 12:27:26 +0100 Subject: [PATCH 48/66] some corrections to loading gifs --- .../gallery/activities/PhotoVideoActivity.kt | 1 - .../gallery/fragments/PhotoFragment.kt | 14 ++++++++++++-- 2 files changed, 12 insertions(+), 3 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 9867df395..cbea2e3a8 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt @@ -28,7 +28,6 @@ import com.simplemobiletools.gallery.models.Medium import kotlinx.android.synthetic.main.fragment_holder.* import java.io.File - open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentListener { private var mMedium: Medium? = null private var mIsFullScreen = false 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 4bb52fdb1..5852698d2 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt @@ -24,6 +24,7 @@ import com.davemorrissey.labs.subscaleview.ImageSource import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.gallery.R +import com.simplemobiletools.gallery.activities.PhotoActivity import com.simplemobiletools.gallery.activities.ViewPagerActivity import com.simplemobiletools.gallery.extensions.* import com.simplemobiletools.gallery.helpers.GlideRotateTransformation @@ -48,10 +49,14 @@ class PhotoFragment : ViewPagerFragment() { override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View { view = inflater.inflate(R.layout.pager_photo_item, container, false) as ViewGroup + if (!isFragmentVisible && activity is PhotoActivity) { + isFragmentVisible = true + } + medium = arguments.getSerializable(MEDIUM) as Medium if (medium.path.startsWith("content://")) { val originalPath = medium.path - medium.path = context.getRealPathFromURI(Uri.parse(originalPath)) ?: "" + medium.path = context.getRealPathFromURI(Uri.parse(originalPath)) ?: medium.path if (medium.path.isEmpty()) { var out: FileOutputStream? = null @@ -155,7 +160,12 @@ class PhotoFragment : ViewPagerFragment() { private fun loadImage() { if (medium.isGif()) { - gifDrawable = GifDrawable(medium.path) + gifDrawable = if (medium.path.startsWith("content://") || medium.path.startsWith("file://")) { + GifDrawable(context.contentResolver, Uri.parse(medium.path)) + } else { + GifDrawable(medium.path) + } + if (!isFragmentVisible) { gifDrawable!!.stop() } From 972a1d4a39e0f1f528b8fcd7b649c7e16fd28a20 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 29 Oct 2017 12:51:04 +0100 Subject: [PATCH 49/66] show Properties button at PhotoVideoActivity only with file content uri --- .../gallery/activities/PhotoVideoActivity.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 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 cbea2e3a8..0b57d68fb 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt @@ -117,8 +117,8 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList menuInflater.inflate(R.menu.photo_video_menu, menu) menu.findItem(R.id.menu_set_as).isVisible = mMedium?.isImage() == true - menu.findItem(R.id.menu_edit).isVisible = mMedium?.isImage() == true - menu.findItem(R.id.menu_edit).isVisible = mUri?.scheme == "file" + menu.findItem(R.id.menu_edit).isVisible = mMedium?.isImage() == true && mUri?.scheme == "file" + menu.findItem(R.id.menu_properties).isVisible = mUri?.scheme == "file" return true } From 73856e676984fa063f3f3ac3f8a4d1d2e0f124a2 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 29 Oct 2017 18:28:28 +0100 Subject: [PATCH 50/66] reuse the OpenFile intent handling from Commons --- app/build.gradle | 2 +- .../gallery/activities/PhotoVideoActivity.kt | 2 +- .../gallery/activities/ViewPagerActivity.kt | 1 + .../gallery/extensions/activity.kt | 29 +++++-------------- .../gallery/extensions/context.kt | 20 ------------- .../gallery/helpers/Constants.kt | 1 - app/src/main/res/values-ca/strings.xml | 2 -- app/src/main/res/values-cs/strings.xml | 2 -- app/src/main/res/values-de/strings.xml | 2 -- app/src/main/res/values-es/strings.xml | 2 -- app/src/main/res/values-fi/strings.xml | 2 -- app/src/main/res/values-fr/strings.xml | 2 -- app/src/main/res/values-hu/strings.xml | 2 -- app/src/main/res/values-it/strings.xml | 2 -- app/src/main/res/values-ja/strings.xml | 2 -- app/src/main/res/values-nl/strings.xml | 2 -- app/src/main/res/values-pl/strings.xml | 2 -- app/src/main/res/values-pt-rBR/strings.xml | 2 -- app/src/main/res/values-pt/strings.xml | 2 -- app/src/main/res/values-ru/strings.xml | 2 -- app/src/main/res/values-sk/strings.xml | 2 -- app/src/main/res/values-sv/strings.xml | 2 -- app/src/main/res/values-tr/strings.xml | 2 -- app/src/main/res/values-zh-rCN/strings.xml | 2 -- app/src/main/res/values-zh-rTW/strings.xml | 2 -- app/src/main/res/values/strings.xml | 2 -- 26 files changed, 10 insertions(+), 85 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 3705db051..df3495aa0 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,7 +37,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.33.2' + compile 'com.simplemobiletools:commons:2.33.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' 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 0b57d68fb..d0879b481 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt @@ -13,6 +13,7 @@ import com.simplemobiletools.commons.extensions.getFilenameFromUri import com.simplemobiletools.commons.extensions.getRealPathFromURI import com.simplemobiletools.commons.extensions.scanPath import com.simplemobiletools.commons.extensions.toast +import com.simplemobiletools.commons.helpers.IS_FROM_GALLERY import com.simplemobiletools.commons.helpers.PERMISSION_WRITE_STORAGE import com.simplemobiletools.commons.helpers.REAL_FILE_PATH import com.simplemobiletools.gallery.R @@ -20,7 +21,6 @@ import com.simplemobiletools.gallery.extensions.* import com.simplemobiletools.gallery.fragments.PhotoFragment import com.simplemobiletools.gallery.fragments.VideoFragment import com.simplemobiletools.gallery.fragments.ViewPagerFragment -import com.simplemobiletools.gallery.helpers.IS_FROM_GALLERY import com.simplemobiletools.gallery.helpers.IS_VIEW_INTENT import com.simplemobiletools.gallery.helpers.MEDIUM import com.simplemobiletools.gallery.helpers.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 57946761e..967f1ce21 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -26,6 +26,7 @@ import android.view.animation.DecelerateInterpolator import com.simplemobiletools.commons.dialogs.PropertiesDialog import com.simplemobiletools.commons.dialogs.RenameItemDialog import com.simplemobiletools.commons.extensions.* +import com.simplemobiletools.commons.helpers.IS_FROM_GALLERY import com.simplemobiletools.commons.helpers.PERMISSION_WRITE_STORAGE import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.activities.MediaActivity.Companion.mMedia 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 3e4c91de9..675f67b2b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt @@ -20,7 +20,9 @@ import com.simplemobiletools.commons.helpers.* import com.simplemobiletools.gallery.BuildConfig import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.activities.SimpleActivity -import com.simplemobiletools.gallery.helpers.* +import com.simplemobiletools.gallery.helpers.NOMEDIA +import com.simplemobiletools.gallery.helpers.REQUEST_EDIT_IMAGE +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 @@ -32,7 +34,7 @@ fun Activity.shareUri(uri: Uri) { val shareTitle = resources.getString(R.string.share_via) Intent().apply { action = Intent.ACTION_SEND - putExtra(Intent.EXTRA_STREAM, ensurePublicUri(uri)) + putExtra(Intent.EXTRA_STREAM, ensurePublicUri(uri, BuildConfig.APPLICATION_ID)) type = getMimeTypeFromUri(uri) addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) startActivity(Intent.createChooser(this, shareTitle)) @@ -71,7 +73,7 @@ fun Activity.shareMedia(media: List) { } fun Activity.setAs(uri: Uri) { - val newUri = ensurePublicUri(uri) + val newUri = ensurePublicUri(uri, BuildConfig.APPLICATION_ID) Intent().apply { action = Intent.ACTION_ATTACH_DATA setDataAndType(newUri, getMimeTypeFromUri(newUri)) @@ -87,28 +89,11 @@ fun Activity.setAs(uri: Uri) { } fun Activity.openFile(uri: Uri, forceChooser: Boolean) { - val newUri = ensurePublicUri(uri) - Intent().apply { - action = Intent.ACTION_VIEW - setDataAndType(newUri, getMimeTypeFromUri(newUri)) - addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) - putExtra(IS_FROM_GALLERY, true) - - if (isNougatPlus()) { - putExtra(REAL_FILE_PATH, uri) - } - - 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) - } - } + openFile(uri, forceChooser, BuildConfig.APPLICATION_ID) } fun Activity.openEditor(uri: Uri) { - val newUri = ensurePublicUri(uri) + val newUri = ensurePublicUri(uri, BuildConfig.APPLICATION_ID) Intent().apply { action = Intent.ACTION_EDIT setDataAndType(newUri, getMimeTypeFromUri(newUri)) 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 9bbbf9acf..d4b01c633 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt @@ -78,23 +78,3 @@ fun Context.getSortedDirectories(source: ArrayList): ArrayListGallery Edit Open camera - Open with - No valid app found (hidden) Pin folder Unpin folder diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index 0a789d2b9..58607210b 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -4,8 +4,6 @@ Galerie Upravit Spustit fotoaparát - Otevřít pomocí - Nebyla nalezena žádná vhodná aplikace (skryté) Připnout složku Odepnout složku diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index cc3cf7217..c61f4ddcf 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -4,8 +4,6 @@ Galerie Bearbeiten Kamera öffnen - Öffnen mit - Keine passende App gefunden (versteckt) Ordner anheften Ordner loslösen diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index a734b1cd3..da0f6fcc5 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -4,8 +4,6 @@ Galería Editar Abrir cámara - Abrir con… - No se encontró una aplicación válida (oculto) Fijar carpeta No fijar carpeta diff --git a/app/src/main/res/values-fi/strings.xml b/app/src/main/res/values-fi/strings.xml index 9e037de4c..6b52c8944 100644 --- a/app/src/main/res/values-fi/strings.xml +++ b/app/src/main/res/values-fi/strings.xml @@ -4,8 +4,6 @@ Galleria Muokkaa Avaa kamera - Avaa - Sovelluksia ei löydetty (piilotettu) Kiinnitä kansio Poista kiinnitys diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index eb5ff60f6..04ef9738b 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -4,8 +4,6 @@ Galerie Édition Ouvrir appareil photo - Ouvrir avec - Aucune application valide trouvée (caché) Épingler le dossier Désépingler le dossier diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index 7db801366..64b823830 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -4,8 +4,6 @@ Gallery Edit Open camera - Open with - No valid app found (hidden) Pin folder Unpin folder diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index cc6924dc3..5e242277b 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -4,8 +4,6 @@ Galleria Modifica Apri fotocamera - Apri con - Nessun app valida trovata (nascosta) Blocca cartella Sblocca cartella diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index f91558821..b2ad7e4b3 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -4,8 +4,6 @@ ギャラリー 編集 カメラを開く - 別のアプリで開く - 有効なアプリが見つかりません (非表示) フォルダーをピン留めする フォルダーのピン留めを外す diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index 82f9b4bff..f8d0b97e1 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -4,8 +4,6 @@ Gallerij Bewerken Camera - Openen met - Geen app gevonden om dit bestand mee te openen (verborgen) Map vastzetten Map losmaken diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index c5ab80af2..5540e8018 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -4,8 +4,6 @@ Simple Gallery Edytuj Uruchom aplikację aparatu - Otwórz w - Nie znaleziono danych aplikacji (ukryty) Przypnij folder Wypakuj folder diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 1e39213db..f3c706810 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -4,8 +4,6 @@ Galeria Editar Abrir câmera - Abrir com - Nenhum aplicativo encontrado     (oculto) Fixar pasta Desfixar pasta diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index bf1efa4af..0cb7291f2 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -4,8 +4,6 @@ Galeria Editar Abrir câmara - Abrir com - Nenhuma aplicação encontrada (oculta) Fixar pasta Desafixar pasta diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index b66903eef..b2e684e73 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -4,8 +4,6 @@ Галерея Редактировать Открыть камеру - Открыть в - Приложение не найдено (Скрытый) Закрепить папку Открепить папку diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index 8f004a004..6239471e7 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -4,8 +4,6 @@ Galéria Upraviť Otvoriť fotoaparát - Otvoriť pomocou - Nenašla sa žiadna vhodná aplikácia (skryté) Pripnúť priečinok Odopnúť priečinok diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index b4c2aef0d..63e5194d9 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -4,8 +4,6 @@ Galleri Redigera Starta kameran - Öppna med - Hittade ingen giltig app (dold) Fäst mappen Släpp mappen diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index 811d06fb6..5179f74ef 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -4,8 +4,6 @@ Galeri Düzenle Kamerayı aç - Bununla aç - Geçerli bir uygulama bulunamadı (gizli) Pin klasör Klasörü çöz diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index a33042254..497b9247d 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -4,8 +4,6 @@ 简约图库 编辑 打开相机 - 打开方式 - 未找到可用应用 (隐藏) 锁定目录 解除锁定目录 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 0bae980b9..3be9815c9 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -4,8 +4,6 @@ 簡易相簿 編輯 開啟相機 - 以其他應用程式開啟 - 找不到應用程式 (隱藏) 釘選資料夾 取消釘選資料夾 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 7d13156d9..99c1c1e81 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -4,8 +4,6 @@ Gallery Edit Open camera - Open with - No valid app found (hidden) Pin folder Unpin folder From 02dfcd63c06fb8c7c4af1c04f037b1afad5ca844 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 29 Oct 2017 18:35:08 +0100 Subject: [PATCH 51/66] reuse shareUri at shareMedium --- .../simplemobiletools/gallery/extensions/activity.kt | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) 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 675f67b2b..d38c06865 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt @@ -42,17 +42,8 @@ fun Activity.shareUri(uri: Uri) { } fun Activity.shareMedium(medium: Medium) { - val shareTitle = resources.getString(R.string.share_via) val file = File(medium.path) - val uri = getFilePublicUri(file, BuildConfig.APPLICATION_ID) - - Intent().apply { - action = Intent.ACTION_SEND - putExtra(Intent.EXTRA_STREAM, uri) - type = getMimeTypeFromUri(uri) - addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) - startActivity(Intent.createChooser(this, shareTitle)) - } + shareUri(Uri.fromFile(file)) } fun Activity.shareMedia(media: List) { From 437390cfa3c603d538c6384e865c8d15b4f0f606 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 29 Oct 2017 18:37:38 +0100 Subject: [PATCH 52/66] create a shareUris extension for sharing multiple media --- .../gallery/extensions/activity.kt | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) 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 d38c06865..12f3ef851 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt @@ -41,15 +41,8 @@ fun Activity.shareUri(uri: Uri) { } } -fun Activity.shareMedium(medium: Medium) { - val file = File(medium.path) - shareUri(Uri.fromFile(file)) -} - -fun Activity.shareMedia(media: List) { +fun Activity.shareUris(uris: ArrayList) { val shareTitle = resources.getString(R.string.share_via) - val uris = media.map { getFilePublicUri(File(it.path), BuildConfig.APPLICATION_ID) } as ArrayList - Intent().apply { action = Intent.ACTION_SEND_MULTIPLE type = uris.getMimeType() @@ -63,6 +56,16 @@ fun Activity.shareMedia(media: List) { } } +fun Activity.shareMedium(medium: Medium) { + val file = File(medium.path) + shareUri(Uri.fromFile(file)) +} + +fun Activity.shareMedia(media: List) { + val uris = media.map { getFilePublicUri(File(it.path), BuildConfig.APPLICATION_ID) } as ArrayList + shareUris(uris) +} + fun Activity.setAs(uri: Uri) { val newUri = ensurePublicUri(uri, BuildConfig.APPLICATION_ID) Intent().apply { From 4c80ba98fbd6f53d1d4ef72304af04f80223e613 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 29 Oct 2017 19:08:45 +0100 Subject: [PATCH 53/66] move a couple more intent handling to the Commons library --- app/build.gradle | 2 +- .../gallery/activities/MediaActivity.kt | 1 + .../gallery/activities/ViewPagerActivity.kt | 2 + .../gallery/extensions/activity.kt | 56 ++----------------- .../gallery/helpers/Constants.kt | 3 - 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-nl/strings.xml | 1 - app/src/main/res/values-pl/strings.xml | 1 - app/src/main/res/values-pt-rBR/strings.xml | 1 - app/src/main/res/values-pt/strings.xml | 1 - app/src/main/res/values-ru/strings.xml | 1 - app/src/main/res/values-sk/strings.xml | 1 - app/src/main/res/values-sv/strings.xml | 1 - app/src/main/res/values-tr/strings.xml | 1 - app/src/main/res/values-zh-rCN/strings.xml | 1 - app/src/main/res/values-zh-rTW/strings.xml | 1 - app/src/main/res/values/strings.xml | 1 - 25 files changed, 8 insertions(+), 76 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index df3495aa0..97c2147ee 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,7 +37,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.33.3' + compile 'com.simplemobiletools:commons:2.33.6' 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/MediaActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt index 990ae5c9c..cdb538151 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -22,6 +22,7 @@ import com.simplemobiletools.commons.dialogs.ConfirmationDialog import com.simplemobiletools.commons.dialogs.RadioGroupDialog import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.helpers.PERMISSION_WRITE_STORAGE +import com.simplemobiletools.commons.helpers.REQUEST_EDIT_IMAGE import com.simplemobiletools.commons.models.RadioItem import com.simplemobiletools.commons.views.MyScalableRecyclerView import com.simplemobiletools.gallery.R 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 967f1ce21..c405adf05 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -28,6 +28,8 @@ import com.simplemobiletools.commons.dialogs.RenameItemDialog import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.helpers.IS_FROM_GALLERY import com.simplemobiletools.commons.helpers.PERMISSION_WRITE_STORAGE +import com.simplemobiletools.commons.helpers.REQUEST_EDIT_IMAGE +import com.simplemobiletools.commons.helpers.REQUEST_SET_AS import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.activities.MediaActivity.Companion.mMedia import com.simplemobiletools.gallery.adapters.MyPagerAdapter 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 12f3ef851..5bf08e18d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt @@ -3,7 +3,6 @@ package com.simplemobiletools.gallery.extensions import android.app.Activity import android.content.Intent import android.net.Uri -import android.os.TransactionTooLargeException import android.provider.MediaStore import android.support.v7.app.AppCompatActivity import android.view.View @@ -21,8 +20,6 @@ import com.simplemobiletools.gallery.BuildConfig 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_AS import com.simplemobiletools.gallery.models.Directory import com.simplemobiletools.gallery.models.Medium import com.simplemobiletools.gallery.views.MySquareImageView @@ -31,29 +28,11 @@ import java.io.File import java.util.* fun Activity.shareUri(uri: Uri) { - val shareTitle = resources.getString(R.string.share_via) - Intent().apply { - action = Intent.ACTION_SEND - putExtra(Intent.EXTRA_STREAM, ensurePublicUri(uri, BuildConfig.APPLICATION_ID)) - type = getMimeTypeFromUri(uri) - addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) - startActivity(Intent.createChooser(this, shareTitle)) - } + shareUri(uri, BuildConfig.APPLICATION_ID) } fun Activity.shareUris(uris: ArrayList) { - val shareTitle = resources.getString(R.string.share_via) - Intent().apply { - action = Intent.ACTION_SEND_MULTIPLE - type = uris.getMimeType() - addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) - putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris) - try { - startActivity(Intent.createChooser(this, shareTitle)) - } catch (e: TransactionTooLargeException) { - toast(R.string.maximum_share_reached) - } - } + shareUris(uris, BuildConfig.APPLICATION_ID) } fun Activity.shareMedium(medium: Medium) { @@ -67,19 +46,7 @@ fun Activity.shareMedia(media: List) { } fun Activity.setAs(uri: Uri) { - val newUri = ensurePublicUri(uri, BuildConfig.APPLICATION_ID) - Intent().apply { - action = Intent.ACTION_ATTACH_DATA - setDataAndType(newUri, getMimeTypeFromUri(newUri)) - addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) - val chooser = Intent.createChooser(this, getString(R.string.set_as)) - - if (resolveActivity(packageManager) != null) { - startActivityForResult(chooser, REQUEST_SET_AS) - } else { - toast(R.string.no_capable_app_found) - } - } + setAs(uri, BuildConfig.APPLICATION_ID) } fun Activity.openFile(uri: Uri, forceChooser: Boolean) { @@ -87,22 +54,7 @@ fun Activity.openFile(uri: Uri, forceChooser: Boolean) { } fun Activity.openEditor(uri: Uri) { - val newUri = ensurePublicUri(uri, BuildConfig.APPLICATION_ID) - Intent().apply { - action = Intent.ACTION_EDIT - setDataAndType(newUri, getMimeTypeFromUri(newUri)) - addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) - - if (isNougatPlus()) { - putExtra(MediaStore.EXTRA_OUTPUT, uri) - } - - if (resolveActivity(packageManager) != null) { - startActivityForResult(this, REQUEST_EDIT_IMAGE) - } else { - toast(R.string.no_editor_found) - } - } + openEditor(uri, BuildConfig.APPLICATION_ID) } fun Activity.launchCamera() { 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 4e3d212c5..23b5a2673 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt @@ -68,9 +68,6 @@ val DIRECTORIES = "directories2" val IS_VIEW_INTENT = "is_view_intent" val PICKED_PATHS = "picked_paths" -val REQUEST_EDIT_IMAGE = 1 -val REQUEST_SET_AS = 2 - // rotations val ROTATE_BY_SYSTEM_SETTING = 0 val ROTATE_BY_DEVICE_ROTATION = 1 diff --git a/app/src/main/res/values-ca/strings.xml b/app/src/main/res/values-ca/strings.xml index 99c1c1e81..d5cb6030c 100644 --- a/app/src/main/res/values-ca/strings.xml +++ b/app/src/main/res/values-ca/strings.xml @@ -20,7 +20,6 @@ Change cover image Select photo Use default - Set as Volume Brightness Do not ask again in this session diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index 58607210b..4d68d3bbd 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -20,7 +20,6 @@ Change cover image Select photo Use default - Nastavit jako Volume Brightness Do not ask again in this session diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index c61f4ddcf..319aafacb 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -20,7 +20,6 @@ Coverbild ändern Auswählen Standard - Festlegen als Lautstärke Helligkeit Nicht erneut fragen (in dieser Session) diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index da0f6fcc5..735ddbe69 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -20,7 +20,6 @@ Cambiar imagen de portada Seleccionar imagen Uso por defecto - Establecer como Volume Brightness Do not ask again in this session diff --git a/app/src/main/res/values-fi/strings.xml b/app/src/main/res/values-fi/strings.xml index 6b52c8944..22afe3cb2 100644 --- a/app/src/main/res/values-fi/strings.xml +++ b/app/src/main/res/values-fi/strings.xml @@ -20,7 +20,6 @@ Vaihda kansikuva Valitse kuva Käytä oletuksia - Aseta Äänenvoimakkuus Kirkkaus Do not ask again in this session diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 04ef9738b..2535b0601 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -20,7 +20,6 @@ Changer l\'image de couverture Sélectionner une photo Utiliser par défaut - Définir comme Volume Luminosité Ne pas redemander pour cette session diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index 64b823830..eab18e858 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -20,7 +20,6 @@ Change cover image Select photo Use default - Set as Volume Brightness Do not ask again in this session diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 5e242277b..440d4639c 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -20,7 +20,6 @@ Cambia immagine copertina Seleziona foto Usa predefinita - Imposta come Volume Luminosità Non chiedere nuovamente in questa sessione diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index b2ad7e4b3..3183601e4 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -20,7 +20,6 @@ カバー画像を変更 写真を選択 デフォルトに戻す - 他で使う 音量 明るさ Do not ask again in this session diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index f8d0b97e1..8397ea526 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -20,7 +20,6 @@ Afbeelding voor omslag veranderen Foto selecteren Standaard gebruiken - Instellen als Volume Helderheid Onthouden voor deze sessie diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index 5540e8018..1b1b88c63 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -20,7 +20,6 @@ Zmień okładkę Wybierz obraz Użyj domyślnej - Ustaw jako Głośność Jasność Nie pytaj więcej w tej sesji diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index f3c706810..d6592ce63 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -20,7 +20,6 @@ Trocar imagem de capa Selecionar foto Usar padrão - Definir como Volume Brilho Não perguntar novamente por enquanto diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index 0cb7291f2..9df65ece4 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -20,7 +20,6 @@ Alterar imagem de capa Selecionar foto Predefinição - Definir como Volume Brilho Não perguntar de novo para esta sessão diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index b2e684e73..5dd2a1e65 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -20,7 +20,6 @@ Изменить обложку Выбрать изображение Использовать по умолчанию - Установить как… Громкость Яркость Do not ask again in this session diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index 6239471e7..044be119d 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -20,7 +20,6 @@ Zmeniť obal albumu Zvoliť foto Použiť predvolený - Nastaviť ako Hlasitosť Jas Nepýtať sa už v tomto spustení diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index 63e5194d9..3fde655e0 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -20,7 +20,6 @@ Byt omslagsbild Välj foto Använd standard - Ange som Volym Ljusstyrka Do not ask again in this session diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index 5179f74ef..fada51349 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -20,7 +20,6 @@ Change cover image Select photo Use default - Set as Volume Brightness Do not ask again in this session diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 497b9247d..d69df212a 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -20,7 +20,6 @@ 更改封面图片 选择图片 使用默认 - 设置为 音量 亮度 不再提醒 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 3be9815c9..0a4bb90d3 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -20,7 +20,6 @@ 更換封面圖片 選擇相片 使用預設 - 設為 音量 亮度 Do not ask again in this session diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 99c1c1e81..d5cb6030c 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -20,7 +20,6 @@ Change cover image Select photo Use default - Set as Volume Brightness Do not ask again in this session From 1cf648069520ab847f1eae16841922d1375db047 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 29 Oct 2017 20:01:35 +0100 Subject: [PATCH 54/66] update commons to 2.33.8 --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 97c2147ee..6d9f6a588 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,7 +37,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.33.6' + compile 'com.simplemobiletools:commons:2.33.8' 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 27476a0735be5fcc8232ad8a63c3334a4ffb029e Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 29 Oct 2017 20:19:12 +0100 Subject: [PATCH 55/66] lets show Set As and Edit button at videos too, why not --- .../simplemobiletools/gallery/activities/ViewPagerActivity.kt | 2 -- .../com/simplemobiletools/gallery/adapters/MediaAdapter.kt | 4 ---- 2 files changed, 6 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 c405adf05..ae02f2a66 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -233,8 +233,6 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View menu.apply { findItem(R.id.menu_share_1).isVisible = !config.replaceShare findItem(R.id.menu_share_2).isVisible = config.replaceShare - findItem(R.id.menu_set_as).isVisible = currentMedium.isImage() - findItem(R.id.menu_edit).isVisible = currentMedium.isImage() findItem(R.id.menu_rotate).isVisible = currentMedium.isImage() findItem(R.id.menu_save_as).isVisible = mRotationDegrees != 0f findItem(R.id.menu_hide).isVisible = !currentMedium.name.startsWith('.') 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 c4f8b2e09..46ff5a7cb 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt @@ -108,8 +108,6 @@ 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_open_with).isVisible = selectedPositions.size == 1 - menu.findItem(R.id.cab_edit).isVisible = isOneImageSelected() - menu.findItem(R.id.cab_set_as).isVisible = isOneImageSelected() menu.findItem(R.id.cab_confirm_selection).isVisible = isPickIntent && allowMultiplePicks && selectedPositions.size > 0 checkHideBtnVisibility(menu) @@ -140,8 +138,6 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, menu.findItem(R.id.cab_hide).isVisible = unhiddenCnt > 0 menu.findItem(R.id.cab_unhide).isVisible = hiddenCnt > 0 } - - private fun isOneImageSelected() = selectedPositions.size == 1 && media.size > selectedPositions.first() && media[selectedPositions.first()].isImage() } private fun confirmSelection() { From bf0f4903972ae1cf130dc60836b6003dda711688 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 29 Oct 2017 20:22:26 +0100 Subject: [PATCH 56/66] update version to 2.17.1 --- app/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 6d9f6a588..236800871 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,8 +10,8 @@ android { applicationId "com.simplemobiletools.gallery" minSdkVersion 16 targetSdkVersion 26 - versionCode 138 - versionName "2.17.0" + versionCode 139 + versionName "2.17.1" } signingConfigs { From 37dd189300f87acaad35193574e7746cd21d9ed0 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 29 Oct 2017 20:22:31 +0100 Subject: [PATCH 57/66] updating changelog --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ac69815dc..0a02b84a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,12 @@ Changelog ========== +Version 2.17.1 *(2017-10-29)* +---------------------------- + + * Show "Set As" and "Edit" menu buttons at videos and gifs too + * Couple other smaller issues fixed + Version 2.17.0 *(2017-10-28)* ---------------------------- From 80c6dcdfc0368081c8aa5b390b4439f1c3fa1959 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 29 Oct 2017 21:01:17 +0100 Subject: [PATCH 58/66] update commons to 2.33.9 --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 236800871..1368f391e 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,7 +37,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.33.8' + compile 'com.simplemobiletools:commons:2.33.9' 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 889ce80df8719c5d4901be98cd5aa4a707bd1b08 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 29 Oct 2017 21:14:09 +0100 Subject: [PATCH 59/66] update Commons to 2.34.1 --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 1368f391e..a06137f99 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,7 +37,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.33.9' + compile 'com.simplemobiletools:commons:2.34.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' From 26e91a5e0e3261ad0c61893d4f7f457bc2ca8986 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 29 Oct 2017 21:14:18 +0100 Subject: [PATCH 60/66] update version to 2.17.2 --- app/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index a06137f99..f448c2e4e 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,8 +10,8 @@ android { applicationId "com.simplemobiletools.gallery" minSdkVersion 16 targetSdkVersion 26 - versionCode 139 - versionName "2.17.1" + versionCode 140 + versionName "2.17.2" } signingConfigs { From ac5d0d604b17e8ce2636ee63d05e18ba6cc3ac57 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 29 Oct 2017 21:14:24 +0100 Subject: [PATCH 61/66] updating changelog --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a02b84a0..856703a75 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ Changelog ========== +Version 2.17.2 *(2017-10-29)* +---------------------------- + + * Couple more minor fixes + Version 2.17.1 *(2017-10-29)* ---------------------------- From c20a814100ffab0aaaccacd0ce151bdfe65af305 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 29 Oct 2017 22:20:13 +0100 Subject: [PATCH 62/66] use the Keep last-modified setting text from Commons --- app/build.gradle | 2 +- 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-nl/strings.xml | 1 - app/src/main/res/values-pl/strings.xml | 1 - app/src/main/res/values-pt-rBR/strings.xml | 1 - app/src/main/res/values-pt/strings.xml | 1 - app/src/main/res/values-ru/strings.xml | 1 - app/src/main/res/values-sk/strings.xml | 1 - app/src/main/res/values-sv/strings.xml | 1 - app/src/main/res/values-tr/strings.xml | 1 - app/src/main/res/values-zh-rCN/strings.xml | 1 - app/src/main/res/values-zh-rTW/strings.xml | 1 - app/src/main/res/values/strings.xml | 1 - 21 files changed, 1 insertion(+), 21 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index f448c2e4e..79f122486 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,7 +37,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.34.1' + compile 'com.simplemobiletools:commons:2.34.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' diff --git a/app/src/main/res/values-ca/strings.xml b/app/src/main/res/values-ca/strings.xml index d5cb6030c..209dc0b10 100644 --- a/app/src/main/res/values-ca/strings.xml +++ b/app/src/main/res/values-ca/strings.xml @@ -126,7 +126,6 @@ Replace Share with Rotate at fullscreen menu Show extended details over fullscreen media Manage extended details - Keep old last-modified value at file copy/move/rename diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index 4d68d3bbd..d835945cd 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -126,7 +126,6 @@ Replace Share with Rotate at fullscreen menu Show extended details over fullscreen media Manage extended details - Keep old last-modified value at file copy/move/rename diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 319aafacb..1e42aafee 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -126,7 +126,6 @@ Teilen/Drehen im Vollbild-Menü vertauschen Eigenschaften anzeigen im Vollbild Eigenschaften auswählen - Keep old last-modified value at file copy/move/rename diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 735ddbe69..037aa80de 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -126,7 +126,6 @@ Reemplazar Compartir con Girar en el menú de pantalla completa Show extended details over fullscreen media Manage extended details - Keep old last-modified value at file copy/move/rename diff --git a/app/src/main/res/values-fi/strings.xml b/app/src/main/res/values-fi/strings.xml index 22afe3cb2..f6ccd7a8d 100644 --- a/app/src/main/res/values-fi/strings.xml +++ b/app/src/main/res/values-fi/strings.xml @@ -126,7 +126,6 @@ Korvaa jakaminen kääntämisellä koko näytön tilassa Show extended details over fullscreen media Manage extended details - Keep old last-modified value at file copy/move/rename diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 2535b0601..edf3e5d03 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -126,7 +126,6 @@ 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 - Keep old last-modified value at file copy/move/rename diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index eab18e858..89abc717c 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -126,7 +126,6 @@ Replace Share with Rotate at fullscreen menu Show extended details over fullscreen media Manage extended details - Keep old last-modified value at file copy/move/rename diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 440d4639c..3e0b0643f 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -126,7 +126,6 @@ Sostituisci Condividi con Ruota a schermo intero Mostra informazioni estese su media a schermo intero Gestisci le informazioni estese - Keep old last-modified value at file copy/move/rename diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 3183601e4..2f9086eb3 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -126,7 +126,6 @@ フルスクリーンメニューの「共有」を「回転」に置き換える Show extended details over fullscreen media Manage extended details - Keep old last-modified value at file copy/move/rename diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index 8397ea526..b8062c76f 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -126,7 +126,6 @@ Menu-item Draaien vastzetten in volledige weergave (in plaats van Delen) Uitgebreide informatie tonen in volledige weergave Uitgebreide informatie - Datum laatst gewijzigd behouden bij bestandsoperaties diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index 1b1b88c63..d153c70ba 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -126,7 +126,6 @@ Zamień funkcję udostępniania na obracanie w menu pełnoekranowym Dodatkowe szczegóły przy podglądzie pełnoekranowym Zarządzaj dodatkowymi szczegółami - Keep old last-modified value at file copy/move/rename diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index d6592ce63..8a17fad18 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -126,7 +126,6 @@ Substituir botão "Compartilhar" por "Rotação de tela" quando em tela cheia Exibir detalhes extendidos quando em tela cheia Gerenciar detalhes extendidos - Keep old last-modified value at file copy/move/rename diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index 9df65ece4..6242d94c4 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -126,7 +126,6 @@ Substituir a opção Partilhar pela opção Rodar se em ecrã completo Mostrar detalhes se em ecrã completo Gerir detalhes exibidos - Keep old last-modified value at file copy/move/rename diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 5dd2a1e65..b3ac96a60 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -126,7 +126,6 @@ Заменить \'Поделиться\' на \'Повернуть\' в меню полноэкранного режима Show extended details over fullscreen media Manage extended details - Keep old last-modified value at file copy/move/rename diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index 044be119d..e4af5b81d 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -126,7 +126,6 @@ Nahradiť Zdieľanie s Otočením v celoobrazovkovom menu Zobraziť rozšírené vlastnosti ponad celoobrazovkové médiá Spravovať rozšírené vlastnosti - Ponechať starú hodnotu naposledy-upravené pri kopírovaní/presúvaní/premenúvaní súborov diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index 3fde655e0..703575d53 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -126,7 +126,6 @@ Ersätt Dela med Rotera i helskärmsmenyn Show extended details over fullscreen media Manage extended details - Keep old last-modified value at file copy/move/rename diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index fada51349..67ea088b9 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -126,7 +126,6 @@ Replace Share with Rotate at fullscreen menu Show extended details over fullscreen media Manage extended details - Keep old last-modified value at file copy/move/rename diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index d69df212a..5442e3f2e 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -126,7 +126,6 @@ 替换全屏时菜单栏的“分享”为“旋转” 全屏浏览媒体时显示详细信息 要显示的详细信息项目 - Keep old last-modified value at file copy/move/rename diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 0a4bb90d3..ff138ebbd 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -126,7 +126,6 @@ 將全螢幕選單的分享取代為旋轉 Show extended details over fullscreen media Manage extended details - Keep old last-modified value at file copy/move/rename diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index d5cb6030c..209dc0b10 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -126,7 +126,6 @@ Replace Share with Rotate at fullscreen menu Show extended details over fullscreen media Manage extended details - Keep old last-modified value at file copy/move/rename From 0fdd03cda20a01708d233a5a1a2b9683da940f0c Mon Sep 17 00:00:00 2001 From: Rodrigo Date: Mon, 30 Oct 2017 00:07:46 -0200 Subject: [PATCH 63/66] 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 8a17fad18..c9e953185 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -122,7 +122,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 + Mostrar quantidade de arquivos das pastas Substituir botão "Compartilhar" por "Rotação de tela" quando em tela cheia Exibir detalhes extendidos quando em tela cheia Gerenciar detalhes extendidos From 25e5279696671e98db63db4b7072da7d059971e0 Mon Sep 17 00:00:00 2001 From: Pzqqt <821026875@qq.com> Date: Mon, 30 Oct 2017 16:00:33 +0800 Subject: [PATCH 64/66] Update strings.xml --- app/src/main/res/values-zh-rCN/strings.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 5442e3f2e..74cfdfe11 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -27,7 +27,7 @@ 要显示的媒体文件 图片 - 适配 + 视频 GIFs 所选的过滤器没有找到媒体文件。 更改过滤器 @@ -41,7 +41,7 @@ 是否排除父目录? 此目录及其子目录中的媒体将不会在“简约图库”中显示,但是其它应用可以访问。如果您想对其它应用隐藏,请使用隐藏功能。 移除全部 - 是否删除排除列表中的所有文件夹?此操作不会删除文件夹。 + 是否删除排除列表中的所有项目?此操作不会删除文件夹本身。 包含目录 @@ -113,7 +113,7 @@ GIF 缩略图 浏览时最大亮度 裁剪缩略图 - 全屏时方向 + 全屏方向 系统设置 设备方向 根据长宽比 From fc5e8cb9db8d2f0744f989f02e0d8073367756c4 Mon Sep 17 00:00:00 2001 From: Oleg A Date: Mon, 30 Oct 2017 23:06:32 +0300 Subject: [PATCH 65/66] Update strings.xml --- app/src/main/res/values-ru/strings.xml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index b3ac96a60..f480ce936 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -15,14 +15,14 @@ Место съёмки не указано Не найдено приложений с картами Не найдено приложения камеры - Добавить 1 столбец - Убрать 1 столбец + Добавить столбец + Убрать столбец Изменить обложку Выбрать изображение Использовать по умолчанию Громкость Яркость - Do not ask again in this session + Не спрашивать снова (до следующего запуска) Фильтр медиа @@ -84,8 +84,8 @@ Приложение не найдено Установка обоев… Обои успешно установлены - Формат изображения - Пейзажное соотношение сторон + Портрет + Ландшафт Слайдшоу @@ -122,10 +122,10 @@ Автоматически скрывать системный интерфейс в полноэкранном режиме Удалять пустые папки после удаления их содержимого Управлять громкостью и яркостью видео с помощью вертикальных жестов - Show folder media count on the main view + Показывать количество файлов в папках Заменить \'Поделиться\' на \'Повернуть\' в меню полноэкранного режима - Show extended details over fullscreen media - Manage extended details + Показывать детали файла + Выбрать детали файла From 4157f1fb113b1a65aed6aa0830460f707eb2a85d Mon Sep 17 00:00:00 2001 From: Phoenix1747 Date: Tue, 31 Oct 2017 14:38:05 +0100 Subject: [PATCH 66/66] Update strings.xml --- app/src/main/res/values-de/strings.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 1e42aafee..f216c800e 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -12,7 +12,7 @@ Ansicht: Als Ordner Ordner wählen Auf Karte zeigen - Unbekannter Ort + Unbekannter Pfad Keine Karten-App gefunden Keine Kamera-App gefunden Kacheln verkleinern @@ -22,7 +22,7 @@ Standard Lautstärke Helligkeit - Nicht erneut fragen (in dieser Session) + Nicht erneut fragen (in dieser Sitzung) Filter @@ -66,7 +66,7 @@ Bildbearbeitung fehlgeschlagen Bild bearbeiten mit Keine Bildeditor-App gefunden - Unbekannter Dateiort + Unbekannter Dateipfad Konnte Quelldatei nicht überschreiben Nach links drehen Nach rechts drehen @@ -131,11 +131,11 @@ Eine schlichte Galerie zum Betrachten von Bildern und Videos ohne Werbung. - Ein schlichtes Tool zum Betrachten von Bildern und Videos. Die Medien können nach Datum, Größe, Name sowie auf- oder absteigend sortiert angezeigt werden, in Bilder kann hineingezoomt werden. Die Vorschau-Kacheln werden in mehreren Spalten abhängig von der Displaygröße angezeigt, die Spaltenanzahl ist mit Zweifingergesten änderbar. Die Medien können umbenannt, geteilt, gelöscht, kopiert, verschoben werden. Bilder können zugeschnitten, gedreht oder als Hintergrund festgelegt werden, direkt aus der App heraus. + Eine schlichte App zum Betrachten von Bildern und Videos. Die Medien können nach Datum, Größe, Name sowie auf- oder absteigend sortiert werden, in Bilder kann auch hineingezoomt werden. Die Vorschau-Kacheln werden in mehreren Spalten abhängig von der Displaygröße angezeigt, die Spaltenanzahl ist mit Zweifingergesten änderbar. Die Medien können umbenannt, geteilt, gelöscht, kopiert und verschoben werden. Bilder können direkt aus der App heraus zugeschnitten, gedreht oder als Hintergrund festgelegt werden. - Die Galerie bietet auch für Drittparteien einige Funktionen an: zum Vorschauen von Bildern / Videos, zum Hinzufügen von Anhängen bei eMail-Clients, etc. Sie ist perfekt für den täglichen Gebrauch. + Diese Galerie bietet auch für Drittanbieter einige Funktionen an: zum Vorschauen von Bildern / Videos, zum Hinzufügen von Anhängen bei Email-Apps, etc. Sie ist perfekt für den täglichen Gebrauch. - Beinhaltet keine Werbung oder unnötige Berechtigungen. Sie ist komplett Open Source, verwendete Farben sind anpassbar. + Beinhaltet keine Werbung oder unnötigen Berechtigungen. Sie ist komplett Open Source, verwendete Farben sind anpassbar. Diese App ist nur eine aus einer größeren Serie von schlichten Apps. Der Rest davon findet sich auf http://www.simplemobiletools.com