From 65bb79fd7105674abf17993793eacaedb00605e3 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 9 Jan 2019 13:24:10 +0100 Subject: [PATCH 01/75] adding a string related to opening videos on new screens --- app/src/main/res/values-ar/strings.xml | 1 + app/src/main/res/values-az/strings.xml | 1 + app/src/main/res/values-ca/strings.xml | 1 + app/src/main/res/values-cs/strings.xml | 1 + app/src/main/res/values-da/strings.xml | 1 + app/src/main/res/values-de/strings.xml | 1 + app/src/main/res/values-el/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-gl/strings.xml | 1 + app/src/main/res/values-hr/strings.xml | 1 + app/src/main/res/values-hu/strings.xml | 1 + app/src/main/res/values-id/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-ko-rKR/strings.xml | 1 + app/src/main/res/values-lt/strings.xml | 1 + app/src/main/res/values-nb/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-sl/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-uk/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 + 32 files changed, 32 insertions(+) diff --git a/app/src/main/res/values-ar/strings.xml b/app/src/main/res/values-ar/strings.xml index 3d9aa2dc2..6957eba5e 100644 --- a/app/src/main/res/values-ar/strings.xml +++ b/app/src/main/res/values-ar/strings.xml @@ -176,6 +176,7 @@ Show the Recycle Bin as the last item on the main screen Allow closing the fullscreen view with a down gesture Allow 1:1 zooming in with two double taps + Always open videos on a new screen المصغرات diff --git a/app/src/main/res/values-az/strings.xml b/app/src/main/res/values-az/strings.xml index bf0b0aa1d..cafe1b12a 100644 --- a/app/src/main/res/values-az/strings.xml +++ b/app/src/main/res/values-az/strings.xml @@ -172,6 +172,7 @@ Show the Recycle Bin as the last item on the main screen Allow closing the fullscreen view with a down gesture Allow 1:1 zooming in with two double taps + Always open videos on a new screen Thumbnails diff --git a/app/src/main/res/values-ca/strings.xml b/app/src/main/res/values-ca/strings.xml index 04b8538bb..f28d0db42 100644 --- a/app/src/main/res/values-ca/strings.xml +++ b/app/src/main/res/values-ca/strings.xml @@ -172,6 +172,7 @@ Mostra la paperera de reciclatge com a últim element a la pantalla principal Permet tancar la vista de pantalla completa amb un gest avall Allow 1:1 zooming in with two double taps + Always open videos on a new screen Miniatures diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index 473005bc5..c14f1f321 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -172,6 +172,7 @@ Zobrazit odpadkový koš jako poslední položku na hlavní obrazovce Povolit zavírání celoobrazovkového režimu tažením prstu dolů Allow 1:1 zooming in with two double taps + Always open videos on a new screen Náhledy diff --git a/app/src/main/res/values-da/strings.xml b/app/src/main/res/values-da/strings.xml index f343b3e35..5dd760616 100644 --- a/app/src/main/res/values-da/strings.xml +++ b/app/src/main/res/values-da/strings.xml @@ -172,6 +172,7 @@ Vis papirkurven som sidste element på hovedskærmen Luk fuldskærmsvisning ved at swipe ned Tillad 1:1 zooming med to dobbelttryk + Always open videos on a new screen Miniaturer diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index e5eea5b16..dcaab1763 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -172,6 +172,7 @@ Zeige den Papierkorb als letztes Element auf dem Hauptbildschirm Erlaube das Schließen der Vollbildansicht mit einer Abwärtsgeste Allow 1:1 zooming in with two double taps + Always open videos on a new screen Thumbnails diff --git a/app/src/main/res/values-el/strings.xml b/app/src/main/res/values-el/strings.xml index 557603bd7..041254944 100644 --- a/app/src/main/res/values-el/strings.xml +++ b/app/src/main/res/values-el/strings.xml @@ -172,6 +172,7 @@ Εμφάνιση του Κάδου ως τελευταίο στοιχείο στην κύρια οθόνη Επιτρέψτε το κλείσιμο προβολής πλήρους οθόνης με χειρονομία προς τα κάτω Allow 1:1 zooming in with two double taps + Always open videos on a new screen Εικονίδια diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index a4ff72ed6..945e3ee9c 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -172,6 +172,7 @@ Mostrar la Papelera de reciclaje como el último elemento en la pantalla principal Permite cerrar la vista de pantalla completa con un gesto hacia abajo. Allow 1:1 zooming in with two double taps + Always open videos on a new screen Miniaturas diff --git a/app/src/main/res/values-fi/strings.xml b/app/src/main/res/values-fi/strings.xml index 012074dbb..09575b139 100644 --- a/app/src/main/res/values-fi/strings.xml +++ b/app/src/main/res/values-fi/strings.xml @@ -172,6 +172,7 @@ Show the Recycle Bin as the last item on the main screen Allow closing the fullscreen view with a down gesture Allow 1:1 zooming in with two double taps + Always open videos on a new screen Esikatselukuvat diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 7a9554894..c82fc80eb 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -172,6 +172,7 @@ Afficher la corbeille en dernière place sur l\'écran principal Fermeture de la vue plein écran par un geste vers le bas Allow 1:1 zooming in with two double taps + Always open videos on a new screen Miniatures diff --git a/app/src/main/res/values-gl/strings.xml b/app/src/main/res/values-gl/strings.xml index df63a45aa..3d8b00fcc 100644 --- a/app/src/main/res/values-gl/strings.xml +++ b/app/src/main/res/values-gl/strings.xml @@ -172,6 +172,7 @@ Show the Recycle Bin as the last item on the main screen Allow closing the fullscreen view with a down gesture Allow 1:1 zooming in with two double taps + Always open videos on a new screen Iconas diff --git a/app/src/main/res/values-hr/strings.xml b/app/src/main/res/values-hr/strings.xml index 205680116..b8c9f916d 100644 --- a/app/src/main/res/values-hr/strings.xml +++ b/app/src/main/res/values-hr/strings.xml @@ -172,6 +172,7 @@ Prikaži koš za smeće kao posljednju stavku na glavnom zaslonu Omogućite zatvaranje prikaza preko cijelog zaslona pokretom prema dolje Dopusti zumiranje 1: 1 s dva dvostruka dodira + Always open videos on a new screen Sličice diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index 3d5fe9350..49f22c00f 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -173,6 +173,7 @@ Mutassa a Lomtárat a fő képernyő utolsó elemeként Engedélyezi a teljes képernyős nézetet a lefelé mozdulattal Engedélyezi az 1:1 nagyítást két dupla érintéssel + Always open videos on a new screen Miniatűrök diff --git a/app/src/main/res/values-id/strings.xml b/app/src/main/res/values-id/strings.xml index 2b4c0c882..48c71c89a 100644 --- a/app/src/main/res/values-id/strings.xml +++ b/app/src/main/res/values-id/strings.xml @@ -172,6 +172,7 @@ Tampilkan Sampah sebagai item terakhir di layar utama Izinkan keluar dari layar penuh dengan menggeser kebawah Allow 1:1 zooming in with two double taps + Always open videos on a new screen Thumbnail diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 080359793..57d4aea18 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -172,6 +172,7 @@ Mostra il cestino come ultimo elemento nella schermata principale Chiudi la visuale a schermo intero con un gesto verso il basso Permetti l\'ingrandimento 1:1 con un doppio tasto + Always open videos on a new screen Anteprime diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 82a57ac7d..13812c793 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -172,6 +172,7 @@ ごみ箱をメイン画面の最後に表示 Allow closing the fullscreen view with a down gesture Allow 1:1 zooming in with two double taps + Always open videos on a new screen サムネイル設定 diff --git a/app/src/main/res/values-ko-rKR/strings.xml b/app/src/main/res/values-ko-rKR/strings.xml index 143ab2f23..98cf71409 100644 --- a/app/src/main/res/values-ko-rKR/strings.xml +++ b/app/src/main/res/values-ko-rKR/strings.xml @@ -172,6 +172,7 @@ Show the Recycle Bin as the last item on the main screen Allow closing the fullscreen view with a down gesture Allow 1:1 zooming in with two double taps + Always open videos on a new screen 섬네일 diff --git a/app/src/main/res/values-lt/strings.xml b/app/src/main/res/values-lt/strings.xml index 0e5945bae..87ff914c3 100644 --- a/app/src/main/res/values-lt/strings.xml +++ b/app/src/main/res/values-lt/strings.xml @@ -172,6 +172,7 @@ Show the Recycle Bin as the last item on the main screen Allow closing the fullscreen view with a down gesture Allow 1:1 zooming in with two double taps + Always open videos on a new screen Miniatiūros diff --git a/app/src/main/res/values-nb/strings.xml b/app/src/main/res/values-nb/strings.xml index ba6a24e90..f0dda7155 100644 --- a/app/src/main/res/values-nb/strings.xml +++ b/app/src/main/res/values-nb/strings.xml @@ -172,6 +172,7 @@ Vis papirkurven som siste element på hovedskjermen Tillat lukking av mediavisningen med en nedoverbevegelse Tillat å zoome 1:1 med to dobbeltrykk + Always open videos on a new screen Minibilder diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index 6aa91343e..3f32ae25f 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -172,6 +172,7 @@ Prullenbak als laatste item tonen Naar beneden vegen om volledig scherm af te sluiten 1:1 zoomen na 2x dubbelklikken + Always open videos on a new screen Miniatuurvoorbeelden diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index f1414d43c..3097d8607 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -172,6 +172,7 @@ Pokazuj kosz jako ostatni element na głównym ekranie Zezwalaj na zamykanie pełnoekranowego widoku gestem pociągnięcia w dół Allow 1:1 zooming in with two double taps + Always open videos on a new screen    Miniatury diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 4e5ac0160..5d91d7424 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -172,6 +172,7 @@ Show the Recycle Bin as the last item on the main screen Allow closing the fullscreen view with a down gesture Allow 1:1 zooming in with two double taps + Always open videos on a new screen Miniaturas diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index 761f3a251..e164e11df 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -172,6 +172,7 @@ Mostrar a reciclagem como o último item do ecrã principal Sair de ecrã completo com um gesto para baixo Allow 1:1 zooming in with two double taps + Always open videos on a new screen Miniaturas diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 78999b471..4d20e8fe7 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -172,6 +172,7 @@ Показывать корзину как последний элемент на главном экране Выходить из полноэкранного режима жестом вниз Масштаб 1:1 двумя двойными нажатиями + Always open videos on a new screen Миниатюры diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index f8c929574..f097481eb 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -172,6 +172,7 @@ Zobraziť odpadkový kôš ako poslednú položku na hlavnej obrazovke Povoliť zatváranie celoobrazovkového režimu potiahnutím prsta dole Povoliť 1:1 priblíženie dvojnásobným dvojklikom + Vždy otvárať videá na novej obrazovke Náhľady diff --git a/app/src/main/res/values-sl/strings.xml b/app/src/main/res/values-sl/strings.xml index 8be442876..d8d07020a 100644 --- a/app/src/main/res/values-sl/strings.xml +++ b/app/src/main/res/values-sl/strings.xml @@ -172,6 +172,7 @@ Prikaži Koš kot zadnji element na glavnem zaslonu Dovoli zapiranje celozaslonskega načina z gesto navzdol Allow 1:1 zooming in with two double taps + Always open videos on a new screen Sličice diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index c2e6e6a9e..e6225eec7 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -172,6 +172,7 @@ Visa Papperskorgen som det sista objektet i huvudvyn Allow closing the fullscreen view with a down gesture Allow 1:1 zooming in with two double taps + Always open videos on a new screen Miniatyrer diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index 961371939..f82a1f623 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -172,6 +172,7 @@ Geri dönüşüm kutusu\'nu ana ekranda son öğe olarak göster Tam ekran görünümünü aşağı hareketi ile kapatmaya izin ver Allow 1:1 zooming in with two double taps + Always open videos on a new screen Küçük resimler diff --git a/app/src/main/res/values-uk/strings.xml b/app/src/main/res/values-uk/strings.xml index e4f8f07dc..54e3ca415 100644 --- a/app/src/main/res/values-uk/strings.xml +++ b/app/src/main/res/values-uk/strings.xml @@ -172,6 +172,7 @@ Показувати \"Кошик\" останнім елементом на головному екрані Дозволити закриття повноекранного перегляду свайпом згори вниз Дозволити масштабування до 1:1 подвійним тапом + Always open videos on a new screen Ескізи diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index abce63b4f..278c5d0cb 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -172,6 +172,7 @@ 在主屏幕界面的最后一项显示回收站 使用下滑手势关闭全屏视图 双击两次后 1:1 放大图像 + Always open videos on a new screen 缩略图 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index f342c0200..16c84b736 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -172,6 +172,7 @@ 回收桶顯示在主畫面最後一項 允許用下滑手勢來關閉全螢幕檢視 允許用兩次雙擊來1:1縮放 + Always open videos on a new screen 縮圖 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 927dcba38..31c9426b6 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -172,6 +172,7 @@ Show the Recycle Bin as the last item on the main screen Allow closing the fullscreen view with a down gesture Allow 1:1 zooming in with two double taps + Always open videos on a new screen Thumbnails From 662dff67d61cd4d6ec762712e71f0d4d5848b55d Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 9 Jan 2019 20:49:45 +0100 Subject: [PATCH 02/75] adding a new checkbox for always opening the videos on a new screen --- .../pro/activities/SettingsActivity.kt | 9 +++++++ .../gallery/pro/helpers/Config.kt | 4 ++++ .../gallery/pro/helpers/Constants.kt | 1 + app/src/main/res/layout/activity_settings.xml | 24 +++++++++++++++++++ 4 files changed, 38 insertions(+) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SettingsActivity.kt index eb292610f..667b5862b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SettingsActivity.kt @@ -42,6 +42,7 @@ class SettingsActivity : SimpleActivity() { setupAutoplayVideos() setupRememberLastVideo() setupLoopVideos() + setupOpenVideosOnNewScreen() setupAnimateGifs() setupMaxBrightness() setupCropThumbnails() @@ -174,6 +175,14 @@ class SettingsActivity : SimpleActivity() { } } + private fun setupOpenVideosOnNewScreen() { + settings_open_videos_on_new_screen.isChecked = config.openVideosOnNewScreen + settings_open_videos_on_new_screen_holder.setOnClickListener { + settings_open_videos_on_new_screen.toggle() + config.openVideosOnNewScreen = settings_open_videos_on_new_screen.isChecked + } + } + private fun setupAnimateGifs() { settings_animate_gifs.isChecked = config.animateGifs settings_animate_gifs_holder.setOnClickListener { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Config.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Config.kt index c218dc78c..f1e9ad4ee 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Config.kt @@ -180,6 +180,10 @@ class Config(context: Context) : BaseConfig(context) { get() = prefs.getBoolean(LOOP_VIDEOS, false) set(loop) = prefs.edit().putBoolean(LOOP_VIDEOS, loop).apply() + var openVideosOnNewScreen: Boolean + get() = prefs.getBoolean(OPEN_VIDEOS_ON_NEW_SCREEN, false) + set(openVideosOnNewScreen) = prefs.edit().putBoolean(OPEN_VIDEOS_ON_NEW_SCREEN, openVideosOnNewScreen).apply() + var displayFileNames: Boolean get() = prefs.getBoolean(DISPLAY_FILE_NAMES, false) set(display) = prefs.edit().putBoolean(DISPLAY_FILE_NAMES, display).apply() diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt index d0c1d72e4..cfbf66ad0 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt @@ -13,6 +13,7 @@ const val IS_THIRD_PARTY_INTENT = "is_third_party_intent" const val AUTOPLAY_VIDEOS = "autoplay_videos" const val REMEMBER_LAST_VIDEO_POSITION = "remember_last_video_position" const val LOOP_VIDEOS = "loop_videos" +const val OPEN_VIDEOS_ON_NEW_SCREEN = "open_videos_on_new_screen" const val ANIMATE_GIFS = "animate_gifs" const val MAX_BRIGHTNESS = "max_brightness" const val CROP_THUMBNAILS = "crop_thumbnails" diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index 72de10803..64dd79f50 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -280,6 +280,30 @@ + + + + + + Date: Wed, 9 Jan 2019 20:58:56 +0100 Subject: [PATCH 03/75] updating the string related to video opening --- .../gallery/pro/activities/SettingsActivity.kt | 12 ++++++------ .../simplemobiletools/gallery/pro/helpers/Config.kt | 6 +++--- .../gallery/pro/helpers/Constants.kt | 2 +- app/src/main/res/layout/activity_settings.xml | 6 +++--- app/src/main/res/values-ar/strings.xml | 2 +- app/src/main/res/values-az/strings.xml | 2 +- app/src/main/res/values-ca/strings.xml | 2 +- app/src/main/res/values-cs/strings.xml | 2 +- app/src/main/res/values-da/strings.xml | 2 +- app/src/main/res/values-de/strings.xml | 2 +- app/src/main/res/values-el/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-gl/strings.xml | 2 +- app/src/main/res/values-hr/strings.xml | 2 +- app/src/main/res/values-hu/strings.xml | 2 +- app/src/main/res/values-id/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-ko-rKR/strings.xml | 2 +- app/src/main/res/values-lt/strings.xml | 2 +- app/src/main/res/values-nb/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-sl/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-uk/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 +- 36 files changed, 45 insertions(+), 45 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SettingsActivity.kt index 667b5862b..df0324e07 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SettingsActivity.kt @@ -42,7 +42,7 @@ class SettingsActivity : SimpleActivity() { setupAutoplayVideos() setupRememberLastVideo() setupLoopVideos() - setupOpenVideosOnNewScreen() + setupOpenVideosOnSeparateScreen() setupAnimateGifs() setupMaxBrightness() setupCropThumbnails() @@ -175,11 +175,11 @@ class SettingsActivity : SimpleActivity() { } } - private fun setupOpenVideosOnNewScreen() { - settings_open_videos_on_new_screen.isChecked = config.openVideosOnNewScreen - settings_open_videos_on_new_screen_holder.setOnClickListener { - settings_open_videos_on_new_screen.toggle() - config.openVideosOnNewScreen = settings_open_videos_on_new_screen.isChecked + private fun setupOpenVideosOnSeparateScreen() { + settings_open_videos_on_separate_screen.isChecked = config.openVideosOnSeparateScreen + settings_open_videos_on_separate_screen_holder.setOnClickListener { + settings_open_videos_on_separate_screen.toggle() + config.openVideosOnSeparateScreen = settings_open_videos_on_separate_screen.isChecked } } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Config.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Config.kt index f1e9ad4ee..d886598a9 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Config.kt @@ -180,9 +180,9 @@ class Config(context: Context) : BaseConfig(context) { get() = prefs.getBoolean(LOOP_VIDEOS, false) set(loop) = prefs.edit().putBoolean(LOOP_VIDEOS, loop).apply() - var openVideosOnNewScreen: Boolean - get() = prefs.getBoolean(OPEN_VIDEOS_ON_NEW_SCREEN, false) - set(openVideosOnNewScreen) = prefs.edit().putBoolean(OPEN_VIDEOS_ON_NEW_SCREEN, openVideosOnNewScreen).apply() + var openVideosOnSeparateScreen: Boolean + get() = prefs.getBoolean(OPEN_VIDEOS_ON_SEPARATE_SCREEN, false) + set(openVideosOnSeparateScreen) = prefs.edit().putBoolean(OPEN_VIDEOS_ON_SEPARATE_SCREEN, openVideosOnSeparateScreen).apply() var displayFileNames: Boolean get() = prefs.getBoolean(DISPLAY_FILE_NAMES, false) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt index cfbf66ad0..8dcc57e1a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt @@ -13,7 +13,7 @@ const val IS_THIRD_PARTY_INTENT = "is_third_party_intent" const val AUTOPLAY_VIDEOS = "autoplay_videos" const val REMEMBER_LAST_VIDEO_POSITION = "remember_last_video_position" const val LOOP_VIDEOS = "loop_videos" -const val OPEN_VIDEOS_ON_NEW_SCREEN = "open_videos_on_new_screen" +const val OPEN_VIDEOS_ON_SEPARATE_SCREEN = "open_videos_on_separate_screen" const val ANIMATE_GIFS = "animate_gifs" const val MAX_BRIGHTNESS = "max_brightness" const val CROP_THUMBNAILS = "crop_thumbnails" diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index 64dd79f50..5a8762ee1 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -281,7 +281,7 @@ diff --git a/app/src/main/res/values-ar/strings.xml b/app/src/main/res/values-ar/strings.xml index 6957eba5e..96ab1111a 100644 --- a/app/src/main/res/values-ar/strings.xml +++ b/app/src/main/res/values-ar/strings.xml @@ -176,7 +176,7 @@ Show the Recycle Bin as the last item on the main screen Allow closing the fullscreen view with a down gesture Allow 1:1 zooming in with two double taps - Always open videos on a new screen + Always open videos on a separate screen with new horizontal gestures المصغرات diff --git a/app/src/main/res/values-az/strings.xml b/app/src/main/res/values-az/strings.xml index cafe1b12a..e6e3830c5 100644 --- a/app/src/main/res/values-az/strings.xml +++ b/app/src/main/res/values-az/strings.xml @@ -172,7 +172,7 @@ Show the Recycle Bin as the last item on the main screen Allow closing the fullscreen view with a down gesture Allow 1:1 zooming in with two double taps - Always open videos on a new screen + Always open videos on a separate screen with new horizontal gestures Thumbnails diff --git a/app/src/main/res/values-ca/strings.xml b/app/src/main/res/values-ca/strings.xml index f28d0db42..8ce23735c 100644 --- a/app/src/main/res/values-ca/strings.xml +++ b/app/src/main/res/values-ca/strings.xml @@ -172,7 +172,7 @@ Mostra la paperera de reciclatge com a últim element a la pantalla principal Permet tancar la vista de pantalla completa amb un gest avall Allow 1:1 zooming in with two double taps - Always open videos on a new screen + Always open videos on a separate screen with new horizontal gestures Miniatures diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index c14f1f321..ef3cf1dfa 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -172,7 +172,7 @@ Zobrazit odpadkový koš jako poslední položku na hlavní obrazovce Povolit zavírání celoobrazovkového režimu tažením prstu dolů Allow 1:1 zooming in with two double taps - Always open videos on a new screen + Always open videos on a separate screen with new horizontal gestures Náhledy diff --git a/app/src/main/res/values-da/strings.xml b/app/src/main/res/values-da/strings.xml index 5dd760616..44843347c 100644 --- a/app/src/main/res/values-da/strings.xml +++ b/app/src/main/res/values-da/strings.xml @@ -172,7 +172,7 @@ Vis papirkurven som sidste element på hovedskærmen Luk fuldskærmsvisning ved at swipe ned Tillad 1:1 zooming med to dobbelttryk - Always open videos on a new screen + Always open videos on a separate screen with new horizontal gestures Miniaturer diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index dcaab1763..466bf63e3 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -172,7 +172,7 @@ Zeige den Papierkorb als letztes Element auf dem Hauptbildschirm Erlaube das Schließen der Vollbildansicht mit einer Abwärtsgeste Allow 1:1 zooming in with two double taps - Always open videos on a new screen + Always open videos on a separate screen with new horizontal gestures Thumbnails diff --git a/app/src/main/res/values-el/strings.xml b/app/src/main/res/values-el/strings.xml index 041254944..031ac83d4 100644 --- a/app/src/main/res/values-el/strings.xml +++ b/app/src/main/res/values-el/strings.xml @@ -172,7 +172,7 @@ Εμφάνιση του Κάδου ως τελευταίο στοιχείο στην κύρια οθόνη Επιτρέψτε το κλείσιμο προβολής πλήρους οθόνης με χειρονομία προς τα κάτω Allow 1:1 zooming in with two double taps - Always open videos on a new screen + Always open videos on a separate screen with new horizontal gestures Εικονίδια diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 945e3ee9c..8042a210a 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -172,7 +172,7 @@ Mostrar la Papelera de reciclaje como el último elemento en la pantalla principal Permite cerrar la vista de pantalla completa con un gesto hacia abajo. Allow 1:1 zooming in with two double taps - Always open videos on a new screen + Always open videos on a separate screen with new horizontal gestures Miniaturas diff --git a/app/src/main/res/values-fi/strings.xml b/app/src/main/res/values-fi/strings.xml index 09575b139..e5a81d617 100644 --- a/app/src/main/res/values-fi/strings.xml +++ b/app/src/main/res/values-fi/strings.xml @@ -172,7 +172,7 @@ Show the Recycle Bin as the last item on the main screen Allow closing the fullscreen view with a down gesture Allow 1:1 zooming in with two double taps - Always open videos on a new screen + Always open videos on a separate screen with new horizontal gestures Esikatselukuvat diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index c82fc80eb..4b8dd1501 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -172,7 +172,7 @@ Afficher la corbeille en dernière place sur l\'écran principal Fermeture de la vue plein écran par un geste vers le bas Allow 1:1 zooming in with two double taps - Always open videos on a new screen + Always open videos on a separate screen with new horizontal gestures Miniatures diff --git a/app/src/main/res/values-gl/strings.xml b/app/src/main/res/values-gl/strings.xml index 3d8b00fcc..12121d648 100644 --- a/app/src/main/res/values-gl/strings.xml +++ b/app/src/main/res/values-gl/strings.xml @@ -172,7 +172,7 @@ Show the Recycle Bin as the last item on the main screen Allow closing the fullscreen view with a down gesture Allow 1:1 zooming in with two double taps - Always open videos on a new screen + Always open videos on a separate screen with new horizontal gestures Iconas diff --git a/app/src/main/res/values-hr/strings.xml b/app/src/main/res/values-hr/strings.xml index b8c9f916d..fda764b84 100644 --- a/app/src/main/res/values-hr/strings.xml +++ b/app/src/main/res/values-hr/strings.xml @@ -172,7 +172,7 @@ Prikaži koš za smeće kao posljednju stavku na glavnom zaslonu Omogućite zatvaranje prikaza preko cijelog zaslona pokretom prema dolje Dopusti zumiranje 1: 1 s dva dvostruka dodira - Always open videos on a new screen + Always open videos on a separate screen with new horizontal gestures Sličice diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index 49f22c00f..0b10ff1a7 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -173,7 +173,7 @@ Mutassa a Lomtárat a fő képernyő utolsó elemeként Engedélyezi a teljes képernyős nézetet a lefelé mozdulattal Engedélyezi az 1:1 nagyítást két dupla érintéssel - Always open videos on a new screen + Always open videos on a separate screen with new horizontal gestures Miniatűrök diff --git a/app/src/main/res/values-id/strings.xml b/app/src/main/res/values-id/strings.xml index 48c71c89a..9cdf9fb68 100644 --- a/app/src/main/res/values-id/strings.xml +++ b/app/src/main/res/values-id/strings.xml @@ -172,7 +172,7 @@ Tampilkan Sampah sebagai item terakhir di layar utama Izinkan keluar dari layar penuh dengan menggeser kebawah Allow 1:1 zooming in with two double taps - Always open videos on a new screen + Always open videos on a separate screen with new horizontal gestures Thumbnail diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 57d4aea18..64e8411eb 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -172,7 +172,7 @@ Mostra il cestino come ultimo elemento nella schermata principale Chiudi la visuale a schermo intero con un gesto verso il basso Permetti l\'ingrandimento 1:1 con un doppio tasto - Always open videos on a new screen + Always open videos on a separate screen with new horizontal gestures Anteprime diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 13812c793..c5f5fe84c 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -172,7 +172,7 @@ ごみ箱をメイン画面の最後に表示 Allow closing the fullscreen view with a down gesture Allow 1:1 zooming in with two double taps - Always open videos on a new screen + Always open videos on a separate screen with new horizontal gestures サムネイル設定 diff --git a/app/src/main/res/values-ko-rKR/strings.xml b/app/src/main/res/values-ko-rKR/strings.xml index 98cf71409..5e71f4a72 100644 --- a/app/src/main/res/values-ko-rKR/strings.xml +++ b/app/src/main/res/values-ko-rKR/strings.xml @@ -172,7 +172,7 @@ Show the Recycle Bin as the last item on the main screen Allow closing the fullscreen view with a down gesture Allow 1:1 zooming in with two double taps - Always open videos on a new screen + Always open videos on a separate screen with new horizontal gestures 섬네일 diff --git a/app/src/main/res/values-lt/strings.xml b/app/src/main/res/values-lt/strings.xml index 87ff914c3..23debda8c 100644 --- a/app/src/main/res/values-lt/strings.xml +++ b/app/src/main/res/values-lt/strings.xml @@ -172,7 +172,7 @@ Show the Recycle Bin as the last item on the main screen Allow closing the fullscreen view with a down gesture Allow 1:1 zooming in with two double taps - Always open videos on a new screen + Always open videos on a separate screen with new horizontal gestures Miniatiūros diff --git a/app/src/main/res/values-nb/strings.xml b/app/src/main/res/values-nb/strings.xml index f0dda7155..9c121cb44 100644 --- a/app/src/main/res/values-nb/strings.xml +++ b/app/src/main/res/values-nb/strings.xml @@ -172,7 +172,7 @@ Vis papirkurven som siste element på hovedskjermen Tillat lukking av mediavisningen med en nedoverbevegelse Tillat å zoome 1:1 med to dobbeltrykk - Always open videos on a new screen + Always open videos on a separate screen with new horizontal gestures Minibilder diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index 3f32ae25f..5e586e2f4 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -172,7 +172,7 @@ Prullenbak als laatste item tonen Naar beneden vegen om volledig scherm af te sluiten 1:1 zoomen na 2x dubbelklikken - Always open videos on a new screen + Always open videos on a separate screen with new horizontal gestures Miniatuurvoorbeelden diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index 3097d8607..650f84c84 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -172,7 +172,7 @@ Pokazuj kosz jako ostatni element na głównym ekranie Zezwalaj na zamykanie pełnoekranowego widoku gestem pociągnięcia w dół Allow 1:1 zooming in with two double taps - Always open videos on a new screen + Always open videos on a separate screen with new horizontal gestures    Miniatury diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 5d91d7424..8433070e7 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -172,7 +172,7 @@ Show the Recycle Bin as the last item on the main screen Allow closing the fullscreen view with a down gesture Allow 1:1 zooming in with two double taps - Always open videos on a new screen + Always open videos on a separate screen with new horizontal gestures Miniaturas diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index e164e11df..a428fc891 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -172,7 +172,7 @@ Mostrar a reciclagem como o último item do ecrã principal Sair de ecrã completo com um gesto para baixo Allow 1:1 zooming in with two double taps - Always open videos on a new screen + Always open videos on a separate screen with new horizontal gestures Miniaturas diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 4d20e8fe7..14c78484f 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -172,7 +172,7 @@ Показывать корзину как последний элемент на главном экране Выходить из полноэкранного режима жестом вниз Масштаб 1:1 двумя двойными нажатиями - Always open videos on a new screen + Always open videos on a separate screen with new horizontal gestures Миниатюры diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index f097481eb..5c16611b5 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -172,7 +172,7 @@ Zobraziť odpadkový kôš ako poslednú položku na hlavnej obrazovke Povoliť zatváranie celoobrazovkového režimu potiahnutím prsta dole Povoliť 1:1 priblíženie dvojnásobným dvojklikom - Vždy otvárať videá na novej obrazovke + Vždy otvárať videá na vlastnej obrazovke s novými vodorovnými gestami Náhľady diff --git a/app/src/main/res/values-sl/strings.xml b/app/src/main/res/values-sl/strings.xml index d8d07020a..ded2b9270 100644 --- a/app/src/main/res/values-sl/strings.xml +++ b/app/src/main/res/values-sl/strings.xml @@ -172,7 +172,7 @@ Prikaži Koš kot zadnji element na glavnem zaslonu Dovoli zapiranje celozaslonskega načina z gesto navzdol Allow 1:1 zooming in with two double taps - Always open videos on a new screen + Always open videos on a separate screen with new horizontal gestures Sličice diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index e6225eec7..28a2519ab 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -172,7 +172,7 @@ Visa Papperskorgen som det sista objektet i huvudvyn Allow closing the fullscreen view with a down gesture Allow 1:1 zooming in with two double taps - Always open videos on a new screen + Always open videos on a separate screen with new horizontal gestures Miniatyrer diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index f82a1f623..98ce6c484 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -172,7 +172,7 @@ Geri dönüşüm kutusu\'nu ana ekranda son öğe olarak göster Tam ekran görünümünü aşağı hareketi ile kapatmaya izin ver Allow 1:1 zooming in with two double taps - Always open videos on a new screen + Always open videos on a separate screen with new horizontal gestures Küçük resimler diff --git a/app/src/main/res/values-uk/strings.xml b/app/src/main/res/values-uk/strings.xml index 54e3ca415..c13346e74 100644 --- a/app/src/main/res/values-uk/strings.xml +++ b/app/src/main/res/values-uk/strings.xml @@ -172,7 +172,7 @@ Показувати \"Кошик\" останнім елементом на головному екрані Дозволити закриття повноекранного перегляду свайпом згори вниз Дозволити масштабування до 1:1 подвійним тапом - Always open videos on a new screen + Always open videos on a separate screen with new horizontal gestures Ескізи diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 278c5d0cb..3b44839e0 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -172,7 +172,7 @@ 在主屏幕界面的最后一项显示回收站 使用下滑手势关闭全屏视图 双击两次后 1:1 放大图像 - Always open videos on a new screen + Always open videos on a separate screen with new horizontal gestures 缩略图 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 16c84b736..dfee2752f 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -172,7 +172,7 @@ 回收桶顯示在主畫面最後一項 允許用下滑手勢來關閉全螢幕檢視 允許用兩次雙擊來1:1縮放 - Always open videos on a new screen + Always open videos on a separate screen with new horizontal gestures 縮圖 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 31c9426b6..671b3bb2e 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -172,7 +172,7 @@ Show the Recycle Bin as the last item on the main screen Allow closing the fullscreen view with a down gesture Allow 1:1 zooming in with two double taps - Always open videos on a new screen + Always open videos on a separate screen with new horizontal gestures Thumbnails From 6d1cf81c96af177a88a845bd38ae33c19165bf8d Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 9 Jan 2019 22:47:15 +0100 Subject: [PATCH 04/75] add back the video time holder at the bottom of the video fragment --- .../gallery/pro/fragments/VideoFragment.kt | 20 ++++++++++++++++++- app/src/main/res/layout/pager_video_item.xml | 2 ++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt index 0ef8a6223..d103c0915 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt @@ -6,6 +6,7 @@ import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.ViewGroup +import android.widget.RelativeLayout import com.bumptech.glide.Glide import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.gallery.pro.R @@ -15,6 +16,7 @@ import com.simplemobiletools.gallery.pro.helpers.MEDIUM import com.simplemobiletools.gallery.pro.helpers.PATH import com.simplemobiletools.gallery.pro.models.Medium import com.simplemobiletools.gallery.pro.views.MediaSideScroll +import kotlinx.android.synthetic.main.bottom_video_time_holder.view.* import kotlinx.android.synthetic.main.pager_video_item.view.* import java.io.File import java.io.FileInputStream @@ -29,6 +31,7 @@ class VideoFragment : ViewPagerFragment() { private var mStoredBottomActions = true private var mStoredExtendedDetails = 0 + private lateinit var mTimeHolder: View private lateinit var mBrightnessSideScroll: MediaSideScroll private lateinit var mVolumeSideScroll: MediaSideScroll @@ -44,6 +47,7 @@ class VideoFragment : ViewPagerFragment() { panorama_outline.setOnClickListener { openPanorama() } video_play_outline.setOnClickListener { launchVideoPlayer() } + mTimeHolder = video_time_holder mBrightnessSideScroll = video_brightness_controller mVolumeSideScroll = video_volume_controller @@ -60,6 +64,7 @@ class VideoFragment : ViewPagerFragment() { Glide.with(context!!).load(mMedium.path).into(mView.video_preview) mIsFullscreen = activity!!.window.decorView.systemUiVisibility and View.SYSTEM_UI_FLAG_FULLSCREEN == View.SYSTEM_UI_FLAG_FULLSCREEN + initTimeHolder() checkIfPanorama() if (mIsPanorama) { @@ -105,6 +110,7 @@ class VideoFragment : ViewPagerFragment() { } checkExtendedDetails() + initTimeHolder() storeStateVariables() } @@ -116,6 +122,7 @@ class VideoFragment : ViewPagerFragment() { override fun onConfigurationChanged(newConfig: Configuration) { super.onConfigurationChanged(newConfig) checkExtendedDetails() + initTimeHolder() updateInstantSwitchWidths() } @@ -157,6 +164,15 @@ class VideoFragment : ViewPagerFragment() { } } + private fun initTimeHolder() { + var bottomMargin = context!!.navigationBarHeight + if (context!!.config.bottomActions) { + bottomMargin += resources.getDimension(R.dimen.bottom_actions_height).toInt() + } + + (mTimeHolder.layoutParams as RelativeLayout.LayoutParams).bottomMargin = bottomMargin + } + private fun checkIfPanorama() { try { val fis = FileInputStream(File(mMedium.path)) @@ -183,12 +199,14 @@ class VideoFragment : ViewPagerFragment() { override fun fullscreenToggled(isFullscreen: Boolean) { mIsFullscreen = isFullscreen + val newAlpha = if (isFullscreen) 0f else 1f + mTimeHolder.animate().alpha(newAlpha).start() mView.video_details.apply { if (mStoredShowExtendedDetails && isVisible()) { animate().y(getExtendedDetailsY(height)) if (mStoredHideExtendedDetails) { - animate().alpha(if (isFullscreen) 0f else 1f).start() + animate().alpha(newAlpha).start() } } } diff --git a/app/src/main/res/layout/pager_video_item.xml b/app/src/main/res/layout/pager_video_item.xml index f8ba09def..9537f8997 100644 --- a/app/src/main/res/layout/pager_video_item.xml +++ b/app/src/main/res/layout/pager_video_item.xml @@ -83,4 +83,6 @@ android:visibility="gone" tools:text="My video\nAnother line"/> + + From e7c003ffcc0e38233be3453c2ff9ebe995f48354 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 9 Jan 2019 22:57:09 +0100 Subject: [PATCH 05/75] adding a couple tweaks to timeholder and extended details positioning --- .../gallery/pro/fragments/VideoFragment.kt | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt index d103c0915..1112f8920 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt @@ -171,6 +171,7 @@ class VideoFragment : ViewPagerFragment() { } (mTimeHolder.layoutParams as RelativeLayout.LayoutParams).bottomMargin = bottomMargin + mTimeHolder.beInvisibleIf(mIsFullscreen) } private fun checkIfPanorama() { @@ -200,6 +201,9 @@ class VideoFragment : ViewPagerFragment() { override fun fullscreenToggled(isFullscreen: Boolean) { mIsFullscreen = isFullscreen val newAlpha = if (isFullscreen) 0f else 1f + if (!mIsFullscreen) { + mTimeHolder.beVisible() + } mTimeHolder.animate().alpha(newAlpha).start() mView.video_details.apply { if (mStoredShowExtendedDetails && isVisible()) { @@ -215,7 +219,13 @@ class VideoFragment : ViewPagerFragment() { private fun getExtendedDetailsY(height: Int): Float { val smallMargin = resources.getDimension(R.dimen.small_margin) val fullscreenOffset = smallMargin + if (mIsFullscreen) 0 else context!!.navigationBarHeight - val actionsHeight = if (context!!.config.bottomActions && !mIsFullscreen) resources.getDimension(R.dimen.bottom_actions_height) else 0f + var actionsHeight = 0f + if (!mIsFullscreen) { + actionsHeight += resources.getDimension(R.dimen.video_player_play_pause_size) + if (context!!.config.bottomActions) { + actionsHeight += resources.getDimension(R.dimen.bottom_actions_height) + } + } return context!!.realScreenSize.y - height - actionsHeight - fullscreenOffset } } From 50c6d4d102da3155d8a25477d079f7df38643f10 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 9 Jan 2019 23:39:40 +0100 Subject: [PATCH 06/75] adding back some viewpager video playback things --- .../gallery/pro/fragments/VideoFragment.kt | 454 +++++++++++++++++- app/src/main/res/layout/pager_video_item.xml | 6 + 2 files changed, 453 insertions(+), 7 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt index 1112f8920..2e921f978 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt @@ -2,17 +2,33 @@ package com.simplemobiletools.gallery.pro.fragments import android.content.Intent import android.content.res.Configuration +import android.graphics.Point +import android.graphics.SurfaceTexture +import android.net.Uri import android.os.Bundle -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup +import android.os.Handler +import android.util.DisplayMetrics +import android.view.* import android.widget.RelativeLayout +import android.widget.SeekBar +import android.widget.TextView import com.bumptech.glide.Glide +import com.google.android.exoplayer2.* +import com.google.android.exoplayer2.extractor.DefaultExtractorsFactory +import com.google.android.exoplayer2.source.ExtractorMediaSource +import com.google.android.exoplayer2.source.TrackGroupArray +import com.google.android.exoplayer2.trackselection.TrackSelectionArray +import com.google.android.exoplayer2.upstream.ContentDataSource +import com.google.android.exoplayer2.upstream.DataSource +import com.google.android.exoplayer2.upstream.DataSpec +import com.google.android.exoplayer2.upstream.FileDataSource import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.gallery.pro.R import com.simplemobiletools.gallery.pro.activities.PanoramaVideoActivity +import com.simplemobiletools.gallery.pro.activities.VideoActivity import com.simplemobiletools.gallery.pro.extensions.* import com.simplemobiletools.gallery.pro.helpers.MEDIUM +import com.simplemobiletools.gallery.pro.helpers.MIN_SKIP_LENGTH import com.simplemobiletools.gallery.pro.helpers.PATH import com.simplemobiletools.gallery.pro.models.Medium import com.simplemobiletools.gallery.pro.views.MediaSideScroll @@ -21,15 +37,33 @@ import kotlinx.android.synthetic.main.pager_video_item.view.* import java.io.File import java.io.FileInputStream -class VideoFragment : ViewPagerFragment() { +class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, SeekBar.OnSeekBarChangeListener { + private val PROGRESS = "progress" + private var mIsFullscreen = false private var mWasFragmentInit = false private var mIsPanorama = false + private var mIsFragmentVisible = false + private var mIsPlaying = false + private var mIsDragged = false + private var mWasVideoStarted = false + private var mCurrTime = 0 + private var mDuration = 0 + + private var mTextureView: TextureView? = null + private var mCurrTimeView: TextView? = null + private var mSeekBar: SeekBar? = null + private var mExoPlayer: SimpleExoPlayer? = null + private var mVideoSize = Point(0, 0) + private var mTimerHandler = Handler() private var mStoredShowExtendedDetails = false private var mStoredHideExtendedDetails = false private var mStoredBottomActions = true private var mStoredExtendedDetails = 0 + private var mStoredRememberLastVideoPosition = false + private var mStoredLastVideoPath = "" + private var mStoredLastVideoPosition = 0 private lateinit var mTimeHolder: View private lateinit var mBrightnessSideScroll: MediaSideScroll @@ -42,17 +76,36 @@ class VideoFragment : ViewPagerFragment() { mView = inflater.inflate(R.layout.pager_video_item, container, false).apply { instant_prev_item.setOnClickListener { listener?.goToPrevItem() } instant_next_item.setOnClickListener { listener?.goToNextItem() } + video_curr_time.setOnClickListener { skip(false) } + video_duration.setOnClickListener { skip(true) } video_holder.setOnClickListener { toggleFullscreen() } video_preview.setOnClickListener { toggleFullscreen() } panorama_outline.setOnClickListener { openPanorama() } - video_play_outline.setOnClickListener { launchVideoPlayer() } + video_play_outline.setOnClickListener { + if (context!!.config.openVideosOnSeparateScreen) { + launchVideoPlayer() + } else { + togglePlayPause() + } + } + + mSeekBar = video_seekbar + mSeekBar!!.setOnSeekBarChangeListener(this@VideoFragment) + // adding an empty click listener just to avoid ripple animation at toggling fullscreen + mSeekBar!!.setOnClickListener { } mTimeHolder = video_time_holder + mCurrTimeView = video_curr_time mBrightnessSideScroll = video_brightness_controller mVolumeSideScroll = video_volume_controller if (context.config.allowDownGesture) { - video_preview.setOnTouchListener { v, event -> + video_preview.setOnTouchListener { view, event -> + handleEvent(event) + false + } + + video_surface.setOnTouchListener { view, event -> handleEvent(event) false } @@ -63,10 +116,20 @@ class VideoFragment : ViewPagerFragment() { mMedium = arguments!!.getSerializable(MEDIUM) as Medium Glide.with(context!!).load(mMedium.path).into(mView.video_preview) + // setMenuVisibility is not called at VideoActivity (third party intent) + if (!mIsFragmentVisible && activity is VideoActivity) { + mIsFragmentVisible = true + } + mIsFullscreen = activity!!.window.decorView.systemUiVisibility and View.SYSTEM_UI_FLAG_FULLSCREEN == View.SYSTEM_UI_FLAG_FULLSCREEN initTimeHolder() checkIfPanorama() + mMedium.path.getVideoResolution()?.apply { + mVideoSize.x = x + mVideoSize.y = y + } + if (mIsPanorama) { mView.apply { panorama_outline.beVisible() @@ -78,7 +141,20 @@ class VideoFragment : ViewPagerFragment() { } if (!mIsPanorama) { + setupPlayer() + setupPlayer() + if (savedInstanceState != null) { + mCurrTime = savedInstanceState.getInt(PROGRESS) + } + mWasFragmentInit = true + mExoPlayer = ExoPlayerFactory.newSimpleInstance(context) + mExoPlayer!!.seekParameters = SeekParameters.CLOSEST_SYNC + initExoPlayerListeners() + + if (mVideoSize.x != 0 && mVideoSize.y != 0) { + setVideoSize() + } mView.apply { mBrightnessSideScroll.initialize(activity!!, slide_info, true, container) { x, y -> @@ -88,9 +164,20 @@ class VideoFragment : ViewPagerFragment() { mVolumeSideScroll.initialize(activity!!, slide_info, false, container) { x, y -> video_holder.performClick() } + + video_surface.onGlobalLayout { + if (mIsFragmentVisible && context?.config?.autoplayVideos == true) { + playVideo() + } + } } } + setupVideoDuration() + if (mStoredRememberLastVideoPosition) { + setLastVideoSavedPosition() + } + updateInstantSwitchWidths() return mView } @@ -117,24 +204,164 @@ class VideoFragment : ViewPagerFragment() { override fun onPause() { super.onPause() storeStateVariables() + pauseVideo() + if (mStoredRememberLastVideoPosition && mIsFragmentVisible && mWasVideoStarted) { + saveVideoProgress() + } + } + + override fun onDestroy() { + super.onDestroy() + if (activity?.isChangingConfigurations == false) { + cleanup() + } + } + + override fun setMenuVisibility(menuVisible: Boolean) { + super.setMenuVisibility(menuVisible) + if (mIsFragmentVisible && !menuVisible) { + pauseVideo() + } + + mIsFragmentVisible = menuVisible + if (mWasFragmentInit && menuVisible && context?.config?.autoplayVideos == true) { + playVideo() + } } override fun onConfigurationChanged(newConfig: Configuration) { super.onConfigurationChanged(newConfig) - checkExtendedDetails() + setVideoSize() initTimeHolder() + checkExtendedDetails() updateInstantSwitchWidths() } + override fun onSaveInstanceState(outState: Bundle) { + super.onSaveInstanceState(outState) + outState.putInt(PROGRESS, mCurrTime) + } + + private fun storeStateVariables() { context!!.config.apply { mStoredShowExtendedDetails = showExtendedDetails mStoredHideExtendedDetails = hideExtendedDetails mStoredExtendedDetails = extendedDetails mStoredBottomActions = bottomActions + mStoredRememberLastVideoPosition = rememberLastVideoPosition + mStoredLastVideoPath = lastVideoPath + mStoredLastVideoPosition = lastVideoPosition } } + private fun setupPlayer() { + if (activity == null) { + return + } + + mTextureView = mView.video_surface + mTextureView!!.setOnClickListener { toggleFullscreen() } + mTextureView!!.surfaceTextureListener = this + + checkExtendedDetails() + } + + private fun saveVideoProgress() { + if (!videoEnded()) { + mStoredLastVideoPosition = mExoPlayer!!.currentPosition.toInt() / 1000 + mStoredLastVideoPath = mMedium.path + } + + context!!.config.apply { + lastVideoPosition = mStoredLastVideoPosition + lastVideoPath = mStoredLastVideoPath + } + } + + private fun setLastVideoSavedPosition() { + if (mStoredLastVideoPath == mMedium.path && mStoredLastVideoPosition > 0) { + setPosition(mStoredLastVideoPosition) + } + } + + private fun setupTimeHolder() { + mSeekBar!!.max = mDuration + mView.video_duration.text = mDuration.getFormattedDuration() + setupTimer() + } + + private fun setupTimer() { + activity!!.runOnUiThread(object : Runnable { + override fun run() { + if (mExoPlayer != null && !mIsDragged && mIsPlaying) { + mCurrTime = (mExoPlayer!!.currentPosition / 1000).toInt() + mSeekBar!!.progress = mCurrTime + mCurrTimeView!!.text = mCurrTime.getFormattedDuration() + } + + mTimerHandler.postDelayed(this, 1000) + } + }) + } + + private fun initExoPlayer() { + val isContentUri = mMedium.path.startsWith("content://") + val uri = if (isContentUri) Uri.parse(mMedium.path) else Uri.fromFile(File(mMedium.path)) + val dataSpec = DataSpec(uri) + val fileDataSource = if (isContentUri) ContentDataSource(context) else FileDataSource() + try { + fileDataSource.open(dataSpec) + } catch (e: Exception) { + activity?.showErrorToast(e) + } + + val factory = DataSource.Factory { fileDataSource } + val audioSource = ExtractorMediaSource(fileDataSource.uri, factory, DefaultExtractorsFactory(), null, null) + mExoPlayer!!.audioStreamType = C.STREAM_TYPE_MUSIC + mExoPlayer!!.prepare(audioSource) + } + + private fun initExoPlayerListeners() { + mExoPlayer!!.addListener(object : Player.EventListener { + override fun onPlaybackParametersChanged(playbackParameters: PlaybackParameters?) {} + + override fun onSeekProcessed() {} + + override fun onTracksChanged(trackGroups: TrackGroupArray?, trackSelections: TrackSelectionArray?) {} + + override fun onPlayerError(error: ExoPlaybackException?) { + } + + override fun onLoadingChanged(isLoading: Boolean) {} + + override fun onPositionDiscontinuity(reason: Int) {} + + override fun onRepeatModeChanged(repeatMode: Int) {} + + override fun onShuffleModeEnabledChanged(shuffleModeEnabled: Boolean) {} + + override fun onTimelineChanged(timeline: Timeline?, manifest: Any?, reason: Int) {} + + override fun onPlayerStateChanged(playWhenReady: Boolean, playbackState: Int) { + when (playbackState) { + Player.STATE_READY -> videoPrepared() + Player.STATE_ENDED -> videoCompleted() + } + } + }) + + mExoPlayer!!.addVideoListener(object : SimpleExoPlayer.VideoListener { + override fun onVideoSizeChanged(width: Int, height: Int, unappliedRotationDegrees: Int, pixelWidthHeightRatio: Float) { + mVideoSize.x = width + mVideoSize.y = height + setVideoSize() + } + + override fun onRenderedFirstFrame() {} + }) + } + private fun launchVideoPlayer() { listener?.launchViewVideoIntent(mMedium.path) } @@ -204,6 +431,8 @@ class VideoFragment : ViewPagerFragment() { if (!mIsFullscreen) { mTimeHolder.beVisible() } + + mSeekBar!!.setOnSeekBarChangeListener(if (mIsFullscreen) null else this) mTimeHolder.animate().alpha(newAlpha).start() mView.video_details.apply { if (mStoredShowExtendedDetails && isVisible()) { @@ -228,4 +457,215 @@ class VideoFragment : ViewPagerFragment() { } return context!!.realScreenSize.y - height - actionsHeight - fullscreenOffset } + + private fun skip(forward: Boolean) { + if (mExoPlayer == null || mIsPanorama) { + return + } + + val curr = mExoPlayer!!.currentPosition + val twoPercents = Math.max((mExoPlayer!!.duration / 50).toInt(), MIN_SKIP_LENGTH) + val newProgress = if (forward) curr + twoPercents else curr - twoPercents + val roundProgress = Math.round(newProgress / 1000f) + val limitedProgress = Math.max(Math.min(mExoPlayer!!.duration.toInt(), roundProgress), 0) + setPosition(limitedProgress) + if (!mIsPlaying) { + togglePlayPause() + } + } + + override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) { + if (mExoPlayer != null && fromUser) { + setPosition(progress) + } + } + + override fun onStartTrackingTouch(seekBar: SeekBar) { + if (mExoPlayer == null) + return + + mExoPlayer!!.playWhenReady = false + mIsDragged = true + } + + override fun onStopTrackingTouch(seekBar: SeekBar) { + if (mIsPanorama) { + openPanorama() + return + } + + if (mExoPlayer == null) + return + + if (mIsPlaying) { + mExoPlayer!!.playWhenReady = true + } else { + togglePlayPause() + } + + mIsDragged = false + } + + private fun togglePlayPause() { + if (activity == null || !isAdded) + return + + mIsPlaying = !mIsPlaying + if (mIsPlaying) { + playVideo() + } else { + pauseVideo() + } + } + + fun playVideo() { + if (mExoPlayer == null) { + return + } + + if (mView.video_preview.isVisible()) { + mView.video_preview.beGone() + initExoPlayer() + } + + val wasEnded = videoEnded() + if (wasEnded) { + setPosition(0) + } + + if (mStoredRememberLastVideoPosition) { + setLastVideoSavedPosition() + clearLastVideoSavedProgress() + } + + if (!wasEnded || context?.config?.loopVideos == false) { + mView.video_play_outline.setImageResource(R.drawable.ic_pause) + } + + mWasVideoStarted = true + mIsPlaying = true + mExoPlayer?.playWhenReady = true + activity!!.window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) + } + + private fun clearLastVideoSavedProgress() { + mStoredLastVideoPosition = 0 + mStoredLastVideoPath = "" + } + + private fun pauseVideo() { + if (mExoPlayer == null) { + return + } + + mIsPlaying = false + if (!videoEnded()) { + mExoPlayer?.playWhenReady = false + } + + mView.video_play_outline?.setImageResource(R.drawable.ic_play) + activity?.window?.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) + } + + private fun videoEnded(): Boolean { + val currentPos = mExoPlayer?.currentPosition ?: 0 + val duration = mExoPlayer?.duration ?: 0 + return currentPos != 0L && currentPos >= duration + } + + private fun setPosition(seconds: Int) { + mExoPlayer?.seekTo(seconds * 1000L) + mSeekBar!!.progress = seconds + mCurrTimeView!!.text = seconds.getFormattedDuration() + } + + private fun setupVideoDuration() { + mDuration = mMedium.path.getVideoDuration() + setupTimeHolder() + setPosition(0) + } + + private fun videoPrepared() { + if (mDuration == 0) { + mDuration = (mExoPlayer!!.duration / 1000).toInt() + setupTimeHolder() + setPosition(mCurrTime) + + if (mIsFragmentVisible && (context!!.config.autoplayVideos)) { + playVideo() + } + } + } + + private fun videoCompleted() { + if (!isAdded || mExoPlayer == null) { + return + } + + mCurrTime = (mExoPlayer!!.duration / 1000).toInt() + if (listener?.videoEnded() == false && context!!.config.loopVideos) { + playVideo() + } else { + mSeekBar!!.progress = mSeekBar!!.max + mCurrTimeView!!.text = mDuration.getFormattedDuration() + pauseVideo() + } + } + + private fun cleanup() { + pauseVideo() + mCurrTimeView?.text = 0.getFormattedDuration() + releaseExoPlayer() + mSeekBar?.progress = 0 + mTimerHandler.removeCallbacksAndMessages(null) + mTextureView = null + } + + private fun releaseExoPlayer() { + mExoPlayer?.stop() + Thread { + mExoPlayer?.release() + mExoPlayer = null + }.start() + } + + override fun onSurfaceTextureSizeChanged(surface: SurfaceTexture?, width: Int, height: Int) {} + + override fun onSurfaceTextureUpdated(surface: SurfaceTexture?) {} + + override fun onSurfaceTextureDestroyed(surface: SurfaceTexture?) = false + + override fun onSurfaceTextureAvailable(surface: SurfaceTexture?, width: Int, height: Int) { + Thread { + mExoPlayer?.setVideoSurface(Surface(mTextureView!!.surfaceTexture)) + }.start() + } + + private fun setVideoSize() { + if (activity == null || mTextureView == null) + return + + val videoProportion = mVideoSize.x.toFloat() / mVideoSize.y.toFloat() + val display = activity!!.windowManager.defaultDisplay + val screenWidth: Int + val screenHeight: Int + + val realMetrics = DisplayMetrics() + display.getRealMetrics(realMetrics) + screenWidth = realMetrics.widthPixels + screenHeight = realMetrics.heightPixels + + val screenProportion = screenWidth.toFloat() / screenHeight.toFloat() + + mTextureView!!.layoutParams.apply { + if (videoProportion > screenProportion) { + width = screenWidth + height = (screenWidth.toFloat() / videoProportion).toInt() + } else { + width = (videoProportion * screenHeight.toFloat()).toInt() + height = screenHeight + } + mTextureView!!.layoutParams = this + } + } } diff --git a/app/src/main/res/layout/pager_video_item.xml b/app/src/main/res/layout/pager_video_item.xml index 9537f8997..fc968dfd5 100644 --- a/app/src/main/res/layout/pager_video_item.xml +++ b/app/src/main/res/layout/pager_video_item.xml @@ -11,6 +11,12 @@ android:layout_width="match_parent" android:layout_height="match_parent"/> + + Date: Wed, 9 Jan 2019 23:50:57 +0100 Subject: [PATCH 07/75] adding some play/pause improvements --- .../pro/activities/ViewPagerActivity.kt | 3 +++ .../gallery/pro/fragments/VideoFragment.kt | 20 +++++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt index 6edf32c38..cda0390d8 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt @@ -41,6 +41,7 @@ import com.simplemobiletools.gallery.pro.dialogs.SaveAsDialog import com.simplemobiletools.gallery.pro.dialogs.SlideshowDialog import com.simplemobiletools.gallery.pro.extensions.* import com.simplemobiletools.gallery.pro.fragments.PhotoFragment +import com.simplemobiletools.gallery.pro.fragments.VideoFragment import com.simplemobiletools.gallery.pro.fragments.ViewPagerFragment import com.simplemobiletools.gallery.pro.helpers.* import com.simplemobiletools.gallery.pro.models.Medium @@ -492,6 +493,8 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View swipeToNextMedium() } }, mSlideshowInterval * 1000L) + } else { + (getCurrentFragment() as? VideoFragment)!!.playVideo() } } } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt index 2e921f978..2e33786b3 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt @@ -9,6 +9,7 @@ import android.os.Bundle import android.os.Handler import android.util.DisplayMetrics import android.view.* +import android.widget.ImageView import android.widget.RelativeLayout import android.widget.SeekBar import android.widget.TextView @@ -52,6 +53,7 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S private var mTextureView: TextureView? = null private var mCurrTimeView: TextView? = null + private var mPlayPauseButton: ImageView? = null private var mSeekBar: SeekBar? = null private var mExoPlayer: SimpleExoPlayer? = null private var mVideoSize = Point(0, 0) @@ -89,6 +91,11 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S } } + mPlayPauseButton = video_toggle_play_pause + mPlayPauseButton!!.setOnClickListener { + togglePlayPause() + } + mSeekBar = video_seekbar mSeekBar!!.setOnSeekBarChangeListener(this@VideoFragment) // adding an empty click listener just to avoid ripple animation at toggling fullscreen @@ -433,6 +440,10 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S } mSeekBar!!.setOnSeekBarChangeListener(if (mIsFullscreen) null else this) + arrayOf(mView.video_curr_time, mView.video_duration).forEach { + it.isClickable = !mIsFullscreen + } + mTimeHolder.animate().alpha(newAlpha).start() mView.video_details.apply { if (mStoredShowExtendedDetails && isVisible()) { @@ -539,7 +550,12 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S } if (!wasEnded || context?.config?.loopVideos == false) { - mView.video_play_outline.setImageResource(R.drawable.ic_pause) + mPlayPauseButton?.setImageResource(R.drawable.ic_pause_outline) + } + + if (!mWasVideoStarted) { + mView.video_play_outline.beGone() + mPlayPauseButton?.beVisible() } mWasVideoStarted = true @@ -563,7 +579,7 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S mExoPlayer?.playWhenReady = false } - mView.video_play_outline?.setImageResource(R.drawable.ic_play) + mPlayPauseButton?.setImageResource(R.drawable.ic_play_outline) activity?.window?.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) } From 24c93a8d7a188e9529f403f4992f43546d1fc025 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Marques?= Date: Wed, 9 Jan 2019 23:25:54 +0000 Subject: [PATCH 08/75] Update strings.xml --- app/src/main/res/values-pt/strings.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index a428fc891..c7b639b5d 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -116,7 +116,7 @@ Apresentação em ciclo Apresentação terminada Não foram encontrados ficheiros para a apresentação - Use crossfade animations + Utilizar animação de transição Tipo de exibição @@ -134,8 +134,8 @@ Extensão - Folder shown on the widget: - Show folder name + Pasta mostrada no widget: + Mostrar nome da pasta Reproduzir vídeos automaticamente @@ -171,8 +171,8 @@ Mostrar fotos com a melhor qualidade possível Mostrar a reciclagem como o último item do ecrã principal Sair de ecrã completo com um gesto para baixo - Allow 1:1 zooming in with two double taps - Always open videos on a separate screen with new horizontal gestures + Permitir ampliação 1:1 com dois toques + Abrir vídeos em ecrã distinto com os novos toques horizontais Miniaturas @@ -220,7 +220,7 @@ - An offline gallery for managing your files without ads, respecting your privacy. + Uma aplicação para gerir os seus ficheiros, sem anúncios e que respeita a sua privacidade. Um aplicação capaz de mostrar diversos tipos de imagens e vídeos incluíndo SVG, RAW, fotos panorâmicas e vídeos. From 4ec83e13dd2dec25f6767a43244c956727812126 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 10 Jan 2019 10:41:04 +0100 Subject: [PATCH 09/75] adding some video player related improvements --- .../pro/activities/PhotoVideoActivity.kt | 2 +- .../gallery/pro/fragments/VideoFragment.kt | 109 +++++++++--------- 2 files changed, 58 insertions(+), 53 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/PhotoVideoActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/PhotoVideoActivity.kt index 224b58325..02ddad7c1 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/PhotoVideoActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/PhotoVideoActivity.kt @@ -72,7 +72,7 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList mUri = intent.data ?: return var filename = getFilenameFromUri(mUri!!) mIsFromGallery = intent.getBooleanExtra(IS_FROM_GALLERY, false) - if (mIsFromGallery && filename.isVideoFast()) { + if (mIsFromGallery && filename.isVideoFast() && config.openVideosOnSeparateScreen) { launchVideoPlayer() return } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt index 2e33786b3..17e4ba289 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt @@ -28,6 +28,7 @@ import com.simplemobiletools.gallery.pro.R import com.simplemobiletools.gallery.pro.activities.PanoramaVideoActivity import com.simplemobiletools.gallery.pro.activities.VideoActivity import com.simplemobiletools.gallery.pro.extensions.* +import com.simplemobiletools.gallery.pro.helpers.Config import com.simplemobiletools.gallery.pro.helpers.MEDIUM import com.simplemobiletools.gallery.pro.helpers.MIN_SKIP_LENGTH import com.simplemobiletools.gallery.pro.helpers.PATH @@ -51,10 +52,6 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S private var mCurrTime = 0 private var mDuration = 0 - private var mTextureView: TextureView? = null - private var mCurrTimeView: TextView? = null - private var mPlayPauseButton: ImageView? = null - private var mSeekBar: SeekBar? = null private var mExoPlayer: SimpleExoPlayer? = null private var mVideoSize = Point(0, 0) private var mTimerHandler = Handler() @@ -70,11 +67,16 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S private lateinit var mTimeHolder: View private lateinit var mBrightnessSideScroll: MediaSideScroll private lateinit var mVolumeSideScroll: MediaSideScroll - private lateinit var mView: View private lateinit var mMedium: Medium + private lateinit var mConfig: Config + private lateinit var mTextureView: TextureView + private lateinit var mCurrTimeView: TextView + private lateinit var mPlayPauseButton: ImageView + private lateinit var mSeekBar: SeekBar override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { + mConfig = context!!.config mView = inflater.inflate(R.layout.pager_video_item, container, false).apply { instant_prev_item.setOnClickListener { listener?.goToPrevItem() } instant_next_item.setOnClickListener { listener?.goToNextItem() } @@ -84,7 +86,7 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S video_preview.setOnClickListener { toggleFullscreen() } panorama_outline.setOnClickListener { openPanorama() } video_play_outline.setOnClickListener { - if (context!!.config.openVideosOnSeparateScreen) { + if (mConfig.openVideosOnSeparateScreen) { launchVideoPlayer() } else { togglePlayPause() @@ -92,21 +94,22 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S } mPlayPauseButton = video_toggle_play_pause - mPlayPauseButton!!.setOnClickListener { + mPlayPauseButton.setOnClickListener { togglePlayPause() } mSeekBar = video_seekbar - mSeekBar!!.setOnSeekBarChangeListener(this@VideoFragment) + mSeekBar.setOnSeekBarChangeListener(this@VideoFragment) // adding an empty click listener just to avoid ripple animation at toggling fullscreen - mSeekBar!!.setOnClickListener { } + mSeekBar.setOnClickListener { } mTimeHolder = video_time_holder mCurrTimeView = video_curr_time mBrightnessSideScroll = video_brightness_controller mVolumeSideScroll = video_volume_controller + mTextureView = video_surface - if (context.config.allowDownGesture) { + if (mConfig.allowDownGesture) { video_preview.setOnTouchListener { view, event -> handleEvent(event) false @@ -148,16 +151,12 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S } if (!mIsPanorama) { - setupPlayer() setupPlayer() if (savedInstanceState != null) { mCurrTime = savedInstanceState.getInt(PROGRESS) } mWasFragmentInit = true - mExoPlayer = ExoPlayerFactory.newSimpleInstance(context) - mExoPlayer!!.seekParameters = SeekParameters.CLOSEST_SYNC - initExoPlayerListeners() if (mVideoSize.x != 0 && mVideoSize.y != 0) { setVideoSize() @@ -173,7 +172,7 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S } video_surface.onGlobalLayout { - if (mIsFragmentVisible && context?.config?.autoplayVideos == true) { + if (mIsFragmentVisible && mConfig.autoplayVideos && !mConfig.openVideosOnSeparateScreen) { playVideo() } } @@ -191,10 +190,11 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S override fun onResume() { super.onResume() + mConfig = context!!.config // make sure we get a new config, in case the user changed something in the app settings activity!!.updateTextColors(mView.video_holder) - val config = context!!.config - val allowVideoGestures = config.allowVideoGestures - val allowInstantChange = config.allowInstantChange + val allowVideoGestures = mConfig.allowVideoGestures + val allowInstantChange = mConfig.allowInstantChange + mTextureView.beGoneIf(mConfig.openVideosOnSeparateScreen || mIsPanorama) mView.apply { video_volume_controller.beVisibleIf(allowVideoGestures && !mIsPanorama) video_brightness_controller.beVisibleIf(allowVideoGestures && !mIsPanorama) @@ -231,7 +231,7 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S } mIsFragmentVisible = menuVisible - if (mWasFragmentInit && menuVisible && context?.config?.autoplayVideos == true) { + if (mWasFragmentInit && menuVisible && mConfig.autoplayVideos && !mConfig.openVideosOnSeparateScreen) { playVideo() } } @@ -251,7 +251,7 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S private fun storeStateVariables() { - context!!.config.apply { + mConfig.apply { mStoredShowExtendedDetails = showExtendedDetails mStoredHideExtendedDetails = hideExtendedDetails mStoredExtendedDetails = extendedDetails @@ -263,15 +263,18 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S } private fun setupPlayer() { - if (activity == null) { + if (activity == null || mConfig.openVideosOnSeparateScreen || mIsPanorama) { return } - mTextureView = mView.video_surface - mTextureView!!.setOnClickListener { toggleFullscreen() } - mTextureView!!.surfaceTextureListener = this + mTextureView.setOnClickListener { toggleFullscreen() } + mTextureView.surfaceTextureListener = this checkExtendedDetails() + + mExoPlayer = ExoPlayerFactory.newSimpleInstance(context) + mExoPlayer!!.seekParameters = SeekParameters.CLOSEST_SYNC + initExoPlayerListeners() } private fun saveVideoProgress() { @@ -280,7 +283,7 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S mStoredLastVideoPath = mMedium.path } - context!!.config.apply { + mConfig.apply { lastVideoPosition = mStoredLastVideoPosition lastVideoPath = mStoredLastVideoPath } @@ -293,7 +296,7 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S } private fun setupTimeHolder() { - mSeekBar!!.max = mDuration + mSeekBar.max = mDuration mView.video_duration.text = mDuration.getFormattedDuration() setupTimer() } @@ -303,8 +306,8 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S override fun run() { if (mExoPlayer != null && !mIsDragged && mIsPlaying) { mCurrTime = (mExoPlayer!!.currentPosition / 1000).toInt() - mSeekBar!!.progress = mCurrTime - mCurrTimeView!!.text = mCurrTime.getFormattedDuration() + mSeekBar.progress = mCurrTime + mCurrTimeView.text = mCurrTime.getFormattedDuration() } mTimerHandler.postDelayed(this, 1000) @@ -378,7 +381,7 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S } private fun checkExtendedDetails() { - if (context!!.config.showExtendedDetails) { + if (mConfig.showExtendedDetails) { mView.video_details.apply { beInvisible() // make it invisible so we can measure it, but not show yet text = getMediumExtendedDetails(mMedium) @@ -388,7 +391,7 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S if (realY > 0) { y = realY beVisibleIf(text.isNotEmpty()) - alpha = if (!context!!.config.hideExtendedDetails || !mIsFullscreen) 1f else 0f + alpha = if (!mConfig.hideExtendedDetails || !mIsFullscreen) 1f else 0f } } } @@ -400,7 +403,7 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S private fun initTimeHolder() { var bottomMargin = context!!.navigationBarHeight - if (context!!.config.bottomActions) { + if (mConfig.bottomActions) { bottomMargin += resources.getDimension(R.dimen.bottom_actions_height).toInt() } @@ -411,8 +414,10 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S private fun checkIfPanorama() { try { val fis = FileInputStream(File(mMedium.path)) - context!!.parseFileChannel(mMedium.path, fis.channel, 0, 0, 0) { - mIsPanorama = true + fis.use { fis -> + context!!.parseFileChannel(mMedium.path, fis.channel, 0, 0, 0) { + mIsPanorama = true + } } } catch (ignored: Exception) { } catch (ignored: OutOfMemoryError) { @@ -439,7 +444,7 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S mTimeHolder.beVisible() } - mSeekBar!!.setOnSeekBarChangeListener(if (mIsFullscreen) null else this) + mSeekBar.setOnSeekBarChangeListener(if (mIsFullscreen) null else this) arrayOf(mView.video_curr_time, mView.video_duration).forEach { it.isClickable = !mIsFullscreen } @@ -462,7 +467,7 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S var actionsHeight = 0f if (!mIsFullscreen) { actionsHeight += resources.getDimension(R.dimen.video_player_play_pause_size) - if (context!!.config.bottomActions) { + if (mConfig.bottomActions) { actionsHeight += resources.getDimension(R.dimen.bottom_actions_height) } } @@ -549,13 +554,13 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S clearLastVideoSavedProgress() } - if (!wasEnded || context?.config?.loopVideos == false) { - mPlayPauseButton?.setImageResource(R.drawable.ic_pause_outline) + if (!wasEnded || !mConfig.loopVideos) { + mPlayPauseButton.setImageResource(R.drawable.ic_pause_outline) } if (!mWasVideoStarted) { mView.video_play_outline.beGone() - mPlayPauseButton?.beVisible() + mPlayPauseButton.beVisible() } mWasVideoStarted = true @@ -579,7 +584,7 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S mExoPlayer?.playWhenReady = false } - mPlayPauseButton?.setImageResource(R.drawable.ic_play_outline) + mPlayPauseButton.setImageResource(R.drawable.ic_play_outline) activity?.window?.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) } @@ -591,8 +596,8 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S private fun setPosition(seconds: Int) { mExoPlayer?.seekTo(seconds * 1000L) - mSeekBar!!.progress = seconds - mCurrTimeView!!.text = seconds.getFormattedDuration() + mSeekBar.progress = seconds + mCurrTimeView.text = seconds.getFormattedDuration() } private fun setupVideoDuration() { @@ -607,7 +612,7 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S setupTimeHolder() setPosition(mCurrTime) - if (mIsFragmentVisible && (context!!.config.autoplayVideos)) { + if (mIsFragmentVisible && (mConfig.autoplayVideos)) { playVideo() } } @@ -619,22 +624,21 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S } mCurrTime = (mExoPlayer!!.duration / 1000).toInt() - if (listener?.videoEnded() == false && context!!.config.loopVideos) { + if (listener?.videoEnded() == false && mConfig.loopVideos) { playVideo() } else { - mSeekBar!!.progress = mSeekBar!!.max - mCurrTimeView!!.text = mDuration.getFormattedDuration() + mSeekBar.progress = mSeekBar.max + mCurrTimeView.text = mDuration.getFormattedDuration() pauseVideo() } } private fun cleanup() { pauseVideo() - mCurrTimeView?.text = 0.getFormattedDuration() + mCurrTimeView.text = 0.getFormattedDuration() releaseExoPlayer() - mSeekBar?.progress = 0 + mSeekBar.progress = 0 mTimerHandler.removeCallbacksAndMessages(null) - mTextureView = null } private fun releaseExoPlayer() { @@ -653,13 +657,14 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S override fun onSurfaceTextureAvailable(surface: SurfaceTexture?, width: Int, height: Int) { Thread { - mExoPlayer?.setVideoSurface(Surface(mTextureView!!.surfaceTexture)) + mExoPlayer?.setVideoSurface(Surface(mTextureView.surfaceTexture)) }.start() } private fun setVideoSize() { - if (activity == null || mTextureView == null) + if (activity == null || mConfig.openVideosOnSeparateScreen) { return + } val videoProportion = mVideoSize.x.toFloat() / mVideoSize.y.toFloat() val display = activity!!.windowManager.defaultDisplay @@ -673,7 +678,7 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S val screenProportion = screenWidth.toFloat() / screenHeight.toFloat() - mTextureView!!.layoutParams.apply { + mTextureView.layoutParams.apply { if (videoProportion > screenProportion) { width = screenWidth height = (screenWidth.toFloat() / videoProportion).toInt() @@ -681,7 +686,7 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S width = (videoProportion * screenHeight.toFloat()).toInt() height = screenHeight } - mTextureView!!.layoutParams = this + mTextureView.layoutParams = this } } } From 3f6e67b79c25b6b4c975aef5dd7e63b3997cde0a Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 10 Jan 2019 11:12:40 +0100 Subject: [PATCH 10/75] updating subsampling scale image view --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index e0cd7c297..885d9a756 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -78,7 +78,7 @@ dependencies { //implementation 'com.davemorrissey.labs:subsampling-scale-image-view:3.10.0' //implementation 'com.github.tibbi:subsampling-scale-image-view:v3.10.1-fork' - implementation 'com.github.tibbi:subsampling-scale-image-view:7a000e651e' + implementation 'com.github.tibbi:subsampling-scale-image-view:9e9a393cc3' // implementation 'com.github.chrisbanes:PhotoView:2.3.0' implementation 'com.github.tibbi:PhotoView:2.3.0-fork' From eb20c802b2b52e6a453d5cbb1fdde26aaef4e3b9 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 10 Jan 2019 11:21:01 +0100 Subject: [PATCH 11/75] allow including videos in slideshows --- .../pro/activities/ViewPagerActivity.kt | 2 +- .../gallery/pro/dialogs/SlideshowDialog.kt | 7 ++++++ .../gallery/pro/helpers/Config.kt | 4 ++++ .../gallery/pro/helpers/Constants.kt | 1 + app/src/main/res/layout/dialog_slideshow.xml | 23 ++++++++++++++++++- 5 files changed, 35 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt index cda0390d8..c6811570a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt @@ -505,7 +505,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View private fun getMediaForSlideshow(): Boolean { mSlideshowMedia = mMediaFiles.filter { - it.isImage() || (config.slideshowIncludeGIFs && it.isGIF()) + it.isImage() || (config.slideshowIncludeVideos && it.isVideo() || (config.slideshowIncludeGIFs && it.isGIF())) }.toMutableList() if (config.slideshowRandomOrder) { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/dialogs/SlideshowDialog.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/dialogs/SlideshowDialog.kt index 5e3c5f198..7ab0371a8 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/dialogs/SlideshowDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/dialogs/SlideshowDialog.kt @@ -28,6 +28,11 @@ class SlideshowDialog(val activity: BaseSimpleActivity, val callback: () -> Unit activity.hideKeyboard(v) } + include_videos_holder.setOnClickListener { + interval_value.clearFocus() + include_videos.toggle() + } + include_gifs_holder.setOnClickListener { interval_value.clearFocus() include_gifs.toggle() @@ -74,6 +79,7 @@ class SlideshowDialog(val activity: BaseSimpleActivity, val callback: () -> Unit val config = activity.config view.apply { interval_value.setText(config.slideshowInterval.toString()) + include_videos.isChecked = config.slideshowIncludeVideos include_gifs.isChecked = config.slideshowIncludeGIFs random_order.isChecked = config.slideshowRandomOrder use_fade.isChecked = config.slideshowUseFade @@ -89,6 +95,7 @@ class SlideshowDialog(val activity: BaseSimpleActivity, val callback: () -> Unit activity.config.apply { slideshowInterval = interval.toInt() + slideshowIncludeVideos = view.include_videos.isChecked slideshowIncludeGIFs = view.include_gifs.isChecked slideshowRandomOrder = view.random_order.isChecked slideshowUseFade = view.use_fade.isChecked diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Config.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Config.kt index d886598a9..32467ca4b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Config.kt @@ -285,6 +285,10 @@ class Config(context: Context) : BaseConfig(context) { get() = prefs.getInt(SLIDESHOW_INTERVAL, SLIDESHOW_DEFAULT_INTERVAL) set(slideshowInterval) = prefs.edit().putInt(SLIDESHOW_INTERVAL, slideshowInterval).apply() + var slideshowIncludeVideos: Boolean + get() = prefs.getBoolean(SLIDESHOW_INCLUDE_VIDEOS, false) + set(slideshowIncludeVideos) = prefs.edit().putBoolean(SLIDESHOW_INCLUDE_VIDEOS, slideshowIncludeVideos).apply() + var slideshowIncludeGIFs: Boolean get() = prefs.getBoolean(SLIDESHOW_INCLUDE_GIFS, false) set(slideshowIncludeGIFs) = prefs.edit().putBoolean(SLIDESHOW_INCLUDE_GIFS, slideshowIncludeGIFs).apply() diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt index 8dcc57e1a..d96736b78 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt @@ -79,6 +79,7 @@ const val ALLOW_ONE_TO_ONE_ZOOM = "allow_one_to_one_zoom" // slideshow const val SLIDESHOW_INTERVAL = "slideshow_interval" +const val SLIDESHOW_INCLUDE_VIDEOS = "slideshow_include_videos" const val SLIDESHOW_INCLUDE_GIFS = "slideshow_include_gifs" const val SLIDESHOW_RANDOM_ORDER = "slideshow_random_order" const val SLIDESHOW_USE_FADE = "slideshow_use_fade" diff --git a/app/src/main/res/layout/dialog_slideshow.xml b/app/src/main/res/layout/dialog_slideshow.xml index 7915aa5dc..0bad63672 100644 --- a/app/src/main/res/layout/dialog_slideshow.xml +++ b/app/src/main/res/layout/dialog_slideshow.xml @@ -37,7 +37,7 @@ android:textSize="@dimen/normal_text_size"/> + + + + + + Date: Thu, 10 Jan 2019 11:25:49 +0100 Subject: [PATCH 12/75] use the new faq text related to video fast forward --- .../com/simplemobiletools/gallery/pro/extensions/Activity.kt | 2 +- app/src/main/res/values-ar/strings.xml | 1 - app/src/main/res/values-az/strings.xml | 1 - app/src/main/res/values-ca/strings.xml | 1 - app/src/main/res/values-cs/strings.xml | 1 - app/src/main/res/values-da/strings.xml | 1 - app/src/main/res/values-de/strings.xml | 1 - app/src/main/res/values-el/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-gl/strings.xml | 1 - app/src/main/res/values-hr/strings.xml | 1 - app/src/main/res/values-hu/strings.xml | 1 - app/src/main/res/values-id/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-ko-rKR/strings.xml | 1 - app/src/main/res/values-lt/strings.xml | 1 - app/src/main/res/values-nb/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-sl/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-uk/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 - 33 files changed, 1 insertion(+), 33 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Activity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Activity.kt index 1c66fdf2b..a8103b206 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Activity.kt @@ -70,7 +70,7 @@ fun SimpleActivity.launchAbout() { FAQItem(R.string.faq_1_title, R.string.faq_1_text), FAQItem(R.string.faq_2_title, R.string.faq_2_text), FAQItem(R.string.faq_3_title, R.string.faq_3_text), - FAQItem(R.string.faq_4_title, R.string.faq_4_text_old), + FAQItem(R.string.faq_4_title, R.string.faq_4_text), FAQItem(R.string.faq_5_title, R.string.faq_5_text), FAQItem(R.string.faq_6_title, R.string.faq_6_text), FAQItem(R.string.faq_7_title, R.string.faq_7_text), diff --git a/app/src/main/res/values-ar/strings.xml b/app/src/main/res/values-ar/strings.xml index 96ab1111a..5539e8daa 100644 --- a/app/src/main/res/values-ar/strings.xml +++ b/app/src/main/res/values-ar/strings.xml @@ -198,7 +198,6 @@ يمكنك الضغط لفترة طويلة على الألبوم المطلوب وتحديد أيقونة الدبوس في الإجراء ، والتي سوف تثبيته إلى الأعلى. يمكنك تثبيت عدة مجلدات أيضًا ، وسيتم ترتيب العناصر المثبتة حسب طريقة الفرز الافتراضية. كيف يمكنني تقديم مقاطع فيديو بسرعة؟ You can either drag your finger horizontally over the video player, or click on the current or max duration texts near the seekbar. That will move the video either backward, or forward. - يمكنك النقر على النصوص الحالية أو أقصى مدة قريبة من شريط السحب ، والتي ستنقل الفيديو إما للخلف أو إلى الأمام. ما الفرق بين إخفاء واستبعاد مجلد؟ يمنع الاستبعاد من عرض المجلد في الاستوديو البسيط فقط ، بينما يقوم بإخفاء بالعمل على مستوى النظام ككل ويقوم بإخفاء المجلد من المعارض الأخرى أيضًا. وهو يعمل عن طريق إنشاء ملف \".nomedia\" فارغ في المجلد المحدد ، والذي يمكنك بعد ذلك إزالته مع أي مدير ملفات أيضًا. لماذا تظهر المجلدات التي تحتوي على ملصقات أو ملصقات موسيقى تغطيها؟ diff --git a/app/src/main/res/values-az/strings.xml b/app/src/main/res/values-az/strings.xml index e6e3830c5..5d0127a54 100644 --- a/app/src/main/res/values-az/strings.xml +++ b/app/src/main/res/values-az/strings.xml @@ -195,7 +195,6 @@ You can long press the desired album and select the Pin icon at the actionmenu, that will pin it to the top. You can pin multiple folders too, pinned items will be sorted by the default sorting method. How can I fast-forward videos? You can either drag your finger horizontally over the video player, or click on the current or max duration texts near the seekbar. That will move the video either backward, or forward. - You can either drag your finger horizontally over the video player, or click on the current or max duration texts near the seekbar. That will move the video either backward, or forward. What is the difference between hiding and excluding a folder? Exclude prevents displaying the folder only in Simple Gallery, while Hide works system-wise and it hides the folder from other galleries too. It works by creating an empty \".nomedia\" file in the given folder, which you can then remove with any file manager too. Why do folders with music cover art or stickers show up? diff --git a/app/src/main/res/values-ca/strings.xml b/app/src/main/res/values-ca/strings.xml index 8ce23735c..5aecb3b14 100644 --- a/app/src/main/res/values-ca/strings.xml +++ b/app/src/main/res/values-ca/strings.xml @@ -195,7 +195,6 @@ Podeu prémer l\'àlbum desitjat i seleccionar la icona de la xinxeta al menú d\'acció i el fixarà a la part superior. També podeu enganxar diverses carpetes, els elements fixats s\'ordenaran pel mètode de classificació predeterminat. Com puc fer avançar els vídeos? You can either drag your finger horizontally over the video player, or click on the current or max duration texts near the seekbar. That will move the video either backward, or forward. - Podeu fer clic als textos actuals o de duració màxima que hi ha a prop de la barra de cerca, això mourà el vídeo cap a enrere o cap endavant. Quina és la diferència entre ocultar i excloure una carpeta? Excloure impedeix mostrar la carpeta només a Simple Galery, mentre que Ocultar també amaga la carpeta a altres galeries. Funciona creant un fitxer \". Nomedia \" buit a la carpeta donada, que podeu eliminar amb qualsevol gestor de fitxers. Per què apareixen les carpetes amb les portades de la música o adhesius? diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index ef3cf1dfa..5b5a6c2ea 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -195,7 +195,6 @@ Můžete označit danou složku dlouhým podržením a zvolit tlačítko s obrázkem připínáčku, to jej připne na vrch. Můžete připnout i více složek, budou seřazeny podle zvoleného řazení. Jak můžu rychle posunout videa? You can either drag your finger horizontally over the video player, or click on the current or max duration texts near the seekbar. That will move the video either backward, or forward. - Můžete kliknout na texty současné nebo maximální délky videa, které jsou vedle indikátoru současného progresu. To posune video buď vpřed, nebo vzad. Jaký je rozdíl mezi Skrytím a Vyloučením složky? Zatímco vyloučení předejde zobrazení složky pouze vrámci Jednoduché Galerie, skrytí ho ukryje vrámci celého systému, tedy to ovlivní i ostatní galerie. Skrytí funguje pomocí vytvoření prázdného \".nomedia\" souboru v daném adresáři, který můžete vymazat i nějakým správcem souborů. Proč se mi zobrazují složky s obaly hudebních alb, nebo nálepkami? diff --git a/app/src/main/res/values-da/strings.xml b/app/src/main/res/values-da/strings.xml index 44843347c..c62cf2f59 100644 --- a/app/src/main/res/values-da/strings.xml +++ b/app/src/main/res/values-da/strings.xml @@ -195,7 +195,6 @@ You can long press the desired album and select the Pin icon at the actionmenu, that will pin it to the top. You can pin multiple folders too, pinned items will be sorted by the default sorting method. How can I fast-forward videos? You can either drag your finger horizontally over the video player, or click on the current or max duration texts near the seekbar. That will move the video either backward, or forward. - You can either drag your finger horizontally over the video player, or click on the current or max duration texts near the seekbar. That will move the video either backward, or forward. What is the difference between hiding and excluding a folder? Exclude prevents displaying the folder only in Simple Gallery, while Hide works system-wise and it hides the folder from other galleries too. It works by creating an empty \".nomedia\" file in the given folder, which you can then remove with any file manager too. Why do folders with music cover art or stickers show up? diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 466bf63e3..126a75875 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -195,7 +195,6 @@ Du kannst lange auf das gewünschte Album drücken und im Aktionsmenü das Stecknadelsymbol auswählen; es wird nun zuoberst angepinnt. Ebenso kannst du mehrere Ordner anpinnen. Angepinnte Objekte werden nach der Standardmethode sortiert. Wie kann ich in Videos vor- oder zurückspringen? You can either drag your finger horizontally over the video player, or click on the current or max duration texts near the seekbar. That will move the video either backward, or forward. - Du kannst auf den Text der aktuellen oder der maximalen Dauer nahe der Suchleiste drücken, um im Video vor- oder zurück zu springen. Was ist der Unterschied zwischen \'Verstecken\' und \'Ausschließen\' eines Ordners? \'Ausschließen\' verhindert lediglich, dass der Ordner in Schlichte Galerie angezeigt wird. \'Verstecken\' hingegen versteckt den Ordner auch vor anderen Apps. Dies funktioniert durch das Erstellen einer leeren \".nomedia\"-Datei im betroffenen Ordner, welche du mit jedem Dateimanager wieder löschen kannst. Wieso erscheinen Ordner mit Musik-Cover oder Stickers? diff --git a/app/src/main/res/values-el/strings.xml b/app/src/main/res/values-el/strings.xml index 031ac83d4..548e81e92 100644 --- a/app/src/main/res/values-el/strings.xml +++ b/app/src/main/res/values-el/strings.xml @@ -195,7 +195,6 @@ Μπορείτε να πατήσετε παρατεταμένα στο άλμπουμ και να επιλέξετε το εικονίδιο καρφιτσώματος στο μενού, αυτό θα το καρφιτσώσει στην κορυφή. Επίσης μπορείτε να καρφιτσώσετε πολλαπλούς φακέλους, τα καρφιτσωμένα αντικείμενα θα είναι ταξινομημένα με την προεπιλεγμένη μέθοδο. Πώς μπορώ να τρέξω μπροστά (fast-forward) τα βίντεο; You can either drag your finger horizontally over the video player, or click on the current or max duration texts near the seekbar. That will move the video either backward, or forward. - Μπορείτε να αγγίξετε στο τρέχον ή στο κείμενο μέγιστης διάρκειας κοντά στην μπάρα αναζήτησης. Αυτό θα μετακινήσει το βίντεο μπροστά ή πίσω. Ποια είναι διαφορά μεταξύ απόκρυψης και εξαίρεσης ενός φακέλου; Η εξαίρεση δεν επιτρέπει την εμφάνιση του φακέλου μόνο στο Simple Gallery, ενώ η απόκρυψη λειτουργεί σε επίπεδο συστήματος και θα αποκρύψει τον φάκελο και από άλλες εφαρμογές γκάλερι. Λειτουργεί δημιουργώντας ένα άδειο \".nomedia\" αρχείο στον επιλεγμένο φάκελο, το οποίο μπορείτε να το διαγράψετε και με οποιονδήποτε διαχειριστή αρχείων. Γιατί εμφανίζονται φάκελοι με εξώφυλλο μουσικής ή αυτόκολλητα; diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 8042a210a..e8fd073d5 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -195,7 +195,6 @@ Puede aguantar pulsado el álbum deseado y seleccionar el ícono Pin en el menú de acción, que lo fijará en la parte superior. También puede anclar varias carpetas, los artículos fijados se ordenarán por el método de clasificación predeterminado. ¿Cómo puedo avanzar videos? You can either drag your finger horizontally over the video player, or click on the current or max duration texts near the seekbar, that will move the video either backward, or forward. - Puede hacer clic en los textos de duración actual o máxima cerca de la barra de búsqueda, que moverán el video hacia atrás o hacia adelante. ¿Cuál es la diferencia entre ocultar y excluir una carpeta? Excluir evita mostrar la carpeta solo en Simple Gallery, mientras que Ocultar funciona en el sistema y oculta la carpeta de otras galerías también. Funciona al crear un archivo \".nomedia \" vacío en la carpeta determinada, que luego puede eliminar también con cualquier administrador de archivos. ¿Por qué aparecen las carpetas con la portada de la música o las pegatinas? diff --git a/app/src/main/res/values-fi/strings.xml b/app/src/main/res/values-fi/strings.xml index e5a81d617..493216b5b 100644 --- a/app/src/main/res/values-fi/strings.xml +++ b/app/src/main/res/values-fi/strings.xml @@ -195,7 +195,6 @@ You can long press the desired album and select the Pin icon at the actionmenu, that will pin it to the top. You can pin multiple folders too, pinned items will be sorted by the default sorting method. How can I fast-forward videos? You can either drag your finger horizontally over the video player, or click on the current or max duration texts near the seekbar. That will move the video either backward, or forward. - You can either drag your finger horizontally over the video player, or click on the current or max duration texts near the seekbar. That will move the video either backward, or forward. What is the difference between hiding and excluding a folder? Exclude prevents displaying the folder only in Simple Gallery, while Hide works system-wise and it hides the folder from other galleries too. It works by creating an empty \".nomedia\" file in the given folder, which you can then remove with any file manager too. Why do folders with music cover art or stickers show up? diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 4b8dd1501..c959b4bd9 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -194,7 +194,6 @@ Vous devez simplement à effectuer un appui prolongé sur l\'album en question et choisir l\'icône \"Épingler\" dans le menu d\'actions. Vous pouvez en épingler plusieurs. Les éléments épinglés seront alors triés selon l\'ordre par défaut. Comment avancer rapidement dans les vidéos ? You can either drag your finger horizontally over the video player, or click on the current or max duration texts near the seekbar. That will move the video either backward, or forward. - Vous pouvez appuyer sur la durée actuelle ou totale de la vidéo sur la barre de progression, la vidéo reculera ou avancera selon votre choix. Quelle est la différence entre masquer et exclure un dossier ? \"Exclure un dossier\" permet de ne pas l\'afficher uniquement dans Simple Gallery, alors que \"Masquer un dossier\" rend le dossier invisible sur l\'ensemble de l\'appareil, y compris les autres applications de galerie. Dans le dernier cas, un fichier \".nomedia\" est créé dans le dossier masqué, et peut être supprimé avec n\'importe quel explorateur de fichiers. Pourquoi des dossiers avec des pochettes d\'albums musicaux ou des miniatures d\'images sont affichés ? diff --git a/app/src/main/res/values-gl/strings.xml b/app/src/main/res/values-gl/strings.xml index 12121d648..447df0d6f 100644 --- a/app/src/main/res/values-gl/strings.xml +++ b/app/src/main/res/values-gl/strings.xml @@ -195,7 +195,6 @@ Pode manter premido o álbume e escoller a icona de Fixar no menú de accións, esto fixarao arriba. Pode fixar varios cartafoles tambén, os elementos fixados estarán ordenados polo criterio por omisión. Cómo podo aumentar a velocidade de reprodución de vídeo? You can either drag your finger horizontally over the video player, or click on the current or max duration texts near the seekbar. That will move the video either backward, or forward. - Pode pulsar no texto de duración actual ou máxima preto da barra de busca, esto moverá ou vídeo hacia adiante ou atrás. Cal é a diferenza entre agochar e excluír un cartafol? A Exclusión prevén que se mostre o cartafol só en Simple Gallery, mentras Agochar funciona para todo o sistema e agocha o cartafol para outras galerías tamén. Esto funciona creando un ficheiro baldeiro de nome \".nomedia\" no cartafol, que tamén pode quitar con calquer xestor de ficheiros. Por qué aparecen cartafoles de música con portadas ou pegatinas? diff --git a/app/src/main/res/values-hr/strings.xml b/app/src/main/res/values-hr/strings.xml index fda764b84..743618779 100644 --- a/app/src/main/res/values-hr/strings.xml +++ b/app/src/main/res/values-hr/strings.xml @@ -195,7 +195,6 @@ Dugo pritisnute željeni album i odaberite ikonu igle na akcijskom izborniku, koji će ga pričvrstiti na vrh. Možete prikvačiti više mapa odjednom, prikvačene stavke će biti razvrstane prema zadanom načinu razvrstavanja. Kako mogu ubrzati video? You can either drag your finger horizontally over the video player, or click on the current or max duration texts near the seekbar. That will move the video either backward, or forward. - Možete pritisnuti trenutačno vrijeme ili ukupno trajanje videozapisa na traci napretka, videozapis će se prema Vašem izboru pomicati unatrag ili prema naprijed. Koja je razlika između skrivanja i izuzimanja mape? Izuzimanje sprječava prikaz mape samo u Jednostavnoj galeriji, a skrivanje radi na razini sustava i skriva mapu iz drugih galerija. Djeluje stvaranjem praznih \".nomedia\" datoteka u zadanoj mapi, koju možete ukloniti pomoću bilo kojeg upraviteljem datoteka. Zašto se prikazuju mape s naslovnicama albuma i minijaturama slika? diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index 0b10ff1a7..ae5fd9159 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -196,7 +196,6 @@ A következő alkalommal, amikor megpróbál megnyitni egy képet vagy videót, Hosszan nyomja meg a kívánt albumot, és válassza ki a Kitűzés ikont a művelet menüben, ami rögzíti felülre. Többféle mappát is kitűzhet, ezeket az elemeket az alapértelmezett rendezési mód szerint rendezi. Hogyan tudom előre tekerni a videókat? Húzhatja az ujját vízszintesen a videolejátszón, vagy kattintson az aktuális vagy a max. időtartam szövegekre a keresősáv közelében. Ez visszafelé vagy előre mozgatja a videót. - Húzhatja az ujját vízszintesen a videolejátszón, vagy kattintson az aktuális vagy a max. időtartam szövegekre a keresősáv közelében. Ez visszafelé vagy előre mozgatja a videót. Mi a különbség a mappa elrejtése és kizárása között? A Kizárás megakadályozza, hogy a mappát a Simple Gallery megjelenítse, az Elrejtés pedig rendszer szinten működik, és elrejti a mappát más galériákból is. Úgy működik, hogy létrehoz egy üres \". nomedia\" nevű fájlt az adott mappában, amelyet bármikor eltávolíthat bármilyen fájlkezelővel is. Miért jelennek meg a zenei borítóval vagy matricával rendelkező mappák? diff --git a/app/src/main/res/values-id/strings.xml b/app/src/main/res/values-id/strings.xml index 9cdf9fb68..04cfb8b77 100644 --- a/app/src/main/res/values-id/strings.xml +++ b/app/src/main/res/values-id/strings.xml @@ -195,7 +195,6 @@ Anda bisa menekan lama album tersebut dan pilih ikon Pin di menu tindakan, itu akan menaruhnya di atas daftar. Anda juga bisa menyematkan beberapa folder, item yang di-pin akan diurutkan berdasarkan metode urutan default. Bagaimana cara mempercepat laju video? You can either drag your finger horizontally over the video player, or click on the current or max duration texts near the seekbar. That will move the video either backward, or forward. - Anda bisa mengklik teks durasi saat ini/maksimal di dekat penggeser durasi, itu akan memajukan atau memundurkan video. Apa perbedaan antara menyembunyikan dan mengecualikan folder? Mengecualikan tidak akan menampilkan folder di Simple Gallery, sedangkan Sembunyikan bekerja sesuai aturan sistem dan akan menyembunyikan folder juga dari aplikasi galeri yang lain. Cara kerjanya dengan membuat file \".nomedia\" kosong pada folder yang diinginkan, yang bisa Anda hapus juga dengan aplikasi file manager. Mengapa folder dengan gambar album musik atau stiker muncul? diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 64e8411eb..84f82b05b 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -195,7 +195,6 @@ Si può toccare a lungo l\'album desiderato e selezionare l\'icona puntina nel menù azioni, ciò lo fisserà in cima. Si possono anche fissare varie cartelle, gli elementi fissati saranno ordinati dal metodo di ordinamento predefinito. Come avanzo velocemente nei video? Si possono trascinare le proprie dita orrizontalmente sul video, oppure cliccando i testi accanto alla barra di avanzamento. In questo modo il video andrà avanti o indietro. - Si può cliccare sui testi di durata attuale o massima vicino alla barra di avanzamento, ciò avanzerà o riavvolgerà il video. Che differenza c\'è tra nascondere ed escludere una cartella? Escludere impedisce la visualizzazione della cartella solo in Semplice Galleria, mentre nascondere ha effetto in tutto il sistema e nasconde la cartella anche alle altre gallerie. Funziona creando un file vuoto \".nomedia\" nella cartella in questione, si possono anche rimuovere successivamente con qualsiasi gestore dei file. Perchè vengono mostrate cartelle con copertine o adesivi di musica? diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index c5f5fe84c..8a0afae34 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -195,7 +195,6 @@ You can long press the desired album and select the Pin icon at the actionmenu, that will pin it to the top. You can pin multiple folders too, pinned items will be sorted by the default sorting method. 動画を早送りするにはどうすればよいですか? You can either drag your finger horizontally over the video player, or click on the current or max duration texts near the seekbar. That will move the video either backward, or forward. - シークバーの隣にある経過時間または最大時間の表示を押すごとに早送り、または巻き戻しが作動します。 What is the difference between hiding and excluding a folder? Exclude prevents displaying the folder only in Simple Gallery, while Hide works system-wise and it hides the folder from other galleries too. It works by creating an empty \".nomedia\" file in the given folder, which you can then remove with any file manager too. Why do folders with music cover art or stickers show up? diff --git a/app/src/main/res/values-ko-rKR/strings.xml b/app/src/main/res/values-ko-rKR/strings.xml index 5e71f4a72..215adb08d 100644 --- a/app/src/main/res/values-ko-rKR/strings.xml +++ b/app/src/main/res/values-ko-rKR/strings.xml @@ -195,7 +195,6 @@ You can long press the desired album and select the Pin icon at the actionmenu, that will pin it to the top. You can pin multiple folders too, pinned items will be sorted by the default sorting method. How can I fast-forward videos? You can either drag your finger horizontally over the video player, or click on the current or max duration texts near the seekbar. That will move the video either backward, or forward. - You can either drag your finger horizontally over the video player, or click on the current or max duration texts near the seekbar. That will move the video either backward, or forward. What is the difference between hiding and excluding a folder? Exclude prevents displaying the folder only in Simple Gallery, while Hide works system-wise and it hides the folder from other galleries too. It works by creating an empty \".nomedia\" file in the given folder, which you can then remove with any file manager too. Why do folders with music cover art or stickers show up? diff --git a/app/src/main/res/values-lt/strings.xml b/app/src/main/res/values-lt/strings.xml index 23debda8c..ff5b194f4 100644 --- a/app/src/main/res/values-lt/strings.xml +++ b/app/src/main/res/values-lt/strings.xml @@ -195,7 +195,6 @@ Galite ilgai paspausti norimą albumą ir pasirinkti "Prisegti" piktogramą, esančią meniu "Veiksmo meniu", viršuje. Galite prisegti kelis aplankus, prisegti elementai bus rūšiuojami pagal numatytąjį rūšiavimo metodą. Kaip galėčiau greitai prasukti vaizdo įrašus? You can either drag your finger horizontally over the video player, or click on the current or max duration texts near the seekbar. That will move the video either backward, or forward. - Galite spustelėti tekstus šalia slinkties juostos, kad būtų perkeltas vaizdo įrašas atgal arba į priekį. Koks skirtumas tarp slėpimo ir išskyrimo iš aplanko? Išskyrimas neleidžia rodyti aplanko tik paprastoje galerijoje, tuo tarpu slėpimas slepia aplanką iš kitų galerijų. Tai veikia, sukuriant tuščią \ ". Nomedia \" bylą tam tikrame aplanke, kurį vėliau galite pašalinti bet kuria bylų tvarkykle. Kodėl pasirodo aplankai su muzikos viršeliu ar lipdukais? diff --git a/app/src/main/res/values-nb/strings.xml b/app/src/main/res/values-nb/strings.xml index 9c121cb44..9f6bca346 100644 --- a/app/src/main/res/values-nb/strings.xml +++ b/app/src/main/res/values-nb/strings.xml @@ -195,7 +195,6 @@ You can long press the desired album and select the Pin icon at the actionmenu, that will pin it to the top. You can pin multiple folders too, pinned items will be sorted by the default sorting method. How can I fast-forward videos? You can either drag your finger horizontally over the video player, or click on the current or max duration texts near the seekbar. That will move the video either backward, or forward. - You can either drag your finger horizontally over the video player, or click on the current or max duration texts near the seekbar. That will move the video either backward, or forward. What is the difference between hiding and excluding a folder? Exclude prevents displaying the folder only in Simple Gallery, while Hide works system-wise and it hides the folder from other galleries too. It works by creating an empty \".nomedia\" file in the given folder, which you can then remove with any file manager too. Why do folders with music cover art or stickers show up? diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index 5e586e2f4..c525cb547 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -195,7 +195,6 @@ You can long press the desired album and select the Pin icon at the actionmenu, that will pin it to the top. You can pin multiple folders too, pinned items will be sorted by the default sorting method. How can I fast-forward videos? You can either drag your finger horizontally over the video player, or click on the current or max duration texts near the seekbar. That will move the video either backward, or forward. - You can either drag your finger horizontally over the video player, or click on the current or max duration texts near the seekbar. That will move the video either backward, or forward. What is the difference between hiding and excluding a folder? Exclude prevents displaying the folder only in Simple Gallery, while Hide works system-wise and it hides the folder from other galleries too. It works by creating an empty \".nomedia\" file in the given folder, which you can then remove with any file manager too. Why do folders with music cover art or stickers show up? diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index 650f84c84..e8476b18f 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -194,7 +194,6 @@    Przytrzymaj album(y) i wybierz ikonę przypięcia w pasku akcji.    Jak mogę przwijać filmy? You can either drag your finger horizontally over the video player, or click on the current or max duration texts near the seekbar. That will move the video either backward, or forward. -    Kliknij na napisie z czasem trwania filmu, bądź tym z obecnym momentem filmu.    Jaka jest różnica między ukryciem, a wykluczeniem folderu?    Wykluczenie działa tylko w obrębie niniejszej aplikacji (wszędzie indziej pliki są normalnie widoczne), ukrywanie - w obrębie całego systemu (nie widać ich nigdzie), dodawany jest wtedy do folderu pusty plik \'.nomedia\', który możesz usunąć w dowolnym menedżerze plików.    Dlaczego pokazują mi się foldery z okładkami do piosenek i tym podobne rzeczy? diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 8433070e7..d8a851774 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -195,7 +195,6 @@ You can long press the desired album and select the Pin icon at the actionmenu, that will pin it to the top. You can pin multiple folders too, pinned items will be sorted by the default sorting method. How can I fast-forward videos? You can either drag your finger horizontally over the video player, or click on the current or max duration texts near the seekbar. That will move the video either backward, or forward. - You can either drag your finger horizontally over the video player, or click on the current or max duration texts near the seekbar. That will move the video either backward, or forward. What is the difference between hiding and excluding a folder? Exclude prevents displaying the folder only in Simple Gallery, while Hide works system-wise and it hides the folder from other galleries too. It works by creating an empty \".nomedia\" file in the given folder, which you can then remove with any file manager too. Why do folders with music cover art or stickers show up? diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index a428fc891..70d41426b 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -195,7 +195,6 @@ You can long press the desired album and select the Pin icon at the actionmenu, that will pin it to the top. You can pin multiple folders too, pinned items will be sorted by the default sorting method. How can I fast-forward videos? You can either drag your finger horizontally over the video player, or click on the current or max duration texts near the seekbar. That will move the video either backward, or forward. - You can either drag your finger horizontally over the video player, or click on the current or max duration texts near the seekbar. That will move the video either backward, or forward. What is the difference between hiding and excluding a folder? Exclude prevents displaying the folder only in Simple Gallery, while Hide works system-wise and it hides the folder from other galleries too. It works by creating an empty \".nomedia\" file in the given folder, which you can then remove with any file manager too. Why do folders with music cover art or stickers show up? diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 14c78484f..2efd74004 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -195,7 +195,6 @@ Вы можете длительным нажатием на желаемый альбом открыть меню действий в нём выбрать пункт \"Закрепить\". Можно закрепить несколько альбомов (папок); прикреплённые элементы будут отсортированы по методу сортировки по умолчанию. Как ускорить перемотку видео? Вы можете либо перемещать пальцем по горизонтали над видеоплеером, либо нажать на цифры текущего положения или максимальной длительности видео рядом с панелью поиска, что приведёт к перемещению позиции воспроизведения назад или вперёд. - Вы можете нажать на цифры текущего положения или максимальной длительности видео рядом с панелью поиска, что приведёт к перемещению позиции воспроизведения либо назад, либо вперёд. В чём разница между скрытием и исключением папки? Исключение запрещает отображение папки только в Simple Gallery, в то время как скрытие работает системно и скрывает папку из других галерей. Это достигается путём создания пустого файла \".nomedia\" в данной папке, который впоследствии можно удалить любым файловым менеджером. Почему отображаются папки с музыкальными обложками? diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index 5c16611b5..4cda1a495 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -195,7 +195,6 @@ Môžete označiť daný priečinok dlhým podržaním a zvoliť tlačidlo s obrázkom pripinačky, to ho pripne na vrch. Môžete pripnúť aj viacero priečinkov, budú zoradené podľa zvoleného radenia. Ako viem posunúť video vpred? Môžete to dosiahnuť vodorovným potiahnutím prsta cez video prehrávač, alebo kliknúť na texty súčasnej, alebo maximálnej dĺžky videa, ktoré sú vedľa indikátora súčasného progresu. To posunie video buď vpred, alebo vzad. - Môžete kliknúť na texty súčasnej, alebo maximálnej dĺžky videa, ktoré sú vedľa indikátora súčasného progresu. To posunie video buď vpred, alebo vzad. Aký je rozdiel medzi Skrytím a Vylúčením priečinka? Kým vylúčenie predíde zobrazeniu priečinka iba vrámci Jednoduchej Galérie, skrytie ho ukryje vrámci celého systému, teda to ovplyvní aj ostatné galérie. Skrytie funguje pomocou vytvorenia prázdneho \".nomedia\" súboru v danom priečinku, ktorý viete vymazať aj nejakým správcom súborov. Prečo sa mi zobrazujú priečinky s obalmi hudobných albumov, alebo nálepkami? diff --git a/app/src/main/res/values-sl/strings.xml b/app/src/main/res/values-sl/strings.xml index ded2b9270..055c0dbc6 100644 --- a/app/src/main/res/values-sl/strings.xml +++ b/app/src/main/res/values-sl/strings.xml @@ -195,7 +195,6 @@ Z dolgim pritiskom na album se vam prikaže meni, v katerem je na voljo bucika, s katero pripnete album na željeno mesto. Na ta način lahko pripnete več albumov, ki bodo razvrščeni v skladu s privzetim načinom razvrščanja. Ali lahko hitro predvajam videoposnetke? You can either drag your finger horizontally over the video player, or click on the current or max duration texts near the seekbar, that will move the video either backward, or forward. - Lahko kliknete na napis trenutnega ali maksimalnega trajanja poleg vrstice položaja, kar premakne/preskoči video naprej ali nazaj. Kakšna je razlika med skrivanjem in izključevanjem mape? Izključevanje mape jo skrije le v Simple galeriji, medtem ko jo skrivanje skrije tudi v ostalih aplikacijah oz. galerijah. Deluje tako, da kreira prazno \".nomedia\" datoteko v izbrani mapi, katero lahko odstranite tudi s katerimkoli urejevalnikom datotek. Zakaj se v galeriji prikažejo datoteke z naslovnicami glasbenih map ali nalepk? diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index 28a2519ab..ca7384748 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -195,7 +195,6 @@ You can long press the desired album and select the Pin icon at the actionmenu, that will pin it to the top. You can pin multiple folders too, pinned items will be sorted by the default sorting method. How can I fast-forward videos? You can either drag your finger horizontally over the video player, or click on the current or max duration texts near the seekbar, that will move the video either backward, or forward. - You can either drag your finger horizontally over the video player, or click on the current or max duration texts near the seekbar. That will move the video either backward, or forward. What is the difference between hiding and excluding a folder? Exclude prevents displaying the folder only in Simple Gallery, while Hide works system-wise and it hides the folder from other galleries too. It works by creating an empty \".nomedia\" file in the given folder, which you can then remove with any file manager too. Why do folders with music cover art or stickers show up? diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index 98ce6c484..c37323182 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -195,7 +195,6 @@ İstediğiniz albüme uzunca basabilir ve eylem menüsündeki Sabitle simgesini seçebilirsiniz. Birden çok klasörü de sabitleyebilirsiniz, sabitlenmiş öğeler varsayılan sıralama yöntemine göre sıralanır. Videoları nasıl hızlıca ileri sarabilirim? You can either drag your finger horizontally over the video player, or click on the current or max duration texts near the seekbar, that will move the video either backward, or forward. - Videoyu geriye ya da ileriye taşıyacak olan arama çubuğunun yakınındaki geçerli veya maksimum süre metinlerini tıklayabilirsiniz. Klasörün gizlenmesi ve hariç tutulması arasındaki fark nedir? Hariç tut, klasörü yalnızca Basit Galeri\'de görüntülemeyi engellerken, Gizle sistem genelinde çalışır ve klasörü diğer galerilerden de gizler. Verilen klasörde boş bir \".nomedia\" dosyası oluşturarak çalışır, daha sonra herhangi bir dosya yöneticisi ile kaldırabilirsiniz. Neden albüm resimlerini içeren klasörler görünüyor? diff --git a/app/src/main/res/values-uk/strings.xml b/app/src/main/res/values-uk/strings.xml index c13346e74..0db30482d 100644 --- a/app/src/main/res/values-uk/strings.xml +++ b/app/src/main/res/values-uk/strings.xml @@ -195,7 +195,6 @@ Ви можете виконати довге натискання на бажаному альбомі і вибрати піктограму \"Закріпити\" у меню дій, що закріпить його вгорі. Ви також можете закріпити декілька тек; закріплені елементи будуть відсортовані за методом сортування за-замовчуванням. Як я можу швидко прокручувати відео? Ви можете або провести пальцем горизонтально під час відтворення відео, або натиснути на текст поточної або максимальної тривалості відео біля прогрес-бару, що прокрутить відео або назад, або вперед. - Ви можете натиснути на текст поточного таймінгу або на текст загальної тривалості відео на прогрес-барі, що перемістить відео або назад, або вперед. В чому полягає різниця між приховуванням та виключенням теки? \"Виключити\" запобігає відображенню теки тільки в додатку Simple Gallery, в той час як \"Приховати\" працює на системному рівні і приховує теку і в інших галереях також. Це здійснюється шляхом створення порожнього файлу \".nomedia\" в заданій теці, який може бути видалений пізніше будь-яким файловим менеджером. Чому відображаються теки з музичними обкладинками або стікерами? diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 3b44839e0..ccefe19ab 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -194,7 +194,6 @@ 你可以长按该相册并在操作栏中点击图钉图标,这样 就可以将其固定在顶部了。你也可以固定多个文件夹,固定项目将按照默认排序方法排序。 如何快进/快退视频? 只需在视频播放器上左右滑动,或点击底栏进度条两侧的时间文本,即可前进或后退视频。 - 可以点击底栏进度条两侧的时间文本,或拖动进度条。 文件夹的隐藏和排除有什么区别? 排除功能只是防止其在简约图库中显示,而隐藏功能则使用的是系统的方法,这样做也会在其他图库中隐藏。它的工作原理是在给定的文件夹中创建一个空的.nomedia文件,你可以使用任何文件管理器删除它。 为什么会出现音乐艺术家封面或贴纸文件夹? diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index dfee2752f..8efb8faec 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -195,7 +195,6 @@ 你可以長按想要的相冊,然後在操作選單中選擇[圖釘]圖示,就會釘選於頂端。你也能釘選多個資料夾,釘選的項目會依預設的排序方法來排序。 我如何快轉影片? 你可以在影片撥放器上水平滑動你的手指,或者點擊進度條附近的當前或總時長文字。這會使影片快轉或倒轉。 - 你可以點擊進度條附近的當前或總時長文字,影片就會快轉或倒轉。 隱藏和排除資料夾,兩者有什麼不同? [排除]只在簡易相簿中避免顯示出來;而[隱藏]則作用於整個系統,資料夾也會被其他相簿隱藏。這是藉由在指定資料夾內建立一個\".nomedia\"空白檔案來進行隱藏,你之後也能用任何檔案管理器移除。 為什麼有些音樂專輯封面或貼圖的資料夾會出現? diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 671b3bb2e..0439c91dc 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -195,7 +195,6 @@ You can long press the desired album and select the Pin icon at the actionmenu, that will pin it to the top. You can pin multiple folders too, pinned items will be sorted by the default sorting method. How can I fast-forward videos? You can either drag your finger horizontally over the video player, or click on the current or max duration texts near the seekbar. That will move the video either backward, or forward. - You can either drag your finger horizontally over the video player, or click on the current or max duration texts near the seekbar. That will move the video either backward, or forward. What is the difference between hiding and excluding a folder? Exclude prevents displaying the folder only in Simple Gallery, while Hide works system-wise and it hides the folder from other galleries too. It works by creating an empty \".nomedia\" file in the given folder, which you can then remove with any file manager too. Why do folders with music cover art or stickers show up? From ebecd4ca34b8047771b14871f2cb37ec260d669f Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 10 Jan 2019 11:36:15 +0100 Subject: [PATCH 13/75] adding the video playback reversion in the release notes --- .../com/simplemobiletools/gallery/pro/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/pro/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt index 330e88e3d..86645f1fe 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt @@ -1231,6 +1231,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { add(Release(206, R.string.release_206)) add(Release(213, R.string.release_213)) add(Release(217, R.string.release_217)) + add(Release(220, R.string.release_220)) checkWhatsNew(this, BuildConfig.VERSION_CODE) } } diff --git a/app/src/main/res/values/donottranslate.xml b/app/src/main/res/values/donottranslate.xml index e0f0e33c6..0c2e2b267 100644 --- a/app/src/main/res/values/donottranslate.xml +++ b/app/src/main/res/values/donottranslate.xml @@ -2,6 +2,7 @@ + Reverted to the old way of opening videos, opening on separate screen can be enabled in the app settings Rewrote video playback, use a separate screen + added fast-forwarding with horizontal swiping\n Added optional 1:1 pixel ratio zooming with two double taps at fullscreen view\n From 7f0ab52d4f101f52bb0b832cf1228a2f9a80a12b Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 10 Jan 2019 11:40:56 +0100 Subject: [PATCH 14/75] update version to 6.2.2 --- app/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 885d9a756..c1b8df75a 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -15,8 +15,8 @@ android { applicationId "com.simplemobiletools.gallery.pro" minSdkVersion 21 targetSdkVersion 28 - versionCode 219 - versionName "6.2.1" + versionCode 220 + versionName "6.2.2" multiDexEnabled true setProperty("archivesBaseName", "gallery") } From f189bd8ad5fdb6c4bf33ddd1f446593ddbc69e10 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 10 Jan 2019 11:41:03 +0100 Subject: [PATCH 15/75] updating changelog --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4679c2ccb..ca94b74d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,13 @@ Changelog ========== +Version 6.2.2 *(2019-01-10)* +---------------------------- + + * Reverted to the old way of playing videos, opening them on a separate screen can be enabled in the app settings + * Added some memory related improvements at displaying fullscreen images + * Allow showing videos in slideshows + Version 6.2.1 *(2019-01-08)* ---------------------------- From df9be69956206802bce0530c9ef9d5803533eb79 Mon Sep 17 00:00:00 2001 From: Guillaume Date: Thu, 10 Jan 2019 13:15:41 +0100 Subject: [PATCH 16/75] Dutch --- 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 c525cb547..ae886a4df 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -172,7 +172,7 @@ Prullenbak als laatste item tonen Naar beneden vegen om volledig scherm af te sluiten 1:1 zoomen na 2x dubbelklikken - Always open videos on a separate screen with new horizontal gestures + Video\'s altijd in apart scherm met horizontale veeggebaren openen Miniatuurvoorbeelden From 3dd366cde910034a193317ec692b77134a2951de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Marques?= Date: Thu, 10 Jan 2019 13:42:43 +0000 Subject: [PATCH 17/75] Update strings.xml --- app/src/main/res/values-pt/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index c7b639b5d..8fcda5c77 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -220,7 +220,7 @@ - Uma aplicação para gerir os seus ficheiros, sem anúncios e que respeita a sua privacidade. + Aplicação para gerir os seus ficheiros, sem anúncios e com total privacidade. Um aplicação capaz de mostrar diversos tipos de imagens e vídeos incluíndo SVG, RAW, fotos panorâmicas e vídeos. From 403497c7fa02cb2e1b471e57226b471d08344c4d Mon Sep 17 00:00:00 2001 From: rmajc <36705473+rmajc@users.noreply.github.com> Date: Thu, 10 Jan 2019 14:54:12 +0100 Subject: [PATCH 18/75] Update strings.xml --- app/src/main/res/values-sl/strings.xml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/src/main/res/values-sl/strings.xml b/app/src/main/res/values-sl/strings.xml index 055c0dbc6..e464954c2 100644 --- a/app/src/main/res/values-sl/strings.xml +++ b/app/src/main/res/values-sl/strings.xml @@ -89,7 +89,7 @@ Zrcali vertikalno Uredi z Prosto - Other + Drugo Simple ozadje @@ -116,7 +116,7 @@ Ponavljaj diaprojekcijo Diaprojekcija se je zaključila Ne najdem datotek za diaprojekcijo - Use crossfade animations + Uporabi križanje animacij Spremeni tip pogleda @@ -134,8 +134,8 @@ Končnica - Folder shown on the widget: - Show folder name + Mapa uporabljena na pripomočku: + Prikaži ime mape Avtomatično predvajaj videoposnetke @@ -171,8 +171,8 @@ Prikaži slike v največji možni kvaliteti Prikaži Koš kot zadnji element na glavnem zaslonu Dovoli zapiranje celozaslonskega načina z gesto navzdol - Allow 1:1 zooming in with two double taps - Always open videos on a separate screen with new horizontal gestures + Dovoli 1:1 povečavo z dvojnim pritiskom + Vedno odpri videoposnetke na ločenem zaslonu z novimi horizontalnimi gestami Sličice @@ -218,7 +218,7 @@ Lahko uporabite funkcijo \"Začasno prikaži skrite elemente\", ki se nahaja v meniju na glavnem zaslonu ali preklopite \"Prikaži skrite elemente\" v Nastavitvah aplikacije. Če želite element označiti kot viden, z dolgim pritiskom nanj prikličite meni in izberite \"Prikaži\". Skrivanje map deluje tako, da se kreira prazno \".nomedia\" datoteko v izbrani mapi, ki jo lahko odstranite tudi s katerimkoli urejevalnikom datotek. - An offline gallery for managing your files without ads, respecting your privacy. + Galerija brez obvezne internetne povezave za urejanje vaših datotek brez prikazovanja oglasov in z upoštevanjem vaše zasebnosti. Visoko prilagodljiva galerija, zmožna prikazovanja različnih tipov fotografij in videoposnetkov, vključno s SVGji, RAWi, panoramskimi fotografijami in videoposnetki. From 12a499544cb71e5d9734711bd87709987e584f0d Mon Sep 17 00:00:00 2001 From: Guillaume Date: Fri, 11 Jan 2019 17:51:17 +0100 Subject: [PATCH 19/75] Dutch FAQ --- app/src/main/res/values-nl/strings.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index ae886a4df..f12b96eba 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -186,12 +186,12 @@ Bestand tonen/verbergen - How can I make Simple Gallery the default device gallery? - First you have to find the currently default gallery in the Apps section of your device settings, look for a button that says something like \"Open by default\", click on it, then select \"Clear defaults\". - The next time you will try opening an image or video you should see an app picker, where you can select Simple Gallery and make it the default app. - I locked the app with a password, but I forgot it. What can I do? - You can solve it in 2 ways. You can either reinstall the app, or find the app in your device settings and select \"Clear data\". It will reset all your settings, it will not remove any media files. - How can I make an album always appear at the top? + Hoe kan ik Eenvoudige Galerij instellen als standaard-app voor foto\'s en video\'s? + Zoek eerst de huidige standaard-app voor foto\'s en video'\s in de Android-instellingen (via \"Apps\" of "\Apps en meldingen\"). Klik bij de App-info op \"Standaardwaarden wissen\" (soms onder \"Standaard openen\"). + Bij het openen van een foto of video zal de volgende keer een keuzescherm verschijnen, waarin Eenvoudige Galerij als standaard-app kan worden ingesteld. + Ik heb de app beveiligd met een wachtwoord, maar ben het wachtwoord nu vergeten. Wat kan ik doen? + Er zijn twee manieren. Herinstalleer de app, of ga naar de app in de Android-instellingen (via \"Apps\" of "\Apps en meldingen\") en kies via "\Opslagruimte\" voor \"Gegevens wissen\". Alleen de instellingen van deze app zullen worden gewist. + Hoe kan ik een album/map bovenaan vastzetten? You can long press the desired album and select the Pin icon at the actionmenu, that will pin it to the top. You can pin multiple folders too, pinned items will be sorted by the default sorting method. How can I fast-forward videos? You can either drag your finger horizontally over the video player, or click on the current or max duration texts near the seekbar. That will move the video either backward, or forward. From 99ae04c3d8dc1d905ced0dea08aa885eebbc1259 Mon Sep 17 00:00:00 2001 From: Guillaume Date: Sat, 12 Jan 2019 03:13:15 +0100 Subject: [PATCH 20/75] Dutch --- app/src/main/res/values-nl/strings.xml | 52 +++++++++++++------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index f12b96eba..380dc2355 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -190,32 +190,32 @@ Zoek eerst de huidige standaard-app voor foto\'s en video'\s in de Android-instellingen (via \"Apps\" of "\Apps en meldingen\"). Klik bij de App-info op \"Standaardwaarden wissen\" (soms onder \"Standaard openen\"). Bij het openen van een foto of video zal de volgende keer een keuzescherm verschijnen, waarin Eenvoudige Galerij als standaard-app kan worden ingesteld. Ik heb de app beveiligd met een wachtwoord, maar ben het wachtwoord nu vergeten. Wat kan ik doen? - Er zijn twee manieren. Herinstalleer de app, of ga naar de app in de Android-instellingen (via \"Apps\" of "\Apps en meldingen\") en kies via "\Opslagruimte\" voor \"Gegevens wissen\". Alleen de instellingen van deze app zullen worden gewist. - Hoe kan ik een album/map bovenaan vastzetten? - You can long press the desired album and select the Pin icon at the actionmenu, that will pin it to the top. You can pin multiple folders too, pinned items will be sorted by the default sorting method. - How can I fast-forward videos? - You can either drag your finger horizontally over the video player, or click on the current or max duration texts near the seekbar. That will move the video either backward, or forward. - What is the difference between hiding and excluding a folder? - Exclude prevents displaying the folder only in Simple Gallery, while Hide works system-wise and it hides the folder from other galleries too. It works by creating an empty \".nomedia\" file in the given folder, which you can then remove with any file manager too. - Why do folders with music cover art or stickers show up? - It can happen that you will see some unusual albums show up. You can easily exclude them by long pressing them and selecting Exclude. In the next dialog you can then select the parent folder, chances are it will prevent the other related albums showing up too. - A folder with images isn\'t showing up, what can I do? - That can have multiple reasons, but solving it is easy. Just go in Settings -> Manage Included Folders, select Plus and navigate to the required folder. - What if I want just a few particular folders visible? - Adding a folder at the Included Folders doesn\'t automatically exclude anything. What you can do is go in Settings -> Manage Excluded Folders, exclude the root folder \"/\", then add the desired folders at Settings -> Manage Included Folders. - That will make only the selected folders visible, as both excluding and including are recursive and if a folder is both excluded and included, it will show up. - Fullscreen images have weird artifacts, can I somehow improve the quality? - Yea, there is a toggle in Settings saying \"Replace deep zoomable images with better quality ones\", you can use that. It will improve the quality of the images, but they will get blurred once you try zooming in too much. - Can I crop images with this app? - Yes, you can crop images in the editor, by dragging the image corners. You can get to the editor either by long pressing an image thumbnail and selecting Edit, or selecting Edit from the fullscreen view. - Can I somehow group media file thumbnails? - Sure, just use the \"Group by\" menu item while at the thumbnails view. You can group files by multiple criteria, including Date Taken. If you use the \"Show all folders content\" function you can group them by folders too. - Sorting by Date Taken doesn\'t seem to work properly, how can I fix it? - It is most likely caused by the files being copied from somewhere. You can fix it by selecting the file thumbnails and selecting \"Fix Date Taken value\". - I see some color banding on the images. How can I improve the quality? - The current solution for displaying images works fine in the vast majority of cases, but if you want even better image quality, you can enable the \"Show images in the highest possible quality\" at the app settings, in the \"Deep zoomable images\" section. - I have hidden a file/folder. How can I unhide it? - You can either press the \"Temporarily show hidden items\" menu item at the main screen, or toggle \"Show hidden items\" in the app settings to see the hidden item. If you want to unhide it, just long press it and select \"Unhide\". Folders are hidden by adding a hidden \".nomedia\" file into them, you can delete the file with any file manager too. + Deïnstalleer en herinstalleer de app, of ga naar de app in de Android-instellingen (via \"Apps (en meldingen)\" -> \"App-info\") en kies via \"Opslagruimte\" voor \"Gegevens wissen\". Hiermee worden alleen de instellingen van deze app gewist. + Hoe kan ik een map bovenaan vastzetten? + Druk lang op het map en kies vervolgens de punaise in het actiemenu. Als er meerdere mappen zijn vastgezet, zullen deze worden weergeven op basis van de standaardsortering. + Hoe kan ik terug- of vooruitspoelen in video\'s? + Sleep horizontaal over de videospeler, of klik bij de zoekbalk op de cijfers die de huidige voortgang of de lengte weergeven. Hierbij zal de video respectievelijk terug- of vooruitspringen. + Wat is het verschil tussen het verbergen en het uitsluiten van mappen? + Met \"Uitsluiten\" wordt het tonen van de map alleen binnen deze app voorkomen, terwijl \"Verbergen\" de map ook zal verbergen voor andere galerij-apps. Met \"Verbergen\" wordt een bestand genaamd \".nomedia\" in de te verbergen map aangemaakt (het verwijderen van dit bestand uit de map maakt het verbergen ongedaan). + Waarom zie ik mappen met stickers of covers van muziekalbums? + Soms worden er wat ongebruikelijke afbeeldingen van andere apps getoond. Deze zijn gemakkelijk uit het overzicht te halen door lang te drukken op de map en vervolgens te kiezen voor \"Uitsluiten\". In het daaropvolgende venster is ook de bovenliggende map te kiezen; dit zou het tonen van soortgelijke ongewenste items kunnen voorkomen. + Een bepaalde map met afbeeldingen wordt niet getoond. Wat kan ik doen? + Dit kan verschillende redenen hebben, maar is eenvoudig op te lossen. Ga naar \"Instellingen\" -> \"Toegevoegde mappen beheren\", klik vervolgens op het plus-symbool en navigeer naar de gewenste map. + Wat als ik slechts een beperkt aantal mappen wil laten zien? + Het toevoegen van mappen aan de lijst bij \"Toegevoegde mappen beheren\" sluit niet automatisch alle andere mappen uit. Sluit daarom de hoofdmap \"/\" uit via \"Instellingen\" -> \"Uitgesloten mappen beheren\" en voeg vervolgens de te tonen mappen toe bij \"Instellingen\" -> \"Toegevoegde mappen beheren\". + Dit zal ervoor zorgen dat alleen de toegevoegde mappen worden getoond (mappen toevoegen of uitsluiten gebeurt recursief, maar een toegevoegde map zal altijd worden getoond). + Afbeeldingen in volledig scherm hebben rare artefacten. Kan ik de kwaliteit verbeteren? + Probeer de instelling \"Verder inzoomen mogelijk maken\" te wijzigen. + Kan ik afbeeldingen bijsnijden met deze app? + Ja, dat kan bij \"Bewerken\" door de hoeken te verslepen. Druk lang op een afbeelding in het overzicht of ga naar het volledig scherm en klik vervolgens op \"Bewerken\". + Hoe kan ik mediabestanden groeperen? + Kies het menu-item \"Groeperen op\" om op basis van verschillende criteria te groeperen. Dit kan ook ongeacht de mappenstructuur als voor de functie \"Alles weergeven\" is gekozen. + Sorteren op Datum opname lijkt niet te werken. Hoe kan ik dit oplossen? + Waarschijnlijk zijn de bestanden gekopieerd vanaf een andere locatie. Selecteer de bestanden en kies \"Datum opname corrigeren\". + Ik zie \"color banding\" op de afbeeldingen. Hoe kan ik de kwaliteit verbeteren? + In de meeste gevallen werkt de huidige methode voor het weergeven van afbeeldingen prima, maar met de instelling \"Afbeeldingen in de hoogst mogelijke kwaliteit weergeven\" onder \"Afbeeldingen ver inzoomen\" kan een nog betere kwaliteit worden bewerkstelligd. + Ik heb een bestand of map verborgen. Hoe kan ik dit ongedaan maken? + Kies het menu-item \"Verborgen items tijdelijk tonen\", of schakel de instelling \"Verborgen items tonen\" in om het verborgen item te kunnen zien. Druk vervolgens lang op het item en kies \"Tonen\" om het verbergen ongedaan te maken. Mappen worden verborgen door het bestand \".nomedia\" in de map te plaatsen; dit bestand kan ook handmatig in een andere app worden verwijderd. From d06a651929d9421d36e72ea85b47cb4ce0f54fff Mon Sep 17 00:00:00 2001 From: fricyo <30796677+fricyo@users.noreply.github.com> Date: Sat, 12 Jan 2019 17:32:15 +0800 Subject: [PATCH 21/75] Update Translation --- app/src/main/res/values-zh-rTW/strings.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 8efb8faec..fe66f62b5 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -116,7 +116,7 @@ 投影片循環 投影片結束 找不到投影片的媒體檔案 - Use crossfade animations + 使用淡入淡出動畫 改變瀏覽類型 @@ -139,7 +139,7 @@ 自動播放影片 - 記住影片上次撥放位置 + 記住影片上次播放位置 顯示檔案名稱 影片循環播放 縮圖顯示GIF動畫 @@ -172,7 +172,7 @@ 回收桶顯示在主畫面最後一項 允許用下滑手勢來關閉全螢幕檢視 允許用兩次雙擊來1:1縮放 - Always open videos on a separate screen with new horizontal gestures + 總是用新的水平手勢在獨立畫面開啟影片 縮圖 @@ -194,7 +194,7 @@ 我如何讓某個相冊總是出現在頂端? 你可以長按想要的相冊,然後在操作選單中選擇[圖釘]圖示,就會釘選於頂端。你也能釘選多個資料夾,釘選的項目會依預設的排序方法來排序。 我如何快轉影片? - 你可以在影片撥放器上水平滑動你的手指,或者點擊進度條附近的當前或總時長文字。這會使影片快轉或倒轉。 + 你可以在影片播放器上水平滑動你的手指,或者點擊進度條附近的當前或總時長文字。這會使影片快轉或倒轉。 隱藏和排除資料夾,兩者有什麼不同? [排除]只在簡易相簿中避免顯示出來;而[隱藏]則作用於整個系統,資料夾也會被其他相簿隱藏。這是藉由在指定資料夾內建立一個\".nomedia\"空白檔案來進行隱藏,你之後也能用任何檔案管理器移除。 為什麼有些音樂專輯封面或貼圖的資料夾會出現? From 34cfebf1151e7530fcb4fed57eb41a826d078262 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 12 Jan 2019 13:32:07 +0100 Subject: [PATCH 22/75] fixing some crash at the video fragment cleanup --- .../gallery/pro/fragments/VideoFragment.kt | 9 ++++++--- app/src/main/res/values-nl/strings.xml | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt index 17e4ba289..d9219ecb4 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt @@ -635,10 +635,13 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S private fun cleanup() { pauseVideo() - mCurrTimeView.text = 0.getFormattedDuration() releaseExoPlayer() - mSeekBar.progress = 0 - mTimerHandler.removeCallbacksAndMessages(null) + + if (mWasFragmentInit) { + mCurrTimeView.text = 0.getFormattedDuration() + mSeekBar.progress = 0 + mTimerHandler.removeCallbacksAndMessages(null) + } } private fun releaseExoPlayer() { diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index 380dc2355..2e31c9414 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -187,7 +187,7 @@ Hoe kan ik Eenvoudige Galerij instellen als standaard-app voor foto\'s en video\'s? - Zoek eerst de huidige standaard-app voor foto\'s en video'\s in de Android-instellingen (via \"Apps\" of "\Apps en meldingen\"). Klik bij de App-info op \"Standaardwaarden wissen\" (soms onder \"Standaard openen\"). + Zoek eerst de huidige standaard-app voor foto\'s en video\'s in de Android-instellingen (via \"Apps\" of "\Apps en meldingen\"). Klik bij de App-info op \"Standaardwaarden wissen\" (soms onder \"Standaard openen\"). Bij het openen van een foto of video zal de volgende keer een keuzescherm verschijnen, waarin Eenvoudige Galerij als standaard-app kan worden ingesteld. Ik heb de app beveiligd met een wachtwoord, maar ben het wachtwoord nu vergeten. Wat kan ik doen? Deïnstalleer en herinstalleer de app, of ga naar de app in de Android-instellingen (via \"Apps (en meldingen)\" -> \"App-info\") en kies via \"Opslagruimte\" voor \"Gegevens wissen\". Hiermee worden alleen de instellingen van deze app gewist. From d2a420a9a80791672bc7a3f02befe39dea14cd70 Mon Sep 17 00:00:00 2001 From: FTno <16176811+FTno@users.noreply.github.com> Date: Sat, 12 Jan 2019 13:49:52 +0100 Subject: [PATCH 23/75] Update strings.xml Norwegian (nb) translation update --- app/src/main/res/values-nb/strings.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/res/values-nb/strings.xml b/app/src/main/res/values-nb/strings.xml index 9f6bca346..68fa4c2fa 100644 --- a/app/src/main/res/values-nb/strings.xml +++ b/app/src/main/res/values-nb/strings.xml @@ -122,7 +122,7 @@ Endre visningstype Rutenett Liste - Group direct subfolders + Grupper direkte undermapper Grupper etter @@ -172,7 +172,7 @@ Vis papirkurven som siste element på hovedskjermen Tillat lukking av mediavisningen med en nedoverbevegelse Tillat å zoome 1:1 med to dobbeltrykk - Always open videos on a separate screen with new horizontal gestures + Åpne alltid videoer på en separat skjerm med nye horisontale bevegelser Minibilder From dc7de93cf7a3cd4c2b7df6b0ab946f4aa0e70447 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 12 Jan 2019 15:25:21 +0100 Subject: [PATCH 24/75] restore date taken values automatically at restoring files from the recycle bin --- .../gallery/pro/adapters/MediaAdapter.kt | 61 ++----------------- .../gallery/pro/extensions/Activity.kt | 61 +++++++++++++++++++ 2 files changed, 65 insertions(+), 57 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/MediaAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/MediaAdapter.kt index 0206d451e..606cfd2a4 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/MediaAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/MediaAdapter.kt @@ -1,11 +1,8 @@ package com.simplemobiletools.gallery.pro.adapters -import android.content.ContentProviderOperation -import android.media.ExifInterface import android.media.MediaMetadataRetriever import android.os.Handler import android.os.Looper -import android.provider.MediaStore import android.view.Menu import android.view.View import android.view.ViewGroup @@ -32,7 +29,6 @@ import com.simplemobiletools.gallery.pro.models.ThumbnailItem import com.simplemobiletools.gallery.pro.models.ThumbnailSection import kotlinx.android.synthetic.main.photo_video_item_grid.view.* import kotlinx.android.synthetic.main.thumbnail_section.view.* -import java.text.SimpleDateFormat import java.util.* class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList, val listener: MediaOperationsListener?, val isAGetIntent: Boolean, @@ -41,7 +37,6 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList() - val mediumDao = activity.galleryDB.MediumDao() - val paths = getSelectedPaths() - for (path in paths) { - val dateTime = ExifInterface(path).getAttribute(ExifInterface.TAG_DATETIME_ORIGINAL) - ?: ExifInterface(path).getAttribute(ExifInterface.TAG_DATETIME) ?: continue - - // some formats contain a "T" in the middle, some don't - // sample dates: 2015-07-26T14:55:23, 2018:09:05 15:09:05 - val t = if (dateTime.substring(10, 11) == "T") "\'T\'" else " " - val separator = dateTime.substring(4, 5) - val format = "yyyy${separator}MM${separator}dd${t}kk:mm:ss" - val formatter = SimpleDateFormat(format, Locale.getDefault()) - val timestamp = formatter.parse(dateTime).time - - val uri = activity.getFileUri(path) - ContentProviderOperation.newUpdate(uri).apply { - val selection = "${MediaStore.Images.Media.DATA} = ?" - val selectionArgs = arrayOf(path) - withSelection(selection, selectionArgs) - withValue(MediaStore.Images.Media.DATE_TAKEN, timestamp) - operations.add(build()) - } - - if (operations.size % BATCH_SIZE == 0) { - activity.contentResolver.applyBatch(MediaStore.AUTHORITY, operations) - operations.clear() - } - - mediumDao.updateFavoriteDateTaken(path, timestamp) - didUpdateFile = true - } - - val resultSize = activity.contentResolver.applyBatch(MediaStore.AUTHORITY, operations).size - if (resultSize == 0) { - didUpdateFile = false - activity.rescanPaths(paths) - } - - activity.toast(if (didUpdateFile) R.string.dates_fixed_successfully else R.string.unknown_error_occurred) - activity.runOnUiThread { - listener?.refreshItems() - finishActMode() - } - } catch (e: Exception) { - activity.showErrorToast(e) - } - }.start() + activity.fixDateTaken(getSelectedPaths()) { + listener?.refreshItems() + finishActMode() + } } private fun checkDeleteConfirmation() { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Activity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Activity.kt index a8103b206..bf9a17437 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Activity.kt @@ -1,9 +1,12 @@ package com.simplemobiletools.gallery.pro.extensions import android.app.Activity +import android.content.ContentProviderOperation import android.content.Intent +import android.media.ExifInterface import android.provider.MediaStore import android.util.DisplayMetrics +import android.util.Log import android.view.View import androidx.appcompat.app.AppCompatActivity import com.simplemobiletools.commons.activities.BaseSimpleActivity @@ -22,6 +25,7 @@ import com.simplemobiletools.gallery.pro.interfaces.MediumDao import java.io.File import java.io.InputStream import java.io.OutputStream +import java.text.SimpleDateFormat import java.util.* fun Activity.sharePath(path: String) { @@ -257,6 +261,8 @@ fun BaseSimpleActivity.restoreRecycleBinPaths(paths: ArrayList, mediumDa runOnUiThread { callback() } + + fixDateTaken(paths) }.start() } @@ -305,3 +311,58 @@ fun Activity.hasNavBar(): Boolean { return (realDisplayMetrics.widthPixels - displayMetrics.widthPixels > 0) || (realDisplayMetrics.heightPixels - displayMetrics.heightPixels > 0) } + +fun Activity.fixDateTaken(paths: ArrayList, callback: (() -> Unit)? = null) { + val BATCH_SIZE = 50 + toast(R.string.fixing) + Thread { + try { + var didUpdateFile = false + val operations = ArrayList() + val mediumDao = galleryDB.MediumDao() + for (path in paths) { + val dateTime = ExifInterface(path).getAttribute(ExifInterface.TAG_DATETIME_ORIGINAL) + ?: ExifInterface(path).getAttribute(ExifInterface.TAG_DATETIME) ?: continue + + // some formats contain a "T" in the middle, some don't + // sample dates: 2015-07-26T14:55:23, 2018:09:05 15:09:05 + val t = if (dateTime.substring(10, 11) == "T") "\'T\'" else " " + val separator = dateTime.substring(4, 5) + val format = "yyyy${separator}MM${separator}dd${t}kk:mm:ss" + val formatter = SimpleDateFormat(format, Locale.getDefault()) + val timestamp = formatter.parse(dateTime).time + + val uri = getFileUri(path) + ContentProviderOperation.newUpdate(uri).apply { + val selection = "${MediaStore.Images.Media.DATA} = ?" + val selectionArgs = arrayOf(path) + withSelection(selection, selectionArgs) + withValue(MediaStore.Images.Media.DATE_TAKEN, timestamp) + operations.add(build()) + } + + if (operations.size % BATCH_SIZE == 0) { + contentResolver.applyBatch(MediaStore.AUTHORITY, operations) + operations.clear() + } + + Log.e("DEBUG", "restoring $path") + mediumDao.updateFavoriteDateTaken(path, timestamp) + didUpdateFile = true + } + + val resultSize = contentResolver.applyBatch(MediaStore.AUTHORITY, operations).size + if (resultSize == 0) { + didUpdateFile = false + rescanPaths(paths) + } + + toast(if (didUpdateFile) R.string.dates_fixed_successfully else R.string.unknown_error_occurred) + runOnUiThread { + callback?.invoke() + } + } catch (e: Exception) { + showErrorToast(e) + } + }.start() +} From 84ebb59482e5a4bbc1a52fa0fc8858def8840031 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 12 Jan 2019 15:44:04 +0100 Subject: [PATCH 25/75] restore proper file paths --- .../gallery/pro/adapters/MediaAdapter.kt | 10 ++- .../gallery/pro/extensions/Activity.kt | 88 +++++++++---------- 2 files changed, 49 insertions(+), 49 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/MediaAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/MediaAdapter.kt index 606cfd2a4..de3601c4c 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/MediaAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/MediaAdapter.kt @@ -307,10 +307,12 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList Unit) fun BaseSimpleActivity.restoreRecycleBinPaths(paths: ArrayList, mediumDao: MediumDao = galleryDB.MediumDao(), callback: () -> Unit) { Thread { + val newPaths = ArrayList() paths.forEach { val source = it val destination = it.removePrefix(recycleBinPath) @@ -250,6 +250,7 @@ fun BaseSimpleActivity.restoreRecycleBinPaths(paths: ArrayList, mediumDa if (File(source).length() == File(destination).length()) { mediumDao.updateDeleted(destination.removePrefix(recycleBinPath), 0, "$RECYCLE_BIN$destination") } + newPaths.add(destination) } catch (e: Exception) { showErrorToast(e) } finally { @@ -262,7 +263,7 @@ fun BaseSimpleActivity.restoreRecycleBinPaths(paths: ArrayList, mediumDa callback() } - fixDateTaken(paths) + fixDateTaken(newPaths) }.start() } @@ -315,54 +316,51 @@ fun Activity.hasNavBar(): Boolean { fun Activity.fixDateTaken(paths: ArrayList, callback: (() -> Unit)? = null) { val BATCH_SIZE = 50 toast(R.string.fixing) - Thread { - try { - var didUpdateFile = false - val operations = ArrayList() - val mediumDao = galleryDB.MediumDao() - for (path in paths) { - val dateTime = ExifInterface(path).getAttribute(ExifInterface.TAG_DATETIME_ORIGINAL) - ?: ExifInterface(path).getAttribute(ExifInterface.TAG_DATETIME) ?: continue + try { + var didUpdateFile = false + val operations = ArrayList() + val mediumDao = galleryDB.MediumDao() + for (path in paths) { + val dateTime = ExifInterface(path).getAttribute(ExifInterface.TAG_DATETIME_ORIGINAL) + ?: ExifInterface(path).getAttribute(ExifInterface.TAG_DATETIME) ?: continue - // some formats contain a "T" in the middle, some don't - // sample dates: 2015-07-26T14:55:23, 2018:09:05 15:09:05 - val t = if (dateTime.substring(10, 11) == "T") "\'T\'" else " " - val separator = dateTime.substring(4, 5) - val format = "yyyy${separator}MM${separator}dd${t}kk:mm:ss" - val formatter = SimpleDateFormat(format, Locale.getDefault()) - val timestamp = formatter.parse(dateTime).time + // some formats contain a "T" in the middle, some don't + // sample dates: 2015-07-26T14:55:23, 2018:09:05 15:09:05 + val t = if (dateTime.substring(10, 11) == "T") "\'T\'" else " " + val separator = dateTime.substring(4, 5) + val format = "yyyy${separator}MM${separator}dd${t}kk:mm:ss" + val formatter = SimpleDateFormat(format, Locale.getDefault()) + val timestamp = formatter.parse(dateTime).time - val uri = getFileUri(path) - ContentProviderOperation.newUpdate(uri).apply { - val selection = "${MediaStore.Images.Media.DATA} = ?" - val selectionArgs = arrayOf(path) - withSelection(selection, selectionArgs) - withValue(MediaStore.Images.Media.DATE_TAKEN, timestamp) - operations.add(build()) - } - - if (operations.size % BATCH_SIZE == 0) { - contentResolver.applyBatch(MediaStore.AUTHORITY, operations) - operations.clear() - } - - Log.e("DEBUG", "restoring $path") - mediumDao.updateFavoriteDateTaken(path, timestamp) - didUpdateFile = true + val uri = getFileUri(path) + ContentProviderOperation.newUpdate(uri).apply { + val selection = "${MediaStore.Images.Media.DATA} = ?" + val selectionArgs = arrayOf(path) + withSelection(selection, selectionArgs) + withValue(MediaStore.Images.Media.DATE_TAKEN, timestamp) + operations.add(build()) } - val resultSize = contentResolver.applyBatch(MediaStore.AUTHORITY, operations).size - if (resultSize == 0) { - didUpdateFile = false - rescanPaths(paths) + if (operations.size % BATCH_SIZE == 0) { + contentResolver.applyBatch(MediaStore.AUTHORITY, operations) + operations.clear() } - toast(if (didUpdateFile) R.string.dates_fixed_successfully else R.string.unknown_error_occurred) - runOnUiThread { - callback?.invoke() - } - } catch (e: Exception) { - showErrorToast(e) + mediumDao.updateFavoriteDateTaken(path, timestamp) + didUpdateFile = true } - }.start() + + val resultSize = contentResolver.applyBatch(MediaStore.AUTHORITY, operations).size + if (resultSize == 0) { + didUpdateFile = false + rescanPaths(paths) + } + + toast(if (didUpdateFile) R.string.dates_fixed_successfully else R.string.unknown_error_occurred) + runOnUiThread { + callback?.invoke() + } + } catch (e: Exception) { + showErrorToast(e) + } } From 212af3f6dcd4d935fbecda1ec55e5a38447cc49f Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 12 Jan 2019 16:26:09 +0100 Subject: [PATCH 26/75] force an editor app chooser at pressing Edit at the editor --- app/build.gradle | 2 +- .../simplemobiletools/gallery/pro/activities/EditActivity.kt | 2 +- .../com/simplemobiletools/gallery/pro/extensions/Activity.kt | 4 ++-- app/src/main/res/values-ar/strings.xml | 1 - app/src/main/res/values-az/strings.xml | 1 - app/src/main/res/values-ca/strings.xml | 1 - app/src/main/res/values-cs/strings.xml | 1 - app/src/main/res/values-da/strings.xml | 1 - app/src/main/res/values-de/strings.xml | 1 - app/src/main/res/values-el/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-gl/strings.xml | 1 - app/src/main/res/values-hr/strings.xml | 1 - app/src/main/res/values-hu/strings.xml | 1 - app/src/main/res/values-id/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-ko-rKR/strings.xml | 1 - app/src/main/res/values-lt/strings.xml | 1 - app/src/main/res/values-nb/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-sl/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-uk/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 - 35 files changed, 4 insertions(+), 36 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index c1b8df75a..8e1c23607 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -57,7 +57,7 @@ android { } dependencies { - implementation 'com.simplemobiletools:commons:5.6.6' + implementation 'com.simplemobiletools:commons:5.6.7' implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0' implementation 'androidx.multidex:multidex:2.0.1' implementation 'it.sephiroth.android.exif:library:1.0.1' diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt index f665296be..64784c34c 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt @@ -633,7 +633,7 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener } private fun editWith() { - openEditor(uri.toString()) + openEditor(uri.toString(), true) isEditingWithThirdParty = true } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Activity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Activity.kt index 8e767320e..c09eab78b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Activity.kt @@ -51,8 +51,8 @@ fun Activity.openPath(path: String, forceChooser: Boolean) { openPathIntent(path, forceChooser, BuildConfig.APPLICATION_ID) } -fun Activity.openEditor(path: String) { - openEditorIntent(path, BuildConfig.APPLICATION_ID) +fun Activity.openEditor(path: String, forceChooser: Boolean = false) { + openEditorIntent(path, forceChooser, BuildConfig.APPLICATION_ID) } fun Activity.launchCamera() { diff --git a/app/src/main/res/values-ar/strings.xml b/app/src/main/res/values-ar/strings.xml index 5539e8daa..32abae374 100644 --- a/app/src/main/res/values-ar/strings.xml +++ b/app/src/main/res/values-ar/strings.xml @@ -91,7 +91,6 @@ قلب قلب أفقيا قلب عموديا - تعديل باستخدام Free Other diff --git a/app/src/main/res/values-az/strings.xml b/app/src/main/res/values-az/strings.xml index 5d0127a54..3bdaebe63 100644 --- a/app/src/main/res/values-az/strings.xml +++ b/app/src/main/res/values-az/strings.xml @@ -87,7 +87,6 @@ Flip Flip horizontally Flip vertically - Edit with Free Other diff --git a/app/src/main/res/values-ca/strings.xml b/app/src/main/res/values-ca/strings.xml index 5aecb3b14..0d0b95fca 100644 --- a/app/src/main/res/values-ca/strings.xml +++ b/app/src/main/res/values-ca/strings.xml @@ -87,7 +87,6 @@ Girar Horizontalment Verticalment - Editar amb Lliure Altres diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index 5b5a6c2ea..95e4d8461 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -87,7 +87,6 @@ Překlopit Překlopit vodorovně Překlopit svisle - Upravit s Volný Other diff --git a/app/src/main/res/values-da/strings.xml b/app/src/main/res/values-da/strings.xml index c62cf2f59..563dc982c 100644 --- a/app/src/main/res/values-da/strings.xml +++ b/app/src/main/res/values-da/strings.xml @@ -87,7 +87,6 @@ Spejlvend Spejlvend vandret Spejlvend lodret - Rediger med Fri Andet diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 126a75875..10ada1d9e 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -87,7 +87,6 @@ Spiegeln Horizontal spiegeln Vertikal spiegeln - Bearbeiten mit: Beliebiges Anderes diff --git a/app/src/main/res/values-el/strings.xml b/app/src/main/res/values-el/strings.xml index 548e81e92..d16504c99 100644 --- a/app/src/main/res/values-el/strings.xml +++ b/app/src/main/res/values-el/strings.xml @@ -87,7 +87,6 @@ Αναποδογύρισμα Οριζόντιο αναποδογύρισμα Κατακόρυφο αναποδογύρισμα - Επεξεργασία με Ελεύθερο Other diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index e8fd073d5..447cf75d3 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -87,7 +87,6 @@ Girar Horizontalmente Verticalmente - Editar con Libre Otros diff --git a/app/src/main/res/values-fi/strings.xml b/app/src/main/res/values-fi/strings.xml index 493216b5b..7797ad5b3 100644 --- a/app/src/main/res/values-fi/strings.xml +++ b/app/src/main/res/values-fi/strings.xml @@ -87,7 +87,6 @@ Pyöräytä Pyöräytä vaakasuoraan Pyöräytä pystysuoraan - Muokkaa sovelluksella Free Other diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index c959b4bd9..4cfead64c 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -87,7 +87,6 @@ Retourner Retourner horizontalement Retourner verticalement - Modifier avec Libre Other diff --git a/app/src/main/res/values-gl/strings.xml b/app/src/main/res/values-gl/strings.xml index 447df0d6f..ae37ddc62 100644 --- a/app/src/main/res/values-gl/strings.xml +++ b/app/src/main/res/values-gl/strings.xml @@ -87,7 +87,6 @@ Voltear Voltear horizontalmente Voltear verticalmente - Editar con Free Other diff --git a/app/src/main/res/values-hr/strings.xml b/app/src/main/res/values-hr/strings.xml index 743618779..f0506cfc5 100644 --- a/app/src/main/res/values-hr/strings.xml +++ b/app/src/main/res/values-hr/strings.xml @@ -87,7 +87,6 @@ Okreni Okreni horizontalno Okreni vertikalno - Uredi pomoću Slobodan odabir Ostalo diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index ae5fd9159..94dfdbcea 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -87,7 +87,6 @@ Tükrözés Tükrözés vízszintesen Tükrözés függőlegesen - Szerkesztés ezzel Kötetlen Egyéb diff --git a/app/src/main/res/values-id/strings.xml b/app/src/main/res/values-id/strings.xml index 04cfb8b77..a55722a1f 100644 --- a/app/src/main/res/values-id/strings.xml +++ b/app/src/main/res/values-id/strings.xml @@ -87,7 +87,6 @@ Balik Balik horizontal Balik vertikal - Edit dengan Bebas Lainnya diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 84f82b05b..f270482ff 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -87,7 +87,6 @@ Capovolgi Capovolgi orizzontalmente Capovolgi verticalmente - Modifica con Libero Altro diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 8a0afae34..99bd75f9b 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -87,7 +87,6 @@ 反転 水平方向に反転 垂直方向に反転 - 他のアプリで編集 Free Other diff --git a/app/src/main/res/values-ko-rKR/strings.xml b/app/src/main/res/values-ko-rKR/strings.xml index 215adb08d..5a59f85bc 100644 --- a/app/src/main/res/values-ko-rKR/strings.xml +++ b/app/src/main/res/values-ko-rKR/strings.xml @@ -87,7 +87,6 @@ 반전 가로 반전 세로 반전 - 이미지편집 프로그램 연결 Free Other diff --git a/app/src/main/res/values-lt/strings.xml b/app/src/main/res/values-lt/strings.xml index ff5b194f4..d0f476c46 100644 --- a/app/src/main/res/values-lt/strings.xml +++ b/app/src/main/res/values-lt/strings.xml @@ -87,7 +87,6 @@ Apversti Apversti horizontaliai Apversti vertikaliai - Redaguoti su Free Other diff --git a/app/src/main/res/values-nb/strings.xml b/app/src/main/res/values-nb/strings.xml index 68fa4c2fa..5074b2de6 100644 --- a/app/src/main/res/values-nb/strings.xml +++ b/app/src/main/res/values-nb/strings.xml @@ -87,7 +87,6 @@ Speilvend Speilvend horisontalt Speilvend vertikalt - Rediger med Fri Annen diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index 2e31c9414..5ec563bd8 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -87,7 +87,6 @@ Kantelen Horizontaal kantelen Verticaal kantelen - Bewerken met Vrij Anders diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index e8476b18f..95f49e24c 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -87,7 +87,6 @@ Przewróć Przewróć w poziomie Przewróć w pionie - Edytuj w: Wolne Inny diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index d8a851774..6d8e9f2a2 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -87,7 +87,6 @@ Inverter Horizontalmente Verticalmente - Editar com Free Other diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index 75d6606f4..53e07cc76 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -87,7 +87,6 @@ Inverter Horizontalmente Verticalmente - Editar com Livre Outro diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 2efd74004..3b2ffee29 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -87,7 +87,6 @@ Отразить По горизонтали По вертикали - Редактировать в… Произвольно Другое diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index 4cda1a495..74525c719 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -87,7 +87,6 @@ Preklopiť Preklopiť vodorovne Preklopiť zvisle - Upraviť s Voľný Iný diff --git a/app/src/main/res/values-sl/strings.xml b/app/src/main/res/values-sl/strings.xml index e464954c2..fbac0d951 100644 --- a/app/src/main/res/values-sl/strings.xml +++ b/app/src/main/res/values-sl/strings.xml @@ -87,7 +87,6 @@ Zrcaljenje Zrcali horizontalno Zrcali vertikalno - Uredi z Prosto Drugo diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index ca7384748..0df7472c6 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -87,7 +87,6 @@ Vänd Vänd horisontellt Vänd vertikalt - Redigera med Fritt Other diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index c37323182..3c3117768 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -87,7 +87,6 @@ Çevir Yatay olarak çevir Dikey olarak çevir - Şununla düzenle Serbest Other diff --git a/app/src/main/res/values-uk/strings.xml b/app/src/main/res/values-uk/strings.xml index 0db30482d..d74d51e0b 100644 --- a/app/src/main/res/values-uk/strings.xml +++ b/app/src/main/res/values-uk/strings.xml @@ -87,7 +87,6 @@ Віддзеркалити Віддзеркалити горизонтально Віддзеркалити вертикально - Редагувати за допомогою Вільне Інше diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index ccefe19ab..42dd3cf22 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -87,7 +87,6 @@ 翻转 水平翻转 垂直翻转 - 编辑方式 自由 其他 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index fe66f62b5..0d86c7021 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -87,7 +87,6 @@ 翻轉 水平翻轉 垂直翻轉 - 用其他程式編輯 自由 其它 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 0439c91dc..f2ebe7283 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -87,7 +87,6 @@ Flip Flip horizontally Flip vertically - Edit with Free Other From 8f3ddfffa9535b836770f9c6607cc13b4856fa96 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 12 Jan 2019 17:08:53 +0100 Subject: [PATCH 27/75] adding a Draw bottom action at the editor --- .../gallery/pro/activities/EditActivity.kt | 18 +++++++++++++++++- app/src/main/res/drawable-hdpi/ic_draw.png | Bin 0 -> 464 bytes app/src/main/res/drawable-xhdpi/ic_draw.png | Bin 0 -> 601 bytes app/src/main/res/drawable-xxhdpi/ic_draw.png | Bin 0 -> 867 bytes app/src/main/res/drawable-xxxhdpi/ic_draw.png | Bin 0 -> 1160 bytes .../layout/bottom_editor_primary_actions.xml | 16 +++++++++++++--- 6 files changed, 30 insertions(+), 4 deletions(-) create mode 100644 app/src/main/res/drawable-hdpi/ic_draw.png create mode 100644 app/src/main/res/drawable-xhdpi/ic_draw.png create mode 100644 app/src/main/res/drawable-xxhdpi/ic_draw.png create mode 100644 app/src/main/res/drawable-xxxhdpi/ic_draw.png diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt index 64784c34c..e0f76780f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt @@ -63,6 +63,7 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener private val PRIMARY_ACTION_NONE = 0 private val PRIMARY_ACTION_FILTER = 1 private val PRIMARY_ACTION_CROP_ROTATE = 2 + private val PRIMARY_ACTION_DRAW = 3 private val CROP_ROTATE_NONE = 0 private val CROP_ROTATE_ASPECT_RATIO = 1 @@ -208,6 +209,7 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener if (isCropIntent) { bottom_primary_filter.beGone() + bottom_primary_draw.beGone() } return false @@ -287,6 +289,10 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener bottom_primary_crop_rotate.setOnClickListener { bottomCropRotateClicked() } + + bottom_primary_draw.setOnClickListener { + bottomDrawClicked() + } } private fun bottomFilterClicked() { @@ -307,6 +313,15 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener updatePrimaryActionButtons() } + private fun bottomDrawClicked() { + currPrimaryAction = if (currPrimaryAction == PRIMARY_ACTION_DRAW) { + PRIMARY_ACTION_NONE + } else { + PRIMARY_ACTION_DRAW + } + updatePrimaryActionButtons() + } + private fun setupCropRotateActionButtons() { bottom_rotate.setOnClickListener { crop_image_view.rotateImage(90) @@ -375,13 +390,14 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener loadDefaultImageView() } - arrayOf(bottom_primary_filter, bottom_primary_crop_rotate).forEach { + arrayOf(bottom_primary_filter, bottom_primary_crop_rotate, bottom_primary_draw).forEach { it.applyColorFilter(Color.WHITE) } val currentPrimaryActionButton = when (currPrimaryAction) { PRIMARY_ACTION_FILTER -> bottom_primary_filter PRIMARY_ACTION_CROP_ROTATE -> bottom_primary_crop_rotate + PRIMARY_ACTION_DRAW -> bottom_primary_draw else -> null } diff --git a/app/src/main/res/drawable-hdpi/ic_draw.png b/app/src/main/res/drawable-hdpi/ic_draw.png new file mode 100644 index 0000000000000000000000000000000000000000..b2c5131749923a85998f1113e04d50b0b75ba13a GIT binary patch literal 464 zcmV;>0WbcEP)D~V1kq_u^M#KdsoG*a9m!3gAv zMS?trX66quxs9~? zJ*6#pbKmb3q9tgu1#2rT|J0!q8Bp(hgXO~WRdIcSBz zYMc}y6D|PmFfl5snmdXib9D^(gzVMjB^Bejg1d?4j>^dRsL@?TZj#s>wBs!ju%S%I zR+6v_c}s3{Fa!zIkZ_)VeW#H*sE-SQL&#aGMnzWhL?`~$#T+E!A##U0WC^fq!fd`H zE_x}A8OUYQo6!atYyOdsAxvZpxy%F|!7pgFb|9rJG(<;^{&O53Sm@BUzoI$ad5R3R z(6JDA*NJDLBMr~on#p3}Aqxi(7wbqJ=@ZBnvO*ENq3-4=vy*7UGG zYBYJ*`cXE=s*$L7Y?R4;QmVC9l*Lmjxhu+HEfZAoTa?8XGKjC8CJm3$WDt*A#D-F@ zD3dK*Q5+wXK8o_$L6dYzluu8o#;Q>^HzM5;DTO5*>>78t!!gluw$&{4vuLD(W4x;d zsh@44WBewy*g9roB_ATC24_b5IRfeVn2n>1S6Q0_qrLno)mS-FI7zeW{*CsrAJW~C z!ciKLYCPo*_vnjsc(jLirKy(5yY|wG^qV!KU~xZ6FUI^?N{e($-nD@VNFQ4)QrKM@ z7W3zHsloD5u$rMruUI%{V{t9gAr4e5QH=+sSE67cza#x%kx1cSj~bwYsK%SpMN#l7 z(qER1f`y%DkkqLFPL5ezg*4KNQLw4Mqz(q~h;(O!>$FKtc8h{N%%HOY951yPYId1r z+p7Ni-~6Olq8dw^q>@LXU=h8{uBYpyhG-9`A*Dz2sVk7`Ty7!TN&TXI+-!C&uE{5s zG)bCZyW-x((g)FAPWG=RGP70iZWP3txBfbFv{T!EmCT7T$IOI+RSd81EO5E n@QB|`H`x2GwRCjrw!qB<9q^6g?R$W%00000NkvXXu0mjfQFCd@0SkkS1~iOYs!0f2CO!(onY46x@dEYiZVm)R)yY1!eq?>lMukoX+x^hGVgA z(X7M*48Yn{vl0(ub=9oIF8B`DtV1IMvHqc4X|OQ6a2yw~A8SyhV&gu1n`Hgi8Oz=(94ABOv$QI@d;rgIo;h1*@FPr-^vgBV|Ala2KNxwo~7mC zHHSNw5UgrOF+fVLjljzdrbW zqE1P$IEP^M;!AfZ8yteQy}7Kl#n*|}BuPC)J2Fx>xCp~-7@y)Bz>;3W_v06`q-<~p zu0cxRCVZpWP!5*ocYxvsbQ!KOnt>AuJ3tPOW)u`ZpyRRD*AyH_fbXVcl`VciTVnml zPCQK58^Dqq|}a(!4s2LEF9VyToXuSNOe z3dZ64oh4ykSG# zbDu}C4pZqdDpd_wp7FRwQLj>?Db?GAO1{8)NTo*^0j_s64K=)i6|jn;Ku4_S*@r7> zi|?gb{_k&$WHCj9^~lEliVkm+$vuh^3)7i&UZ+CQVj0?!+$3(GT+yS2r~^Z=Ntwg%%;}C|u~;k? zi^XF3U_!R!2Hv6v_?lCgR;7bQcp2ACw8(!)~HVezx}W@GmD{AIU$QNEkE7FKkFSd&w`f@(N*`Dc{h{^SJ)xd_Ko@ll(&ik22UD zOd>H6NwPgAA5p{oWUzl`KJ}69KKY3%?gRjK)&H0q*Y)xhm0U}j?Uli`xQ>>;C}VMD zFf%D!YpXO+#&cN4R%u{+ERU-+Fe^P+)>kQ@l6SFuLb*x-dtqBmd836%nVW@Kc*L6= zJ(FwhrV%xY9=WN<&0-x*gqFc~NC3qihQ7iv^&tcPtY4T*8Mi8Q%< z#=I&fy7?vi_@s<2`IY=6Sxd#kg;>64JO!ejn+YSqLMjes!nU0PF#)d;)(?!YV&E1m z?@^%u%**!_;t9$WHDvL7}!$)VK-4R7kdAIDUwDq%sYbKN(vlHfFdsQXdo66L^exQ^%G>|Y^ETK%|IFh1H|#P&Ut zDiD)%2)FSmc`Bs9yHeCTJ^3MQzcQ0dw6nQAv7$YJRdBsvOc7g(#bjV=?j#9N{1ey& z*JT=nEy8Sg(7?$gDNr;e@(c~Yx}>mOCkIRM8MY#wz+$*ARt77Q#`X#|My97>WKUpv zT(9bXEKfhSFB#kE#%E(I>It-A`8QSBjTE+CW^uM_uOtErkC$=%%6Ytj$zCPpA{ea` zIFPUoP!^7$5T_YQ93C?e&IQWCstoN}cB2nhTXB~YZTC{)>^1*HkX}w>Qi*YK^(ZP# zN-z0&nkHr841!$2c={KM<9b`sVPEp`JdMi2jHI#r$>z#nM_e~5N}NV6FVZ3h*J4R9 zzXsqcdlZc1DcnM<9CVSuvR+oi{fujQMU5qR3Cnk^DHFS3Il*ait~3oQ2A1YJ`UeEs z1MEtt0`MfRH>lJgoNj-z7Y*$!%)%_hL>dweq;ak8bh$rp9k0>HT)6&la$l`cOV#lUyZ-8lK0pzkI+7xW1uwz*4|fSpK9nEm?e^`+e`S^`J-(Mm2l#yZPW8!xSnFG_nR)@G{?!CdE74$WGL0m}0S5EEbE! aVt)b9-F*&;Q?K;^0000 @@ -28,9 +27,20 @@ android:padding="@dimen/normal_margin" android:src="@drawable/ic_crop_rotate" app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintHorizontal_bias="0.5" + app:layout_constraintEnd_toStartOf="@+id/bottom_primary_draw" app:layout_constraintStart_toEndOf="@+id/bottom_primary_filter" app:layout_constraintTop_toTopOf="parent"/> + + From c44a884a952f3a8d62bf194f678bbbff30b475c1 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 12 Jan 2019 17:34:00 +0100 Subject: [PATCH 28/75] show the editor draw canvas only when appropriate --- .../gallery/pro/activities/EditActivity.kt | 10 ++++++++++ .../gallery/pro/views/EditorDrawCanvas.kt | 9 +++++++++ app/src/main/res/layout/activity_edit.xml | 9 +++++++++ 3 files changed, 28 insertions(+) create mode 100644 app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/EditorDrawCanvas.kt diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt index e0f76780f..a791a634a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt @@ -180,6 +180,7 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener private fun loadDefaultImageView() { default_image_view.beVisible() crop_image_view.beGone() + editor_draw_canvas.beGone() val options = RequestOptions() .skipMemoryCache(true) @@ -219,6 +220,7 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener private fun loadCropImageView() { default_image_view.beGone() + editor_draw_canvas.beGone() crop_image_view.apply { beVisible() setOnCropImageCompleteListener(this@EditActivity) @@ -233,6 +235,12 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener } } + private fun loadDrawCanvas() { + default_image_view.beGone() + crop_image_view.beGone() + editor_draw_canvas.beVisible() + } + @TargetApi(Build.VERSION_CODES.N) private fun saveImage() { var inputStream: InputStream? = null @@ -388,6 +396,8 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener loadCropImageView() } else if (default_image_view.isGone() && currPrimaryAction == PRIMARY_ACTION_FILTER) { loadDefaultImageView() + } else if (editor_draw_canvas.isGone() && currPrimaryAction == PRIMARY_ACTION_DRAW) { + loadDrawCanvas() } arrayOf(bottom_primary_filter, bottom_primary_crop_rotate, bottom_primary_draw).forEach { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/EditorDrawCanvas.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/EditorDrawCanvas.kt new file mode 100644 index 000000000..9fd6014e3 --- /dev/null +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/EditorDrawCanvas.kt @@ -0,0 +1,9 @@ +package com.simplemobiletools.gallery.pro.views + +import android.content.Context +import android.util.AttributeSet +import android.view.View + +class EditorDrawCanvas(context: Context, attrs: AttributeSet) : View(context, attrs) { + +} diff --git a/app/src/main/res/layout/activity_edit.xml b/app/src/main/res/layout/activity_edit.xml index b6db534a7..6a675d81c 100644 --- a/app/src/main/res/layout/activity_edit.xml +++ b/app/src/main/res/layout/activity_edit.xml @@ -23,6 +23,15 @@ app:cropBackgroundColor="@color/crop_image_view_background" app:cropInitialCropWindowPaddingRatio="0"/> + + Date: Sat, 12 Jan 2019 17:52:01 +0100 Subject: [PATCH 29/75] add background bitmap loading at the editor draw canvas --- .../gallery/pro/activities/EditActivity.kt | 37 ++++++++++++++++--- .../gallery/pro/views/EditorDrawCanvas.kt | 17 +++++++++ 2 files changed, 48 insertions(+), 6 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt index a791a634a..09f43c482 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt @@ -18,6 +18,7 @@ import android.widget.RelativeLayout import androidx.recyclerview.widget.LinearLayoutManager import com.bumptech.glide.Glide 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.request.RequestListener @@ -79,8 +80,7 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener private var isCropIntent = false private var isEditingWithThirdParty = false private var oldExif: ExifInterface? = null - - private var initialBitmap: Bitmap? = null + private var filterInitialBitmap: Bitmap? = null override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -195,17 +195,17 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener override fun onResourceReady(bitmap: Bitmap?, model: Any?, target: Target?, dataSource: DataSource?, isFirstResource: Boolean): Boolean { val currentFilter = getFiltersAdapter()?.getCurrentFilter() - if (initialBitmap == null) { + if (filterInitialBitmap == null) { loadCropImageView() bottomCropRotateClicked() } - if (initialBitmap != null && currentFilter != null && currentFilter.filter.name != getString(R.string.none)) { + if (filterInitialBitmap != null && currentFilter != null && currentFilter.filter.name != getString(R.string.none)) { default_image_view.onGlobalLayout { applyFilter(currentFilter) } } else { - initialBitmap = bitmap + filterInitialBitmap = bitmap } if (isCropIntent) { @@ -239,6 +239,31 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener default_image_view.beGone() crop_image_view.beGone() editor_draw_canvas.beVisible() + + Thread { + val size = Point() + windowManager.defaultDisplay.getSize(size) + val options = RequestOptions() + .format(DecodeFormat.PREFER_ARGB_8888) + .skipMemoryCache(true) + .diskCacheStrategy(DiskCacheStrategy.NONE) + .fitCenter() + + try { + val builder = Glide.with(applicationContext) + .asBitmap() + .load(uri) + .apply(options) + .into(size.x, size.y) + + val bitmap = builder.get() + runOnUiThread { + editor_draw_canvas.updateBackgroundBitmap(bitmap) + } + } catch (e: Exception) { + showErrorToast(e) + } + }.start() } @TargetApi(Build.VERSION_CODES.N) @@ -462,7 +487,7 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener } private fun applyFilter(filterItem: FilterItem) { - val newBitmap = Bitmap.createBitmap(initialBitmap) + val newBitmap = Bitmap.createBitmap(filterInitialBitmap) default_image_view.setImageBitmap(filterItem.filter.processFilter(newBitmap)) } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/EditorDrawCanvas.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/EditorDrawCanvas.kt index 9fd6014e3..9619e24bc 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/EditorDrawCanvas.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/EditorDrawCanvas.kt @@ -1,9 +1,26 @@ package com.simplemobiletools.gallery.pro.views import android.content.Context +import android.graphics.Bitmap +import android.graphics.Canvas import android.util.AttributeSet import android.view.View class EditorDrawCanvas(context: Context, attrs: AttributeSet) : View(context, attrs) { + private var backgroundBitmap: Bitmap? = null + override fun onDraw(canvas: Canvas) { + super.onDraw(canvas) + + if (backgroundBitmap != null) { + val left = (width - backgroundBitmap!!.width) / 2 + val top = (height - backgroundBitmap!!.height) / 2 + canvas.drawBitmap(backgroundBitmap, left.toFloat(), top.toFloat(), null) + } + } + + fun updateBackgroundBitmap(bitmap: Bitmap) { + backgroundBitmap = bitmap + invalidate() + } } From f9f247ecaf9b04fa47033f1fb6d4198931ddc4da Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 12 Jan 2019 17:55:38 +0100 Subject: [PATCH 30/75] save and restore canvas around drawing the background --- .../simplemobiletools/gallery/pro/views/EditorDrawCanvas.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/EditorDrawCanvas.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/EditorDrawCanvas.kt index 9619e24bc..9de902b29 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/EditorDrawCanvas.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/EditorDrawCanvas.kt @@ -11,12 +11,15 @@ class EditorDrawCanvas(context: Context, attrs: AttributeSet) : View(context, at override fun onDraw(canvas: Canvas) { super.onDraw(canvas) + canvas.save() if (backgroundBitmap != null) { val left = (width - backgroundBitmap!!.width) / 2 val top = (height - backgroundBitmap!!.height) / 2 canvas.drawBitmap(backgroundBitmap, left.toFloat(), top.toFloat(), null) } + + canvas.restore() } fun updateBackgroundBitmap(bitmap: Bitmap) { From 731cac7ef417fcc175a1d949c63316c713dc18e1 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 12 Jan 2019 18:47:38 +0100 Subject: [PATCH 31/75] removing an unused faq item --- .../com/simplemobiletools/gallery/pro/views/EditorDrawCanvas.kt | 2 +- app/src/main/res/values-ar/strings.xml | 2 -- app/src/main/res/values-az/strings.xml | 2 -- app/src/main/res/values-ca/strings.xml | 2 -- app/src/main/res/values-cs/strings.xml | 2 -- app/src/main/res/values-da/strings.xml | 2 -- app/src/main/res/values-de/strings.xml | 2 -- app/src/main/res/values-el/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-gl/strings.xml | 2 -- app/src/main/res/values-hr/strings.xml | 2 -- app/src/main/res/values-hu/strings.xml | 2 -- app/src/main/res/values-id/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-ko-rKR/strings.xml | 2 -- app/src/main/res/values-lt/strings.xml | 2 -- app/src/main/res/values-nb/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-sl/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-uk/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 -- 33 files changed, 1 insertion(+), 65 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/EditorDrawCanvas.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/EditorDrawCanvas.kt index 9de902b29..c409de011 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/EditorDrawCanvas.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/EditorDrawCanvas.kt @@ -16,7 +16,7 @@ class EditorDrawCanvas(context: Context, attrs: AttributeSet) : View(context, at if (backgroundBitmap != null) { val left = (width - backgroundBitmap!!.width) / 2 val top = (height - backgroundBitmap!!.height) / 2 - canvas.drawBitmap(backgroundBitmap, left.toFloat(), top.toFloat(), null) + canvas.drawBitmap(backgroundBitmap!!, left.toFloat(), top.toFloat(), null) } canvas.restore() diff --git a/app/src/main/res/values-ar/strings.xml b/app/src/main/res/values-ar/strings.xml index 32abae374..fb5b1c36e 100644 --- a/app/src/main/res/values-ar/strings.xml +++ b/app/src/main/res/values-ar/strings.xml @@ -205,8 +205,6 @@ يمكن أن يكون ذلك لأسباب متعددة ، ولكن حلها أمر سهل. أذهب إلى الإعدادات -> إدارة المجلدات المضمنة ، اضغط علامة الزائد وانتقل إلى المجلد المطلوب. ماذا لو كنت أرغب في رؤية بعض المجلدات الخاصة؟ لا يؤدي إضافة مجلد في \"المجلدات المضمنة\" إلى استبعاد أي شيء تلقائيًا. ما يمكنك فعله هو الذهاب إلى الإعدادات -> إدارة المجلدات المستبعدة ، واستبعاد المجلد الجذر \"/\" ، ثم إضافة المجلدات المطلوبة في الإعدادات -> إدارة المجلدات المضمنة. سيؤدي ذلك إلى إظهار المجلدات المحددة فقط ، حيث أن الاستبعاد والتضمين يكونان متكررين ، وإذا تم استبعاد أحد المجلدات وإدراجه ، فسيظهر. - الصور بملء الشاشة لها آثار غريبة ، هل يمكنني تحسين الجودة؟ - نعم ، هناك تبديل في الإعدادات يقول \"استبدل صورًا ذات زووم عميق بجودة أفضل منها\" ، يمكنك استخدام ذلك. سيؤدي ذلك إلى تحسين جودة الصور ، ولكن ستظهر بشكل واضح عند محاولة التكبير كثيرًا. هل يمكنني قص الصور باستخدام هذا التطبيق؟ نعم ، يمكنك اقتصاص الصور في المحرر ، عن طريق سحب زوايا الصورة. يمكنك الوصول إلى المحرر إما عن طريق الضغط لفترة طويلة على صورة مصغرة وتحديد تحرير ، أو تحديد تحرير من العرض بملء الشاشة. Can I somehow group media file thumbnails? diff --git a/app/src/main/res/values-az/strings.xml b/app/src/main/res/values-az/strings.xml index 3bdaebe63..c9e15476d 100644 --- a/app/src/main/res/values-az/strings.xml +++ b/app/src/main/res/values-az/strings.xml @@ -203,8 +203,6 @@ What if I want just a few particular folders visible? Adding a folder at the Included Folders doesn\'t automatically exclude anything. What you can do is go in Settings -> Manage Excluded Folders, exclude the root folder \"/\", then add the desired folders at Settings -> Manage Included Folders. That will make only the selected folders visible, as both excluding and including are recursive and if a folder is both excluded and included, it will show up. - Fullscreen images have weird artifacts, can I somehow improve the quality? - Yea, there is a toggle in Settings saying \"Replace deep zoomable images with better quality ones\", you can use that. It will improve the quality of the images, but they will get blurred once you try zooming in too much. Can I crop images with this app? Yes, you can crop images in the editor, by dragging the image corners. You can get to the editor either by long pressing an image thumbnail and selecting Edit, or selecting Edit from the fullscreen view. Can I somehow group media file thumbnails? diff --git a/app/src/main/res/values-ca/strings.xml b/app/src/main/res/values-ca/strings.xml index 0d0b95fca..f3cadd8e0 100644 --- a/app/src/main/res/values-ca/strings.xml +++ b/app/src/main/res/values-ca/strings.xml @@ -203,8 +203,6 @@ Què passa si vull veure només algunes carpetes concretes? L\'addició d\'una carpeta a les carpetes incloses no exclou automàticament res. El que podeu fer és anar a Configuració -> Gestionar carpetes excloses, excloure la carpeta arrel \"/\" i, a continuació, afegir les carpetes desitjades a Configuració -> Gestionar carpetes incloses. Això farà que només les carpetes seleccionades siguin visibles, ja que tant excloure com incloure són recursius i si una carpeta està exclosa i inclosa, es mostrarà. - Les imatges a pantalla completa tenen artefactes estranys, puc millorar d\'alguna manera la qualitat? - Sí, hi ha un commutador a la configuració que diu \"Substituïu imatges ampliades i de gran qualitat\", podeu fer-ho. Millora la qualitat de les imatges, però es borraran una vegada que intenteu fer zoom massa. Puc retallar imatges amb aquesta aplicació? Sí, pots retallar imatges a l\'editor, arrossegant les cantonades de la imatge. Pots accedir a l\'editor prement una miniatura d\'imatge i seleccionant Edita o seleccionant Edita des de la visualització de pantalla completa. Puc agrupar d\'alguna manera les miniatures del fitxer multimèdia? diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index 95e4d8461..788fe4d0a 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -203,8 +203,6 @@ Co v případě, že chci mít zobrazeno pouze několik složek? Přidání složky mezi Přidané složky automaticky nevyloučí ostatní. Můžete ale jít do Nastavení -> Spravovat vyloučené složky a zvolit Kořenovou složku \"/\", následně přidat požadované složky v Nastavení -> Spravovat přidané složky. To způsobí, že budou zobrazeny pouze vyžádané složky, protože vyloučení i přidání fungují rekurzivně a pokud je složka vyloučena i přidaná, bude viditelná. - Fotky přes celou obrazovku mají zhoršenou kvalitu, můžu to nějak zlepšit? - Ano, v nastavení je přepínač s textem \"Nahradit hluboko priblížiteľné obrázky s obrázky s lepší kvalitou\", můžete to zkusit. Způsobí to vyšší kvalitu obrázků, po přiblížení se ale budou rozmazávat mnohem dříve. Můžu s touto aplikací oříznout obrázky? Ano, oříznutí je možné v editoru potažením rohů obrázků. Do editoru se můžete dostat buď dlouhým podržením náhledu obrázku a zvolením menu položky Upravit nebo zvolením Upravit při celoobrazovkovém režimu. Můžu nějakým způsobem seskupit náhledy souborů? diff --git a/app/src/main/res/values-da/strings.xml b/app/src/main/res/values-da/strings.xml index 563dc982c..774bc168d 100644 --- a/app/src/main/res/values-da/strings.xml +++ b/app/src/main/res/values-da/strings.xml @@ -203,8 +203,6 @@ What if I want just a few particular folders visible? Adding a folder at the Included Folders doesn\'t automatically exclude anything. What you can do is go in Settings -> Manage Excluded Folders, exclude the root folder \"/\", then add the desired folders at Settings -> Manage Included Folders. That will make only the selected folders visible, as both excluding and including are recursive and if a folder is both excluded and included, it will show up. - Fullscreen images have weird artifacts, can I somehow improve the quality? - Yea, there is a toggle in Settings saying \"Replace deep zoomable images with better quality ones\", you can use that. It will improve the quality of the images, but they will get blurred once you try zooming in too much. Can I crop images with this app? Yes, you can crop images in the editor, by dragging the image corners. You can get to the editor either by long pressing an image thumbnail and selecting Edit, or selecting Edit from the fullscreen view. Can I somehow group media file thumbnails? diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 10ada1d9e..42590db83 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -202,8 +202,6 @@ Öffne die Galerie-Einstellungen, wähle dort \'Einbezogene Ordner verwalten\', dann das Plus-Zeichen oben rechts und navigiere zum gewünschten Ordner. Wie kann ich erreichen, dass nur ein paar definierte Ordner sichtbar sind? Einen Ordner zu den \'einbezogenen Ordnern\' hinzuzufügen, schließt nicht automatisch alle anderen aus. Eine Möglichkeit ist, in den Galerie-Einstellungen \'Ausgeschlossene Ordner verwalten\' zu wählen, den Stammordner \"/\" auszuschliessen und dann alle gewünschten Ordner in \'Einbezogene Ordner verwalten\' hinzuzufügen. - Als Vollbild angezeigte Bilder haben seltsame Artefakte. Kann ich die Qualität verbessern? - Ja, es gibt einen Schalter in den Einstellungen, gekennzeichnet mit \"Stark zoombare Bilder durch Bilder mit hoher Qualität ersetzen\". Dieser wird die Bildqualität verbessern, aber sie werden bei sehr hoher Zoomstufe unscharf. Kann ich mit dieser App Bilder zuschneiden? Ja, du kannst Bilder über das Ziehen der Bildecken im Editor zuschneiden. Du gelangst zum Editor indem du lange auf ein Vorschaubild drückst und Bearbeiten auswählst oder durch Auswählen von Bearbeiten in der Vollbildansicht. Kann ich Mediendatei-Thumbnails irgendwie gruppieren? diff --git a/app/src/main/res/values-el/strings.xml b/app/src/main/res/values-el/strings.xml index d16504c99..f7657df46 100644 --- a/app/src/main/res/values-el/strings.xml +++ b/app/src/main/res/values-el/strings.xml @@ -203,8 +203,6 @@ Πώς μπορώ να επιλέξω μόνο κάποιους φακέλους να εμφανίζονται; Η προσθήκη ενός φακέλου στους Συμπεριλαμβανόμενους Φακέλους δεν εξαιρεί αυτόματα τίποτα. Μπορείτε να πάτε στις Ρυμίσεις-> Διαχείριση Εξαιρεμένων Φακέλων, εξαιρέστε τον ριζικό φάκελο \"/\", έπειτα προσθέστε τους φακέλους στο Ρυθμίσεις -> Διαχείριση Συμπεριλαμβανομένων Φακέλων. Αυτό θα κάνει ορατούς μόνο τους επιλεγμένους φακέλους, καθώς η εξαίρεση και η συμπερίληψη λειτουργούν αναδρομικά και αν ενας φάκελος ανήκει και στα δύο, θα εμφανιστεί. - Οι εικόνες πλήρους οθόνης έχουν κάποια περίεργα σημάδια. Μπορώ κάπως να βελτιώσω την ποιότητα; - Ναι. Υπάρχει ένας διακόπτης στις Ρυθμίσεις με το κείμενο \"Αντικατάσταση των φωτογραφιών που απαιτούν ζούμ με άλλες καλύτερης ποιότητας\". Μπορείτε να χρησιμοποιήσετε αυτό. Θα βελτιώσει την ποιότητα των φωτογραφιών, αλλά θα θολώσουν στο μεγάλο ζουμ. Μπορώ να περικόψω εικόνες με την εφαρμογή; Ναι, μπορείτε να περικόψετε εικόνες στον επεξεργαστή, σύροντας τις γωνίες εικόνας. Μπορείτε να μεταβείτε στον επεξεργαστή είτε πατώντας παρατεταμένα μια μικρογραφία εικόνας και επιλέγοντας Επεξεργασία, είτε επιλέγοντας Επεξεργασία από την προβολή πλήρους οθόνης. Μπορώ να ομαδοποιήσω κάπως τις μικρογραφίες των αρχείων πολυμέσων? diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 447cf75d3..451f358f5 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -203,8 +203,6 @@ ¿Qué pasa si quiero solo algunas carpetas concretas visibles? Agregar una carpeta en las carpetas incluidas no excluye automáticamente nada. Lo que puede hacer es ir a Ajustes -> Administrar carpetas excluidas, excluir la carpeta raíz \"/\", luego agregar las carpetas deseadas en Configuración -> Administrar carpetas incluidas. Esto hará que solo las carpetas seleccionadas sean visibles, ya que tanto la exclusión como la inclusión son recursivas y si una carpeta está excluida e incluida, aparecerá. - Las imágenes a pantalla completa tienen artefactos extraños, ¿puedo de alguna manera mejorar la calidad? - Sí, hay una alternancia en Ajustes que dice \"Reemplazar imágenes con zoom profundo con las de mejor calidad\", puede usar eso. Mejorará la calidad de las imágenes, pero se volverán borrosas una vez que intente ampliar demasiado. ¿Puedo recortar imágenes con esta aplicación? Sí, puede recortar imágenes en el editor arrastrando las esquinas de la imagen. Puede acceder al editor pulsando prolongadamente una imagen en miniatura y seleccionando Editar, o seleccionando Editar en la vista de pantalla completa. ¿Puedo de alguna manera agrupar miniaturas de archivos multimedia? diff --git a/app/src/main/res/values-fi/strings.xml b/app/src/main/res/values-fi/strings.xml index 7797ad5b3..5dfc7bc0d 100644 --- a/app/src/main/res/values-fi/strings.xml +++ b/app/src/main/res/values-fi/strings.xml @@ -203,8 +203,6 @@ What if I want just a few particular folders visible? Adding a folder at the Included Folders doesn\'t automatically exclude anything. What you can do is go in Settings -> Manage Excluded Folders, exclude the root folder \"/\", then add the desired folders at Settings -> Manage Included Folders. That will make only the selected folders visible, as both excluding and including are recursive and if a folder is both excluded and included, it will show up. - Fullscreen images have weird artifacts, can I somehow improve the quality? - Yea, there is a toggle in Settings saying \"Replace deep zoomable images with better quality ones\", you can use that. It will improve the quality of the images, but they will get blurred once you try zooming in too much. Can I crop images with this app? Yes, you can crop images in the editor, by dragging the image corners. You can get to the editor either by long pressing an image thumbnail and selecting Edit, or selecting Edit from the fullscreen view. Can I somehow group media file thumbnails? diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 4cfead64c..49fc80b2e 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -201,8 +201,6 @@ Cela peut arriver pour de multiples raisons, mais c\'est facile à résoudre. Allez dans \"Paramètres\", puis \"Gérer les dossiers inclus\", appuyez sur \"+\" et sélectionnez le dossier voulu. Comment faire apparaître uniquement certains dossiers ? Ajouter un dossier dans les \"Dossiers inclus\" rend visible l\'ensemble du contenu du dossier. Pour exclure certains dossiers, il faut aller dans \"Paramètres\", puis \"Gérer les dossiers exclus\", exclure le dossier racine \"/\", puis ajouter les dossiers souhaités dans \"Paramètres\", puis \"Gérer les dossiers inclus\". Seuls les dossiers sélectionnés seront visibles, du fait que les exclusions et inclusions sont récursives, et si un dossier est à la fois exclus et inclus, il sera affiché. - Les images en plein écran contiennent des artefacts, est-ce possible d\'améliorer la qualité ? - Oui, il existe dans \"Paramètres\" une option \"Afficher les images avec la plus haute qualité possible\", mais les images seront alors floues si vous zoomez trop. Puis-je recadrer des images avec cette application ? Oui, vous pouvez recadrer les images dans l\'éditeur en faisant glisser les coins de l\'image. Vous pouvez accéder à l\'éditeur en appuyant longuement sur une vignette d\'image et en sélectionnant \"Modifier\", ou en sélectionnant \"Modifier\" en mode plein écran. Puis-je regrouper les miniatures des fichiers multimédias ? diff --git a/app/src/main/res/values-gl/strings.xml b/app/src/main/res/values-gl/strings.xml index ae37ddc62..a71526efb 100644 --- a/app/src/main/res/values-gl/strings.xml +++ b/app/src/main/res/values-gl/strings.xml @@ -203,8 +203,6 @@ E qué pasa si só quero que sexan visibles certos cartafoles Engadir un cartafol a Cartafoles incluídos non exclúe nada de xeito automático. O que pode facer é ir a Axustes -> Xestionar cartafoles incluídos, excluír o cartafol root \"/\", e despóis engadir os cartafoles desexados con Axustes -> Xestionar Cartafoles Incluídos. Esto fará visibles só aos cartafoles escollidos, como tanto excluír e incluír son recursivos e si está excluído e logo incluído, será mostrado. - As imaxes a pantalla completa teñen píxeles extranos, podo mellorar a calidade da imaxe? - Si, hai unha opción en Axustes que di \"Substituír imaxes con un gran zoom con imaxes de mellor calidade\", pode usar eso. mellorará a calidade das imaxes, mais farase máis borrosaxa si intenta facer moito zoom. Can I crop images with this app? Yes, you can crop images in the editor, by dragging the image corners. You can get to the editor either by long pressing an image thumbnail and selecting Edit, or selecting Edit from the fullscreen view. Can I somehow group media file thumbnails? diff --git a/app/src/main/res/values-hr/strings.xml b/app/src/main/res/values-hr/strings.xml index f0506cfc5..26a19ad69 100644 --- a/app/src/main/res/values-hr/strings.xml +++ b/app/src/main/res/values-hr/strings.xml @@ -203,8 +203,6 @@ Što ako želim vidjeti samo nekoliko određenih mapa? Dodavanje direktorija u uključene mape ne izuzima ništa automatski. Da biste to učinili, idite na "Postavke", a zatim "Upravljanje izuzetim mapama", izuzmite korijenski direktorij \"/\", a zatim dodajte željene direktorije u "Postavke" i "Upravljanje uključenim mapama". Samo će odabrane mape biti vidljive, jer su izuzimanja i uključivanja rekurzivni, a ako je mapa isključena i uključena, bit će prikazana. - Slike na cijelom zaslonu imaju čudne artefakte, mogu li nekako poboljšati kvalitetu? - Da, u "Postavkama" postoji opcija "Zamjena duboko zumiranih slika s kvalitetnijim slikama", ali slike će biti zamućene ako zumirate previše. Mogu li izrezati slike pomoću ove aplikacije? Da, možete obrezati slike u uređivaču povlačenjem uglova. Možete doći do uređivača dugim pritiskom na minijaturu slike i odabirom Uređivanje ili odabirom Uredi iz prikaza preko cijelog zaslona. Mogu li nekako grupirati sličice medijskih datoteka? diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index 94dfdbcea..9a57d8b84 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -204,8 +204,6 @@ A következő alkalommal, amikor megpróbál megnyitni egy képet vagy videót, Mi van, ha csak néhány különleges mappát szeretnék látni? A Befoglalt mappákhoz tartozó mappák hozzáadása nem zár ki automatikusan semmit. Amit tehetünk, menjünk a Beállítások -> Kizárt mappák kezelése, kizárjuk a gyökérmappát \"/ \", utána hozzáadjuk a kívánt mappákat a Beállítások -> Befoglalt mappák kezelése menüpontban. Ezzel csak a kiválasztott mappák láthatók, mivel a kizárás és a befoglalás rekurzív. Ha egy mappát hozzáadunk mindkettőhöz, akkor megjelenik. - A teljes képernyős képek furcsán néznek ki, tudnám valahogy javítani a minőséget? - Igen, van egy kapcsoló a Beállításokban: \"Cserélje le a mély nagyítású képeket jobb minőségűekre\", akkor használhatja. Javítja a képek minőségét, de elmosódik, ha túl nagy zoomolást használ. Tudom vágni a képeket ezzel az alkalmazással? Igen, megvághatja a képeket a szerkesztőben a kép sarkainak húzásával. A szerkesztőhöz eljuthat egy miniatűr kép hosszú megnyomásával és a Szerkesztés választásával, vagy a Szerkesztés választásával a teljes képernyős nézetben. Valamilyen módon össze tudom csoportosítani a médiafájl bélyegképeit? diff --git a/app/src/main/res/values-id/strings.xml b/app/src/main/res/values-id/strings.xml index a55722a1f..b316419f7 100644 --- a/app/src/main/res/values-id/strings.xml +++ b/app/src/main/res/values-id/strings.xml @@ -203,8 +203,6 @@ Bagaimana jika saya hanya ingin beberapa folder saja yang terlihat? Menambahkan folder di Folder yang Disertakan tidak otomatis mengecualikan folder yang lain. Yang bisa Anda lakukan adalah pergi ke Setelan -> Atur Folder yang Dikecualikan, lalu kecualikan folder root \"/\", lalu tambahkan folder yang diinginkan di Setelan -> Atur Folder yang Disertakan. Itu akan membuat folder yang dipilih saja yang muncul, dan jika sebuah folder disertakan dan dikecualikan secara bersamaan, folder tersebut akan muncul. - Gambar layar penuh terlihat pecah, bisakah ditingkatkan kualitasnya? - Ya, ada opsi di Setelan \"Ganti zoom mendalam dengan kualitas gambar yang lebih bagus\", Anda bisa menggunakannya. Ini akan meningkatkan kualitas gambar, namun gambar akan terlihat kabur jika Anda zoom terlalu banyak. Bisakah saya meng-crop gambar dengan aplikasi ini? Ya, Anda bisa melakukannya di Editor, dengan menyeret sudut gambar. Anda bisa masuk ke editor dengan menekan lama thumbnail gambar dan memilih Edit, atau pilih Edit dari tampilan layar penuh. Bisakah saya mengelompokkan thumbnail file media? diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index f270482ff..b75eb6ff3 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -203,8 +203,6 @@ Che fare se voglio rendere visibili solo poche particolari cartelle? Aggiungere una cartella nelle Cartelle Incluse non esclude automaticamente nulla. Quello che puoi fare è andare in Impostazioni → Gestisci le cartelle escluse, escludi la cartella root \"/\", poi aggiungi le cartelle desiderate in Impostazioni → Gestisci le cartelle incluse. Ciò renderà visibili solo le cartelle selezionate, dato che sia l\'esclusione che l\'inclusione sono ricorsive e se una cartella è sia esclusa che inclusa, verrà mostrata. - Le immagini a schermo intero hanno strani artefatti, posso migliorarne la qualità in qualche modo? - Sì, c\'è un\'opzione nelle impostazioni che dice \"Sostituisci le immagini ingrandibili a fondo con altre di migliore qualità\". Ciò migliorerà la qualità delle immagini, ma saranno sfuocate quando si proverà a ingrandirle troppo. Posso ritagliare le immagini con questa app? Sì, si possono ritagliare le immagini nell\'editor, trascinando gli angoli dell\'immagine. Si può accedere all\'editor sia premendo a lungo la miniatura di un\'immagine e selezionando Modifica, oppure selezionando Modifica mentre si vede una foto a schermo intero. Posso raggruppare in qualche modo le miniature dei file? diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 99bd75f9b..a22be1164 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -203,8 +203,6 @@ What if I want just a few particular folders visible? Adding a folder at the Included Folders doesn\'t automatically exclude anything. What you can do is go in Settings -> Manage Excluded Folders, exclude the root folder \"/\", then add the desired folders at Settings -> Manage Included Folders. That will make only the selected folders visible, as both excluding and including are recursive and if a folder is both excluded and included, it will show up. - Fullscreen images have weird artifacts, can I somehow improve the quality? - Yea, there is a toggle in Settings saying \"Replace deep zoomable images with better quality ones\", you can use that. It will improve the quality of the images, but they will get blurred once you try zooming in too much. Can I crop images with this app? Yes, you can crop images in the editor, by dragging the image corners. You can get to the editor either by long pressing an image thumbnail and selecting Edit, or selecting Edit from the fullscreen view. Can I somehow group media file thumbnails? diff --git a/app/src/main/res/values-ko-rKR/strings.xml b/app/src/main/res/values-ko-rKR/strings.xml index 5a59f85bc..6dcb1bc82 100644 --- a/app/src/main/res/values-ko-rKR/strings.xml +++ b/app/src/main/res/values-ko-rKR/strings.xml @@ -203,8 +203,6 @@ What if I want just a few particular folders visible? Adding a folder at the Included Folders doesn\'t automatically exclude anything. What you can do is go in Settings -> Manage Excluded Folders, exclude the root folder \"/\", then add the desired folders at Settings -> Manage Included Folders. That will make only the selected folders visible, as both excluding and including are recursive and if a folder is both excluded and included, it will show up. - Fullscreen images have weird artifacts, can I somehow improve the quality? - Yea, there is a toggle in Settings saying \"Replace deep zoomable images with better quality ones\", you can use that. It will improve the quality of the images, but they will get blurred once you try zooming in too much. Can I crop images with this app? Yes, you can crop images in the editor, by dragging the image corners. You can get to the editor either by long pressing an image thumbnail and selecting Edit, or selecting Edit from the fullscreen view. Can I somehow group media file thumbnails? diff --git a/app/src/main/res/values-lt/strings.xml b/app/src/main/res/values-lt/strings.xml index d0f476c46..c3098c8ca 100644 --- a/app/src/main/res/values-lt/strings.xml +++ b/app/src/main/res/values-lt/strings.xml @@ -203,8 +203,6 @@ Ką daryti, jei noriu matyti tik keletą konkrečių aplankų? Pridėjus aplanką į "Įtraukti aplankai", automatiškai neįtraukiama nieko. Ką jūs galite padaryti, eikite į Nustatymai -> Tvarkyti išskirtus aplankus, išskirkite šakninį aplanką \ "/ \", tada pridėkite norimus aplankus, esančius Nustatymai -> Tvarkyti įtrauktas aplankas. Tai leis matyti tik tuos pasirinktus aplankus, nes abu atmetami ir įtraukti yra rekursyvūs, ir jei aplankas yra išskirtas ir įtrauktas, jis bus rodomas. - Viso ekrano atvaizdai turi keistus artefaktus, galiu kokiu nors būdu pagerinti kokybę? - Taip, "Nustatymuose" perjunkite \ "Pakeisti giliuosius, patobulintus vaizdus geresnės kokybės vaizdais \", galite tai naudoti. Tai pagerins vaizdų kokybę, tačiau kai jūs pabandysite per daug padidinti vaizdą, jie bus neryškūs. Ar galiu apkarpyti vaizdus naudojant šią programėlę? Taip, redaguodami vaizdus, galite juos apkarpyti, vilkdami vaizdo kampus. Galite patekti į redaktorių ilgai paspaudę vaizdo miniatiūrą ir pasirinkę "Redaguoti" arba iš viso ekrano rodinio pasirinkę "Redaguoti". Can I somehow group media file thumbnails? diff --git a/app/src/main/res/values-nb/strings.xml b/app/src/main/res/values-nb/strings.xml index 5074b2de6..2a296793e 100644 --- a/app/src/main/res/values-nb/strings.xml +++ b/app/src/main/res/values-nb/strings.xml @@ -203,8 +203,6 @@ What if I want just a few particular folders visible? Adding a folder at the Included Folders doesn\'t automatically exclude anything. What you can do is go in Settings -> Manage Excluded Folders, exclude the root folder \"/\", then add the desired folders at Settings -> Manage Included Folders. That will make only the selected folders visible, as both excluding and including are recursive and if a folder is both excluded and included, it will show up. - Fullscreen images have weird artifacts, can I somehow improve the quality? - Yea, there is a toggle in Settings saying \"Replace deep zoomable images with better quality ones\", you can use that. It will improve the quality of the images, but they will get blurred once you try zooming in too much. Can I crop images with this app? Yes, you can crop images in the editor, by dragging the image corners. You can get to the editor either by long pressing an image thumbnail and selecting Edit, or selecting Edit from the fullscreen view. Can I somehow group media file thumbnails? diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index 5ec563bd8..e21db0b57 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -203,8 +203,6 @@ Wat als ik slechts een beperkt aantal mappen wil laten zien? Het toevoegen van mappen aan de lijst bij \"Toegevoegde mappen beheren\" sluit niet automatisch alle andere mappen uit. Sluit daarom de hoofdmap \"/\" uit via \"Instellingen\" -> \"Uitgesloten mappen beheren\" en voeg vervolgens de te tonen mappen toe bij \"Instellingen\" -> \"Toegevoegde mappen beheren\". Dit zal ervoor zorgen dat alleen de toegevoegde mappen worden getoond (mappen toevoegen of uitsluiten gebeurt recursief, maar een toegevoegde map zal altijd worden getoond). - Afbeeldingen in volledig scherm hebben rare artefacten. Kan ik de kwaliteit verbeteren? - Probeer de instelling \"Verder inzoomen mogelijk maken\" te wijzigen. Kan ik afbeeldingen bijsnijden met deze app? Ja, dat kan bij \"Bewerken\" door de hoeken te verslepen. Druk lang op een afbeelding in het overzicht of ga naar het volledig scherm en klik vervolgens op \"Bewerken\". Hoe kan ik mediabestanden groeperen? diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index 95f49e24c..a7b6bef3b 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -201,8 +201,6 @@    Wejdź do ustawień aplikacji i w sekcji z dołączonymi folderami dodaj tenże folder do listy. Co jeśli chcę widzieć tylko wybrane foldery?    Przejdź do sekcji z wykluczonymi folderami w ustawieniach aplikacji, dodaj tam folder główny (\"/\"), a następnie dodaj pożądane foldery w sekcji z dołączonymi folderami. -    Zdjęcia w widoku pełnoekranowym mają dziwne artefakty. Jak mogę to naprawić? - W ustawieniach aplikacji włącz opcję \'Zamieniaj powiększalne obrazy na te o lepszej jakości\'. Poprawi ona jakość zdjęć, jednak przy bardzo dużych powiększeniach mogą się stać one zbyt rozmazane. Czy mogę w tej aplikacji przycinać obrazy? Tak, możesz to zrobić w edytorze, przeciągając krawędzie obrazu. Edytor otworzysz przytrzymując miniaturę obrazu i wybierając opcję \'Edytuj\', bądź wybierając tą samą opcję w menu pełnoekranowym. Czy mogę jakoś grupować miniatury plików? diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 6d8e9f2a2..ca9565e3a 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -203,8 +203,6 @@ What if I want just a few particular folders visible? Adding a folder at the Included Folders doesn\'t automatically exclude anything. What you can do is go in Settings -> Manage Excluded Folders, exclude the root folder \"/\", then add the desired folders at Settings -> Manage Included Folders. That will make only the selected folders visible, as both excluding and including are recursive and if a folder is both excluded and included, it will show up. - Fullscreen images have weird artifacts, can I somehow improve the quality? - Yea, there is a toggle in Settings saying \"Replace deep zoomable images with better quality ones\", you can use that. It will improve the quality of the images, but they will get blurred once you try zooming in too much. Can I crop images with this app? Yes, you can crop images in the editor, by dragging the image corners. You can get to the editor either by long pressing an image thumbnail and selecting Edit, or selecting Edit from the fullscreen view. Can I somehow group media file thumbnails? diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index 53e07cc76..262a32198 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -203,8 +203,6 @@ What if I want just a few particular folders visible? Adding a folder at the Included Folders doesn\'t automatically exclude anything. What you can do is go in Settings -> Manage Excluded Folders, exclude the root folder \"/\", then add the desired folders at Settings -> Manage Included Folders. That will make only the selected folders visible, as both excluding and including are recursive and if a folder is both excluded and included, it will show up. - Fullscreen images have weird artifacts, can I somehow improve the quality? - Yea, there is a toggle in Settings saying \"Replace deep zoomable images with better quality ones\", you can use that. It will improve the quality of the images, but they will get blurred once you try zooming in too much. Can I crop images with this app? Yes, you can crop images in the editor, by dragging the image corners. You can get to the editor either by long pressing an image thumbnail and selecting Edit, or selecting Edit from the fullscreen view. Can I somehow group media file thumbnails? diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 3b2ffee29..1c1958f85 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -203,8 +203,6 @@ Что делать, если я хочу видеть только несколько конкретных папок? Добавление папки во включённые не исключает автоматически остальные. Что вы можете сделать это через \"Настройки\" -> \"Управление исключёнными папками\". Исключите корневую папку \"/\", затем добавьте нужные папки в \"Настройки\" -> \"Управление включёнными папками\". Это сделает видимыми только выбранные папки, так как исключение и включение являются рекурсивными, и если папка исключена и включена, то она будет отображаться. - Полноэкранные изображения имеют странные артефакты, можно как-то улучшить качество? - Да, в настройках есть переключатель \"Заменять масштабируемые изображения высококачественными\", использовуйте его. Это улучшит качество изображений, но они будут размыты, если вы попытаетесь сильно увеличить масштаб отображения. Можно ли обрезать изображения с помощью данного приложения? Да, вы можете обрезать изображения в редакторе, перетаскивая за углы. К редактированию можно перейти, выбрав соответсвующий пункт в меню, открывающемуся длительным нажатием на миниатюру или изображение в полноэкранном режиме. Могу ли я как-то сгруппировать миниатюры медиафайлов? diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index 74525c719..c9029678b 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -203,8 +203,6 @@ Čo v prípade, ak chcem mať zobrazených iba pár priečinkov? Pridanie priečinka medzi Pridané Priečinky automaticky nevylúči ostatné. Môžete ale ísť do Nastavenia -> Spravovať vylúčené priečinky a zvoliť Koreňový priečinok \"/\", následne pridať žiadané priečinky v Nastavenia -> Spravovať pridané priečinky. To spôsobí, že budú zobrazené iba vyžiadané priečinky, keďže aj vylúčenie, aj pridanie fungujú rekurzívne a ak je priečinok vylúčený, aj pridaný, bude viditeľný. - Fotky na celú obrazovku majú zhoršenú kvalitu, viem ju nejak zlepšiť? - Áno, v nastaveniach je prepínač s textom \"Nahradiť hlboko priblížiteľné obrázky s obrázkami s lepšou kvalitou\", môžete ho skúsiť. Spôsobí to vyššiu kvalitu obrázkov, po priblížení sa ale budú rozmazávať oveľa skôr. Dá sa s touto aplikáciou orezať obrázky? Áno, orezanie je možné v editore, potiahnutím rohov obrázkov. Do editoru sa môžete dostať buď dlhým podržaním náhľadu obrázku a zvolením menu položky Upraviť, alebo zvolením Upraviť pri celoobrazovkovom režime. Viem nejakým spôsobom zoskupiť náhľady súborov? diff --git a/app/src/main/res/values-sl/strings.xml b/app/src/main/res/values-sl/strings.xml index fbac0d951..bd7e541a5 100644 --- a/app/src/main/res/values-sl/strings.xml +++ b/app/src/main/res/values-sl/strings.xml @@ -203,8 +203,6 @@ Kaj, če želim prikazati le nekaj izbranih map? Dodajanje mape med vključene mape avtomatično ne izključi ničesar. Lahko pa naredite sledeče: v Nastavitvah -> Urejaj izključene mape izključite korensko mapo \"/\", željene mape pa dodajte v Nastavitvah -> Urejaj vključene mape. To bo naredilo vidne le vključene mape, saj sta tako vključevanje kot tudi izključevanje rekurzivna, kar pomeni, da je mapa, ki je istočasno izključena in vključena, vidna. - Celozaslonske slike imajo čuden izgled, lahko kako popravim kvaliteto? - Da, v Nastavitvah je opcija \"Nadomesti globoko povečljive slike z bolj kvalitetnimi\", ki jo lahko uporabite. To bo slike izboljšalo, vendar bodo te bolj zamegljene, ko jih boste želeli preveč povečati. Ali lahko obrezujem slike s to aplikacijo? Da, slike lahko obrezujete z vlečenjem kotov slike. Do urejevalnika lahko pridete z dolgim pritiskom na sličico fotografije in izborom opcije Uredi ali izborom funkcije Uredi iz celozaslonskega načina prikaza. Ali lahko združujem sličice medijskih datotek? diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index 0df7472c6..90373f2da 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -203,8 +203,6 @@ What if I want just a few particular folders visible? Adding a folder at the Included Folders doesn\'t automatically exclude anything. What you can do is go in Settings -> Manage Excluded Folders, exclude the root folder \"/\", then add the desired folders at Settings -> Manage Included Folders. That will make only the selected folders visible, as both excluding and including are recursive and if a folder is both excluded and included, it will show up. - Fullscreen images have weird artifacts, can I somehow improve the quality? - Yea, there is a toggle in Settings saying \"Replace deep zoomable images with better quality ones\", you can use that. It will improve the quality of the images, but they will get blurred once you try zooming in too much. Can I crop images with this app? Yes, you can crop images in the editor, by dragging the image corners. You can get to the editor either by long pressing an image thumbnail and selecting Edit, or selecting Edit from the fullscreen view. Can I somehow group media file thumbnails? diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index 3c3117768..6b087ee42 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -203,8 +203,6 @@ Sadece birkaç belirli klasörün görünmesini istersem ne olur? Dahil Edilen Klasörler\'e bir klasör eklemek otomatik olarak hiçbir şeyi hariç tutmaz. Yapabilecekleriniz Ayarlar -> Hariç Tutulan Klasörleri Yönet, kök klasörü \"/\" hariç tut, ardından Ayarlar -> Dahil Edilen Klasörleri Yönet. Bu, hem hariç tutulan hem de dahil edilen olmak üzere, yalnızca seçilen klasörleri görünür hale getirir ve bir klasör her ikisi de hariç tutulur ve dahil edilirse, görünür. - Tam ekran görüntülerde garip eserler var, bir şekilde kaliteyi artırabilir miyim? - Evet, Ayarlar\'da \"Daha iyi kalitede olanlar ile derin yakınlaştırılabilir resimleri değiştir\" diyen bir geçiş var. Bunu kullanabilirsiniz. Görüntülerin kalitesini artırır, ancak çok fazla zum yapmaya çalıştığınızda bulanıklaşır. Bu uygulamayla görüntüleri kırpabilir miyim? Evet, görüntü köşelerini sürükleyerek resimleri düzenleyicide kırpabilirsiniz. Düzenleyiciye, bir resim küçük resmine uzun basıp Düzenle\'yi seçerek veya tam ekran görünümünden Düzenle\'yi seçerek ulaşabilirsiniz. Medya dosyası küçük resimlerini bir şekilde gruplayabilir miyim? diff --git a/app/src/main/res/values-uk/strings.xml b/app/src/main/res/values-uk/strings.xml index d74d51e0b..9e153372d 100644 --- a/app/src/main/res/values-uk/strings.xml +++ b/app/src/main/res/values-uk/strings.xml @@ -203,8 +203,6 @@ Що робити, якщо я хочу, щоб лише кілька окремих тек були видимими? Додавання теки до \"Включених тек\" автоматично не виключає нічого. Що ви можете зробити, то це перейти в \"Налаштування\" -> \"Керування виключеними теками\", виключити кореневу теку \"/\", потім додати бажані теки через \"Налаштування\" -> \"Керування включеними теками\". Це зробить видимими лише обрані теки. Якщо тека є одночасно і виключеною, і включеною, вона відобразиться, оскільки і виключення, і включення є рекурсивним. - Повноекранні зображення мають дивні артефакти. Чи можна якось покращити якість? - Так, у \"Налаштуваннях\" є перемикач з текстом \"Замінити глибокомасштабовані зображення іншими кращої якості\", скористайтеся ним. Він покращить якість зображень, але вони будуть розмиватися, якщо ви занадто їх збільшуватимете. Чи можу я обрізати зображення у цьому додатку? Так, обрізати зображення можна у редакторі шляхом перетягування кутів зображення. Відкрити редактор можна або довгим натисканням на ескіз зображення і наступним вибором \"Редагувати\", або вибором \"Редагувати\" при повноекранному перегляді. Чи можу я якимось чином згрупувати ескізи медіафайлів? diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 42dd3cf22..3e9014936 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -201,8 +201,6 @@ 原因可能有很多,但解决方法很简单。只需进入设置 -> 管理包含目录,点击+号并选择到所需的文件夹。 如果我只想显示几个特定的文件夹,该如何操作? 在包含目录中添加文件夹不会自动排除其他的内容。你可以做的:进入设置 -> 管理排除目录,排除根目录\"/\",然后在设置 -> 管理包含目录中添加所需的文件夹。这样就只显示选定的文件夹了,由于排除和包含都是递归的,所以排除并包含的文件夹是会显示的。 - 全屏图像有些奇怪的东西,该如何提高画面质量? - 在设置中有一个“用质量更好的图像替换可深度缩放的图像”开关,打开它后就可以提高图像的显示质量,但是一旦尝试放大太多次,它们就又会变得模糊不清。 可以裁剪图片吗? 当然,通过长按图片缩略图并选择编辑,或在全屏视图中选择编辑来打开编辑器。你可以通过拖动图片边角来剪裁图像。 我能将媒体文件缩略图分组吗? diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 0d86c7021..3af9cc60b 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -203,8 +203,6 @@ 如果我只想看到幾個特定的資料夾,怎麼做? 在[包含資料夾]內添加資料夾並不會自動排除任何東西。你能做的是到[設定] -> [管理排除資料夾],排除根目錄 \"/\",然後在[設定] -> [管理包含資料夾]添加想要的資料夾。 那樣的話就只有選擇的資料夾可見。因為排除和包含都是遞迴的,如果一個資料夾被排除又被包含,則會顯示出來。 - 全螢幕圖片有雜訊,我有辦法提高品質嗎? - 可啊,[設定]內有個開關叫做「可深度縮放的圖片用品質更佳的來取代」,你能用用看。這會提高圖片的品質,不過一旦你放大太多就會模糊掉。 我可以用這程式裁減圖片嗎? 是的,你能夠在編輯器內拉動圖片角落來裁剪圖片。要進入編輯器,你可以長按圖片縮圖然後選擇[編輯],或是在全螢幕檢視下選擇[編輯]。 我可以歸類媒體檔案的縮圖嗎? diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index f2ebe7283..c4c43a400 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -203,8 +203,6 @@ What if I want just a few particular folders visible? Adding a folder at the Included Folders doesn\'t automatically exclude anything. What you can do is go in Settings -> Manage Excluded Folders, exclude the root folder \"/\", then add the desired folders at Settings -> Manage Included Folders. That will make only the selected folders visible, as both excluding and including are recursive and if a folder is both excluded and included, it will show up. - Fullscreen images have weird artifacts, can I somehow improve the quality? - Yea, there is a toggle in Settings saying \"Replace deep zoomable images with better quality ones\", you can use that. It will improve the quality of the images, but they will get blurred once you try zooming in too much. Can I crop images with this app? Yes, you can crop images in the editor, by dragging the image corners. You can get to the editor either by long pressing an image thumbnail and selecting Edit, or selecting Edit from the fullscreen view. Can I somehow group media file thumbnails? From 9da4b800ac8b4c63c57fdcb92e1f0756acf5e2e5 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 12 Jan 2019 19:20:35 +0100 Subject: [PATCH 32/75] adding some initial Editor Draw related things copied from Simple Draw --- .../gallery/pro/actions/Action.kt | 11 +++ .../gallery/pro/actions/Line.kt | 37 +++++++ .../gallery/pro/actions/Move.kt | 37 +++++++ .../gallery/pro/actions/Quad.kt | 46 +++++++++ .../gallery/pro/models/MyPath.kt | 82 ++++++++++++++++ .../gallery/pro/models/PaintOptions.kt | 7 ++ .../gallery/pro/views/EditorDrawCanvas.kt | 97 +++++++++++++++++++ 7 files changed, 317 insertions(+) create mode 100644 app/src/main/kotlin/com/simplemobiletools/gallery/pro/actions/Action.kt create mode 100644 app/src/main/kotlin/com/simplemobiletools/gallery/pro/actions/Line.kt create mode 100644 app/src/main/kotlin/com/simplemobiletools/gallery/pro/actions/Move.kt create mode 100644 app/src/main/kotlin/com/simplemobiletools/gallery/pro/actions/Quad.kt create mode 100644 app/src/main/kotlin/com/simplemobiletools/gallery/pro/models/MyPath.kt create mode 100644 app/src/main/kotlin/com/simplemobiletools/gallery/pro/models/PaintOptions.kt diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/actions/Action.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/actions/Action.kt new file mode 100644 index 000000000..adbc82662 --- /dev/null +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/actions/Action.kt @@ -0,0 +1,11 @@ +package com.simplemobiletools.gallery.pro.actions + +import android.graphics.Path +import java.io.Serializable +import java.io.Writer + +interface Action : Serializable { + fun perform(path: Path) + + fun perform(writer: Writer) +} diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/actions/Line.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/actions/Line.kt new file mode 100644 index 000000000..a38a70b1f --- /dev/null +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/actions/Line.kt @@ -0,0 +1,37 @@ +package com.simplemobiletools.gallery.pro.actions + +import android.graphics.Path +import java.io.Writer +import java.security.InvalidParameterException + +class Line : Action { + + val x: Float + val y: Float + + constructor(data: String) { + if (!data.startsWith("L")) + throw InvalidParameterException("The Line data should start with 'L'.") + + try { + val xy = data.substring(1).split(",".toRegex()).dropLastWhile(String::isEmpty).toTypedArray() + x = xy[0].trim().toFloat() + y = xy[1].trim().toFloat() + } catch (ignored: Exception) { + throw InvalidParameterException("Error parsing the given Line data.") + } + } + + constructor(x: Float, y: Float) { + this.x = x + this.y = y + } + + override fun perform(path: Path) { + path.lineTo(x, y) + } + + override fun perform(writer: Writer) { + writer.write("L$x,$y") + } +} diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/actions/Move.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/actions/Move.kt new file mode 100644 index 000000000..bf96489bb --- /dev/null +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/actions/Move.kt @@ -0,0 +1,37 @@ +package com.simplemobiletools.gallery.pro.actions + +import android.graphics.Path +import java.io.Writer +import java.security.InvalidParameterException + +class Move : Action { + + val x: Float + val y: Float + + constructor(data: String) { + if (!data.startsWith("M")) + throw InvalidParameterException("The Move data should start with 'M'.") + + try { + val xy = data.substring(1).split(",".toRegex()).dropLastWhile(String::isEmpty).toTypedArray() + x = xy[0].trim().toFloat() + y = xy[1].trim().toFloat() + } catch (ignored: Exception) { + throw InvalidParameterException("Error parsing the given Move data.") + } + } + + constructor(x: Float, y: Float) { + this.x = x + this.y = y + } + + override fun perform(path: Path) { + path.moveTo(x, y) + } + + override fun perform(writer: Writer) { + writer.write("M$x,$y") + } +} diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/actions/Quad.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/actions/Quad.kt new file mode 100644 index 000000000..fb281c29a --- /dev/null +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/actions/Quad.kt @@ -0,0 +1,46 @@ +package com.simplemobiletools.gallery.pro.actions + +import android.graphics.Path +import java.io.Writer +import java.security.InvalidParameterException + +class Quad : Action { + + val x1: Float + val y1: Float + val x2: Float + val y2: Float + + constructor(data: String) { + if (!data.startsWith("Q")) + throw InvalidParameterException("The Quad data should start with 'Q'.") + + try { + val parts = data.split("\\s+".toRegex()).dropLastWhile(String::isEmpty).toTypedArray() + val xy1 = parts[0].substring(1).split(",".toRegex()).dropLastWhile(String::isEmpty).toTypedArray() + val xy2 = parts[1].split(",".toRegex()).dropLastWhile(String::isEmpty).toTypedArray() + + x1 = xy1[0].trim().toFloat() + y1 = xy1[1].trim().toFloat() + x2 = xy2[0].trim().toFloat() + y2 = xy2[1].trim().toFloat() + } catch (ignored: Exception) { + throw InvalidParameterException("Error parsing the given Quad data.") + } + } + + constructor(x1: Float, y1: Float, x2: Float, y2: Float) { + this.x1 = x1 + this.y1 = y1 + this.x2 = x2 + this.y2 = y2 + } + + override fun perform(path: Path) { + path.quadTo(x1, y1, x2, y2) + } + + override fun perform(writer: Writer) { + writer.write("Q$x1,$y1 $x2,$y2") + } +} diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/models/MyPath.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/models/MyPath.kt new file mode 100644 index 000000000..564eab0c8 --- /dev/null +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/models/MyPath.kt @@ -0,0 +1,82 @@ +package com.simplemobiletools.gallery.pro.models + +import android.app.Activity +import android.graphics.Path +import com.simplemobiletools.commons.extensions.toast +import com.simplemobiletools.gallery.pro.R +import com.simplemobiletools.gallery.pro.actions.Action +import com.simplemobiletools.gallery.pro.actions.Line +import com.simplemobiletools.gallery.pro.actions.Move +import com.simplemobiletools.gallery.pro.actions.Quad +import java.io.ObjectInputStream +import java.io.Serializable +import java.security.InvalidParameterException +import java.util.* + +// https://stackoverflow.com/a/8127953 +class MyPath : Path(), Serializable { + val actions = LinkedList() + + private fun readObject(inputStream: ObjectInputStream) { + inputStream.defaultReadObject() + + val copiedActions = actions.map { it } + copiedActions.forEach { + it.perform(this) + } + } + + fun readObject(pathData: String, activity: Activity) { + val tokens = pathData.split("\\s+".toRegex()).dropLastWhile(String::isEmpty).toTypedArray() + var i = 0 + try { + while (i < tokens.size) { + when (tokens[i][0]) { + 'M' -> addAction(Move(tokens[i])) + 'L' -> addAction(Line(tokens[i])) + 'Q' -> { + // Quad actions are of the following form: + // "Qx1,y1 x2,y2" + // Since we split the tokens by whitespace, we need to join them again + if (i + 1 >= tokens.size) + throw InvalidParameterException("Error parsing the data for a Quad.") + + addAction(Quad(tokens[i] + " " + tokens[i + 1])) + ++i + } + } + ++i + } + } catch (e: Exception) { + activity.toast(R.string.unknown_error_occurred) + } + } + + override fun reset() { + actions.clear() + super.reset() + } + + private fun addAction(action: Action) { + when (action) { + is Move -> moveTo(action.x, action.y) + is Line -> lineTo(action.x, action.y) + is Quad -> quadTo(action.x1, action.y1, action.x2, action.y2) + } + } + + override fun moveTo(x: Float, y: Float) { + actions.add(Move(x, y)) + super.moveTo(x, y) + } + + override fun lineTo(x: Float, y: Float) { + actions.add(Line(x, y)) + super.lineTo(x, y) + } + + override fun quadTo(x1: Float, y1: Float, x2: Float, y2: Float) { + actions.add(Quad(x1, y1, x2, y2)) + super.quadTo(x1, y1, x2, y2) + } +} diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/models/PaintOptions.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/models/PaintOptions.kt new file mode 100644 index 000000000..34c128dca --- /dev/null +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/models/PaintOptions.kt @@ -0,0 +1,7 @@ +package com.simplemobiletools.gallery.pro.models + +import android.graphics.Color + +data class PaintOptions(var color: Int = Color.BLACK, var strokeWidth: Float = 5f, var isEraser: Boolean = false) { + fun getColorToExport() = if (isEraser) "none" else "#${Integer.toHexString(color).substring(2)}" +} diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/EditorDrawCanvas.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/EditorDrawCanvas.kt index c409de011..0451f0667 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/EditorDrawCanvas.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/EditorDrawCanvas.kt @@ -3,12 +3,42 @@ package com.simplemobiletools.gallery.pro.views import android.content.Context import android.graphics.Bitmap import android.graphics.Canvas +import android.graphics.Paint import android.util.AttributeSet +import android.view.MotionEvent import android.view.View +import com.simplemobiletools.gallery.pro.extensions.config +import com.simplemobiletools.gallery.pro.models.MyPath +import com.simplemobiletools.gallery.pro.models.PaintOptions +import java.util.* class EditorDrawCanvas(context: Context, attrs: AttributeSet) : View(context, attrs) { + private var mCurX = 0f + private var mCurY = 0f + private var mStartX = 0f + private var mStartY = 0f + private var mColor = 0 + private var mWasMultitouch = false + + private var mPaths = LinkedHashMap() + private var mPaint = Paint() + private var mPath = MyPath() + private var mPaintOptions = PaintOptions() + private var backgroundBitmap: Bitmap? = null + init { + mColor = context.config.primaryColor + mPaint.apply { + color = mColor + style = Paint.Style.STROKE + strokeJoin = Paint.Join.ROUND + strokeCap = Paint.Cap.ROUND + strokeWidth = 40f + isAntiAlias = true + } + } + override fun onDraw(canvas: Canvas) { super.onDraw(canvas) canvas.save() @@ -19,9 +49,76 @@ class EditorDrawCanvas(context: Context, attrs: AttributeSet) : View(context, at canvas.drawBitmap(backgroundBitmap!!, left.toFloat(), top.toFloat(), null) } + for ((key, value) in mPaths) { + changePaint(value) + canvas.drawPath(key, mPaint) + } + + changePaint(mPaintOptions) + canvas.drawPath(mPath, mPaint) + canvas.restore() } + override fun onTouchEvent(event: MotionEvent): Boolean { + val x = event.x + val y = event.y + + when (event.action and MotionEvent.ACTION_MASK) { + MotionEvent.ACTION_DOWN -> { + mWasMultitouch = false + mStartX = x + mStartY = y + actionDown(x, y) + } + MotionEvent.ACTION_MOVE -> { + if (event.pointerCount == 1 && !mWasMultitouch) { + actionMove(x, y) + } + } + MotionEvent.ACTION_UP, MotionEvent.ACTION_CANCEL -> actionUp() + MotionEvent.ACTION_POINTER_DOWN -> mWasMultitouch = true + } + + invalidate() + return true + } + + private fun actionDown(x: Float, y: Float) { + mPath.reset() + mPath.moveTo(x, y) + mCurX = x + mCurY = y + } + + private fun actionMove(x: Float, y: Float) { + mPath.quadTo(mCurX, mCurY, (x + mCurX) / 2, (y + mCurY) / 2) + mCurX = x + mCurY = y + } + + private fun actionUp() { + if (!mWasMultitouch) { + mPath.lineTo(mCurX, mCurY) + + // draw a dot on click + if (mStartX == mCurX && mStartY == mCurY) { + mPath.lineTo(mCurX, mCurY + 2) + mPath.lineTo(mCurX + 1, mCurY + 2) + mPath.lineTo(mCurX + 1, mCurY) + } + } + + mPaths[mPath] = mPaintOptions + mPath = MyPath() + mPaintOptions = PaintOptions(mPaintOptions.color, mPaintOptions.strokeWidth, mPaintOptions.isEraser) + } + + private fun changePaint(paintOptions: PaintOptions) { + mPaint.color = paintOptions.color + mPaint.strokeWidth = paintOptions.strokeWidth + } + fun updateBackgroundBitmap(bitmap: Bitmap) { backgroundBitmap = bitmap invalidate() From 90f2d5e5df22fc9abeeaa6bac464de7382572423 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 12 Jan 2019 22:48:15 +0100 Subject: [PATCH 33/75] allow customizing the editor drawing color --- .../gallery/pro/activities/EditActivity.kt | 23 +++++++++++++++++++ .../gallery/pro/helpers/Config.kt | 4 ++++ .../gallery/pro/helpers/Constants.kt | 1 + .../gallery/pro/views/EditorDrawCanvas.kt | 4 ++++ app/src/main/res/layout/activity_edit.xml | 8 +++++++ .../res/layout/bottom_editor_draw_actions.xml | 22 ++++++++++++++++++ app/src/main/res/values/dimens.xml | 1 + 7 files changed, 63 insertions(+) create mode 100644 app/src/main/res/layout/bottom_editor_draw_actions.xml diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt index 09f43c482..ae3747789 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt @@ -24,6 +24,7 @@ import com.bumptech.glide.load.engine.GlideException import com.bumptech.glide.request.RequestListener import com.bumptech.glide.request.RequestOptions import com.bumptech.glide.request.target.Target +import com.simplemobiletools.commons.dialogs.ColorPickerDialog import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.helpers.OTG_PATH import com.simplemobiletools.commons.helpers.PERMISSION_WRITE_STORAGE @@ -46,6 +47,7 @@ import kotlinx.android.synthetic.main.activity_edit.* import kotlinx.android.synthetic.main.bottom_actions_aspect_ratio.* import kotlinx.android.synthetic.main.bottom_editor_actions_filter.* import kotlinx.android.synthetic.main.bottom_editor_crop_rotate_actions.* +import kotlinx.android.synthetic.main.bottom_editor_draw_actions.* import kotlinx.android.synthetic.main.bottom_editor_primary_actions.* import java.io.* @@ -73,6 +75,7 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener private lateinit var saveUri: Uri private var resizeWidth = 0 private var resizeHeight = 0 + private var drawColor = 0 private var lastOtherAspectRatio: Pair? = null private var currPrimaryAction = PRIMARY_ACTION_NONE private var currCropRotateAction = CROP_ROTATE_NONE @@ -312,6 +315,7 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener setupPrimaryActionButtons() setupCropRotateActionButtons() setupAspectRatioButtons() + setupDrawButtons() } private fun setupPrimaryActionButtons() { @@ -416,6 +420,17 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener updateAspectRatioButtons() } + private fun setupDrawButtons() { + updateDrawColor(config.lastEditorDrawColor) + bottom_draw_color.setOnClickListener { + ColorPickerDialog(this, drawColor) { wasPositivePressed, color -> + if (wasPositivePressed) { + updateDrawColor(color) + } + } + } + } + private fun updatePrimaryActionButtons() { if (crop_image_view.isGone() && currPrimaryAction == PRIMARY_ACTION_CROP_ROTATE) { loadCropImageView() @@ -439,6 +454,7 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener currentPrimaryActionButton?.applyColorFilter(config.primaryColor) bottom_editor_filter_actions.beVisibleIf(currPrimaryAction == PRIMARY_ACTION_FILTER) bottom_editor_crop_rotate_actions.beVisibleIf(currPrimaryAction == PRIMARY_ACTION_CROP_ROTATE) + bottom_editor_draw_actions.beVisibleIf(currPrimaryAction == PRIMARY_ACTION_DRAW) if (currPrimaryAction == PRIMARY_ACTION_FILTER && bottom_actions_filter_list.adapter == null) { Thread { @@ -541,6 +557,13 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener primaryActionView?.applyColorFilter(config.primaryColor) } + private fun updateDrawColor(color: Int) { + drawColor = color + bottom_draw_color.applyColorFilter(color) + config.lastEditorDrawColor = color + editor_draw_canvas.updateColor(color) + } + private fun resizeImage() { val point = getAreaSize() if (point == null) { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Config.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Config.kt index 32467ca4b..ef2b092e7 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Config.kt @@ -453,4 +453,8 @@ class Config(context: Context) : BaseConfig(context) { var allowOneToOneZoom: Boolean get() = prefs.getBoolean(ALLOW_ONE_TO_ONE_ZOOM, false) set(allowOneToOneZoom) = prefs.edit().putBoolean(ALLOW_ONE_TO_ONE_ZOOM, allowOneToOneZoom).apply() + + var lastEditorDrawColor: Int + get() = prefs.getInt(LAST_EDITOR_DRAW_COLOR, primaryColor) + set(lastEditorDrawColor) = prefs.edit().putInt(LAST_EDITOR_DRAW_COLOR, lastEditorDrawColor).apply() } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt index d96736b78..f84ae3b88 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt @@ -76,6 +76,7 @@ const val LAST_EDITOR_CROP_OTHER_ASPECT_RATIO_Y = "last_editor_crop_other_aspect const val GROUP_DIRECT_SUBFOLDERS = "group_direct_subfolders" const val SHOW_WIDGET_FOLDER_NAME = "show_widget_folder_name" const val ALLOW_ONE_TO_ONE_ZOOM = "allow_one_to_one_zoom" +const val LAST_EDITOR_DRAW_COLOR = "last_editor_draw_color" // slideshow const val SLIDESHOW_INTERVAL = "slideshow_interval" diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/EditorDrawCanvas.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/EditorDrawCanvas.kt index 0451f0667..2db8dcbaa 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/EditorDrawCanvas.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/EditorDrawCanvas.kt @@ -119,6 +119,10 @@ class EditorDrawCanvas(context: Context, attrs: AttributeSet) : View(context, at mPaint.strokeWidth = paintOptions.strokeWidth } + fun updateColor(newColor: Int) { + mPaintOptions.color = newColor + } + fun updateBackgroundBitmap(bitmap: Bitmap) { backgroundBitmap = bitmap invalidate() diff --git a/app/src/main/res/layout/activity_edit.xml b/app/src/main/res/layout/activity_edit.xml index 6a675d81c..bef9caf69 100644 --- a/app/src/main/res/layout/activity_edit.xml +++ b/app/src/main/res/layout/activity_edit.xml @@ -63,6 +63,14 @@ android:layout_above="@+id/bottom_editor_primary_actions" android:visibility="gone"/> + + diff --git a/app/src/main/res/layout/bottom_editor_draw_actions.xml b/app/src/main/res/layout/bottom_editor_draw_actions.xml new file mode 100644 index 000000000..4f2a55fbf --- /dev/null +++ b/app/src/main/res/layout/bottom_editor_draw_actions.xml @@ -0,0 +1,22 @@ + + + + + + diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index b2135537c..9185f05bb 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -12,6 +12,7 @@ 50dp 72dp 64dp + 48dp 76dp 90dp 180dp From 722efbfeddafe279af1b99b976a79ffb46dfda95 Mon Sep 17 00:00:00 2001 From: sawka6630 Date: Sun, 13 Jan 2019 14:06:10 +0200 Subject: [PATCH 34/75] Upadated Ukrainian translation Updated string #174 --- app/src/main/res/values-uk/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/values-uk/strings.xml b/app/src/main/res/values-uk/strings.xml index 9e153372d..d6e3047fa 100644 --- a/app/src/main/res/values-uk/strings.xml +++ b/app/src/main/res/values-uk/strings.xml @@ -171,7 +171,7 @@ Показувати \"Кошик\" останнім елементом на головному екрані Дозволити закриття повноекранного перегляду свайпом згори вниз Дозволити масштабування до 1:1 подвійним тапом - Always open videos on a separate screen with new horizontal gestures + Завжди відкривати відео на окремому екрані з новими горизонтальними жестами Ескізи From b039a6f8d81b617dcc3a64f655e7a557f47d655a Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 13 Jan 2019 13:18:47 +0100 Subject: [PATCH 35/75] adjusting some editor related sizes/margins --- .../gallery/pro/activities/EditActivity.kt | 51 +++++++++++-------- .../gallery/pro/views/EditorDrawCanvas.kt | 4 +- app/src/main/res/layout/activity_edit.xml | 8 +-- app/src/main/res/values/dimens.xml | 1 + 4 files changed, 38 insertions(+), 26 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt index ae3747789..2a06ea6a5 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt @@ -242,31 +242,42 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener default_image_view.beGone() crop_image_view.beGone() editor_draw_canvas.beVisible() + editor_draw_canvas.onGlobalLayout { + Thread { + fillCanvasBackground() + }.start() + } + } - Thread { - val size = Point() - windowManager.defaultDisplay.getSize(size) - val options = RequestOptions() - .format(DecodeFormat.PREFER_ARGB_8888) - .skipMemoryCache(true) - .diskCacheStrategy(DiskCacheStrategy.NONE) - .fitCenter() + private fun fillCanvasBackground() { + val size = Point() + windowManager.defaultDisplay.getSize(size) + val options = RequestOptions() + .format(DecodeFormat.PREFER_ARGB_8888) + .skipMemoryCache(true) + .diskCacheStrategy(DiskCacheStrategy.NONE) + .fitCenter() - try { - val builder = Glide.with(applicationContext) - .asBitmap() - .load(uri) - .apply(options) - .into(size.x, size.y) + try { + val builder = Glide.with(applicationContext) + .asBitmap() + .load(uri) + .apply(options) + .into(editor_draw_canvas.width, editor_draw_canvas.height) - val bitmap = builder.get() - runOnUiThread { - editor_draw_canvas.updateBackgroundBitmap(bitmap) + val bitmap = builder.get() + runOnUiThread { + editor_draw_canvas.apply { + updateBackgroundBitmap(bitmap) + layoutParams.width = bitmap.width + layoutParams.height = bitmap.height + (layoutParams as RelativeLayout.LayoutParams).removeRule(RelativeLayout.ABOVE) + requestLayout() } - } catch (e: Exception) { - showErrorToast(e) } - }.start() + } catch (e: Exception) { + showErrorToast(e) + } } @TargetApi(Build.VERSION_CODES.N) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/EditorDrawCanvas.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/EditorDrawCanvas.kt index 2db8dcbaa..4cc2e9dc9 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/EditorDrawCanvas.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/EditorDrawCanvas.kt @@ -44,9 +44,7 @@ class EditorDrawCanvas(context: Context, attrs: AttributeSet) : View(context, at canvas.save() if (backgroundBitmap != null) { - val left = (width - backgroundBitmap!!.width) / 2 - val top = (height - backgroundBitmap!!.height) / 2 - canvas.drawBitmap(backgroundBitmap!!, left.toFloat(), top.toFloat(), null) + canvas.drawBitmap(backgroundBitmap!!, 0f, 0f, null) } for ((key, value) in mPaths) { diff --git a/app/src/main/res/layout/activity_edit.xml b/app/src/main/res/layout/activity_edit.xml index bef9caf69..bc2d1b016 100644 --- a/app/src/main/res/layout/activity_edit.xml +++ b/app/src/main/res/layout/activity_edit.xml @@ -11,14 +11,14 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:layout_above="@+id/bottom_editor_crop_rotate_actions" - android:layout_marginBottom="@dimen/activity_margin"/> + android:layout_marginBottom="@dimen/bottom_filters_height_with_margin"/> @@ -28,7 +28,9 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:layout_above="@+id/bottom_editor_crop_rotate_actions" - android:layout_marginBottom="@dimen/activity_margin" + android:layout_alignParentTop="true" + android:layout_centerInParent="true" + android:layout_marginBottom="@dimen/bottom_actions_height" android:background="@android:color/transparent" android:visibility="gone"/> diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index 9185f05bb..936d72808 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -15,6 +15,7 @@ 48dp 76dp 90dp + 98dp 180dp 86dp 110dp From 73042347831887f924cb71ec7e9b53dcf57c45a9 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 13 Jan 2019 13:28:01 +0100 Subject: [PATCH 36/75] handle saving images with something drawn on them --- .../gallery/pro/activities/EditActivity.kt | 21 +++++++++++++++---- .../gallery/pro/views/EditorDrawCanvas.kt | 9 ++++++++ 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt index 2a06ea6a5..bbd5e91c6 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt @@ -295,6 +295,18 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener if (crop_image_view.isVisible()) { crop_image_view.getCroppedImageAsync() + } else if (editor_draw_canvas.isVisible()) { + val bitmap = editor_draw_canvas.getBitmap() + if (saveUri.scheme == "file") { + SaveAsDialog(this, saveUri.path, true) { + saveBitmapToFile(bitmap, it, true) + } + } else if (saveUri.scheme == "content") { + val filePathGetter = getNewFilePath() + SaveAsDialog(this, filePathGetter.first, filePathGetter.second) { + saveBitmapToFile(bitmap, it, true) + } + } } else { val currentFilter = getFiltersAdapter()?.getCurrentFilter() ?: return val filePathGetter = getNewFilePath() @@ -610,15 +622,16 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener override fun onCropImageComplete(view: CropImageView, result: CropImageView.CropResult) { if (result.error == null) { + val bitmap = result.bitmap if (isCropIntent) { if (saveUri.scheme == "file") { - saveBitmapToFile(result.bitmap, saveUri.path, true) + saveBitmapToFile(bitmap, saveUri.path, true) } else { var inputStream: InputStream? = null var outputStream: OutputStream? = null try { val stream = ByteArrayOutputStream() - result.bitmap.compress(CompressFormat.JPEG, 100, stream) + bitmap.compress(CompressFormat.JPEG, 100, stream) inputStream = ByteArrayInputStream(stream.toByteArray()) outputStream = contentResolver.openOutputStream(saveUri) inputStream.copyTo(outputStream) @@ -636,12 +649,12 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener } } else if (saveUri.scheme == "file") { SaveAsDialog(this, saveUri.path, true) { - saveBitmapToFile(result.bitmap, it, true) + saveBitmapToFile(bitmap, it, true) } } else if (saveUri.scheme == "content") { val filePathGetter = getNewFilePath() SaveAsDialog(this, filePathGetter.first, filePathGetter.second) { - saveBitmapToFile(result.bitmap, it, true) + saveBitmapToFile(bitmap, it, true) } } else { toast(R.string.unknown_file_location) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/EditorDrawCanvas.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/EditorDrawCanvas.kt index 4cc2e9dc9..d97745055 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/EditorDrawCanvas.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/EditorDrawCanvas.kt @@ -3,6 +3,7 @@ package com.simplemobiletools.gallery.pro.views import android.content.Context import android.graphics.Bitmap import android.graphics.Canvas +import android.graphics.Color import android.graphics.Paint import android.util.AttributeSet import android.view.MotionEvent @@ -125,4 +126,12 @@ class EditorDrawCanvas(context: Context, attrs: AttributeSet) : View(context, at backgroundBitmap = bitmap invalidate() } + + fun getBitmap(): Bitmap { + val bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888) + val canvas = Canvas(bitmap) + canvas.drawColor(Color.WHITE) + draw(canvas) + return bitmap + } } From b63c385859fd8e3067353556e0d8a9602fb7d79d Mon Sep 17 00:00:00 2001 From: Emanuele Petriglia Date: Sun, 13 Jan 2019 13:06:49 +0000 Subject: [PATCH 37/75] Update italian translation --- app/src/main/res/values-it/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index b75eb6ff3..7c5a6ead1 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -171,7 +171,7 @@ Mostra il cestino come ultimo elemento nella schermata principale Chiudi la visuale a schermo intero con un gesto verso il basso Permetti l\'ingrandimento 1:1 con un doppio tasto - Always open videos on a separate screen with new horizontal gestures + Apri sempre i video su uno schermo separato con i nuovi movimenti orizzontali Anteprime From d0d04f6ca694e7a3324b92cd48f2a18e3efa5d97 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 13 Jan 2019 17:46:06 +0100 Subject: [PATCH 38/75] allow customizing the editor draw brush width --- .../gallery/pro/activities/EditActivity.kt | 17 ++++++++++- .../gallery/pro/helpers/Config.kt | 4 +++ .../gallery/pro/helpers/Constants.kt | 1 + .../gallery/pro/views/EditorDrawCanvas.kt | 5 ++++ .../res/layout/bottom_editor_draw_actions.xml | 29 +++++++++++++++++-- app/src/main/res/values/dimens.xml | 1 + 6 files changed, 53 insertions(+), 4 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt index bbd5e91c6..b14e064e2 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt @@ -445,13 +445,28 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener private fun setupDrawButtons() { updateDrawColor(config.lastEditorDrawColor) - bottom_draw_color.setOnClickListener { + bottom_draw_width.progress = config.lastEditorBrushSize + updateBrushSize(config.lastEditorBrushSize) + + bottom_draw_color_clickable.setOnClickListener { ColorPickerDialog(this, drawColor) { wasPositivePressed, color -> if (wasPositivePressed) { updateDrawColor(color) } } } + + bottom_draw_width.onSeekBarChangeListener { + config.lastEditorBrushSize = it + updateBrushSize(it) + } + } + + private fun updateBrushSize(percent: Int) { + editor_draw_canvas.updateBrushSize(percent) + val scale = Math.max(0.03f, percent / 100f) + bottom_draw_color.scaleX = scale + bottom_draw_color.scaleY = scale } private fun updatePrimaryActionButtons() { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Config.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Config.kt index ef2b092e7..6b2c9879e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Config.kt @@ -457,4 +457,8 @@ class Config(context: Context) : BaseConfig(context) { var lastEditorDrawColor: Int get() = prefs.getInt(LAST_EDITOR_DRAW_COLOR, primaryColor) set(lastEditorDrawColor) = prefs.edit().putInt(LAST_EDITOR_DRAW_COLOR, lastEditorDrawColor).apply() + + var lastEditorBrushSize: Int + get() = prefs.getInt(LAST_EDITOR_BRUSH_SIZE, 50) + set(lastEditorBrushSize) = prefs.edit().putInt(LAST_EDITOR_BRUSH_SIZE, lastEditorBrushSize).apply() } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt index f84ae3b88..90cbba1a6 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt @@ -77,6 +77,7 @@ const val GROUP_DIRECT_SUBFOLDERS = "group_direct_subfolders" const val SHOW_WIDGET_FOLDER_NAME = "show_widget_folder_name" const val ALLOW_ONE_TO_ONE_ZOOM = "allow_one_to_one_zoom" const val LAST_EDITOR_DRAW_COLOR = "last_editor_draw_color" +const val LAST_EDITOR_BRUSH_SIZE = "last_editor_brush_size" // slideshow const val SLIDESHOW_INTERVAL = "slideshow_interval" diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/EditorDrawCanvas.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/EditorDrawCanvas.kt index d97745055..0551cc963 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/EditorDrawCanvas.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/EditorDrawCanvas.kt @@ -8,6 +8,7 @@ import android.graphics.Paint import android.util.AttributeSet import android.view.MotionEvent import android.view.View +import com.simplemobiletools.gallery.pro.R import com.simplemobiletools.gallery.pro.extensions.config import com.simplemobiletools.gallery.pro.models.MyPath import com.simplemobiletools.gallery.pro.models.PaintOptions @@ -122,6 +123,10 @@ class EditorDrawCanvas(context: Context, attrs: AttributeSet) : View(context, at mPaintOptions.color = newColor } + fun updateBrushSize(newBrushSize: Int) { + mPaintOptions.strokeWidth = resources.getDimension(R.dimen.full_brush_size) * (newBrushSize / 100f) + } + fun updateBackgroundBitmap(bitmap: Bitmap) { backgroundBitmap = bitmap invalidate() diff --git a/app/src/main/res/layout/bottom_editor_draw_actions.xml b/app/src/main/res/layout/bottom_editor_draw_actions.xml index 4f2a55fbf..d88f7b995 100644 --- a/app/src/main/res/layout/bottom_editor_draw_actions.xml +++ b/app/src/main/res/layout/bottom_editor_draw_actions.xml @@ -7,16 +7,39 @@ android:layout_height="@dimen/bottom_actions_height" android:layout_alignParentBottom="true"> + + + + diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index 936d72808..bdebf85ea 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -19,4 +19,5 @@ 180dp 86dp 110dp + 40dp From 5f9378135a5662d2ed23dd79f60fcffd9d0444e8 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 13 Jan 2019 17:52:16 +0100 Subject: [PATCH 39/75] make spam folder excluding more agressive, check them at 55 folders already --- .../simplemobiletools/gallery/pro/activities/MainActivity.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt index 86645f1fe..6e4fa3240 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt @@ -927,7 +927,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { } mDirs = dirs.clone() as ArrayList - if (mDirs.size > 100) { + if (mDirs.size > 55) { excludeSpamFolders() } } From 1776ab592d38a29178393d1c4c9b93e5bcff49a4 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 13 Jan 2019 18:02:06 +0100 Subject: [PATCH 40/75] adding an Undo button to editor drawing --- .../gallery/pro/activities/EditActivity.kt | 4 ++++ .../gallery/pro/views/EditorDrawCanvas.kt | 10 ++++++++++ .../res/layout/bottom_editor_draw_actions.xml | 19 ++++++++++++++++--- 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt index b14e064e2..0cc34a601 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt @@ -460,6 +460,10 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener config.lastEditorBrushSize = it updateBrushSize(it) } + + bottom_draw_undo.setOnClickListener { + editor_draw_canvas.undo() + } } private fun updateBrushSize(percent: Int) { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/EditorDrawCanvas.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/EditorDrawCanvas.kt index 0551cc963..8d1ee75b7 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/EditorDrawCanvas.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/EditorDrawCanvas.kt @@ -139,4 +139,14 @@ class EditorDrawCanvas(context: Context, attrs: AttributeSet) : View(context, at draw(canvas) return bitmap } + + fun undo() { + if (mPaths.isEmpty()) { + return + } + + val lastKey = mPaths.keys.lastOrNull() + mPaths.remove(lastKey) + invalidate() + } } diff --git a/app/src/main/res/layout/bottom_editor_draw_actions.xml b/app/src/main/res/layout/bottom_editor_draw_actions.xml index d88f7b995..fb12e40b2 100644 --- a/app/src/main/res/layout/bottom_editor_draw_actions.xml +++ b/app/src/main/res/layout/bottom_editor_draw_actions.xml @@ -24,21 +24,34 @@ android:id="@+id/bottom_draw_color_clickable" android:layout_width="@dimen/bottom_editor_color_picker_size" android:layout_height="@dimen/bottom_editor_color_picker_size" - android:layout_marginRight="@dimen/activity_margin" + android:layout_marginRight="@dimen/small_margin" android:background="?attr/selectableItemBackgroundBorderless" app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintRight_toRightOf="parent" + app:layout_constraintRight_toLeftOf="@+id/bottom_draw_undo" app:layout_constraintTop_toTopOf="parent"/> + + From d8e19762fcd5e4c52e06de11ab32bc432b1d8c4f Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 13 Jan 2019 18:12:03 +0100 Subject: [PATCH 41/75] removing some redundant drawing related files --- .../gallery/pro/actions/Action.kt | 11 --- .../gallery/pro/actions/Line.kt | 37 --------- .../gallery/pro/actions/Move.kt | 37 --------- .../gallery/pro/actions/Quad.kt | 46 ----------- .../gallery/pro/models/MyPath.kt | 82 ------------------- .../gallery/pro/models/PaintOptions.kt | 4 +- .../gallery/pro/views/EditorDrawCanvas.kt | 15 ++-- 7 files changed, 6 insertions(+), 226 deletions(-) delete mode 100644 app/src/main/kotlin/com/simplemobiletools/gallery/pro/actions/Action.kt delete mode 100644 app/src/main/kotlin/com/simplemobiletools/gallery/pro/actions/Line.kt delete mode 100644 app/src/main/kotlin/com/simplemobiletools/gallery/pro/actions/Move.kt delete mode 100644 app/src/main/kotlin/com/simplemobiletools/gallery/pro/actions/Quad.kt delete mode 100644 app/src/main/kotlin/com/simplemobiletools/gallery/pro/models/MyPath.kt diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/actions/Action.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/actions/Action.kt deleted file mode 100644 index adbc82662..000000000 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/actions/Action.kt +++ /dev/null @@ -1,11 +0,0 @@ -package com.simplemobiletools.gallery.pro.actions - -import android.graphics.Path -import java.io.Serializable -import java.io.Writer - -interface Action : Serializable { - fun perform(path: Path) - - fun perform(writer: Writer) -} diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/actions/Line.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/actions/Line.kt deleted file mode 100644 index a38a70b1f..000000000 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/actions/Line.kt +++ /dev/null @@ -1,37 +0,0 @@ -package com.simplemobiletools.gallery.pro.actions - -import android.graphics.Path -import java.io.Writer -import java.security.InvalidParameterException - -class Line : Action { - - val x: Float - val y: Float - - constructor(data: String) { - if (!data.startsWith("L")) - throw InvalidParameterException("The Line data should start with 'L'.") - - try { - val xy = data.substring(1).split(",".toRegex()).dropLastWhile(String::isEmpty).toTypedArray() - x = xy[0].trim().toFloat() - y = xy[1].trim().toFloat() - } catch (ignored: Exception) { - throw InvalidParameterException("Error parsing the given Line data.") - } - } - - constructor(x: Float, y: Float) { - this.x = x - this.y = y - } - - override fun perform(path: Path) { - path.lineTo(x, y) - } - - override fun perform(writer: Writer) { - writer.write("L$x,$y") - } -} diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/actions/Move.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/actions/Move.kt deleted file mode 100644 index bf96489bb..000000000 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/actions/Move.kt +++ /dev/null @@ -1,37 +0,0 @@ -package com.simplemobiletools.gallery.pro.actions - -import android.graphics.Path -import java.io.Writer -import java.security.InvalidParameterException - -class Move : Action { - - val x: Float - val y: Float - - constructor(data: String) { - if (!data.startsWith("M")) - throw InvalidParameterException("The Move data should start with 'M'.") - - try { - val xy = data.substring(1).split(",".toRegex()).dropLastWhile(String::isEmpty).toTypedArray() - x = xy[0].trim().toFloat() - y = xy[1].trim().toFloat() - } catch (ignored: Exception) { - throw InvalidParameterException("Error parsing the given Move data.") - } - } - - constructor(x: Float, y: Float) { - this.x = x - this.y = y - } - - override fun perform(path: Path) { - path.moveTo(x, y) - } - - override fun perform(writer: Writer) { - writer.write("M$x,$y") - } -} diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/actions/Quad.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/actions/Quad.kt deleted file mode 100644 index fb281c29a..000000000 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/actions/Quad.kt +++ /dev/null @@ -1,46 +0,0 @@ -package com.simplemobiletools.gallery.pro.actions - -import android.graphics.Path -import java.io.Writer -import java.security.InvalidParameterException - -class Quad : Action { - - val x1: Float - val y1: Float - val x2: Float - val y2: Float - - constructor(data: String) { - if (!data.startsWith("Q")) - throw InvalidParameterException("The Quad data should start with 'Q'.") - - try { - val parts = data.split("\\s+".toRegex()).dropLastWhile(String::isEmpty).toTypedArray() - val xy1 = parts[0].substring(1).split(",".toRegex()).dropLastWhile(String::isEmpty).toTypedArray() - val xy2 = parts[1].split(",".toRegex()).dropLastWhile(String::isEmpty).toTypedArray() - - x1 = xy1[0].trim().toFloat() - y1 = xy1[1].trim().toFloat() - x2 = xy2[0].trim().toFloat() - y2 = xy2[1].trim().toFloat() - } catch (ignored: Exception) { - throw InvalidParameterException("Error parsing the given Quad data.") - } - } - - constructor(x1: Float, y1: Float, x2: Float, y2: Float) { - this.x1 = x1 - this.y1 = y1 - this.x2 = x2 - this.y2 = y2 - } - - override fun perform(path: Path) { - path.quadTo(x1, y1, x2, y2) - } - - override fun perform(writer: Writer) { - writer.write("Q$x1,$y1 $x2,$y2") - } -} diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/models/MyPath.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/models/MyPath.kt deleted file mode 100644 index 564eab0c8..000000000 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/models/MyPath.kt +++ /dev/null @@ -1,82 +0,0 @@ -package com.simplemobiletools.gallery.pro.models - -import android.app.Activity -import android.graphics.Path -import com.simplemobiletools.commons.extensions.toast -import com.simplemobiletools.gallery.pro.R -import com.simplemobiletools.gallery.pro.actions.Action -import com.simplemobiletools.gallery.pro.actions.Line -import com.simplemobiletools.gallery.pro.actions.Move -import com.simplemobiletools.gallery.pro.actions.Quad -import java.io.ObjectInputStream -import java.io.Serializable -import java.security.InvalidParameterException -import java.util.* - -// https://stackoverflow.com/a/8127953 -class MyPath : Path(), Serializable { - val actions = LinkedList() - - private fun readObject(inputStream: ObjectInputStream) { - inputStream.defaultReadObject() - - val copiedActions = actions.map { it } - copiedActions.forEach { - it.perform(this) - } - } - - fun readObject(pathData: String, activity: Activity) { - val tokens = pathData.split("\\s+".toRegex()).dropLastWhile(String::isEmpty).toTypedArray() - var i = 0 - try { - while (i < tokens.size) { - when (tokens[i][0]) { - 'M' -> addAction(Move(tokens[i])) - 'L' -> addAction(Line(tokens[i])) - 'Q' -> { - // Quad actions are of the following form: - // "Qx1,y1 x2,y2" - // Since we split the tokens by whitespace, we need to join them again - if (i + 1 >= tokens.size) - throw InvalidParameterException("Error parsing the data for a Quad.") - - addAction(Quad(tokens[i] + " " + tokens[i + 1])) - ++i - } - } - ++i - } - } catch (e: Exception) { - activity.toast(R.string.unknown_error_occurred) - } - } - - override fun reset() { - actions.clear() - super.reset() - } - - private fun addAction(action: Action) { - when (action) { - is Move -> moveTo(action.x, action.y) - is Line -> lineTo(action.x, action.y) - is Quad -> quadTo(action.x1, action.y1, action.x2, action.y2) - } - } - - override fun moveTo(x: Float, y: Float) { - actions.add(Move(x, y)) - super.moveTo(x, y) - } - - override fun lineTo(x: Float, y: Float) { - actions.add(Line(x, y)) - super.lineTo(x, y) - } - - override fun quadTo(x1: Float, y1: Float, x2: Float, y2: Float) { - actions.add(Quad(x1, y1, x2, y2)) - super.quadTo(x1, y1, x2, y2) - } -} diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/models/PaintOptions.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/models/PaintOptions.kt index 34c128dca..fc1cacb2a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/models/PaintOptions.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/models/PaintOptions.kt @@ -2,6 +2,4 @@ package com.simplemobiletools.gallery.pro.models import android.graphics.Color -data class PaintOptions(var color: Int = Color.BLACK, var strokeWidth: Float = 5f, var isEraser: Boolean = false) { - fun getColorToExport() = if (isEraser) "none" else "#${Integer.toHexString(color).substring(2)}" -} +data class PaintOptions(var color: Int = Color.BLACK, var strokeWidth: Float = 5f) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/EditorDrawCanvas.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/EditorDrawCanvas.kt index 8d1ee75b7..592320b33 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/EditorDrawCanvas.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/EditorDrawCanvas.kt @@ -1,16 +1,12 @@ package com.simplemobiletools.gallery.pro.views import android.content.Context -import android.graphics.Bitmap -import android.graphics.Canvas -import android.graphics.Color -import android.graphics.Paint +import android.graphics.* import android.util.AttributeSet import android.view.MotionEvent import android.view.View import com.simplemobiletools.gallery.pro.R import com.simplemobiletools.gallery.pro.extensions.config -import com.simplemobiletools.gallery.pro.models.MyPath import com.simplemobiletools.gallery.pro.models.PaintOptions import java.util.* @@ -22,9 +18,9 @@ class EditorDrawCanvas(context: Context, attrs: AttributeSet) : View(context, at private var mColor = 0 private var mWasMultitouch = false - private var mPaths = LinkedHashMap() + private var mPaths = LinkedHashMap() private var mPaint = Paint() - private var mPath = MyPath() + private var mPath = Path() private var mPaintOptions = PaintOptions() private var backgroundBitmap: Bitmap? = null @@ -56,7 +52,6 @@ class EditorDrawCanvas(context: Context, attrs: AttributeSet) : View(context, at changePaint(mPaintOptions) canvas.drawPath(mPath, mPaint) - canvas.restore() } @@ -110,8 +105,8 @@ class EditorDrawCanvas(context: Context, attrs: AttributeSet) : View(context, at } mPaths[mPath] = mPaintOptions - mPath = MyPath() - mPaintOptions = PaintOptions(mPaintOptions.color, mPaintOptions.strokeWidth, mPaintOptions.isEraser) + mPath = Path() + mPaintOptions = PaintOptions(mPaintOptions.color, mPaintOptions.strokeWidth) } private fun changePaint(paintOptions: PaintOptions) { From aee4012178dcece9537e780c0453de74d2df6dee Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 13 Jan 2019 19:47:38 +0100 Subject: [PATCH 42/75] removing an unused Settings strin --- app/src/main/res/values-ar/strings.xml | 1 - app/src/main/res/values-az/strings.xml | 1 - app/src/main/res/values-ca/strings.xml | 1 - app/src/main/res/values-cs/strings.xml | 1 - app/src/main/res/values-da/strings.xml | 1 - app/src/main/res/values-de/strings.xml | 1 - app/src/main/res/values-el/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-gl/strings.xml | 1 - app/src/main/res/values-hr/strings.xml | 1 - app/src/main/res/values-hu/strings.xml | 1 - app/src/main/res/values-id/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-ko-rKR/strings.xml | 1 - app/src/main/res/values-lt/strings.xml | 1 - app/src/main/res/values-nb/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-sl/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-uk/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 - 32 files changed, 32 deletions(-) diff --git a/app/src/main/res/values-ar/strings.xml b/app/src/main/res/values-ar/strings.xml index fb5b1c36e..183dcd9c6 100644 --- a/app/src/main/res/values-ar/strings.xml +++ b/app/src/main/res/values-ar/strings.xml @@ -160,7 +160,6 @@ السماح بالتحكم في سطوع الصورة باستخدام الإيماءات الرأسية السماح بالتحكم في صوت الفيديو والسطوع بالإيماءات العمودية إظهار عدد لوسائط المجلد على طريقة العرض الرئيسية - استبدال خيار المشاركة مع خيار تدوير في القائمة ملء الشاشة عرض تفاصيل موسعة على وسائط ملء الشاشة إدارة المجلدات المستبعدة السماح بتكبير الوسائط بأصبع واحد في وضع ملء الشاشة diff --git a/app/src/main/res/values-az/strings.xml b/app/src/main/res/values-az/strings.xml index c9e15476d..24a058657 100644 --- a/app/src/main/res/values-az/strings.xml +++ b/app/src/main/res/values-az/strings.xml @@ -156,7 +156,6 @@ Allow controlling photo brightness with vertical gestures Allow controlling video volume and brightness with vertical gestures Show folder media count on the main view - Replace Share with Rotate at fullscreen menu Show extended details over fullscreen media Manage extended details Allow one finger zoom at fullscreen media diff --git a/app/src/main/res/values-ca/strings.xml b/app/src/main/res/values-ca/strings.xml index f3cadd8e0..6a70c16b4 100644 --- a/app/src/main/res/values-ca/strings.xml +++ b/app/src/main/res/values-ca/strings.xml @@ -156,7 +156,6 @@ Permet controlar la brillantor amb gestos verticals Permet controlar el volum i la brillantor del vídeo amb gestos verticals Mostrar el número de mitjans de les carpetes a la vista principal - Reemplaçar Compartir per Girar al menú de pantalla complerta Mostrar detalls estesos sobre mitjans a pantalla complerta Gestioneu els detalls ampliats Permet fer zoom amb un sol dit a pantalla complerta diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index 788fe4d0a..217713a38 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -156,7 +156,6 @@ Povolit ovládání jasu vertikálními tahy Povolit ovládání hlasitosti a jasu videí vertikálními tahy Zobrazit počet médií ve složce na hlavní obrazovce - Nahradit Sdílení s Otočením v celoobrazovkovém menu Zobrazit rozšířené vlastnosti přes celoobrazovkové média Spravovat rozšířené vlastnosti Povolit přibližování jedním prstem v celoobrazovkovém režimu diff --git a/app/src/main/res/values-da/strings.xml b/app/src/main/res/values-da/strings.xml index 774bc168d..7a8184851 100644 --- a/app/src/main/res/values-da/strings.xml +++ b/app/src/main/res/values-da/strings.xml @@ -156,7 +156,6 @@ Tillad kontrol af lysstyrke på billeder med lodrette bevægelser Tillad kontrol af lyd- og lysstyrke på videoer med lodrette bevægelser Vis antal filer i hver mappe i oversigten - Erstat Del med Rotér i fuldskærmsmenuen Vis udvidede oplysninger over medier i fuldskærm Administrer udvidede oplysninger Tillad zoom med en finger når medier er i fuldskærm diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 42590db83..cb0fb96b3 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -156,7 +156,6 @@ Fotohelligkeit mit vertikalen Gesten ändern Gesten für Videolautstärke/Helligkeit zulassen Medienanzahl bei Ordnern anzeigen - Teilen/Drehen im Vollbild-Menü vertauschen Dateieigenschaften in Vollbild-Anzeige einblenden Eigenschaften auswählen Ein-Finger-Zoom im Vollbild zulassen diff --git a/app/src/main/res/values-el/strings.xml b/app/src/main/res/values-el/strings.xml index f7657df46..e6abbeba5 100644 --- a/app/src/main/res/values-el/strings.xml +++ b/app/src/main/res/values-el/strings.xml @@ -156,7 +156,6 @@ Να επιτρέπεται ο έλεγχος φωτεινότητας με κατακόρυφες κινήσεις Να επιτρέπεται ο έλεγχος έντασης του βίντεο και φωτεινότητας με κατακόρυφες κινήσεις (gestures) Εμφάνιση του αριθμού πολυμέσων στον φάκελο, στην κύρια οθόνη - Αντικατάσταση της "Κοινής χρήσης" με "Περιστροφή" στο μενού πλήρους οθόνης Εμφάνιση λεπτομερειών στα πολυμέσα σε κατάσταση πλήρους οθόνης Διαχείριση εκτεταμένων λεπτομερειών Να επιτρέπεται μεγένθυση με ένα δάχτυλο σε πλήρη οθόνη diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 451f358f5..10b4c4fde 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -156,7 +156,6 @@ Permite controlar el brillo con gestos verticales Permite controlar el volumen y el brillo del video con gestos verticales Mostrar el conteo de medios de las carpetas en la vista principal - Reemplazar Compartir con Girar en el menú de pantalla completa Mostrar detalles extendidos sobre medios en pantalla completa Administrar detalles ampliados Permitir zoom con un dedo en pantalla completa diff --git a/app/src/main/res/values-fi/strings.xml b/app/src/main/res/values-fi/strings.xml index 5dfc7bc0d..c18bb546a 100644 --- a/app/src/main/res/values-fi/strings.xml +++ b/app/src/main/res/values-fi/strings.xml @@ -156,7 +156,6 @@ Salli kirkkauden säätäminen pystysuorilla eleillä Salli videon äänenvoimakkuuden ja kirkkauden säätö pystysuorilla eleillä Näytä kansioiden sisällön määrä päänäkymässä - Korvaa jakaminen kääntämisellä koko näytön tilassa Näytä yksityiskohtaiset tiedot täyden näytön tilassa Hallitse yksityiskohtaisia tietoja Salli lähentäminen yhdellä sormella täyden ruudun tilassa diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 49fc80b2e..8f2e3f9b1 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -156,7 +156,6 @@ Contrôler la luminosité de la photo avec des gestes verticaux Contrôler le volume et la luminosité de la vidéo avec des gestes verticaux Afficher le nombre de fichiers dans les dossiers - Remplacer \"Partager\" par \"Pivoter\" en plein écran Afficher en surimpression les informations supplémentaires du média en plein écran Gérer les informations supplémentaires Effectuer le zoom avec un doigt sur une image en plein écran diff --git a/app/src/main/res/values-gl/strings.xml b/app/src/main/res/values-gl/strings.xml index a71526efb..ed1120240 100644 --- a/app/src/main/res/values-gl/strings.xml +++ b/app/src/main/res/values-gl/strings.xml @@ -156,7 +156,6 @@ Permitir controlar o brillo da foto con xestos verticais Permitir controlar o volume do vídeo e o brillo con xestos verticáis Mostrar a conta de medios do cartafol na vista principal - Substituír Compartir con Rotar no menú de pantalla completa Mostrar información pormenorizada sobre medios a pantalla completa Xestionar información polo miúdo Permitir zoom con un dedo a pantalla completa diff --git a/app/src/main/res/values-hr/strings.xml b/app/src/main/res/values-hr/strings.xml index 26a19ad69..94e87d505 100644 --- a/app/src/main/res/values-hr/strings.xml +++ b/app/src/main/res/values-hr/strings.xml @@ -156,7 +156,6 @@ Omogućite kontrolu svjetline fotografije vertikalnim pokretima Omogući kontrolu glasnoće videa i svjetline pomoću vertikalnih pokreta Prikaz broja medija mapa u glavnom prikazu - Zamjeni Dijeli s Rotiraj pri pregledu datoteka Prikaži proširene pojedinosti preko medija na cijelom zaslonu Upravljaj proširenim pojedinostima Omogući zumiranje jednim prstom na mediju cijelog zaslona diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index 9a57d8b84..553de10b5 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -157,7 +157,6 @@ Engedélyezi a kép fényerő módosítást függőleges gesztusokkal Engedélyezi a videó hangerő és fényerő módosítást függőleges gesztusokkal Mutassa a fájlok számát a mappákban - Cserélje meg a Megosztást a Forgatással a teljes képernyős menüben Mutassa a kiterjesztett adatokat a teljes képernyős médián keresztül Bővített részletek kezelése Engedélyezi az egy ujjas nagyítást a teljes képernyős médiában diff --git a/app/src/main/res/values-id/strings.xml b/app/src/main/res/values-id/strings.xml index b316419f7..db3a73100 100644 --- a/app/src/main/res/values-id/strings.xml +++ b/app/src/main/res/values-id/strings.xml @@ -156,7 +156,6 @@ Izinkan mengontrol kecerahan foto dengan gerakan vertikal Izinkan mengontrol kecerahan dan volume video dengan gerakan vertikal Tampilkan jumlah folder media di tampilan utama - Ganti tombol Bagikan dengan Rotasi di menu layar penuh Tampilkan detail tambahan saat layar penuh Atur detail tambahan Izinkan zoom satu jari di layar penuh diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 7c5a6ead1..64f74108d 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -156,7 +156,6 @@ Controlla la luminosità delle foto con gesti verticali Gestisci il volume e la luminosità dei video con gesti verticali Mostra numero elementi nella cartella - Sostituisci Condividi con Ruota a schermo intero Mostra informazioni estese su media a schermo intero Gestisci le informazioni estese Abilita zoom con un dito su media a schermo intero diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index a22be1164..a1f015ddc 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -156,7 +156,6 @@ 垂直の動作で写真の明るさを制御 音量と明るさを縦の動作で変更 フォルダ内のメディア数を表示する - フルスクリーン時の「共有」を「回転」に置き換える フルスクリーンに詳細を重ねて表示する 詳細表示を管理する メディアを指だけでズームする diff --git a/app/src/main/res/values-ko-rKR/strings.xml b/app/src/main/res/values-ko-rKR/strings.xml index 6dcb1bc82..7b768c8c6 100644 --- a/app/src/main/res/values-ko-rKR/strings.xml +++ b/app/src/main/res/values-ko-rKR/strings.xml @@ -156,7 +156,6 @@ 상하 제스처로 사진 밝기 제어 수직 제스처로 비디오 볼륨 및 밝기 제어 폴더에 포함된 미디어파일 수 표시 - 전체화면 메뉴의 공유 아이콘을 회전 아이콘으로 변경 전체화면 모드에서 세부정보 표시 확장된 세부정보 관리 전체화면 모드에서 한 손가락으로 확대 및 축소 diff --git a/app/src/main/res/values-lt/strings.xml b/app/src/main/res/values-lt/strings.xml index c3098c8ca..dad3f6412 100644 --- a/app/src/main/res/values-lt/strings.xml +++ b/app/src/main/res/values-lt/strings.xml @@ -156,7 +156,6 @@ Leisti valdyti nuotraukų ryškumą vertikaliais gestais Leisti kontroliuoti vaizdo įrašo garsumą ir ryškumą vertikaliais gestais Rodyti aplanko bylų skaičių pagrindiniame rodinyje - Pakeisti bendrinti su rotacija viso ekrano meniu Rodyti išsamią informaciją per visą ekraną Tvarkykite išsamią informaciją Leisti vienu pirštu pritraukti viso ekrano rėžime diff --git a/app/src/main/res/values-nb/strings.xml b/app/src/main/res/values-nb/strings.xml index 2a296793e..38b03c9b3 100644 --- a/app/src/main/res/values-nb/strings.xml +++ b/app/src/main/res/values-nb/strings.xml @@ -156,7 +156,6 @@ Tillat å styre fotolysstyrke med vertikale bevegelser Tillat å styre videovolum og lysstyrke med vertikale bevegelser Vis mediaantallet i mapper på hovedvisningen - Erstatt Del med Roter i meny ved mediavisning Vis flere detaljer i mediavisningen Velg detaljer Tillat en-finger-zoom i mediavisningen diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index e21db0b57..94da40ac2 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -156,7 +156,6 @@ Helderheid voor afbeeldingen aanpassen met verticale veeggebaren Volume en helderheid voor video\'s aanpassen met verticale veeggebaren Aantallen in mappen tonen - Menu-item Draaien vastzetten in volledig scherm (in plaats van Delen) Uitgebreide informatie tonen in volledig scherm Uitgebreide informatie Met één vinger zoomen in volledig scherm diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index a7b6bef3b..cca934793 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -156,7 +156,6 @@    Zezwalaj na kontrolowanie jasności zdjęcia pionowymi gestami    Zezwalaj na kontrolowanie jasności i głośności filmów pionowymi gestami Pokazuj liczbę elementów w folderach w głównym widoku - Zamień funkcję udostępniania na obracanie w menu pełnoekranowym Dodatkowe szczegóły przy podglądzie pełnoekranowym Zarządzaj dodatkowymi szczegółami    Zezwalaj na powiększanie jednym palcem w widoku pełnoekranowym diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index ca9565e3a..2e40cf553 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -156,7 +156,6 @@ Permitir controle do brilho com gestos na vertical Permitir controle do volume e brilho com gestos na vertical 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 Permitir zoom com um dedo quando em exibição de tela cheia diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index 262a32198..5320da013 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -156,7 +156,6 @@ Permitir controlo do brilho das fotos com gestos verticais Permitir controlo do volume e do brilho dos vídeos através de gestos verticais Mostrar número de ficheiros na vista principal - Substituir a opção Partilhar pela opção Rodar se em ecrã completo Mostrar detalhes se em ecrã completo Gerir detalhes exibidos Permitir ampliação com um dedo se em ecrã completo diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 1c1958f85..02793b862 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -156,7 +156,6 @@ Управление яркостью при просмотре изображения вертикальными жестами Управление громкостью и яркостью при просмотре видео вертикальными жестами Показывать количество файлов в папках - Заменить \"Поделиться\" на \"Повернуть\" в меню при просмотре изображения Показывать сведения о файле Выбор сведений о файле Масштабирование одним пальцем при просмотре изображения diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index c9029678b..d3358df79 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -156,7 +156,6 @@ Povoliť ovládanie jasu vertikálnymi ťahmi Povoliť ovládanie hlasitosti a jasu videí vertikálnymi ťahmi Zobraziť počet médií v priečinku na hlavnej obrazovke - Nahradiť Zdieľanie s Otočením v celoobrazovkovom menu Zobraziť rozšírené vlastnosti ponad celoobrazovkové médiá Spravovať rozšírené vlastnosti Povoliť približovanie jedným prstom v celoobrazovkovom režime diff --git a/app/src/main/res/values-sl/strings.xml b/app/src/main/res/values-sl/strings.xml index bd7e541a5..f8e327cad 100644 --- a/app/src/main/res/values-sl/strings.xml +++ b/app/src/main/res/values-sl/strings.xml @@ -156,7 +156,6 @@ Dovoli nadzor svetlosti fotografije z vertikalnimi gestami Dovoli nadzor glasnosti in svetlosti videoposnetka z vertikalnimi gestami Pokaži število elementov v glavnem pogledu - Zamenjaj Deli z Obrni v celozaslonskem meniju Prikaži razširjene podrobnosti nad celozaslonskim prikazom Urejaj razširjene podrobnosti Dovoli enoprstno povečavo v celozaslonskem načinu diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index 90373f2da..996ca6c7c 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -156,7 +156,6 @@ Tillåt styrning av fotoljusstyrka med vertikala gester Tillåt styrning av videovolym och videoljusstyrka med vertikala gester Visa antalet mediefiler i varje mapp i huvudvyn - Ersätt Dela med Rotera i helskärmsmenyn Visa utökad information över media i helskärmsläge Hantera utökad information Tillåt zoomning med ett finger när media visas i helskärmsläge diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index 6b087ee42..23ce014cd 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -156,7 +156,6 @@ Dikey hareketlerle fotoğraf parlaklığının kontrolüne izin ver Video sesini ve parlaklığını dikey hareketlerle kontrol etmeye izin ver Ana görünümde klasör medya sayısını göster - Tam ekran menüsünde Döndür ile Paylaş\'ın yerini değiştir Tam ekran medya üzerinde genişletilmiş ayrıntıları göster Genişletilmiş ayrıntıları yönet Tam ekran medyalarda tek parmakla yakınlaştırmaya izin ver diff --git a/app/src/main/res/values-uk/strings.xml b/app/src/main/res/values-uk/strings.xml index d6e3047fa..636060dea 100644 --- a/app/src/main/res/values-uk/strings.xml +++ b/app/src/main/res/values-uk/strings.xml @@ -156,7 +156,6 @@ Дозволити керування яскравістю фотографій вертикальними жестами Дозволити керування яскравістю та гучністю відео вертикальними жестами Показувати кількість файлів у теці на головному екрані - Замінити \"Поділитися\" на \"Обернути\" в повноекранному меню Показувати розширені подробиці при повноекранному перегляді Керування розширеними подробицями Дозволити масштабування одним пальцем при повноекранному перегляді diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 3e9014936..b50ea10b6 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -156,7 +156,6 @@ 使用纵向滑动手势控制照片亮度 使用纵向滑动手势控制视频音量和亮度 在主界面显示文件夹媒体计数 - 替换全屏时菜单栏的“分享”为“旋转” 全屏浏览媒体时显示详细信息 要显示的详细信息项目 单指缩放 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 3af9cc60b..8faf9f6e8 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -156,7 +156,6 @@ 允許用上下手勢來控制相片的亮度 允許用上下手勢來控制影片的音量和亮度 主畫面顯示資料夾內的媒體檔案數量 - 將全螢幕選單的分享取代為旋轉 全螢幕時顯示詳細資訊 管理詳細資訊 全螢幕時允許單指縮放 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index c4c43a400..259e41f22 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -156,7 +156,6 @@ Allow controlling photo brightness with vertical gestures Allow controlling video volume and brightness with vertical gestures Show folder media count on the main view - Replace Share with Rotate at fullscreen menu Show extended details over fullscreen media Manage extended details Allow one finger zoom at fullscreen media From bb038aa47b445d46fc09053f6f1125593e78a84e Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 13 Jan 2019 19:54:49 +0100 Subject: [PATCH 43/75] adding a new string for resizing images before sharing --- app/src/main/res/values-ar/strings.xml | 1 + app/src/main/res/values-az/strings.xml | 1 + app/src/main/res/values-ca/strings.xml | 1 + app/src/main/res/values-cs/strings.xml | 1 + app/src/main/res/values-da/strings.xml | 1 + app/src/main/res/values-de/strings.xml | 1 + app/src/main/res/values-el/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-gl/strings.xml | 1 + app/src/main/res/values-hr/strings.xml | 1 + app/src/main/res/values-hu/strings.xml | 1 + app/src/main/res/values-id/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-ko-rKR/strings.xml | 1 + app/src/main/res/values-lt/strings.xml | 1 + app/src/main/res/values-nb/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-sl/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-uk/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 + 32 files changed, 32 insertions(+) diff --git a/app/src/main/res/values-ar/strings.xml b/app/src/main/res/values-ar/strings.xml index 183dcd9c6..b489c68b0 100644 --- a/app/src/main/res/values-ar/strings.xml +++ b/app/src/main/res/values-ar/strings.xml @@ -31,6 +31,7 @@ Fix Date Taken value Fixing… Dates fixed successfully + Share a resized version فلتر الميديا diff --git a/app/src/main/res/values-az/strings.xml b/app/src/main/res/values-az/strings.xml index 24a058657..33362f9f1 100644 --- a/app/src/main/res/values-az/strings.xml +++ b/app/src/main/res/values-az/strings.xml @@ -31,6 +31,7 @@ Fix Date Taken value Fixing… Dates fixed successfully + Share a resized version Filter media diff --git a/app/src/main/res/values-ca/strings.xml b/app/src/main/res/values-ca/strings.xml index 6a70c16b4..d0433fd12 100644 --- a/app/src/main/res/values-ca/strings.xml +++ b/app/src/main/res/values-ca/strings.xml @@ -31,6 +31,7 @@ Fixar la data de presa Fixant… Data fixada correctament + Share a resized version Filtre d\'arxius diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index 217713a38..1f08bfbd9 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -31,6 +31,7 @@ Opravit datum vytvoření Opravuji… Datumy byly úspěšně opraveny + Share a resized version Filtr médií diff --git a/app/src/main/res/values-da/strings.xml b/app/src/main/res/values-da/strings.xml index 7a8184851..8f542b363 100644 --- a/app/src/main/res/values-da/strings.xml +++ b/app/src/main/res/values-da/strings.xml @@ -31,6 +31,7 @@ Fiks Dato Taget værdi Fikser… Datoer fikset med succes + Share a resized version Filtrér medier diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index cb0fb96b3..91f8e0e1d 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -31,6 +31,7 @@ Aufnahmedatum korrigieren Korrigiere… Datum erfolgreich korrigiert. + Share a resized version Filter diff --git a/app/src/main/res/values-el/strings.xml b/app/src/main/res/values-el/strings.xml index e6abbeba5..0a147bc9f 100644 --- a/app/src/main/res/values-el/strings.xml +++ b/app/src/main/res/values-el/strings.xml @@ -31,6 +31,7 @@ Διόρθωση ημερ. λήψης Διορθώνεται… Ημερ. διορθώθηκε με επιτυχία + Share a resized version Φιλτράρισμα πολυμέσων diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 10b4c4fde..89f0bd44e 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -31,6 +31,7 @@ Fijar fecha de toma Fijando… Fecha fijada correctamente + Share a resized version Filtro de medios diff --git a/app/src/main/res/values-fi/strings.xml b/app/src/main/res/values-fi/strings.xml index c18bb546a..d4410137c 100644 --- a/app/src/main/res/values-fi/strings.xml +++ b/app/src/main/res/values-fi/strings.xml @@ -31,6 +31,7 @@ Fix Date Taken value Fixing… Dates fixed successfully + Share a resized version Suodata media diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 8f2e3f9b1..013a04193 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -31,6 +31,7 @@ Corriger la valeur des dates de prise des photos Correction en cours.... Dates corrigées + Share a resized version Filtrer les médias diff --git a/app/src/main/res/values-gl/strings.xml b/app/src/main/res/values-gl/strings.xml index ed1120240..1bfcab564 100644 --- a/app/src/main/res/values-gl/strings.xml +++ b/app/src/main/res/values-gl/strings.xml @@ -31,6 +31,7 @@ Fix Date Taken value Fixing… Dates fixed successfully + Share a resized version Filtrar medios diff --git a/app/src/main/res/values-hr/strings.xml b/app/src/main/res/values-hr/strings.xml index 94e87d505..87786044b 100644 --- a/app/src/main/res/values-hr/strings.xml +++ b/app/src/main/res/values-hr/strings.xml @@ -31,6 +31,7 @@ Ispravi vrijednost datuma snimanja Popravljam… Datumi uspješno popravljeni + Share a resized version Filtriranje medija diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index 553de10b5..2db88f5cf 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -31,6 +31,7 @@ Dátum javítása Javítás… Sikeres dátum javítás + Share a resized version Média szűrő diff --git a/app/src/main/res/values-id/strings.xml b/app/src/main/res/values-id/strings.xml index db3a73100..7129f35b8 100644 --- a/app/src/main/res/values-id/strings.xml +++ b/app/src/main/res/values-id/strings.xml @@ -31,6 +31,7 @@ Perbaiki Tanggal Diambil Memperbaiki… Tanggal berhasil diperbaiki + Share a resized version Filter media diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 64f74108d..f5939868a 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -31,6 +31,7 @@ Correggi valore Data acquisizione Correzione in corso… Date aggiornate correttamente + Share a resized version Filtra i file diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index a1f015ddc..9d8334625 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -31,6 +31,7 @@ 撮影日の値を修正 修正中… 撮影日が正常に修正されました + Share a resized version 表示する形式 diff --git a/app/src/main/res/values-ko-rKR/strings.xml b/app/src/main/res/values-ko-rKR/strings.xml index 7b768c8c6..b13747387 100644 --- a/app/src/main/res/values-ko-rKR/strings.xml +++ b/app/src/main/res/values-ko-rKR/strings.xml @@ -31,6 +31,7 @@ Fix Date Taken value Fixing… Dates fixed successfully + Share a resized version 미디어 필터 설정 diff --git a/app/src/main/res/values-lt/strings.xml b/app/src/main/res/values-lt/strings.xml index dad3f6412..00f8dfb82 100644 --- a/app/src/main/res/values-lt/strings.xml +++ b/app/src/main/res/values-lt/strings.xml @@ -31,6 +31,7 @@ Fix Date Taken value Fixing… Dates fixed successfully + Share a resized version Filtruoti mediją diff --git a/app/src/main/res/values-nb/strings.xml b/app/src/main/res/values-nb/strings.xml index 38b03c9b3..153802ae6 100644 --- a/app/src/main/res/values-nb/strings.xml +++ b/app/src/main/res/values-nb/strings.xml @@ -31,6 +31,7 @@ Korriger Dato tatt-verdi Korrigerer… Datoer er korrigerte + Share a resized version Filtrer media diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index 94da40ac2..5a211b4e5 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -31,6 +31,7 @@ Datum opname corrigeren Corrigeren… Datums zijn gecorrigeerd + Share a resized version Media filteren diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index cca934793..fa6d862d1 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -31,6 +31,7 @@ Napraw datę utworzenia Naprawiam… Daty zostały naprawione + Share a resized version Filtruj multimedia diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 2e40cf553..b2b49c576 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -31,6 +31,7 @@ Fix Date Taken value Fixing… Dates fixed successfully + Share a resized version Filtrar mídia diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index 5320da013..9706ec32d 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -31,6 +31,7 @@ Corrigir data de obtenção A corrigir… Dados corrigidos com sucesso + Share a resized version Filtrar multimédia diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 02793b862..2da3c8be5 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -31,6 +31,7 @@ Исправить дату Исправление… Даты исправлены + Share a resized version Фильтр медиа diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index d3358df79..d9b61d146 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -31,6 +31,7 @@ Opraviť dátum vytvorenia Opravuje sa… Dátumy boli úspešne opravené + Zdieľať verziu so zmenenou veľkosťou Filter médií diff --git a/app/src/main/res/values-sl/strings.xml b/app/src/main/res/values-sl/strings.xml index f8e327cad..6ded38895 100644 --- a/app/src/main/res/values-sl/strings.xml +++ b/app/src/main/res/values-sl/strings.xml @@ -31,6 +31,7 @@ Popravi datum posnetka Popravljam… Datumi uspešno popravljeni + Share a resized version Filtriranje datotek diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index 996ca6c7c..796a5a6c8 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -31,6 +31,7 @@ Korrigera fotodatum Korrigerar… Datumen har korrigerats + Share a resized version Filtrera media diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index 23ce014cd..cab36d290 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -31,6 +31,7 @@ Çekilen tarih değerini düzelt Düzeltiliyor… Tarihler başarıyla düzeltildi + Share a resized version Medyayı filtrele diff --git a/app/src/main/res/values-uk/strings.xml b/app/src/main/res/values-uk/strings.xml index 636060dea..5aabd8d6e 100644 --- a/app/src/main/res/values-uk/strings.xml +++ b/app/src/main/res/values-uk/strings.xml @@ -31,6 +31,7 @@ Виправити дату зйомки Виправлення… Дати успішно виправлені + Share a resized version Фільтр мультимедійних файлів diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index b50ea10b6..0415507d4 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -31,6 +31,7 @@ 修复拍摄日期 正在修复… 日期修复成功 + Share a resized version 要显示的媒体文件 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 8faf9f6e8..0c3413685 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -31,6 +31,7 @@ 修復拍照日期數值 修復中… 日期修復成功 + Share a resized version 篩選媒體檔案 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 259e41f22..f6c49d687 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -31,6 +31,7 @@ Fix Date Taken value Fixing… Dates fixed successfully + Share a resized version Filter media From 57e7fb03d1c8da169809ff0f2e4e4303e895e055 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 13 Jan 2019 20:02:11 +0100 Subject: [PATCH 44/75] reordering some PhotoFragment functions --- .../gallery/pro/fragments/PhotoFragment.kt | 54 +++++++++---------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/PhotoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/PhotoFragment.kt index f8a36a11b..4e35d0604 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/PhotoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/PhotoFragment.kt @@ -204,6 +204,33 @@ class PhotoFragment : ViewPagerFragment() { storeStateVariables() } + override fun onDestroyView() { + super.onDestroyView() + if (activity?.isDestroyed == false) { + mView.subsampling_view.recycle() + } + mIoadZoomableViewHandler.removeCallbacksAndMessages(null) + } + + override fun onConfigurationChanged(newConfig: Configuration) { + super.onConfigurationChanged(newConfig) + + // avoid GIFs being skewed, played in wrong aspect ratio + if (mMedium.isGIF()) { + mView.onGlobalLayout { + Handler().postDelayed({ + loadGif() + }, 50) + } + } else { + hideZoomableView() + loadImage() + } + + initExtendedDetails() + updateInstantSwitchWidths() + } + override fun setMenuVisibility(menuVisible: Boolean) { super.setMenuVisibility(menuVisible) mIsFragmentVisible = menuVisible @@ -537,33 +564,6 @@ class PhotoFragment : ViewPagerFragment() { } } - override fun onDestroyView() { - super.onDestroyView() - if (activity?.isDestroyed == false) { - mView.subsampling_view.recycle() - } - mIoadZoomableViewHandler.removeCallbacksAndMessages(null) - } - - override fun onConfigurationChanged(newConfig: Configuration) { - super.onConfigurationChanged(newConfig) - - // avoid GIFs being skewed, played in wrong aspect ratio - if (mMedium.isGIF()) { - mView.onGlobalLayout { - Handler().postDelayed({ - loadGif() - }, 50) - } - } else { - hideZoomableView() - loadImage() - } - - initExtendedDetails() - updateInstantSwitchWidths() - } - private fun hideZoomableView() { if (context?.config?.allowZoomingImages == true) { mIsSubsamplingVisible = false From 247b41445dde211386dfce8ee8df647da4687b5c Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 13 Jan 2019 20:19:54 +0100 Subject: [PATCH 45/75] properly retrieve old last_modified at rotating files by exif --- .../gallery/pro/activities/ViewPagerActivity.kt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt index c6811570a..0d09d339d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt @@ -665,7 +665,13 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View @TargetApi(Build.VERSION_CODES.N) private fun tryRotateByExif(path: String): Boolean { return try { + val file = File(path) + val oldLastModified = file.lastModified() if (saveImageRotation(path, mRotationDegrees)) { + if (config.keepLastModified) { + file.setLastModified(oldLastModified) + updateLastModified(path, oldLastModified) + } mRotationDegrees = 0 invalidateOptionsMenu() toast(R.string.file_saved) From 745adda5a494bbc33a4d63475d30e3448b42481f Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 13 Jan 2019 20:38:42 +0100 Subject: [PATCH 46/75] simplifying some code at image rotating --- .../gallery/pro/activities/ViewPagerActivity.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt index 0d09d339d..fac43adb8 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt @@ -618,9 +618,9 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View return@getFileOutputStream } - val oldLastModified = getCurrentFile().lastModified() + val oldLastModified = File(oldPath).lastModified() if (oldPath.isJpg()) { - copyFile(getCurrentPath(), tmpPath) + copyFile(oldPath, tmpPath) saveExifRotation(ExifInterface(tmpPath), mRotationDegrees) } else { val inputstream = getFileInputStreamSync(oldPath) From 79cf2ef0c52d432581b4aecd847b67b8d1bd2bee Mon Sep 17 00:00:00 2001 From: Pzqqt <821026875@qq.com> Date: Mon, 14 Jan 2019 03:38:53 +0800 Subject: [PATCH 47/75] Update strings.xml --- app/src/main/res/values-zh-rCN/strings.xml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 0415507d4..5226ef286 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -5,10 +5,10 @@ 编辑 打开相机 (隐藏) - (排除) + (排除) 锁定目录 解除锁定目录 - 锁定到顶部 + 固定到顶部 文件视图 所有目录 目录视图 @@ -31,7 +31,7 @@ 修复拍摄日期 正在修复… 日期修复成功 - Share a resized version + 调整图像尺寸并分享 要显示的媒体文件 @@ -76,12 +76,12 @@ 保存 旋转 路径 - 无效图片路径 + 无效的图片路径 图片编辑失败 编辑方式: 未找到可用图片编辑器 未知的文件路径 - 不能覆盖源文件 + 无法覆盖源文件 向左旋转 向右旋转 旋转 180º @@ -116,7 +116,7 @@ 循环幻灯片 幻灯片结束 未发现可用媒体 - 使用交叉渐变动画 + 使用淡入淡出动画 更改视图类型 @@ -171,7 +171,7 @@ 在主屏幕界面的最后一项显示回收站 使用下滑手势关闭全屏视图 双击两次后 1:1 放大图像 - Always open videos on a separate screen with new horizontal gestures + 使用新的水平手势在独立页面播放视频 缩略图 From c81fbdbf9d6bbd566ccdd087972e626c18ef5344 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 13 Jan 2019 20:56:39 +0100 Subject: [PATCH 48/75] moving some file rotation related functions in activity extensions --- .../pro/activities/ViewPagerActivity.kt | 118 +----------------- .../gallery/pro/extensions/Activity.kt | 109 ++++++++++++++++ 2 files changed, 113 insertions(+), 114 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt index fac43adb8..379a8733e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt @@ -8,10 +8,7 @@ import android.content.Intent import android.content.pm.ActivityInfo import android.content.res.Configuration import android.database.Cursor -import android.graphics.Bitmap -import android.graphics.BitmapFactory import android.graphics.Color -import android.graphics.Matrix import android.graphics.drawable.ColorDrawable import android.media.ExifInterface import android.net.Uri @@ -26,7 +23,6 @@ import android.view.WindowManager import android.view.animation.DecelerateInterpolator import android.widget.Toast import androidx.viewpager.widget.ViewPager -import com.bumptech.glide.Glide import com.simplemobiletools.commons.dialogs.PropertiesDialog import com.simplemobiletools.commons.dialogs.RenameItemDialog import com.simplemobiletools.commons.extensions.* @@ -49,9 +45,6 @@ import com.simplemobiletools.gallery.pro.models.ThumbnailItem import kotlinx.android.synthetic.main.activity_medium.* import kotlinx.android.synthetic.main.bottom_actions.* import java.io.File -import java.io.FileOutputStream -import java.io.InputStream -import java.io.OutputStream import java.util.* class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, ViewPagerFragment.FragmentListener { @@ -595,116 +588,15 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View SaveAsDialog(this, currPath, false) { handleSAFDialog(it) { Thread { - saveImageToFile(currPath, it) + saveImageToFile(currPath, it, mRotationDegrees) { + mRotationDegrees = 0 + invalidateOptionsMenu() + } }.start() } } } - private fun saveImageToFile(oldPath: String, newPath: String) { - toast(R.string.saving) - if (oldPath == newPath && oldPath.isJpg()) { - if (tryRotateByExif(oldPath)) { - return - } - } - - val tmpPath = "$recycleBinPath/.tmp_${newPath.getFilenameFromPath()}" - val tmpFileDirItem = FileDirItem(tmpPath, tmpPath.getFilenameFromPath()) - try { - getFileOutputStream(tmpFileDirItem) { - if (it == null) { - toast(R.string.unknown_error_occurred) - return@getFileOutputStream - } - - val oldLastModified = File(oldPath).lastModified() - if (oldPath.isJpg()) { - copyFile(oldPath, tmpPath) - saveExifRotation(ExifInterface(tmpPath), mRotationDegrees) - } else { - val inputstream = getFileInputStreamSync(oldPath) - val bitmap = BitmapFactory.decodeStream(inputstream) - saveFile(tmpPath, bitmap, it as FileOutputStream) - } - - if (getDoesFilePathExist(newPath)) { - tryDeleteFileDirItem(FileDirItem(newPath, newPath.getFilenameFromPath()), false, true) - } - - copyFile(tmpPath, newPath) - scanPathRecursively(newPath) - toast(R.string.file_saved) - - if (config.keepLastModified) { - File(newPath).setLastModified(oldLastModified) - updateLastModified(newPath, oldLastModified) - } - - it.flush() - it.close() - mRotationDegrees = 0 - invalidateOptionsMenu() - - // we cannot refresh a specific image in Glide Cache, so just clear it all - val glide = Glide.get(applicationContext) - glide.clearDiskCache() - runOnUiThread { - glide.clearMemory() - } - } - } catch (e: OutOfMemoryError) { - toast(R.string.out_of_memory_error) - } catch (e: Exception) { - showErrorToast(e) - } finally { - tryDeleteFileDirItem(tmpFileDirItem, false, true) - } - } - - @TargetApi(Build.VERSION_CODES.N) - private fun tryRotateByExif(path: String): Boolean { - return try { - val file = File(path) - val oldLastModified = file.lastModified() - if (saveImageRotation(path, mRotationDegrees)) { - if (config.keepLastModified) { - file.setLastModified(oldLastModified) - updateLastModified(path, oldLastModified) - } - mRotationDegrees = 0 - invalidateOptionsMenu() - toast(R.string.file_saved) - true - } else { - false - } - } catch (e: Exception) { - showErrorToast(e) - false - } - } - - private fun copyFile(source: String, destination: String) { - var inputStream: InputStream? = null - var out: OutputStream? = null - try { - out = getFileOutputStreamSync(destination, source.getMimeType()) - inputStream = getFileInputStreamSync(source) - inputStream?.copyTo(out!!) - } finally { - inputStream?.close() - out?.close() - } - } - - private fun saveFile(path: String, bitmap: Bitmap, out: FileOutputStream) { - val matrix = Matrix() - matrix.postRotate(mRotationDegrees.toFloat()) - val bmp = Bitmap.createBitmap(bitmap, 0, 0, bitmap.width, bitmap.height, matrix, true) - bmp.compress(path.getCompressionFormat(), 90, out) - } - private fun isShowHiddenFlagNeeded(): Boolean { val file = File(mPath) if (file.isHidden) { @@ -1169,8 +1061,6 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View private fun getCurrentPath() = getCurrentMedium()?.path ?: "" - private fun getCurrentFile() = File(getCurrentPath()) - override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {} override fun onPageSelected(position: Int) { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Activity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Activity.kt index c09eab78b..3a68db2c3 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Activity.kt @@ -1,13 +1,19 @@ package com.simplemobiletools.gallery.pro.extensions +import android.annotation.TargetApi import android.app.Activity import android.content.ContentProviderOperation import android.content.Intent +import android.graphics.Bitmap +import android.graphics.BitmapFactory +import android.graphics.Matrix import android.media.ExifInterface +import android.os.Build import android.provider.MediaStore import android.util.DisplayMetrics import android.view.View import androidx.appcompat.app.AppCompatActivity +import com.bumptech.glide.Glide import com.simplemobiletools.commons.activities.BaseSimpleActivity import com.simplemobiletools.commons.dialogs.ConfirmationDialog import com.simplemobiletools.commons.extensions.* @@ -22,6 +28,7 @@ import com.simplemobiletools.gallery.pro.helpers.NOMEDIA import com.simplemobiletools.gallery.pro.helpers.RECYCLE_BIN import com.simplemobiletools.gallery.pro.interfaces.MediumDao import java.io.File +import java.io.FileOutputStream import java.io.InputStream import java.io.OutputStream import java.text.SimpleDateFormat @@ -364,3 +371,105 @@ fun Activity.fixDateTaken(paths: ArrayList, callback: (() -> Unit)? = nu showErrorToast(e) } } + +fun BaseSimpleActivity.saveImageToFile(oldPath: String, newPath: String, degrees: Int, callback: () -> Unit) { + toast(R.string.saving) + if (oldPath == newPath && oldPath.isJpg()) { + if (tryRotateByExif(oldPath, degrees, callback)) { + return + } + } + + val tmpPath = "$recycleBinPath/.tmp_${newPath.getFilenameFromPath()}" + val tmpFileDirItem = FileDirItem(tmpPath, tmpPath.getFilenameFromPath()) + try { + getFileOutputStream(tmpFileDirItem) { + if (it == null) { + toast(R.string.unknown_error_occurred) + return@getFileOutputStream + } + + val oldLastModified = File(oldPath).lastModified() + if (oldPath.isJpg()) { + copyFile(oldPath, tmpPath) + saveExifRotation(ExifInterface(tmpPath), degrees) + } else { + val inputstream = getFileInputStreamSync(oldPath) + val bitmap = BitmapFactory.decodeStream(inputstream) + saveFile(tmpPath, bitmap, it as FileOutputStream, degrees) + } + + if (getDoesFilePathExist(newPath)) { + tryDeleteFileDirItem(FileDirItem(newPath, newPath.getFilenameFromPath()), false, true) + } + + copyFile(tmpPath, newPath) + scanPathRecursively(newPath) + toast(R.string.file_saved) + + if (config.keepLastModified) { + File(newPath).setLastModified(oldLastModified) + updateLastModified(newPath, oldLastModified) + } + + it.flush() + it.close() + callback.invoke() + + // we cannot refresh a specific image in Glide Cache, so just clear it all + val glide = Glide.get(applicationContext) + glide.clearDiskCache() + runOnUiThread { + glide.clearMemory() + } + } + } catch (e: OutOfMemoryError) { + toast(R.string.out_of_memory_error) + } catch (e: Exception) { + showErrorToast(e) + } finally { + tryDeleteFileDirItem(tmpFileDirItem, false, true) + } +} + +@TargetApi(Build.VERSION_CODES.N) +fun Activity.tryRotateByExif(path: String, degrees: Int, callback: () -> Unit): Boolean { + return try { + val file = File(path) + val oldLastModified = file.lastModified() + if (saveImageRotation(path, degrees)) { + if (config.keepLastModified) { + file.setLastModified(oldLastModified) + updateLastModified(path, oldLastModified) + } + callback.invoke() + toast(R.string.file_saved) + true + } else { + false + } + } catch (e: Exception) { + showErrorToast(e) + false + } +} + +fun BaseSimpleActivity.copyFile(source: String, destination: String) { + var inputStream: InputStream? = null + var out: OutputStream? = null + try { + out = getFileOutputStreamSync(destination, source.getMimeType()) + inputStream = getFileInputStreamSync(source) + inputStream?.copyTo(out!!) + } finally { + inputStream?.close() + out?.close() + } +} + +fun saveFile(path: String, bitmap: Bitmap, out: FileOutputStream, degrees: Int) { + val matrix = Matrix() + matrix.postRotate(degrees.toFloat()) + val bmp = Bitmap.createBitmap(bitmap, 0, 0, bitmap.width, bitmap.height, matrix, true) + bmp.compress(path.getCompressionFormat(), 90, out) +} From b128298e733c7174f1b4ec6671e40f7eb29e0b9c Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 13 Jan 2019 21:01:28 +0100 Subject: [PATCH 49/75] renaming a function --- .../gallery/pro/activities/ViewPagerActivity.kt | 2 +- .../com/simplemobiletools/gallery/pro/extensions/Activity.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt index 379a8733e..9f6e83f2b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt @@ -588,7 +588,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View SaveAsDialog(this, currPath, false) { handleSAFDialog(it) { Thread { - saveImageToFile(currPath, it, mRotationDegrees) { + saveRotatedImageToFile(currPath, it, mRotationDegrees) { mRotationDegrees = 0 invalidateOptionsMenu() } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Activity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Activity.kt index 3a68db2c3..d07d0f197 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Activity.kt @@ -372,7 +372,7 @@ fun Activity.fixDateTaken(paths: ArrayList, callback: (() -> Unit)? = nu } } -fun BaseSimpleActivity.saveImageToFile(oldPath: String, newPath: String, degrees: Int, callback: () -> Unit) { +fun BaseSimpleActivity.saveRotatedImageToFile(oldPath: String, newPath: String, degrees: Int, callback: () -> Unit) { toast(R.string.saving) if (oldPath == newPath && oldPath.isJpg()) { if (tryRotateByExif(oldPath, degrees, callback)) { From f8d39f61af813a9db6e283e1c9b4056dfd56573e Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 13 Jan 2019 21:16:20 +0100 Subject: [PATCH 50/75] improve cache clearing at rotating a file --- .../gallery/pro/extensions/Activity.kt | 34 ++++++++++--------- .../gallery/pro/extensions/String.kt | 6 ++-- .../gallery/pro/fragments/PhotoFragment.kt | 1 + 3 files changed, 23 insertions(+), 18 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Activity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Activity.kt index d07d0f197..3ef475fe5 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Activity.kt @@ -27,6 +27,7 @@ import com.simplemobiletools.gallery.pro.dialogs.PickDirectoryDialog import com.simplemobiletools.gallery.pro.helpers.NOMEDIA import com.simplemobiletools.gallery.pro.helpers.RECYCLE_BIN import com.simplemobiletools.gallery.pro.interfaces.MediumDao +import com.squareup.picasso.Picasso import java.io.File import java.io.FileOutputStream import java.io.InputStream @@ -406,22 +407,11 @@ fun BaseSimpleActivity.saveRotatedImageToFile(oldPath: String, newPath: String, copyFile(tmpPath, newPath) scanPathRecursively(newPath) toast(R.string.file_saved) - - if (config.keepLastModified) { - File(newPath).setLastModified(oldLastModified) - updateLastModified(newPath, oldLastModified) - } + fileRotatedSuccessfully(newPath, oldLastModified) it.flush() it.close() callback.invoke() - - // we cannot refresh a specific image in Glide Cache, so just clear it all - val glide = Glide.get(applicationContext) - glide.clearDiskCache() - runOnUiThread { - glide.clearMemory() - } } } catch (e: OutOfMemoryError) { toast(R.string.out_of_memory_error) @@ -438,10 +428,7 @@ fun Activity.tryRotateByExif(path: String, degrees: Int, callback: () -> Unit): val file = File(path) val oldLastModified = file.lastModified() if (saveImageRotation(path, degrees)) { - if (config.keepLastModified) { - file.setLastModified(oldLastModified) - updateLastModified(path, oldLastModified) - } + fileRotatedSuccessfully(path, oldLastModified) callback.invoke() toast(R.string.file_saved) true @@ -454,6 +441,21 @@ fun Activity.tryRotateByExif(path: String, degrees: Int, callback: () -> Unit): } } +fun Activity.fileRotatedSuccessfully(path: String, lastModified: Long) { + if (config.keepLastModified) { + File(path).setLastModified(lastModified) + updateLastModified(path, lastModified) + } + + Picasso.get().invalidate(path.getFileKey()) + // we cannot refresh a specific image in Glide Cache, so just clear it all + val glide = Glide.get(applicationContext) + glide.clearDiskCache() + runOnUiThread { + glide.clearMemory() + } +} + fun BaseSimpleActivity.copyFile(source: String, destination: String) { var inputStream: InputStream? = null var out: OutputStream? = null diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/String.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/String.kt index ee08503bf..556f2c2f0 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/String.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/String.kt @@ -6,9 +6,11 @@ import com.simplemobiletools.commons.helpers.OTG_PATH import java.io.File import java.io.IOException -fun String.getFileSignature(): ObjectKey { +fun String.getFileSignature() = ObjectKey(getFileKey()) + +fun String.getFileKey(): String { val file = File(this) - return ObjectKey("${file.absolutePath}${file.lastModified()}") + return "${file.absolutePath}${file.lastModified()}" } fun String.isThisOrParentIncluded(includedPaths: MutableSet) = includedPaths.any { startsWith(it, true) } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/PhotoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/PhotoFragment.kt index 4e35d0604..867c54936 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/PhotoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/PhotoFragment.kt @@ -336,6 +336,7 @@ class PhotoFragment : ViewPagerFragment() { val picasso = Picasso.get() .load(pathToLoad) .centerInside() + .stableKey(mMedium.path.getFileKey()) .resize(mScreenWidth, mScreenHeight) if (degrees != 0) { From 040d6357c9ff6e6e7806a1d74e2625f6536d617c Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 13 Jan 2019 22:12:16 +0100 Subject: [PATCH 51/75] add batch image rotation at the thumbnails screen --- .../gallery/pro/adapters/MediaAdapter.kt | 14 ++++++++++++++ app/src/main/res/menu/cab_media.xml | 17 +++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/MediaAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/MediaAdapter.kt index de3601c4c..571bfb9bf 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/MediaAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/MediaAdapter.kt @@ -137,6 +137,9 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList toggleFavorites(false) R.id.cab_restore_recycle_bin_files -> restoreFiles() R.id.cab_share -> shareMedia() + R.id.cab_rotate_right -> rotateSelection(90) + R.id.cab_rotate_left -> rotateSelection(270) + R.id.cab_rotate_one_eighty -> rotateSelection(180) R.id.cab_copy_to -> copyMoveTo(true) R.id.cab_move_to -> moveFilesTo() R.id.cab_select_all -> selectAll() @@ -273,6 +276,17 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList + + + + + + + Date: Sun, 13 Jan 2019 22:21:17 +0100 Subject: [PATCH 52/75] refresh thumbnail items after rotating --- .../gallery/pro/activities/ViewPagerActivity.kt | 2 ++ .../gallery/pro/adapters/MediaAdapter.kt | 10 +++++++++- .../gallery/pro/extensions/Activity.kt | 2 -- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt index 9f6e83f2b..3bef8201c 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt @@ -587,8 +587,10 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View val currPath = getCurrentPath() SaveAsDialog(this, currPath, false) { handleSAFDialog(it) { + toast(R.string.saving) Thread { saveRotatedImageToFile(currPath, it, mRotationDegrees) { + toast(R.string.file_saved) mRotationDegrees = 0 invalidateOptionsMenu() } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/MediaAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/MediaAdapter.kt index 571bfb9bf..b5c3bbb06 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/MediaAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/MediaAdapter.kt @@ -277,11 +277,19 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList, callback: (() -> Unit)? = nu } fun BaseSimpleActivity.saveRotatedImageToFile(oldPath: String, newPath: String, degrees: Int, callback: () -> Unit) { - toast(R.string.saving) if (oldPath == newPath && oldPath.isJpg()) { if (tryRotateByExif(oldPath, degrees, callback)) { return @@ -406,7 +405,6 @@ fun BaseSimpleActivity.saveRotatedImageToFile(oldPath: String, newPath: String, copyFile(tmpPath, newPath) scanPathRecursively(newPath) - toast(R.string.file_saved) fileRotatedSuccessfully(newPath, oldLastModified) it.flush() From 1935e3147b8e32ba84f03511dd15b0fd9bff05c7 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 13 Jan 2019 22:22:44 +0100 Subject: [PATCH 53/75] removing a redundant function --- .../gallery/pro/adapters/MediaAdapter.kt | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/MediaAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/MediaAdapter.kt index b5c3bbb06..ef0f82aea 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/MediaAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/MediaAdapter.kt @@ -1,6 +1,5 @@ package com.simplemobiletools.gallery.pro.adapters -import android.media.MediaMetadataRetriever import android.os.Handler import android.os.Looper import android.view.Menu @@ -486,13 +485,4 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList Date: Sun, 13 Jan 2019 22:26:41 +0100 Subject: [PATCH 54/75] avoid always showing the Refreshing spinner at thumbnails view --- .../gallery/pro/activities/MediaActivity.kt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MediaActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MediaActivity.kt index 13572628f..5a474751e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MediaActivity.kt @@ -558,7 +558,9 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener { } mIsGettingMedia = true - if (!mLoadedInitialPhotos) { + if (mLoadedInitialPhotos) { + startAsyncTask() + } else { getCachedMedia(mPath, mIsGetVideoIntent, mIsGetImageIntent, mMediumDao) { if (it.isEmpty()) { runOnUiThread { @@ -569,9 +571,6 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener { } startAsyncTask() } - } else { - media_refresh_layout.isRefreshing = true - startAsyncTask() } mLoadedInitialPhotos = true From 62502f3722675384d098199f65793407ac5b65a5 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 14 Jan 2019 13:58:29 +0100 Subject: [PATCH 55/75] fix #1207, exclude a given folder if the user excluded it specifically --- .../com/simplemobiletools/gallery/pro/extensions/String.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/String.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/String.kt index 556f2c2f0..3941ba0db 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/String.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/String.kt @@ -23,6 +23,8 @@ fun String.shouldFolderBeVisible(excludedPaths: MutableSet, includedPath false } else if (!showHidden && file.containsNoMedia()) { false + } else if (excludedPaths.contains(this) && !includedPaths.contains(this)) { + false } else if (isThisOrParentIncluded(includedPaths)) { true } else if (isThisOrParentExcluded(excludedPaths)) { From b2686a309780ed6b4bc9f64d74e99bb0257c8009 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 14 Jan 2019 14:02:03 +0100 Subject: [PATCH 56/75] reordering some EditActivity functions --- .../gallery/pro/activities/EditActivity.kt | 52 +++++++++---------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt index 0cc34a601..2520d75ae 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt @@ -99,6 +99,32 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener } } + override fun onResume() { + super.onResume() + isEditingWithThirdParty = false + } + + override fun onStop() { + super.onStop() + if (isEditingWithThirdParty) { + finish() + } + } + + override fun onCreateOptionsMenu(menu: Menu): Boolean { + menuInflater.inflate(R.menu.menu_editor, menu) + return true + } + + override fun onOptionsItemSelected(item: MenuItem): Boolean { + when (item.itemId) { + R.id.save_as -> saveImage() + R.id.edit -> editWith() + else -> return super.onOptionsItemSelected(item) + } + return true + } + private fun initEditActivity() { if (intent.data == null) { toast(R.string.invalid_image_path) @@ -154,32 +180,6 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener updateAspectRatio(config.lastEditorCropAspectRatio) } - override fun onResume() { - super.onResume() - isEditingWithThirdParty = false - } - - override fun onStop() { - super.onStop() - if (isEditingWithThirdParty) { - finish() - } - } - - override fun onCreateOptionsMenu(menu: Menu): Boolean { - menuInflater.inflate(R.menu.menu_editor, menu) - return true - } - - override fun onOptionsItemSelected(item: MenuItem): Boolean { - when (item.itemId) { - R.id.save_as -> saveImage() - R.id.edit -> editWith() - else -> return super.onOptionsItemSelected(item) - } - return true - } - private fun loadDefaultImageView() { default_image_view.beVisible() crop_image_view.beGone() From 2e3a8cb65806cbcf1c3c8ec9eab45b1465be60e9 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 14 Jan 2019 14:03:38 +0100 Subject: [PATCH 57/75] adding a Share button to the editor for sharing directly without saving --- .../simplemobiletools/gallery/pro/activities/EditActivity.kt | 5 +++++ app/src/main/res/menu/menu_editor.xml | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt index 2520d75ae..9a4e72aab 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt @@ -120,6 +120,7 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener when (item.itemId) { R.id.save_as -> saveImage() R.id.edit -> editWith() + R.id.share -> shareImage() else -> return super.onOptionsItemSelected(item) } return true @@ -332,6 +333,10 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener } } + private fun shareImage() { + + } + private fun getFiltersAdapter() = bottom_actions_filter_list.adapter as? FiltersAdapter private fun setupBottomActions() { diff --git a/app/src/main/res/menu/menu_editor.xml b/app/src/main/res/menu/menu_editor.xml index b72316342..bf319ba75 100644 --- a/app/src/main/res/menu/menu_editor.xml +++ b/app/src/main/res/menu/menu_editor.xml @@ -11,4 +11,9 @@ android:icon="@drawable/ic_edit" android:title="@string/edit_with" app:showAsAction="ifRoom"/> + From 0b0def35d80724dafcbf965120bdfa4cacda7890 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 14 Jan 2019 14:18:59 +0100 Subject: [PATCH 58/75] fix #1204, allow sharing images directly from the editor --- .../gallery/pro/activities/EditActivity.kt | 69 +++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt index 9a4e72aab..e1c619a7f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt @@ -31,6 +31,7 @@ import com.simplemobiletools.commons.helpers.PERMISSION_WRITE_STORAGE import com.simplemobiletools.commons.helpers.REAL_FILE_PATH import com.simplemobiletools.commons.helpers.isNougatPlus import com.simplemobiletools.commons.models.FileDirItem +import com.simplemobiletools.gallery.pro.BuildConfig import com.simplemobiletools.gallery.pro.R import com.simplemobiletools.gallery.pro.adapters.FiltersAdapter import com.simplemobiletools.gallery.pro.dialogs.OtherAspectRatioDialog @@ -58,6 +59,7 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener } } + private val TEMP_FOLDER_NAME = "images" private val ASPECT_X = "aspectX" private val ASPECT_Y = "aspectY" private val CROP = "crop" @@ -82,6 +84,7 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener private var currAspectRatio = ASPECT_RATIO_FREE private var isCropIntent = false private var isEditingWithThirdParty = false + private var isSharingBitmap = false private var oldExif: ExifInterface? = null private var filterInitialBitmap: Bitmap? = null @@ -334,7 +337,67 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener } private fun shareImage() { + Thread { + when { + default_image_view.isVisible() -> { + val currentFilter = getFiltersAdapter()?.getCurrentFilter() + if (currentFilter == null) { + toast(R.string.unknown_error_occurred) + } + val originalBitmap = Glide.with(applicationContext).asBitmap().load(uri).submit(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL).get() + currentFilter!!.filter.processFilter(originalBitmap) + shareBitmap(originalBitmap) + } + crop_image_view.isVisible() -> { + isSharingBitmap = true + runOnUiThread { + crop_image_view.getCroppedImageAsync() + } + } + editor_draw_canvas.isVisible() -> shareBitmap(editor_draw_canvas.getBitmap()) + } + }.start() + } + + private fun getTempImagePath(bitmap: Bitmap, callback: (path: String?) -> Unit) { + val bytes = ByteArrayOutputStream() + bitmap.compress(Bitmap.CompressFormat.PNG, 0, bytes) + + val folder = File(cacheDir, TEMP_FOLDER_NAME) + if (!folder.exists()) { + if (!folder.mkdir()) { + callback(null) + return + } + } + + val filename = applicationContext.getFilenameFromContentUri(saveUri) ?: "tmp.jpg" + val newPath = "$folder/$filename" + val fileDirItem = FileDirItem(newPath, filename) + getFileOutputStream(fileDirItem, true) { + if (it != null) { + try { + it.write(bytes.toByteArray()) + callback(newPath) + } catch (e: Exception) { + } finally { + it.close() + } + } else { + callback("") + } + } + } + + private fun shareBitmap(bitmap: Bitmap) { + getTempImagePath(bitmap) { + if (it != null) { + sharePathIntent(it, BuildConfig.APPLICATION_ID) + } else { + toast(R.string.unknown_error_occurred) + } + } } private fun getFiltersAdapter() = bottom_actions_filter_list.adapter as? FiltersAdapter @@ -647,6 +710,12 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener override fun onCropImageComplete(view: CropImageView, result: CropImageView.CropResult) { if (result.error == null) { val bitmap = result.bitmap + if (isSharingBitmap) { + isSharingBitmap = false + shareBitmap(bitmap) + return + } + if (isCropIntent) { if (saveUri.scheme == "file") { saveBitmapToFile(bitmap, saveUri.path, true) From 1a366254398c3f3c0107f579f486e759ce3daa2f Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 14 Jan 2019 16:10:05 +0100 Subject: [PATCH 59/75] center the drawing canvas at the editor --- .../gallery/pro/activities/EditActivity.kt | 15 ++++++++++----- app/src/main/res/layout/activity_edit.xml | 9 +++------ app/src/main/res/values/dimens.xml | 2 ++ 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt index e1c619a7f..be4ce6d94 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt @@ -85,6 +85,7 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener private var isCropIntent = false private var isEditingWithThirdParty = false private var isSharingBitmap = false + private var wasDrawCanvasPositioned = false private var oldExif: ExifInterface? = null private var filterInitialBitmap: Bitmap? = null @@ -246,10 +247,14 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener default_image_view.beGone() crop_image_view.beGone() editor_draw_canvas.beVisible() - editor_draw_canvas.onGlobalLayout { - Thread { - fillCanvasBackground() - }.start() + + if (!wasDrawCanvasPositioned) { + wasDrawCanvasPositioned = true + editor_draw_canvas.onGlobalLayout { + Thread { + fillCanvasBackground() + }.start() + } } } @@ -275,7 +280,7 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener updateBackgroundBitmap(bitmap) layoutParams.width = bitmap.width layoutParams.height = bitmap.height - (layoutParams as RelativeLayout.LayoutParams).removeRule(RelativeLayout.ABOVE) + y = (height - bitmap.height) / 2f requestLayout() } } diff --git a/app/src/main/res/layout/activity_edit.xml b/app/src/main/res/layout/activity_edit.xml index bc2d1b016..dcf322124 100644 --- a/app/src/main/res/layout/activity_edit.xml +++ b/app/src/main/res/layout/activity_edit.xml @@ -17,8 +17,7 @@ android:id="@+id/crop_image_view" android:layout_width="match_parent" android:layout_height="match_parent" - android:layout_above="@+id/bottom_editor_crop_rotate_actions" - android:layout_marginBottom="@dimen/bottom_actions_height" + android:layout_marginBottom="@dimen/bottom_actions_height_bigger" android:visibility="gone" app:cropBackgroundColor="@color/crop_image_view_background" app:cropInitialCropWindowPaddingRatio="0"/> @@ -27,10 +26,8 @@ android:id="@+id/editor_draw_canvas" android:layout_width="match_parent" android:layout_height="match_parent" - android:layout_above="@+id/bottom_editor_crop_rotate_actions" - android:layout_alignParentTop="true" - android:layout_centerInParent="true" - android:layout_marginBottom="@dimen/bottom_actions_height" + android:layout_centerHorizontal="true" + android:layout_marginBottom="@dimen/bottom_actions_height_double" android:background="@android:color/transparent" android:visibility="gone"/> diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index bdebf85ea..d9854752f 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -12,6 +12,8 @@ 50dp 72dp 64dp + 128dp + 164dp 48dp 76dp 90dp From 34fade06a0b9cac2dca6265c63aa4bb1e47e1b35 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 14 Jan 2019 19:26:43 +0100 Subject: [PATCH 60/75] fix #1171, allow zooming videos --- .../gallery/pro/fragments/VideoFragment.kt | 162 +++++++++++++++++- .../gallery/pro/helpers/Constants.kt | 8 + 2 files changed, 164 insertions(+), 6 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt index d9219ecb4..3b3232b40 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt @@ -2,6 +2,7 @@ package com.simplemobiletools.gallery.pro.fragments import android.content.Intent import android.content.res.Configuration +import android.graphics.Matrix import android.graphics.Point import android.graphics.SurfaceTexture import android.net.Uri @@ -28,10 +29,7 @@ import com.simplemobiletools.gallery.pro.R import com.simplemobiletools.gallery.pro.activities.PanoramaVideoActivity import com.simplemobiletools.gallery.pro.activities.VideoActivity import com.simplemobiletools.gallery.pro.extensions.* -import com.simplemobiletools.gallery.pro.helpers.Config -import com.simplemobiletools.gallery.pro.helpers.MEDIUM -import com.simplemobiletools.gallery.pro.helpers.MIN_SKIP_LENGTH -import com.simplemobiletools.gallery.pro.helpers.PATH +import com.simplemobiletools.gallery.pro.helpers.* import com.simplemobiletools.gallery.pro.models.Medium import com.simplemobiletools.gallery.pro.views.MediaSideScroll import kotlinx.android.synthetic.main.bottom_video_time_holder.view.* @@ -51,10 +49,19 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S private var mWasVideoStarted = false private var mCurrTime = 0 private var mDuration = 0 + private var mSaveScale = 1f + private var mRight = 0f + private var mBottom = 0f + private var mLastTouchX = 0f + private var mLastTouchY = 0f + private var mTouchDownTime = 0L private var mExoPlayer: SimpleExoPlayer? = null private var mVideoSize = Point(0, 0) private var mTimerHandler = Handler() + private var mScaleDetector: ScaleGestureDetector? = null + private var mMatrices = floatArrayOf() + private val mMatrix = Matrix() private var mStoredShowExtendedDetails = false private var mStoredHideExtendedDetails = false @@ -75,8 +82,14 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S private lateinit var mPlayPauseButton: ImageView private lateinit var mSeekBar: SeekBar + private var mCurrZoomMode = ZOOM_MODE_NONE + override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { mConfig = context!!.config + + mMatrices = FloatArray(9) + mScaleDetector = ScaleGestureDetector(context, ScaleListener()) + mView = inflater.inflate(R.layout.pager_video_item, container, false).apply { instant_prev_item.setOnClickListener { listener?.goToPrevItem() } instant_next_item.setOnClickListener { listener?.goToNextItem() } @@ -116,8 +129,8 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S } video_surface.setOnTouchListener { view, event -> - handleEvent(event) - false + handleEventWithZooming(event) + true } } } @@ -692,4 +705,141 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S mTextureView.layoutParams = this } } + + private fun handleEventWithZooming(event: MotionEvent) { + mScaleDetector?.onTouchEvent(event) + + mMatrix.getValues(mMatrices) + val x = mMatrices[Matrix.MTRANS_X] + val y = mMatrices[Matrix.MTRANS_Y] + + when (event.actionMasked) { + MotionEvent.ACTION_DOWN -> { + mTouchDownTime = System.currentTimeMillis() + mCurrZoomMode = ZOOM_MODE_DRAG + mLastTouchX = event.x + mLastTouchY = event.y + + mTouchDownX = event.x + mTouchDownY = event.y + } + MotionEvent.ACTION_UP -> { + mCurrZoomMode = ZOOM_MODE_NONE + val diffX = mTouchDownX - event.x + val diffY = mTouchDownY - event.y + + val downGestureDuration = System.currentTimeMillis() - mTouchDownTime + if (!mIgnoreCloseDown && Math.abs(diffY) > Math.abs(diffX) && diffY < -mCloseDownThreshold && downGestureDuration < MAX_CLOSE_DOWN_GESTURE_DURATION && mSaveScale == 1f) { + activity?.supportFinishAfterTransition() + } + mIgnoreCloseDown = false + + if (System.currentTimeMillis() - mTouchDownTime < CLICK_MAX_DURATION) { + mTextureView.performClick() + } + } + MotionEvent.ACTION_POINTER_DOWN -> { + mLastTouchX = event.x + mLastTouchY = event.y + mCurrZoomMode = ZOOM_MODE_ZOOM + mIgnoreCloseDown = true + } + MotionEvent.ACTION_MOVE -> { + if (mCurrZoomMode == ZOOM_MODE_ZOOM || mCurrZoomMode == ZOOM_MODE_DRAG && mSaveScale > MIN_VIDEO_ZOOM_SCALE) { + var deltaX = event.x - mLastTouchX + var deltaY = event.y - mLastTouchY + if (y + deltaY > 0) { + deltaY = -y + } else if (y + deltaY < -mBottom) { + deltaY = -(y + mBottom) + } + + if (x + deltaX > 0) { + deltaX = -x + } else if (x + deltaX < -mRight) { + deltaX = -(x + mRight) + } + + mMatrix.postTranslate(deltaX, deltaY) + mLastTouchX = event.x + mLastTouchY = event.y + } + } + MotionEvent.ACTION_POINTER_UP -> { + mCurrZoomMode = ZOOM_MODE_NONE + } + } + + mTextureView.setTransform(mMatrix) + mTextureView.invalidate() + } + + // taken from https://github.com/Manuiq/ZoomableTextureView + private inner class ScaleListener : ScaleGestureDetector.SimpleOnScaleGestureListener() { + override fun onScaleBegin(detector: ScaleGestureDetector): Boolean { + mCurrZoomMode = ZOOM_MODE_ZOOM + return true + } + + override fun onScale(detector: ScaleGestureDetector): Boolean { + var scaleFactor = detector.scaleFactor + val width = mTextureView.width + val height = mTextureView.height + val origScale = mSaveScale + mSaveScale *= scaleFactor + + if (mSaveScale > MAX_VIDEO_ZOOM_SCALE) { + mSaveScale = MAX_VIDEO_ZOOM_SCALE + scaleFactor = MAX_VIDEO_ZOOM_SCALE / origScale + } else if (mSaveScale < MIN_VIDEO_ZOOM_SCALE) { + mSaveScale = MIN_VIDEO_ZOOM_SCALE + scaleFactor = MIN_VIDEO_ZOOM_SCALE / origScale + } + + mRight = width * mSaveScale - width + mBottom = mTextureView.height * mSaveScale - height + if (0 <= width || 0 <= height) { + mMatrix.postScale(scaleFactor, scaleFactor, detector.focusX, detector.focusY) + if (scaleFactor < 1) { + mMatrix.getValues(mMatrices) + val x = mMatrices[Matrix.MTRANS_X] + val y = mMatrices[Matrix.MTRANS_Y] + if (scaleFactor < 1) { + if (0 < width) { + if (y < -mBottom) { + mMatrix.postTranslate(0f, -(y + mBottom)) + } else if (y > 0) { + mMatrix.postTranslate(0f, -y) + } + } else { + if (x < -mRight) { + mMatrix.postTranslate(-(x + mRight), 0f) + } else if (x > 0) { + mMatrix.postTranslate(-x, 0f) + } + } + } + } + } else { + mMatrix.postScale(scaleFactor, scaleFactor, detector.focusX, detector.focusY) + mMatrix.getValues(mMatrices) + val x = mMatrices[Matrix.MTRANS_X] + val y = mMatrices[Matrix.MTRANS_Y] + if (scaleFactor < 1) { + if (x < -mRight) { + mMatrix.postTranslate(-(x + mRight), 0f) + } else if (x > 0) { + mMatrix.postTranslate(-x, 0f) + } + + if (y < -mBottom) { + mMatrix.postTranslate(0f, -(y + mBottom)) + } else if (y > 0) { + mMatrix.postTranslate(0f, -y) + } + } + } + return true + } + } } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt index 90cbba1a6..177997fe6 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt @@ -103,6 +103,7 @@ const val GO_TO_PREV_ITEM = "go_to_prev_item" const val MAX_COLUMN_COUNT = 20 const val SHOW_TEMP_HIDDEN_DURATION = 300000L const val CLICK_MAX_DURATION = 150 +const val MAX_CLOSE_DOWN_GESTURE_DURATION = 500 const val DRAG_THRESHOLD = 8 const val MONTH_MILLISECONDS = MONTH_SECONDS * 1000L const val MIN_SKIP_LENGTH = 2000 @@ -181,3 +182,10 @@ const val ASPECT_RATIO_ONE_ONE = 1 const val ASPECT_RATIO_FOUR_THREE = 2 const val ASPECT_RATIO_SIXTEEN_NINE = 3 const val ASPECT_RATIO_OTHER = 4 + +// some constants related to zooming videos +const val MIN_VIDEO_ZOOM_SCALE = 1f +const val MAX_VIDEO_ZOOM_SCALE = 5f +const val ZOOM_MODE_NONE = 0 +const val ZOOM_MODE_DRAG = 1 +const val ZOOM_MODE_ZOOM = 2 From f6696c4552cdef3e58d1295e7d3b59345ab0a51b Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 14 Jan 2019 19:32:14 +0100 Subject: [PATCH 61/75] do not allow closing the fullscreen videoplayer with slow down gestures --- .../gallery/pro/activities/VideoPlayerActivity.kt | 3 ++- .../com/simplemobiletools/gallery/pro/helpers/Constants.kt | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/VideoPlayerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/VideoPlayerActivity.kt index d47601c06..b09da8cd0 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/VideoPlayerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/VideoPlayerActivity.kt @@ -523,7 +523,8 @@ open class VideoPlayerActivity : SimpleActivity(), SeekBar.OnSeekBarChangeListen val diffX = mTouchDownX - event.x val diffY = mTouchDownY - event.y - if (config.allowDownGesture && !mIgnoreCloseDown && Math.abs(diffY) > Math.abs(diffX) && diffY < -mCloseDownThreshold) { + val downGestureDuration = System.currentTimeMillis() - mTouchDownTime + if (config.allowDownGesture && !mIgnoreCloseDown && Math.abs(diffY) > Math.abs(diffX) && diffY < -mCloseDownThreshold && downGestureDuration < MAX_CLOSE_DOWN_GESTURE_DURATION) { supportFinishAfterTransition() } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt index 177997fe6..bb2b876ab 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt @@ -103,7 +103,7 @@ const val GO_TO_PREV_ITEM = "go_to_prev_item" const val MAX_COLUMN_COUNT = 20 const val SHOW_TEMP_HIDDEN_DURATION = 300000L const val CLICK_MAX_DURATION = 150 -const val MAX_CLOSE_DOWN_GESTURE_DURATION = 500 +const val MAX_CLOSE_DOWN_GESTURE_DURATION = 400 const val DRAG_THRESHOLD = 8 const val MONTH_MILLISECONDS = MONTH_SECONDS * 1000L const val MIN_SKIP_LENGTH = 2000 From 326e6f06793a0b6e37f21d5e45835b2f860c45b1 Mon Sep 17 00:00:00 2001 From: Guillaume Date: Mon, 14 Jan 2019 20:24:37 +0100 Subject: [PATCH 62/75] Dutch --- 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 5a211b4e5..77996d5ea 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -31,7 +31,7 @@ Datum opname corrigeren Corrigeren… Datums zijn gecorrigeerd - Share a resized version + Verkleinde versie delen Media filteren From 3a44733b944133dc36a4a0dad5fb82cb00d09a30 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 14 Jan 2019 20:39:55 +0100 Subject: [PATCH 63/75] handle video zooming at the standalone screen too --- .../pro/activities/VideoPlayerActivity.kt | 261 +++++++++++++++++- .../pro/activities/ViewPagerActivity.kt | 2 +- .../gallery/pro/fragments/VideoFragment.kt | 31 +-- .../pro/fragments/ViewPagerFragment.kt | 5 +- .../gallery/pro/helpers/Constants.kt | 1 + 5 files changed, 267 insertions(+), 33 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/VideoPlayerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/VideoPlayerActivity.kt index b09da8cd0..0628708ee 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/VideoPlayerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/VideoPlayerActivity.kt @@ -5,6 +5,7 @@ import android.content.Intent import android.content.pm.ActivityInfo import android.content.res.Configuration import android.graphics.Color +import android.graphics.Matrix import android.graphics.Point import android.graphics.SurfaceTexture import android.graphics.drawable.ColorDrawable @@ -43,19 +44,28 @@ open class VideoPlayerActivity : SimpleActivity(), SeekBar.OnSeekBarChangeListen private var mScreenWidth = 0 private var mCurrTime = 0 private var mDuration = 0 - private var mVideoSize = Point(0, 0) + private var mSaveScale = 1f + private var mRight = 0f + private var mBottom = 0f + private var mLastTouchX = 0f + private var mLastTouchY = 0f private var mDragThreshold = 0f - - private var mUri: Uri? = null - private var mExoPlayer: SimpleExoPlayer? = null - private var mTimerHandler = Handler() - private var mPlayWhenReadyHandler = Handler() - private var mTouchDownX = 0f private var mTouchDownY = 0f private var mTouchDownTime = 0L private var mProgressAtDown = 0L private var mCloseDownThreshold = 100f + private var mCurrZoomMode = ZOOM_MODE_NONE + + private var mUri: Uri? = null + private var mExoPlayer: SimpleExoPlayer? = null + private var mVideoSize = Point(0, 0) + private var mTimerHandler = Handler() + private var mPlayWhenReadyHandler = Handler() + private var mScaleDetector: ScaleGestureDetector? = null + private var mMatrices = FloatArray(9) + private val mMatrix = Matrix() + private var mIgnoreCloseDown = false public override fun onCreate(savedInstanceState: Bundle?) { @@ -176,7 +186,7 @@ open class VideoPlayerActivity : SimpleActivity(), SeekBar.OnSeekBarChangeListen } video_surface.setOnTouchListener { view, event -> - handleEvent(event) + handleEventWithZooming(event) true } @@ -185,11 +195,11 @@ open class VideoPlayerActivity : SimpleActivity(), SeekBar.OnSeekBarChangeListen if (config.allowVideoGestures) { video_brightness_controller.initialize(this, slide_info, true, video_player_holder) { x, y -> - fullscreenToggled(!mIsFullscreen) + toggleFullscreen() } video_volume_controller.initialize(this, slide_info, false, video_player_holder) { x, y -> - fullscreenToggled(!mIsFullscreen) + toggleFullscreen() } } else { video_brightness_controller.beGone() @@ -199,10 +209,11 @@ open class VideoPlayerActivity : SimpleActivity(), SeekBar.OnSeekBarChangeListen if (config.hideSystemUI) { Handler().postDelayed({ fullscreenToggled(true) - }, 500) + }, HIDE_SYSTEM_UI_DELAY) } mDragThreshold = DRAG_THRESHOLD * resources.displayMetrics.density + mScaleDetector = ScaleGestureDetector(applicationContext, ScaleListener()) } private fun initExoPlayer() { @@ -418,6 +429,10 @@ open class VideoPlayerActivity : SimpleActivity(), SeekBar.OnSeekBarChangeListen } } + private fun toggleFullscreen() { + fullscreenToggled(!mIsFullscreen) + } + private fun fullscreenToggled(isFullScreen: Boolean) { mIsFullscreen = isFullScreen if (isFullScreen) { @@ -541,7 +556,7 @@ open class VideoPlayerActivity : SimpleActivity(), SeekBar.OnSeekBarChangeListen } } else { if (System.currentTimeMillis() - mTouchDownTime < CLICK_MAX_DURATION) { - fullscreenToggled(!mIsFullscreen) + toggleFullscreen() } } mIsDragged = false @@ -616,6 +631,226 @@ open class VideoPlayerActivity : SimpleActivity(), SeekBar.OnSeekBarChangeListen }.start() } - override fun onSurfaceTextureSizeChanged(surface: SurfaceTexture?, width: Int, height: Int) { + override fun onSurfaceTextureSizeChanged(surface: SurfaceTexture?, width: Int, height: Int) {} + + private fun handleEventWithZooming(event: MotionEvent) { + mScaleDetector?.onTouchEvent(event) + + mMatrix.getValues(mMatrices) + val x = mMatrices[Matrix.MTRANS_X] + val y = mMatrices[Matrix.MTRANS_Y] + + when (event.actionMasked) { + MotionEvent.ACTION_DOWN -> { + mTouchDownTime = System.currentTimeMillis() + mCurrZoomMode = ZOOM_MODE_DRAG + mLastTouchX = event.x + mLastTouchY = event.y + + mTouchDownX = event.x + mTouchDownY = event.y + mProgressAtDown = mExoPlayer!!.currentPosition + } + MotionEvent.ACTION_UP -> { + mCurrZoomMode = ZOOM_MODE_NONE + val diffX = mTouchDownX - event.x + val diffY = mTouchDownY - event.y + + val downGestureDuration = System.currentTimeMillis() - mTouchDownTime + if (!mIgnoreCloseDown && Math.abs(diffY) > Math.abs(diffX) && diffY < -mCloseDownThreshold && downGestureDuration < MAX_CLOSE_DOWN_GESTURE_DURATION && mSaveScale == 1f) { + supportFinishAfterTransition() + } + mIgnoreCloseDown = false + + if (mIsDragged) { + if (mIsFullscreen) { + arrayOf(video_curr_time, video_seekbar, video_duration).forEach { + it.animate().alpha(0f).start() + } + } + + if (!mIsPlaying) { + togglePlayPause() + } + } else { + if (System.currentTimeMillis() - mTouchDownTime < CLICK_MAX_DURATION) { + toggleFullscreen() + } + } + + mIsDragged = false + } + MotionEvent.ACTION_POINTER_DOWN -> { + mLastTouchX = event.x + mLastTouchY = event.y + mCurrZoomMode = ZOOM_MODE_ZOOM + mIgnoreCloseDown = true + } + MotionEvent.ACTION_MOVE -> { + val diffX = event.x - mTouchDownX + val diffY = event.y - mTouchDownY + if (mSaveScale == 1f && (mIsDragged || (Math.abs(diffX) > mDragThreshold && Math.abs(diffX) > Math.abs(diffY)))) { + if (!mIsDragged) { + arrayOf(video_curr_time, video_seekbar, video_duration).forEach { + it.animate().alpha(1f).start() + } + } + mIgnoreCloseDown = true + mIsDragged = true + var percent = ((diffX / mScreenWidth) * 100).toInt() + percent = Math.min(100, Math.max(-100, percent)) + + val skipLength = (mDuration * 1000f) * (percent / 100f) + var newProgress = mProgressAtDown + skipLength + newProgress = Math.max(Math.min(mExoPlayer!!.duration.toFloat(), newProgress), 0f) + val newSeconds = (newProgress / 1000).toInt() + setPosition(newSeconds) + resetPlayWhenReady() + } else if (mCurrZoomMode == ZOOM_MODE_ZOOM || mCurrZoomMode == ZOOM_MODE_DRAG && mSaveScale > MIN_VIDEO_ZOOM_SCALE) { + var deltaX = event.x - mLastTouchX + var deltaY = event.y - mLastTouchY + if (y + deltaY > 0) { + deltaY = -y + } else if (y + deltaY < -mBottom) { + deltaY = -(y + mBottom) + } + + if (x + deltaX > 0) { + deltaX = -x + } else if (x + deltaX < -mRight) { + deltaX = -(x + mRight) + } + + mMatrix.postTranslate(deltaX, deltaY) + mLastTouchX = event.x + mLastTouchY = event.y + } + } + MotionEvent.ACTION_POINTER_UP -> { + mCurrZoomMode = ZOOM_MODE_NONE + } + } + + video_surface.setTransform(mMatrix) + video_surface.invalidate() + } + + private fun handleEventt(event: MotionEvent) { + when (event.actionMasked) { + MotionEvent.ACTION_MOVE -> { + val diffX = event.x - mTouchDownX + val diffY = event.y - mTouchDownY + + if (mIsDragged || (Math.abs(diffX) > mDragThreshold && Math.abs(diffX) > Math.abs(diffY))) { + if (!mIsDragged) { + arrayOf(video_curr_time, video_seekbar, video_duration).forEach { + it.animate().alpha(1f).start() + } + } + mIgnoreCloseDown = true + mIsDragged = true + var percent = ((diffX / mScreenWidth) * 100).toInt() + percent = Math.min(100, Math.max(-100, percent)) + + val skipLength = (mDuration * 1000f) * (percent / 100f) + var newProgress = mProgressAtDown + skipLength + newProgress = Math.max(Math.min(mExoPlayer!!.duration.toFloat(), newProgress), 0f) + val newSeconds = (newProgress / 1000).toInt() + setPosition(newSeconds) + resetPlayWhenReady() + } + } + MotionEvent.ACTION_UP -> { + val diffX = mTouchDownX - event.x + val diffY = mTouchDownY - event.y + + mIgnoreCloseDown = false + if (mIsDragged) { + if (mIsFullscreen) { + arrayOf(video_curr_time, video_seekbar, video_duration).forEach { + it.animate().alpha(0f).start() + } + } + + if (!mIsPlaying) { + togglePlayPause() + } + } else { + if (System.currentTimeMillis() - mTouchDownTime < CLICK_MAX_DURATION) { + toggleFullscreen() + } + } + mIsDragged = false + } + } + } + + // taken from https://github.com/Manuiq/ZoomableTextureView + private inner class ScaleListener : ScaleGestureDetector.SimpleOnScaleGestureListener() { + override fun onScaleBegin(detector: ScaleGestureDetector): Boolean { + mCurrZoomMode = ZOOM_MODE_ZOOM + return true + } + + override fun onScale(detector: ScaleGestureDetector): Boolean { + var scaleFactor = detector.scaleFactor + val width = video_surface.width + val height = video_surface.height + val origScale = mSaveScale + mSaveScale *= scaleFactor + + if (mSaveScale > MAX_VIDEO_ZOOM_SCALE) { + mSaveScale = MAX_VIDEO_ZOOM_SCALE + scaleFactor = MAX_VIDEO_ZOOM_SCALE / origScale + } else if (mSaveScale < MIN_VIDEO_ZOOM_SCALE) { + mSaveScale = MIN_VIDEO_ZOOM_SCALE + scaleFactor = MIN_VIDEO_ZOOM_SCALE / origScale + } + + mRight = width * mSaveScale - width + mBottom = video_surface.height * mSaveScale - height + if (0 <= width || 0 <= height) { + mMatrix.postScale(scaleFactor, scaleFactor, detector.focusX, detector.focusY) + if (scaleFactor < 1) { + mMatrix.getValues(mMatrices) + val x = mMatrices[Matrix.MTRANS_X] + val y = mMatrices[Matrix.MTRANS_Y] + if (scaleFactor < 1) { + if (0 < width) { + if (y < -mBottom) { + mMatrix.postTranslate(0f, -(y + mBottom)) + } else if (y > 0) { + mMatrix.postTranslate(0f, -y) + } + } else { + if (x < -mRight) { + mMatrix.postTranslate(-(x + mRight), 0f) + } else if (x > 0) { + mMatrix.postTranslate(-x, 0f) + } + } + } + } + } else { + mMatrix.postScale(scaleFactor, scaleFactor, detector.focusX, detector.focusY) + mMatrix.getValues(mMatrices) + val x = mMatrices[Matrix.MTRANS_X] + val y = mMatrices[Matrix.MTRANS_Y] + if (scaleFactor < 1) { + if (x < -mRight) { + mMatrix.postTranslate(-(x + mRight), 0f) + } else if (x > 0) { + mMatrix.postTranslate(-x, 0f) + } + + if (y < -mBottom) { + mMatrix.postTranslate(0f, -(y + mBottom)) + } else if (y > 0) { + mMatrix.postTranslate(0f, -y) + } + } + } + return true + } } } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt index 3bef8201c..2100ea9ec 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt @@ -299,7 +299,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View view_pager.onGlobalLayout { Handler().postDelayed({ fragmentClicked() - }, 500) + }, HIDE_SYSTEM_UI_DELAY) } } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt index 3b3232b40..4005a52c8 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt @@ -54,13 +54,13 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S private var mBottom = 0f private var mLastTouchX = 0f private var mLastTouchY = 0f - private var mTouchDownTime = 0L + private var mCurrZoomMode = ZOOM_MODE_NONE private var mExoPlayer: SimpleExoPlayer? = null private var mVideoSize = Point(0, 0) private var mTimerHandler = Handler() private var mScaleDetector: ScaleGestureDetector? = null - private var mMatrices = floatArrayOf() + private var mMatrices = FloatArray(9) private val mMatrix = Matrix() private var mStoredShowExtendedDetails = false @@ -82,14 +82,9 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S private lateinit var mPlayPauseButton: ImageView private lateinit var mSeekBar: SeekBar - private var mCurrZoomMode = ZOOM_MODE_NONE - override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { mConfig = context!!.config - - mMatrices = FloatArray(9) mScaleDetector = ScaleGestureDetector(context, ScaleListener()) - mView = inflater.inflate(R.layout.pager_video_item, container, false).apply { instant_prev_item.setOnClickListener { listener?.goToPrevItem() } instant_next_item.setOnClickListener { listener?.goToNextItem() } @@ -746,21 +741,21 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S } MotionEvent.ACTION_MOVE -> { if (mCurrZoomMode == ZOOM_MODE_ZOOM || mCurrZoomMode == ZOOM_MODE_DRAG && mSaveScale > MIN_VIDEO_ZOOM_SCALE) { - var deltaX = event.x - mLastTouchX - var deltaY = event.y - mLastTouchY - if (y + deltaY > 0) { - deltaY = -y - } else if (y + deltaY < -mBottom) { - deltaY = -(y + mBottom) + var diffX = event.x - mLastTouchX + var diffY = event.y - mLastTouchY + if (y + diffY > 0) { + diffY = -y + } else if (y + diffY < -mBottom) { + diffY = -(y + mBottom) } - if (x + deltaX > 0) { - deltaX = -x - } else if (x + deltaX < -mRight) { - deltaX = -(x + mRight) + if (x + diffX > 0) { + diffX = -x + } else if (x + diffX < -mRight) { + diffX = -(x + mRight) } - mMatrix.postTranslate(deltaX, deltaY) + mMatrix.postTranslate(diffX, diffY) mLastTouchX = event.x mLastTouchY = event.y } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/ViewPagerFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/ViewPagerFragment.kt index 5153859ad..bee1b525b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/ViewPagerFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/ViewPagerFragment.kt @@ -13,6 +13,7 @@ import java.io.File abstract class ViewPagerFragment : Fragment() { var listener: FragmentListener? = null + protected var mTouchDownTime = 0L protected var mTouchDownX = 0f protected var mTouchDownY = 0f protected var mCloseDownThreshold = 100f @@ -98,6 +99,7 @@ abstract class ViewPagerFragment : Fragment() { protected fun handleEvent(event: MotionEvent) { when (event.actionMasked) { MotionEvent.ACTION_DOWN -> { + mTouchDownTime = System.currentTimeMillis() mTouchDownX = event.x mTouchDownY = event.y } @@ -106,7 +108,8 @@ abstract class ViewPagerFragment : Fragment() { val diffX = mTouchDownX - event.x val diffY = mTouchDownY - event.y - if (!mIgnoreCloseDown && Math.abs(diffY) > Math.abs(diffX) && diffY < -mCloseDownThreshold) { + val downGestureDuration = System.currentTimeMillis() - mTouchDownTime + if (!mIgnoreCloseDown && Math.abs(diffY) > Math.abs(diffX) && diffY < -mCloseDownThreshold && downGestureDuration < MAX_CLOSE_DOWN_GESTURE_DURATION) { activity?.supportFinishAfterTransition() } mIgnoreCloseDown = false diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt index bb2b876ab..53714f1db 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt @@ -107,6 +107,7 @@ const val MAX_CLOSE_DOWN_GESTURE_DURATION = 400 const val DRAG_THRESHOLD = 8 const val MONTH_MILLISECONDS = MONTH_SECONDS * 1000L const val MIN_SKIP_LENGTH = 2000 +const val HIDE_SYSTEM_UI_DELAY = 500L const val DIRECTORY = "directory" const val MEDIUM = "medium" From 6c019c8edc9bba635aaad05ddef81c21fc941753 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 14 Jan 2019 21:13:36 +0100 Subject: [PATCH 64/75] removing a redundant call --- .../gallery/pro/activities/VideoPlayerActivity.kt | 2 +- .../simplemobiletools/gallery/pro/fragments/VideoFragment.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/VideoPlayerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/VideoPlayerActivity.kt index 0628708ee..8ff3686ef 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/VideoPlayerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/VideoPlayerActivity.kt @@ -808,7 +808,7 @@ open class VideoPlayerActivity : SimpleActivity(), SeekBar.OnSeekBarChangeListen } mRight = width * mSaveScale - width - mBottom = video_surface.height * mSaveScale - height + mBottom = height * mSaveScale - height if (0 <= width || 0 <= height) { mMatrix.postScale(scaleFactor, scaleFactor, detector.focusX, detector.focusY) if (scaleFactor < 1) { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt index 4005a52c8..01e626289 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt @@ -792,7 +792,7 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S } mRight = width * mSaveScale - width - mBottom = mTextureView.height * mSaveScale - height + mBottom = height * mSaveScale - height if (0 <= width || 0 <= height) { mMatrix.postScale(scaleFactor, scaleFactor, detector.focusX, detector.focusY) if (scaleFactor < 1) { From b916f0c6199956248d34c9443b24059bfd3f700f Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 14 Jan 2019 23:48:52 +0100 Subject: [PATCH 65/75] adding initial Gif view zooming, not done yet --- .../gallery/pro/fragments/PhotoFragment.kt | 14 +- .../pro/views/MyZoomableGifTextureView.kt | 195 ++++++++++++++++++ app/src/main/res/layout/pager_photo_item.xml | 7 +- 3 files changed, 206 insertions(+), 10 deletions(-) create mode 100644 app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/MyZoomableGifTextureView.kt diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/PhotoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/PhotoFragment.kt index 867c54936..caf20f36e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/PhotoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/PhotoFragment.kt @@ -2,10 +2,7 @@ package com.simplemobiletools.gallery.pro.fragments import android.content.Intent import android.content.res.Configuration -import android.graphics.Bitmap -import android.graphics.BitmapFactory -import android.graphics.Color -import android.graphics.Matrix +import android.graphics.* import android.graphics.drawable.ColorDrawable import android.graphics.drawable.PictureDrawable import android.media.ExifInterface.* @@ -292,6 +289,7 @@ class PhotoFragment : ViewPagerFragment() { } private fun loadImage() { + checkScreenDimensions() mImageOrientation = getImageOrientation() when { mMedium.isGIF() -> loadGif() @@ -310,8 +308,11 @@ class PhotoFragment : ViewPagerFragment() { } mView.photo_view.beGone() - mView.gif_view.beVisible() - mView.gif_view.setInputSource(source) + val resolution = mMedium.path.getImageResolution() ?: Point(0, 0) + mView.gif_view.apply { + setInputSource(source) + setupSizes(resolution.x, resolution.y, mScreenWidth, mScreenHeight) + } } catch (e: Exception) { loadBitmap() } catch (e: OutOfMemoryError) { @@ -328,7 +329,6 @@ class PhotoFragment : ViewPagerFragment() { } private fun loadBitmap(degrees: Int = 0) { - checkScreenDimensions() var pathToLoad = if (mMedium.path.startsWith("content://")) mMedium.path else "file://${mMedium.path}" pathToLoad = pathToLoad.replace("%", "%25").replace("#", "%23") diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/MyZoomableGifTextureView.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/MyZoomableGifTextureView.kt new file mode 100644 index 000000000..5d2819909 --- /dev/null +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/MyZoomableGifTextureView.kt @@ -0,0 +1,195 @@ +package com.simplemobiletools.gallery.pro.views + +import android.content.Context +import android.graphics.Matrix +import android.graphics.RectF +import android.util.AttributeSet +import android.view.MotionEvent +import android.view.ScaleGestureDetector +import android.widget.ImageView +import com.simplemobiletools.commons.extensions.beVisible +import com.simplemobiletools.gallery.pro.helpers.* +import pl.droidsonroids.gif.GifTextureView + +// allow horizontal swipes through the layout, else it can cause glitches at zoomed in images +class MyZoomableGifTextureView(context: Context, attrs: AttributeSet) : GifTextureView(context, attrs) { + private var mSaveScale = 1f + private var mRight = 0f + private var mBottom = 0f + private var mLastTouchX = 0f + private var mLastTouchY = 0f + private var mTouchDownTime = 0L + private var mTouchDownX = 0f + private var mTouchDownY = 0f + private var mGifWidth = 0f + private var mGifHeight = 0f + private var mScreenWidth = 0f + private var mScreenHeight = 0f + private var mLastFocusX = 0f + private var mLastFocusY = 0f + private var mCurrZoomMode = ZOOM_MODE_NONE + + private var mScaleDetector: ScaleGestureDetector? = null + private var mMatrices = FloatArray(9) + private val mMatrix = Matrix() + private var mOrigRect = RectF() + private var mWantedRect = RectF() + + init { + mScaleDetector = ScaleGestureDetector(context, ScaleListener()) + } + + fun setupSizes(gifWidth: Int, gifHeight: Int, screenWidth: Int, screenHeight: Int) { + // if we don't know the gifs' resolution, just display it and disable zooming + if (gifWidth == 0 || gifHeight == 0) { + scaleType = ImageView.ScaleType.FIT_CENTER + mScaleDetector = null + beVisible() + return + } + + mGifWidth = gifWidth.toFloat() + mGifHeight = gifHeight.toFloat() + mScreenWidth = screenWidth.toFloat() + mScreenHeight = screenHeight.toFloat() + + // we basically want scaleType fitCenter, but we have to use matrices to reach that + mOrigRect = RectF(0f, 0f, mGifWidth, mGifHeight) + mWantedRect = RectF(0f, 0f, mScreenWidth, mScreenHeight) + mMatrix.setRectToRect(mOrigRect, mWantedRect, Matrix.ScaleToFit.CENTER) + setTransform(mMatrix) + invalidate() + beVisible() + } + + override fun onTouchEvent(event: MotionEvent): Boolean { + mScaleDetector?.onTouchEvent(event) + + mMatrix.getValues(mMatrices) + mMatrix.setRectToRect(mOrigRect, mWantedRect, Matrix.ScaleToFit.CENTER) + mMatrix.postScale(mSaveScale, mSaveScale, mLastFocusX, mLastFocusY) + + val x = mMatrices[Matrix.MTRANS_X] + val y = mMatrices[Matrix.MTRANS_Y] + + when (event.actionMasked) { + MotionEvent.ACTION_DOWN -> { + mTouchDownTime = System.currentTimeMillis() + mCurrZoomMode = ZOOM_MODE_DRAG + mLastTouchX = event.x + mLastTouchY = event.y + + mTouchDownX = event.x + mTouchDownY = event.y + } + MotionEvent.ACTION_UP -> { + mCurrZoomMode = ZOOM_MODE_NONE + if (System.currentTimeMillis() - mTouchDownTime < CLICK_MAX_DURATION) { + performClick() + } + } + MotionEvent.ACTION_POINTER_DOWN -> { + mLastTouchX = event.x + mLastTouchY = event.y + mCurrZoomMode = ZOOM_MODE_ZOOM + } + MotionEvent.ACTION_MOVE -> { + if (mCurrZoomMode == ZOOM_MODE_ZOOM || mCurrZoomMode == ZOOM_MODE_DRAG && mSaveScale > MIN_VIDEO_ZOOM_SCALE) { + var diffX = event.x - mLastTouchX + var diffY = event.y - mLastTouchY + if (y + diffY > 0) { + diffY = -y + } else if (y + diffY < -mBottom) { + diffY = -(y + mBottom) + } + + if (x + diffX > 0) { + diffX = -x + } else if (x + diffX < -mRight) { + diffX = -(x + mRight) + } + + mMatrix.postTranslate(diffX, diffY) + mLastTouchX = event.x + mLastTouchY = event.y + } + } + MotionEvent.ACTION_POINTER_UP -> { + mCurrZoomMode = ZOOM_MODE_NONE + } + } + + setTransform(mMatrix) + invalidate() + return true + } + + // taken from https://github.com/Manuiq/ZoomableTextureView + private inner class ScaleListener : ScaleGestureDetector.SimpleOnScaleGestureListener() { + override fun onScaleBegin(detector: ScaleGestureDetector): Boolean { + mCurrZoomMode = ZOOM_MODE_ZOOM + return true + } + + override fun onScale(detector: ScaleGestureDetector): Boolean { + mLastFocusX = detector.focusX + mLastFocusY = detector.focusY + var scaleFactor = detector.scaleFactor + val origScale = mSaveScale + mSaveScale *= scaleFactor + + if (mSaveScale > MAX_VIDEO_ZOOM_SCALE) { + mSaveScale = MAX_VIDEO_ZOOM_SCALE + scaleFactor = MAX_VIDEO_ZOOM_SCALE / origScale + } else if (mSaveScale < MIN_VIDEO_ZOOM_SCALE) { + mSaveScale = MIN_VIDEO_ZOOM_SCALE + scaleFactor = MIN_VIDEO_ZOOM_SCALE / origScale + } + + mRight = width * mSaveScale - width + mBottom = height * mSaveScale - height + if (0 <= width || 0 <= height) { + mMatrix.postScale(scaleFactor, scaleFactor, detector.focusX, detector.focusY) + if (scaleFactor < 1) { + mMatrix.getValues(mMatrices) + val x = mMatrices[Matrix.MTRANS_X] + val y = mMatrices[Matrix.MTRANS_Y] + if (scaleFactor < 1) { + if (0 < width) { + if (y < -mBottom) { + mMatrix.postTranslate(0f, -(y + mBottom)) + } else if (y > 0) { + mMatrix.postTranslate(0f, -y) + } + } else { + if (x < -mRight) { + mMatrix.postTranslate(-(x + mRight), 0f) + } else if (x > 0) { + mMatrix.postTranslate(-x, 0f) + } + } + } + } + } else { + mMatrix.postScale(scaleFactor, scaleFactor, detector.focusX, detector.focusY) + mMatrix.getValues(mMatrices) + val x = mMatrices[Matrix.MTRANS_X] + val y = mMatrices[Matrix.MTRANS_Y] + if (scaleFactor < 1) { + if (x < -mRight) { + mMatrix.postTranslate(-(x + mRight), 0f) + } else if (x > 0) { + mMatrix.postTranslate(-x, 0f) + } + + if (y < -mBottom) { + mMatrix.postTranslate(0f, -(y + mBottom)) + } else if (y > 0) { + mMatrix.postTranslate(0f, -y) + } + } + } + return true + } + } +} diff --git a/app/src/main/res/layout/pager_photo_item.xml b/app/src/main/res/layout/pager_photo_item.xml index 46ed641d6..bc3ec30e8 100644 --- a/app/src/main/res/layout/pager_photo_item.xml +++ b/app/src/main/res/layout/pager_photo_item.xml @@ -11,10 +11,11 @@ android:layout_width="match_parent" android:layout_height="match_parent"/> - Date: Tue, 15 Jan 2019 15:26:25 +0100 Subject: [PATCH 66/75] removing some redundant ScaleListener code --- .../pro/activities/VideoPlayerActivity.kt | 54 +++++++------------ .../gallery/pro/fragments/VideoFragment.kt | 54 +++++++------------ .../pro/views/MyZoomableGifTextureView.kt | 52 +++++++----------- 3 files changed, 56 insertions(+), 104 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/VideoPlayerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/VideoPlayerActivity.kt index 8ff3686ef..1e73437b6 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/VideoPlayerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/VideoPlayerActivity.kt @@ -793,9 +793,13 @@ open class VideoPlayerActivity : SimpleActivity(), SeekBar.OnSeekBarChangeListen } override fun onScale(detector: ScaleGestureDetector): Boolean { - var scaleFactor = detector.scaleFactor val width = video_surface.width val height = video_surface.height + if (width <= 0 || height <= 0) { + return true + } + + var scaleFactor = detector.scaleFactor val origScale = mSaveScale mSaveScale *= scaleFactor @@ -809,44 +813,24 @@ open class VideoPlayerActivity : SimpleActivity(), SeekBar.OnSeekBarChangeListen mRight = width * mSaveScale - width mBottom = height * mSaveScale - height - if (0 <= width || 0 <= height) { - mMatrix.postScale(scaleFactor, scaleFactor, detector.focusX, detector.focusY) - if (scaleFactor < 1) { - mMatrix.getValues(mMatrices) - val x = mMatrices[Matrix.MTRANS_X] - val y = mMatrices[Matrix.MTRANS_Y] - if (scaleFactor < 1) { - if (0 < width) { - if (y < -mBottom) { - mMatrix.postTranslate(0f, -(y + mBottom)) - } else if (y > 0) { - mMatrix.postTranslate(0f, -y) - } - } else { - if (x < -mRight) { - mMatrix.postTranslate(-(x + mRight), 0f) - } else if (x > 0) { - mMatrix.postTranslate(-x, 0f) - } - } - } - } - } else { - mMatrix.postScale(scaleFactor, scaleFactor, detector.focusX, detector.focusY) + mMatrix.postScale(scaleFactor, scaleFactor, detector.focusX, detector.focusY) + if (scaleFactor < 1) { mMatrix.getValues(mMatrices) val x = mMatrices[Matrix.MTRANS_X] val y = mMatrices[Matrix.MTRANS_Y] if (scaleFactor < 1) { - if (x < -mRight) { - mMatrix.postTranslate(-(x + mRight), 0f) - } else if (x > 0) { - mMatrix.postTranslate(-x, 0f) - } - - if (y < -mBottom) { - mMatrix.postTranslate(0f, -(y + mBottom)) - } else if (y > 0) { - mMatrix.postTranslate(0f, -y) + if (width > 0) { + if (y < -mBottom) { + mMatrix.postTranslate(0f, -(y + mBottom)) + } else if (y > 0) { + mMatrix.postTranslate(0f, -y) + } + } else { + if (x < -mRight) { + mMatrix.postTranslate(-(x + mRight), 0f) + } else if (x > 0) { + mMatrix.postTranslate(-x, 0f) + } } } } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt index 01e626289..96bddc49a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt @@ -777,9 +777,13 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S } override fun onScale(detector: ScaleGestureDetector): Boolean { - var scaleFactor = detector.scaleFactor val width = mTextureView.width val height = mTextureView.height + if (width <= 0 || height <= 0) { + return true + } + + var scaleFactor = detector.scaleFactor val origScale = mSaveScale mSaveScale *= scaleFactor @@ -793,44 +797,24 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S mRight = width * mSaveScale - width mBottom = height * mSaveScale - height - if (0 <= width || 0 <= height) { - mMatrix.postScale(scaleFactor, scaleFactor, detector.focusX, detector.focusY) - if (scaleFactor < 1) { - mMatrix.getValues(mMatrices) - val x = mMatrices[Matrix.MTRANS_X] - val y = mMatrices[Matrix.MTRANS_Y] - if (scaleFactor < 1) { - if (0 < width) { - if (y < -mBottom) { - mMatrix.postTranslate(0f, -(y + mBottom)) - } else if (y > 0) { - mMatrix.postTranslate(0f, -y) - } - } else { - if (x < -mRight) { - mMatrix.postTranslate(-(x + mRight), 0f) - } else if (x > 0) { - mMatrix.postTranslate(-x, 0f) - } - } - } - } - } else { - mMatrix.postScale(scaleFactor, scaleFactor, detector.focusX, detector.focusY) + mMatrix.postScale(scaleFactor, scaleFactor, detector.focusX, detector.focusY) + if (scaleFactor < 1) { mMatrix.getValues(mMatrices) val x = mMatrices[Matrix.MTRANS_X] val y = mMatrices[Matrix.MTRANS_Y] if (scaleFactor < 1) { - if (x < -mRight) { - mMatrix.postTranslate(-(x + mRight), 0f) - } else if (x > 0) { - mMatrix.postTranslate(-x, 0f) - } - - if (y < -mBottom) { - mMatrix.postTranslate(0f, -(y + mBottom)) - } else if (y > 0) { - mMatrix.postTranslate(0f, -y) + if (width > 0) { + if (y < -mBottom) { + mMatrix.postTranslate(0f, -(y + mBottom)) + } else if (y > 0) { + mMatrix.postTranslate(0f, -y) + } + } else { + if (x < -mRight) { + mMatrix.postTranslate(-(x + mRight), 0f) + } else if (x > 0) { + mMatrix.postTranslate(-x, 0f) + } } } } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/MyZoomableGifTextureView.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/MyZoomableGifTextureView.kt index 5d2819909..ec29309fe 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/MyZoomableGifTextureView.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/MyZoomableGifTextureView.kt @@ -132,6 +132,10 @@ class MyZoomableGifTextureView(context: Context, attrs: AttributeSet) : GifTextu } override fun onScale(detector: ScaleGestureDetector): Boolean { + if (width <= 0 || height <= 0) { + return true + } + mLastFocusX = detector.focusX mLastFocusY = detector.focusY var scaleFactor = detector.scaleFactor @@ -148,44 +152,24 @@ class MyZoomableGifTextureView(context: Context, attrs: AttributeSet) : GifTextu mRight = width * mSaveScale - width mBottom = height * mSaveScale - height - if (0 <= width || 0 <= height) { - mMatrix.postScale(scaleFactor, scaleFactor, detector.focusX, detector.focusY) - if (scaleFactor < 1) { - mMatrix.getValues(mMatrices) - val x = mMatrices[Matrix.MTRANS_X] - val y = mMatrices[Matrix.MTRANS_Y] - if (scaleFactor < 1) { - if (0 < width) { - if (y < -mBottom) { - mMatrix.postTranslate(0f, -(y + mBottom)) - } else if (y > 0) { - mMatrix.postTranslate(0f, -y) - } - } else { - if (x < -mRight) { - mMatrix.postTranslate(-(x + mRight), 0f) - } else if (x > 0) { - mMatrix.postTranslate(-x, 0f) - } - } - } - } - } else { - mMatrix.postScale(scaleFactor, scaleFactor, detector.focusX, detector.focusY) + mMatrix.postScale(scaleFactor, scaleFactor, detector.focusX, detector.focusY) + if (scaleFactor < 1) { mMatrix.getValues(mMatrices) val x = mMatrices[Matrix.MTRANS_X] val y = mMatrices[Matrix.MTRANS_Y] if (scaleFactor < 1) { - if (x < -mRight) { - mMatrix.postTranslate(-(x + mRight), 0f) - } else if (x > 0) { - mMatrix.postTranslate(-x, 0f) - } - - if (y < -mBottom) { - mMatrix.postTranslate(0f, -(y + mBottom)) - } else if (y > 0) { - mMatrix.postTranslate(0f, -y) + if (width > 0) { + if (y < -mBottom) { + mMatrix.postTranslate(0f, -(y + mBottom)) + } else if (y > 0) { + mMatrix.postTranslate(0f, -y) + } + } else { + if (x < -mRight) { + mMatrix.postTranslate(-(x + mRight), 0f) + } else if (x > 0) { + mMatrix.postTranslate(-x, 0f) + } } } } From 7e7ef2063e31ba0775db8b7fae899250a4dec95a Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 15 Jan 2019 16:19:05 +0100 Subject: [PATCH 67/75] disable autoplaying videos by default --- .../kotlin/com/simplemobiletools/gallery/pro/helpers/Config.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Config.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Config.kt index 6b2c9879e..29368ae2d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Config.kt @@ -153,7 +153,7 @@ class Config(context: Context) : BaseConfig(context) { set(includedFolders) = prefs.edit().remove(INCLUDED_FOLDERS).putStringSet(INCLUDED_FOLDERS, includedFolders).apply() var autoplayVideos: Boolean - get() = prefs.getBoolean(AUTOPLAY_VIDEOS, true) + get() = prefs.getBoolean(AUTOPLAY_VIDEOS, false) set(autoplay) = prefs.edit().putBoolean(AUTOPLAY_VIDEOS, autoplay).apply() var animateGifs: Boolean From e9cbf444e12d2ca2dd26a5e92090bf89cd9e285c Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 15 Jan 2019 16:21:45 +0100 Subject: [PATCH 68/75] removing some more scaling related redundant code --- .../pro/activities/VideoPlayerActivity.kt | 20 ++++--------------- .../gallery/pro/fragments/VideoFragment.kt | 17 ++++------------ .../pro/views/MyZoomableGifTextureView.kt | 17 ++++------------ 3 files changed, 12 insertions(+), 42 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/VideoPlayerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/VideoPlayerActivity.kt index 1e73437b6..f09538ca1 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/VideoPlayerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/VideoPlayerActivity.kt @@ -761,9 +761,6 @@ open class VideoPlayerActivity : SimpleActivity(), SeekBar.OnSeekBarChangeListen } } MotionEvent.ACTION_UP -> { - val diffX = mTouchDownX - event.x - val diffY = mTouchDownY - event.y - mIgnoreCloseDown = false if (mIsDragged) { if (mIsFullscreen) { @@ -816,21 +813,12 @@ open class VideoPlayerActivity : SimpleActivity(), SeekBar.OnSeekBarChangeListen mMatrix.postScale(scaleFactor, scaleFactor, detector.focusX, detector.focusY) if (scaleFactor < 1) { mMatrix.getValues(mMatrices) - val x = mMatrices[Matrix.MTRANS_X] val y = mMatrices[Matrix.MTRANS_Y] if (scaleFactor < 1) { - if (width > 0) { - if (y < -mBottom) { - mMatrix.postTranslate(0f, -(y + mBottom)) - } else if (y > 0) { - mMatrix.postTranslate(0f, -y) - } - } else { - if (x < -mRight) { - mMatrix.postTranslate(-(x + mRight), 0f) - } else if (x > 0) { - mMatrix.postTranslate(-x, 0f) - } + if (y < -mBottom) { + mMatrix.postTranslate(0f, -(y + mBottom)) + } else if (y > 0) { + mMatrix.postTranslate(0f, -y) } } } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt index 96bddc49a..57ab7dcae 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt @@ -800,21 +800,12 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S mMatrix.postScale(scaleFactor, scaleFactor, detector.focusX, detector.focusY) if (scaleFactor < 1) { mMatrix.getValues(mMatrices) - val x = mMatrices[Matrix.MTRANS_X] val y = mMatrices[Matrix.MTRANS_Y] if (scaleFactor < 1) { - if (width > 0) { - if (y < -mBottom) { - mMatrix.postTranslate(0f, -(y + mBottom)) - } else if (y > 0) { - mMatrix.postTranslate(0f, -y) - } - } else { - if (x < -mRight) { - mMatrix.postTranslate(-(x + mRight), 0f) - } else if (x > 0) { - mMatrix.postTranslate(-x, 0f) - } + if (y < -mBottom) { + mMatrix.postTranslate(0f, -(y + mBottom)) + } else if (y > 0) { + mMatrix.postTranslate(0f, -y) } } } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/MyZoomableGifTextureView.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/MyZoomableGifTextureView.kt index ec29309fe..59aec6067 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/MyZoomableGifTextureView.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/MyZoomableGifTextureView.kt @@ -155,21 +155,12 @@ class MyZoomableGifTextureView(context: Context, attrs: AttributeSet) : GifTextu mMatrix.postScale(scaleFactor, scaleFactor, detector.focusX, detector.focusY) if (scaleFactor < 1) { mMatrix.getValues(mMatrices) - val x = mMatrices[Matrix.MTRANS_X] val y = mMatrices[Matrix.MTRANS_Y] if (scaleFactor < 1) { - if (width > 0) { - if (y < -mBottom) { - mMatrix.postTranslate(0f, -(y + mBottom)) - } else if (y > 0) { - mMatrix.postTranslate(0f, -y) - } - } else { - if (x < -mRight) { - mMatrix.postTranslate(-(x + mRight), 0f) - } else if (x > 0) { - mMatrix.postTranslate(-x, 0f) - } + if (y < -mBottom) { + mMatrix.postTranslate(0f, -(y + mBottom)) + } else if (y > 0) { + mMatrix.postTranslate(0f, -y) } } } From 494745c10fb6e7c2cf574dc0af660761e9de5dee Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 15 Jan 2019 21:11:00 +0100 Subject: [PATCH 69/75] fix the video time holder right margin at landscape video fragment --- .../gallery/pro/fragments/VideoFragment.kt | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt index 57ab7dcae..5e78802a8 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt @@ -410,12 +410,20 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S } private fun initTimeHolder() { - var bottomMargin = context!!.navigationBarHeight + var right = 0 + var bottom = context!!.navigationBarHeight if (mConfig.bottomActions) { - bottomMargin += resources.getDimension(R.dimen.bottom_actions_height).toInt() + bottom += resources.getDimension(R.dimen.bottom_actions_height).toInt() } - (mTimeHolder.layoutParams as RelativeLayout.LayoutParams).bottomMargin = bottomMargin + if (resources.configuration.orientation == Configuration.ORIENTATION_LANDSCAPE && activity?.hasNavBar() == true) { + right += activity!!.navigationBarWidth + } + + (mTimeHolder.layoutParams as RelativeLayout.LayoutParams).apply { + bottomMargin = bottom + rightMargin = right + } mTimeHolder.beInvisibleIf(mIsFullscreen) } From 0e68d01f08b10a27a858559586bbc15173c503eb Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 16 Jan 2019 14:02:21 +0100 Subject: [PATCH 70/75] improve bounds checking at gif view --- .../pro/views/MyZoomableGifTextureView.kt | 48 ++++++++++++------- 1 file changed, 32 insertions(+), 16 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/MyZoomableGifTextureView.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/MyZoomableGifTextureView.kt index 59aec6067..01443ce52 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/MyZoomableGifTextureView.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/MyZoomableGifTextureView.kt @@ -34,6 +34,7 @@ class MyZoomableGifTextureView(context: Context, attrs: AttributeSet) : GifTextu private val mMatrix = Matrix() private var mOrigRect = RectF() private var mWantedRect = RectF() + private var mCurrentViewport = RectF() init { mScaleDetector = ScaleGestureDetector(context, ScaleListener()) @@ -57,20 +58,21 @@ class MyZoomableGifTextureView(context: Context, attrs: AttributeSet) : GifTextu mOrigRect = RectF(0f, 0f, mGifWidth, mGifHeight) mWantedRect = RectF(0f, 0f, mScreenWidth, mScreenHeight) mMatrix.setRectToRect(mOrigRect, mWantedRect, Matrix.ScaleToFit.CENTER) + mMatrix.getValues(mMatrices) + + val left = mMatrices[Matrix.MTRANS_X] + val top = mMatrices[Matrix.MTRANS_Y] + val right = mScreenWidth - left + val bottom = mScreenHeight - top + mCurrentViewport.set(left, top, right, bottom) + setTransform(mMatrix) invalidate() beVisible() } override fun onTouchEvent(event: MotionEvent): Boolean { - mScaleDetector?.onTouchEvent(event) - - mMatrix.getValues(mMatrices) - mMatrix.setRectToRect(mOrigRect, mWantedRect, Matrix.ScaleToFit.CENTER) - mMatrix.postScale(mSaveScale, mSaveScale, mLastFocusX, mLastFocusY) - - val x = mMatrices[Matrix.MTRANS_X] - val y = mMatrices[Matrix.MTRANS_Y] +// mScaleDetector?.onTouchEvent(event) when (event.actionMasked) { MotionEvent.ACTION_DOWN -> { @@ -97,19 +99,33 @@ class MyZoomableGifTextureView(context: Context, attrs: AttributeSet) : GifTextu if (mCurrZoomMode == ZOOM_MODE_ZOOM || mCurrZoomMode == ZOOM_MODE_DRAG && mSaveScale > MIN_VIDEO_ZOOM_SCALE) { var diffX = event.x - mLastTouchX var diffY = event.y - mLastTouchY - if (y + diffY > 0) { - diffY = -y - } else if (y + diffY < -mBottom) { - diffY = -(y + mBottom) + + // horizontal bounds + if (mCurrentViewport.left + diffX < 0) { + diffX = -mCurrentViewport.left + } else if (mCurrentViewport.right + diffX > mScreenWidth) { + diffX = mScreenWidth - mCurrentViewport.right } - if (x + diffX > 0) { - diffX = -x - } else if (x + diffX < -mRight) { - diffX = -(x + mRight) + // vertical bounds + if (mCurrentViewport.top + diffY < 0) { + diffY = -mCurrentViewport.top + } else if (mCurrentViewport.bottom + diffY > mScreenHeight) { + diffY = mScreenHeight - mCurrentViewport.bottom } + mCurrentViewport.left += diffX + mCurrentViewport.right += diffX + mCurrentViewport.top += diffY + mCurrentViewport.bottom += diffY + mMatrix.postTranslate(diffX, diffY) + + mCurrentViewport.left = Math.max(mCurrentViewport.left, 0f) + mCurrentViewport.right = Math.min(mCurrentViewport.right, mScreenWidth) + mCurrentViewport.top = Math.max(mCurrentViewport.top, 0f) + mCurrentViewport.bottom = Math.min(mCurrentViewport.bottom, mScreenHeight) + mLastTouchX = event.x mLastTouchY = event.y } From a53fad8014c2a00df9dd2f0f589b204b78fb1fae Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 16 Jan 2019 17:06:52 +0100 Subject: [PATCH 71/75] updating gradle --- build.gradle | 2 +- gradle/wrapper/gradle-wrapper.properties | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index d93366c1c..18eabc38b 100644 --- a/build.gradle +++ b/build.gradle @@ -9,7 +9,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:3.2.1' + classpath 'com.android.tools.build:gradle:3.3.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 3e009998b..00616cb8d 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Wed Sep 26 14:42:41 CEST 2018 +#Wed Jan 16 16:59:58 CET 2019 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip From fe51dc186c83a294e301904af6ac2b7234829b21 Mon Sep 17 00:00:00 2001 From: sawka6630 Date: Wed, 16 Jan 2019 21:45:42 +0200 Subject: [PATCH 72/75] Updated Ukrainian translation Translation of line No.34. --- app/src/main/res/values-uk/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/values-uk/strings.xml b/app/src/main/res/values-uk/strings.xml index 5aabd8d6e..0099580ab 100644 --- a/app/src/main/res/values-uk/strings.xml +++ b/app/src/main/res/values-uk/strings.xml @@ -31,7 +31,7 @@ Виправити дату зйомки Виправлення… Дати успішно виправлені - Share a resized version + Поділитися зображенням іншого розміру Фільтр мультимедійних файлів From 95492d5e0655a123a05a7045ba165522af59a5b1 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 16 Jan 2019 21:48:25 +0100 Subject: [PATCH 73/75] fix #984, allow zooming GIFs --- .../pro/views/MyZoomableGifTextureView.kt | 51 +++++-------------- 1 file changed, 14 insertions(+), 37 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/MyZoomableGifTextureView.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/MyZoomableGifTextureView.kt index 01443ce52..26c6bed46 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/MyZoomableGifTextureView.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/MyZoomableGifTextureView.kt @@ -14,8 +14,6 @@ import pl.droidsonroids.gif.GifTextureView // allow horizontal swipes through the layout, else it can cause glitches at zoomed in images class MyZoomableGifTextureView(context: Context, attrs: AttributeSet) : GifTextureView(context, attrs) { private var mSaveScale = 1f - private var mRight = 0f - private var mBottom = 0f private var mLastTouchX = 0f private var mLastTouchY = 0f private var mTouchDownTime = 0L @@ -32,8 +30,6 @@ class MyZoomableGifTextureView(context: Context, attrs: AttributeSet) : GifTextu private var mScaleDetector: ScaleGestureDetector? = null private var mMatrices = FloatArray(9) private val mMatrix = Matrix() - private var mOrigRect = RectF() - private var mWantedRect = RectF() private var mCurrentViewport = RectF() init { @@ -55,9 +51,9 @@ class MyZoomableGifTextureView(context: Context, attrs: AttributeSet) : GifTextu mScreenHeight = screenHeight.toFloat() // we basically want scaleType fitCenter, but we have to use matrices to reach that - mOrigRect = RectF(0f, 0f, mGifWidth, mGifHeight) - mWantedRect = RectF(0f, 0f, mScreenWidth, mScreenHeight) - mMatrix.setRectToRect(mOrigRect, mWantedRect, Matrix.ScaleToFit.CENTER) + val origRect = RectF(0f, 0f, mGifWidth, mGifHeight) + val wantedRect = RectF(0f, 0f, mScreenWidth, mScreenHeight) + mMatrix.setRectToRect(origRect, wantedRect, Matrix.ScaleToFit.CENTER) mMatrix.getValues(mMatrices) val left = mMatrices[Matrix.MTRANS_X] @@ -72,7 +68,7 @@ class MyZoomableGifTextureView(context: Context, attrs: AttributeSet) : GifTextu } override fun onTouchEvent(event: MotionEvent): Boolean { -// mScaleDetector?.onTouchEvent(event) + mScaleDetector?.onTouchEvent(event) when (event.actionMasked) { MotionEvent.ACTION_DOWN -> { @@ -98,33 +94,21 @@ class MyZoomableGifTextureView(context: Context, attrs: AttributeSet) : GifTextu MotionEvent.ACTION_MOVE -> { if (mCurrZoomMode == ZOOM_MODE_ZOOM || mCurrZoomMode == ZOOM_MODE_DRAG && mSaveScale > MIN_VIDEO_ZOOM_SCALE) { var diffX = event.x - mLastTouchX - var diffY = event.y - mLastTouchY // horizontal bounds - if (mCurrentViewport.left + diffX < 0) { + if (mCurrentViewport.left >= 0) { diffX = -mCurrentViewport.left - } else if (mCurrentViewport.right + diffX > mScreenWidth) { - diffX = mScreenWidth - mCurrentViewport.right - } - - // vertical bounds - if (mCurrentViewport.top + diffY < 0) { - diffY = -mCurrentViewport.top - } else if (mCurrentViewport.bottom + diffY > mScreenHeight) { - diffY = mScreenHeight - mCurrentViewport.bottom + } else if (mCurrentViewport.right + diffX >= mScreenWidth * mSaveScale) { + diffX = -((mScreenWidth * mSaveScale) - mCurrentViewport.right) } mCurrentViewport.left += diffX mCurrentViewport.right += diffX - mCurrentViewport.top += diffY - mCurrentViewport.bottom += diffY - mMatrix.postTranslate(diffX, diffY) + mMatrix.postTranslate(diffX, 0f) mCurrentViewport.left = Math.max(mCurrentViewport.left, 0f) mCurrentViewport.right = Math.min(mCurrentViewport.right, mScreenWidth) - mCurrentViewport.top = Math.max(mCurrentViewport.top, 0f) - mCurrentViewport.bottom = Math.min(mCurrentViewport.bottom, mScreenHeight) mLastTouchX = event.x mLastTouchY = event.y @@ -166,20 +150,13 @@ class MyZoomableGifTextureView(context: Context, attrs: AttributeSet) : GifTextu scaleFactor = MIN_VIDEO_ZOOM_SCALE / origScale } - mRight = width * mSaveScale - width - mBottom = height * mSaveScale - height mMatrix.postScale(scaleFactor, scaleFactor, detector.focusX, detector.focusY) - if (scaleFactor < 1) { - mMatrix.getValues(mMatrices) - val y = mMatrices[Matrix.MTRANS_Y] - if (scaleFactor < 1) { - if (y < -mBottom) { - mMatrix.postTranslate(0f, -(y + mBottom)) - } else if (y > 0) { - mMatrix.postTranslate(0f, -y) - } - } - } + mMatrix.getValues(mMatrices) + val left = mMatrices[Matrix.MTRANS_X] + val top = mMatrices[Matrix.MTRANS_Y] + val right = mScreenWidth - left + val bottom = mScreenHeight - top + mCurrentViewport.set(left, top, right, bottom) return true } } From f495a0790ef1df53c75c9f39784134f8256f11d8 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 16 Jan 2019 22:00:28 +0100 Subject: [PATCH 74/75] handle closing GIF view with down gesture --- .../gallery/pro/fragments/PhotoFragment.kt | 9 +++------ .../pro/views/MyZoomableGifTextureView.kt | 16 +++++++++++++++- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/PhotoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/PhotoFragment.kt index caf20f36e..49cdabda3 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/PhotoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/PhotoFragment.kt @@ -103,11 +103,6 @@ class PhotoFragment : ViewPagerFragment() { } if (context.config.allowDownGesture) { - gif_view.setOnTouchListener { v, event -> - handleEvent(event) - false - } - subsampling_view.setOnTouchListener { v, event -> if (mView.subsampling_view.scale == mOriginalSubsamplingScale) { handleEvent(event) @@ -311,7 +306,9 @@ class PhotoFragment : ViewPagerFragment() { val resolution = mMedium.path.getImageResolution() ?: Point(0, 0) mView.gif_view.apply { setInputSource(source) - setupSizes(resolution.x, resolution.y, mScreenWidth, mScreenHeight) + setupGIFView(resolution.x, resolution.y, mScreenWidth, mScreenHeight) { + activity?.supportFinishAfterTransition() + } } } catch (e: Exception) { loadBitmap() diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/MyZoomableGifTextureView.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/MyZoomableGifTextureView.kt index 26c6bed46..60e54ec1a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/MyZoomableGifTextureView.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/MyZoomableGifTextureView.kt @@ -8,6 +8,7 @@ import android.view.MotionEvent import android.view.ScaleGestureDetector import android.widget.ImageView import com.simplemobiletools.commons.extensions.beVisible +import com.simplemobiletools.gallery.pro.extensions.config import com.simplemobiletools.gallery.pro.helpers.* import pl.droidsonroids.gif.GifTextureView @@ -25,18 +26,22 @@ class MyZoomableGifTextureView(context: Context, attrs: AttributeSet) : GifTextu private var mScreenHeight = 0f private var mLastFocusX = 0f private var mLastFocusY = 0f + private var mCloseDownThreshold = 100f + private var mIgnoreCloseDown = false private var mCurrZoomMode = ZOOM_MODE_NONE private var mScaleDetector: ScaleGestureDetector? = null private var mMatrices = FloatArray(9) private val mMatrix = Matrix() private var mCurrentViewport = RectF() + private var mCloseDownCallback: (() -> Unit)? = null init { mScaleDetector = ScaleGestureDetector(context, ScaleListener()) } - fun setupSizes(gifWidth: Int, gifHeight: Int, screenWidth: Int, screenHeight: Int) { + fun setupGIFView(gifWidth: Int, gifHeight: Int, screenWidth: Int, screenHeight: Int, callback: () -> Unit) { + mCloseDownCallback = callback // if we don't know the gifs' resolution, just display it and disable zooming if (gifWidth == 0 || gifHeight == 0) { scaleType = ImageView.ScaleType.FIT_CENTER @@ -81,10 +86,19 @@ class MyZoomableGifTextureView(context: Context, attrs: AttributeSet) : GifTextu mTouchDownY = event.y } MotionEvent.ACTION_UP -> { + val diffX = mTouchDownX - event.x + val diffY = mTouchDownY - event.y mCurrZoomMode = ZOOM_MODE_NONE if (System.currentTimeMillis() - mTouchDownTime < CLICK_MAX_DURATION) { performClick() } + + val downGestureDuration = System.currentTimeMillis() - mTouchDownTime + val areDiffsOK = Math.abs(diffY) > Math.abs(diffX) && diffY < -mCloseDownThreshold + if (mSaveScale == 1f && !mIgnoreCloseDown && areDiffsOK && context.config.allowDownGesture && downGestureDuration < MAX_CLOSE_DOWN_GESTURE_DURATION) { + mCloseDownCallback?.invoke() + } + mIgnoreCloseDown = false } MotionEvent.ACTION_POINTER_DOWN -> { mLastTouchX = event.x From 9abafd841fe76e35b27d71144b4ae84c22dc8073 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 16 Jan 2019 22:14:36 +0100 Subject: [PATCH 75/75] adding some click distance limitation to custom views --- .../pro/activities/VideoPlayerActivity.kt | 51 +------------------ .../gallery/pro/fragments/VideoFragment.kt | 14 ++--- .../gallery/pro/helpers/Constants.kt | 1 + .../gallery/pro/views/InstantItemSwitch.kt | 5 +- .../gallery/pro/views/MediaSideScroll.kt | 5 +- .../pro/views/MyZoomableGifTextureView.kt | 14 ++--- 6 files changed, 25 insertions(+), 65 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/VideoPlayerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/VideoPlayerActivity.kt index f09538ca1..4c0f3614e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/VideoPlayerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/VideoPlayerActivity.kt @@ -555,7 +555,7 @@ open class VideoPlayerActivity : SimpleActivity(), SeekBar.OnSeekBarChangeListen togglePlayPause() } } else { - if (System.currentTimeMillis() - mTouchDownTime < CLICK_MAX_DURATION) { + if (Math.abs(diffX) < CLICK_MAX_DISTANCE && Math.abs(diffY) < CLICK_MAX_DISTANCE && System.currentTimeMillis() - mTouchDownTime < CLICK_MAX_DURATION) { toggleFullscreen() } } @@ -673,7 +673,7 @@ open class VideoPlayerActivity : SimpleActivity(), SeekBar.OnSeekBarChangeListen togglePlayPause() } } else { - if (System.currentTimeMillis() - mTouchDownTime < CLICK_MAX_DURATION) { + if (Math.abs(diffX) < CLICK_MAX_DISTANCE && Math.abs(diffY) < CLICK_MAX_DISTANCE && System.currentTimeMillis() - mTouchDownTime < CLICK_MAX_DURATION) { toggleFullscreen() } } @@ -735,53 +735,6 @@ open class VideoPlayerActivity : SimpleActivity(), SeekBar.OnSeekBarChangeListen video_surface.invalidate() } - private fun handleEventt(event: MotionEvent) { - when (event.actionMasked) { - MotionEvent.ACTION_MOVE -> { - val diffX = event.x - mTouchDownX - val diffY = event.y - mTouchDownY - - if (mIsDragged || (Math.abs(diffX) > mDragThreshold && Math.abs(diffX) > Math.abs(diffY))) { - if (!mIsDragged) { - arrayOf(video_curr_time, video_seekbar, video_duration).forEach { - it.animate().alpha(1f).start() - } - } - mIgnoreCloseDown = true - mIsDragged = true - var percent = ((diffX / mScreenWidth) * 100).toInt() - percent = Math.min(100, Math.max(-100, percent)) - - val skipLength = (mDuration * 1000f) * (percent / 100f) - var newProgress = mProgressAtDown + skipLength - newProgress = Math.max(Math.min(mExoPlayer!!.duration.toFloat(), newProgress), 0f) - val newSeconds = (newProgress / 1000).toInt() - setPosition(newSeconds) - resetPlayWhenReady() - } - } - MotionEvent.ACTION_UP -> { - mIgnoreCloseDown = false - if (mIsDragged) { - if (mIsFullscreen) { - arrayOf(video_curr_time, video_seekbar, video_duration).forEach { - it.animate().alpha(0f).start() - } - } - - if (!mIsPlaying) { - togglePlayPause() - } - } else { - if (System.currentTimeMillis() - mTouchDownTime < CLICK_MAX_DURATION) { - toggleFullscreen() - } - } - mIsDragged = false - } - } - } - // taken from https://github.com/Manuiq/ZoomableTextureView private inner class ScaleListener : ScaleGestureDetector.SimpleOnScaleGestureListener() { override fun onScaleBegin(detector: ScaleGestureDetector): Boolean { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt index 5e78802a8..beebb1604 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/VideoFragment.kt @@ -731,15 +731,15 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S val diffX = mTouchDownX - event.x val diffY = mTouchDownY - event.y - val downGestureDuration = System.currentTimeMillis() - mTouchDownTime - if (!mIgnoreCloseDown && Math.abs(diffY) > Math.abs(diffX) && diffY < -mCloseDownThreshold && downGestureDuration < MAX_CLOSE_DOWN_GESTURE_DURATION && mSaveScale == 1f) { - activity?.supportFinishAfterTransition() + if (Math.abs(diffX) < CLICK_MAX_DISTANCE && Math.abs(diffY) < CLICK_MAX_DISTANCE && System.currentTimeMillis() - mTouchDownTime < CLICK_MAX_DURATION) { + mTextureView.performClick() + } else { + val downGestureDuration = System.currentTimeMillis() - mTouchDownTime + if (!mIgnoreCloseDown && Math.abs(diffY) > Math.abs(diffX) && diffY < -mCloseDownThreshold && downGestureDuration < MAX_CLOSE_DOWN_GESTURE_DURATION && mSaveScale == 1f) { + activity?.supportFinishAfterTransition() + } } mIgnoreCloseDown = false - - if (System.currentTimeMillis() - mTouchDownTime < CLICK_MAX_DURATION) { - mTextureView.performClick() - } } MotionEvent.ACTION_POINTER_DOWN -> { mLastTouchX = event.x diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt index 53714f1db..e775ba452 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt @@ -103,6 +103,7 @@ const val GO_TO_PREV_ITEM = "go_to_prev_item" const val MAX_COLUMN_COUNT = 20 const val SHOW_TEMP_HIDDEN_DURATION = 300000L const val CLICK_MAX_DURATION = 150 +const val CLICK_MAX_DISTANCE = 100 const val MAX_CLOSE_DOWN_GESTURE_DURATION = 400 const val DRAG_THRESHOLD = 8 const val MONTH_MILLISECONDS = MONTH_SECONDS * 1000L diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/InstantItemSwitch.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/InstantItemSwitch.kt index c21e2f642..18f2f154e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/InstantItemSwitch.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/InstantItemSwitch.kt @@ -5,6 +5,7 @@ import android.util.AttributeSet import android.view.MotionEvent import android.view.ViewGroup import android.widget.RelativeLayout +import com.simplemobiletools.gallery.pro.helpers.CLICK_MAX_DISTANCE import com.simplemobiletools.gallery.pro.helpers.CLICK_MAX_DURATION import com.simplemobiletools.gallery.pro.helpers.DRAG_THRESHOLD @@ -40,7 +41,9 @@ class InstantItemSwitch(context: Context, attrs: AttributeSet) : RelativeLayout( mTouchDownTime = System.currentTimeMillis() } MotionEvent.ACTION_UP -> { - if (System.currentTimeMillis() - mTouchDownTime < CLICK_MAX_DURATION) { + val diffX = mTouchDownX - event.x + val diffY = mTouchDownY - event.y + if (Math.abs(diffX) < CLICK_MAX_DISTANCE && Math.abs(diffY) < CLICK_MAX_DISTANCE && System.currentTimeMillis() - mTouchDownTime < CLICK_MAX_DURATION) { performClick() } } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/MediaSideScroll.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/MediaSideScroll.kt index 0c424b631..52ebde06e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/MediaSideScroll.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/MediaSideScroll.kt @@ -13,6 +13,7 @@ import android.widget.TextView import com.simplemobiletools.commons.extensions.onGlobalLayout import com.simplemobiletools.gallery.pro.R import com.simplemobiletools.gallery.pro.extensions.audioManager +import com.simplemobiletools.gallery.pro.helpers.CLICK_MAX_DISTANCE import com.simplemobiletools.gallery.pro.helpers.CLICK_MAX_DURATION import com.simplemobiletools.gallery.pro.helpers.DRAG_THRESHOLD @@ -106,7 +107,9 @@ class MediaSideScroll(context: Context, attrs: AttributeSet) : RelativeLayout(co mLastTouchY = event.y } MotionEvent.ACTION_UP -> { - if (System.currentTimeMillis() - mTouchDownTime < CLICK_MAX_DURATION) { + val diffX = mTouchDownX - event.x + val diffY = mTouchDownY - event.y + if (Math.abs(diffX) < CLICK_MAX_DISTANCE && Math.abs(diffY) < CLICK_MAX_DISTANCE && System.currentTimeMillis() - mTouchDownTime < CLICK_MAX_DURATION) { callback(event.rawX, event.rawY) } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/MyZoomableGifTextureView.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/MyZoomableGifTextureView.kt index 60e54ec1a..be6e23a35 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/MyZoomableGifTextureView.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/MyZoomableGifTextureView.kt @@ -89,14 +89,14 @@ class MyZoomableGifTextureView(context: Context, attrs: AttributeSet) : GifTextu val diffX = mTouchDownX - event.x val diffY = mTouchDownY - event.y mCurrZoomMode = ZOOM_MODE_NONE - if (System.currentTimeMillis() - mTouchDownTime < CLICK_MAX_DURATION) { + if (Math.abs(diffX) < CLICK_MAX_DISTANCE && Math.abs(diffY) < CLICK_MAX_DISTANCE && System.currentTimeMillis() - mTouchDownTime < CLICK_MAX_DURATION) { performClick() - } - - val downGestureDuration = System.currentTimeMillis() - mTouchDownTime - val areDiffsOK = Math.abs(diffY) > Math.abs(diffX) && diffY < -mCloseDownThreshold - if (mSaveScale == 1f && !mIgnoreCloseDown && areDiffsOK && context.config.allowDownGesture && downGestureDuration < MAX_CLOSE_DOWN_GESTURE_DURATION) { - mCloseDownCallback?.invoke() + } else { + val downGestureDuration = System.currentTimeMillis() - mTouchDownTime + val areDiffsOK = Math.abs(diffY) > Math.abs(diffX) && diffY < -mCloseDownThreshold + if (mSaveScale == 1f && !mIgnoreCloseDown && areDiffsOK && context.config.allowDownGesture && downGestureDuration < MAX_CLOSE_DOWN_GESTURE_DURATION) { + mCloseDownCallback?.invoke() + } } mIgnoreCloseDown = false }