diff --git a/app/build.gradle b/app/build.gradle index df3495aa0..97c2147ee 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,7 +37,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.33.3' + compile 'com.simplemobiletools:commons:2.33.6' compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.6.0' compile 'com.theartofdev.edmodo:android-image-cropper:2.4.0' compile 'com.bignerdranch.android:recyclerview-multiselect:0.2' diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt index 990ae5c9c..cdb538151 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -22,6 +22,7 @@ import com.simplemobiletools.commons.dialogs.ConfirmationDialog import com.simplemobiletools.commons.dialogs.RadioGroupDialog import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.helpers.PERMISSION_WRITE_STORAGE +import com.simplemobiletools.commons.helpers.REQUEST_EDIT_IMAGE import com.simplemobiletools.commons.models.RadioItem import com.simplemobiletools.commons.views.MyScalableRecyclerView import com.simplemobiletools.gallery.R diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt index 967f1ce21..c405adf05 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -28,6 +28,8 @@ import com.simplemobiletools.commons.dialogs.RenameItemDialog import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.helpers.IS_FROM_GALLERY import com.simplemobiletools.commons.helpers.PERMISSION_WRITE_STORAGE +import com.simplemobiletools.commons.helpers.REQUEST_EDIT_IMAGE +import com.simplemobiletools.commons.helpers.REQUEST_SET_AS import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.activities.MediaActivity.Companion.mMedia import com.simplemobiletools.gallery.adapters.MyPagerAdapter diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt index 12f3ef851..5bf08e18d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt @@ -3,7 +3,6 @@ package com.simplemobiletools.gallery.extensions import android.app.Activity import android.content.Intent import android.net.Uri -import android.os.TransactionTooLargeException import android.provider.MediaStore import android.support.v7.app.AppCompatActivity import android.view.View @@ -21,8 +20,6 @@ import com.simplemobiletools.gallery.BuildConfig import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.activities.SimpleActivity import com.simplemobiletools.gallery.helpers.NOMEDIA -import com.simplemobiletools.gallery.helpers.REQUEST_EDIT_IMAGE -import com.simplemobiletools.gallery.helpers.REQUEST_SET_AS import com.simplemobiletools.gallery.models.Directory import com.simplemobiletools.gallery.models.Medium import com.simplemobiletools.gallery.views.MySquareImageView @@ -31,29 +28,11 @@ import java.io.File import java.util.* fun Activity.shareUri(uri: Uri) { - val shareTitle = resources.getString(R.string.share_via) - Intent().apply { - action = Intent.ACTION_SEND - putExtra(Intent.EXTRA_STREAM, ensurePublicUri(uri, BuildConfig.APPLICATION_ID)) - type = getMimeTypeFromUri(uri) - addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) - startActivity(Intent.createChooser(this, shareTitle)) - } + shareUri(uri, BuildConfig.APPLICATION_ID) } fun Activity.shareUris(uris: ArrayList) { - val shareTitle = resources.getString(R.string.share_via) - Intent().apply { - action = Intent.ACTION_SEND_MULTIPLE - type = uris.getMimeType() - addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) - putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris) - try { - startActivity(Intent.createChooser(this, shareTitle)) - } catch (e: TransactionTooLargeException) { - toast(R.string.maximum_share_reached) - } - } + shareUris(uris, BuildConfig.APPLICATION_ID) } fun Activity.shareMedium(medium: Medium) { @@ -67,19 +46,7 @@ fun Activity.shareMedia(media: List) { } fun Activity.setAs(uri: Uri) { - val newUri = ensurePublicUri(uri, BuildConfig.APPLICATION_ID) - Intent().apply { - action = Intent.ACTION_ATTACH_DATA - setDataAndType(newUri, getMimeTypeFromUri(newUri)) - addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) - val chooser = Intent.createChooser(this, getString(R.string.set_as)) - - if (resolveActivity(packageManager) != null) { - startActivityForResult(chooser, REQUEST_SET_AS) - } else { - toast(R.string.no_capable_app_found) - } - } + setAs(uri, BuildConfig.APPLICATION_ID) } fun Activity.openFile(uri: Uri, forceChooser: Boolean) { @@ -87,22 +54,7 @@ fun Activity.openFile(uri: Uri, forceChooser: Boolean) { } fun Activity.openEditor(uri: Uri) { - val newUri = ensurePublicUri(uri, BuildConfig.APPLICATION_ID) - Intent().apply { - action = Intent.ACTION_EDIT - setDataAndType(newUri, getMimeTypeFromUri(newUri)) - addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) - - if (isNougatPlus()) { - putExtra(MediaStore.EXTRA_OUTPUT, uri) - } - - if (resolveActivity(packageManager) != null) { - startActivityForResult(this, REQUEST_EDIT_IMAGE) - } else { - toast(R.string.no_editor_found) - } - } + openEditor(uri, BuildConfig.APPLICATION_ID) } fun Activity.launchCamera() { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt index 4e3d212c5..23b5a2673 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt @@ -68,9 +68,6 @@ val DIRECTORIES = "directories2" val IS_VIEW_INTENT = "is_view_intent" val PICKED_PATHS = "picked_paths" -val REQUEST_EDIT_IMAGE = 1 -val REQUEST_SET_AS = 2 - // rotations val ROTATE_BY_SYSTEM_SETTING = 0 val ROTATE_BY_DEVICE_ROTATION = 1 diff --git a/app/src/main/res/values-ca/strings.xml b/app/src/main/res/values-ca/strings.xml index 99c1c1e81..d5cb6030c 100644 --- a/app/src/main/res/values-ca/strings.xml +++ b/app/src/main/res/values-ca/strings.xml @@ -20,7 +20,6 @@ Change cover image Select photo Use default - Set as Volume Brightness Do not ask again in this session diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index 58607210b..4d68d3bbd 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -20,7 +20,6 @@ Change cover image Select photo Use default - Nastavit jako Volume Brightness Do not ask again in this session diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index c61f4ddcf..319aafacb 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -20,7 +20,6 @@ Coverbild ändern Auswählen Standard - Festlegen als Lautstärke Helligkeit Nicht erneut fragen (in dieser Session) diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index da0f6fcc5..735ddbe69 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -20,7 +20,6 @@ Cambiar imagen de portada Seleccionar imagen Uso por defecto - Establecer como Volume Brightness Do not ask again in this session diff --git a/app/src/main/res/values-fi/strings.xml b/app/src/main/res/values-fi/strings.xml index 6b52c8944..22afe3cb2 100644 --- a/app/src/main/res/values-fi/strings.xml +++ b/app/src/main/res/values-fi/strings.xml @@ -20,7 +20,6 @@ Vaihda kansikuva Valitse kuva Käytä oletuksia - Aseta Äänenvoimakkuus Kirkkaus Do not ask again in this session diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 04ef9738b..2535b0601 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -20,7 +20,6 @@ Changer l\'image de couverture Sélectionner une photo Utiliser par défaut - Définir comme Volume Luminosité Ne pas redemander pour cette session diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index 64b823830..eab18e858 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -20,7 +20,6 @@ Change cover image Select photo Use default - Set as Volume Brightness Do not ask again in this session diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 5e242277b..440d4639c 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -20,7 +20,6 @@ Cambia immagine copertina Seleziona foto Usa predefinita - Imposta come Volume Luminosità Non chiedere nuovamente in questa sessione diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index b2ad7e4b3..3183601e4 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -20,7 +20,6 @@ カバー画像を変更 写真を選択 デフォルトに戻す - 他で使う 音量 明るさ Do not ask again in this session diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index f8d0b97e1..8397ea526 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -20,7 +20,6 @@ Afbeelding voor omslag veranderen Foto selecteren Standaard gebruiken - Instellen als Volume Helderheid Onthouden voor deze sessie diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index 5540e8018..1b1b88c63 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -20,7 +20,6 @@ Zmień okładkę Wybierz obraz Użyj domyślnej - Ustaw jako Głośność Jasność Nie pytaj więcej w tej sesji diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index f3c706810..d6592ce63 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -20,7 +20,6 @@ Trocar imagem de capa Selecionar foto Usar padrão - Definir como Volume Brilho Não perguntar novamente por enquanto diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index 0cb7291f2..9df65ece4 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -20,7 +20,6 @@ Alterar imagem de capa Selecionar foto Predefinição - Definir como Volume Brilho Não perguntar de novo para esta sessão diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index b2e684e73..5dd2a1e65 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -20,7 +20,6 @@ Изменить обложку Выбрать изображение Использовать по умолчанию - Установить как… Громкость Яркость Do not ask again in this session diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index 6239471e7..044be119d 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -20,7 +20,6 @@ Zmeniť obal albumu Zvoliť foto Použiť predvolený - Nastaviť ako Hlasitosť Jas Nepýtať sa už v tomto spustení diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index 63e5194d9..3fde655e0 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -20,7 +20,6 @@ Byt omslagsbild Välj foto Använd standard - Ange som Volym Ljusstyrka Do not ask again in this session diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index 5179f74ef..fada51349 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -20,7 +20,6 @@ Change cover image Select photo Use default - Set as Volume Brightness Do not ask again in this session diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 497b9247d..d69df212a 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -20,7 +20,6 @@ 更改封面图片 选择图片 使用默认 - 设置为 音量 亮度 不再提醒 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 3be9815c9..0a4bb90d3 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -20,7 +20,6 @@ 更換封面圖片 選擇相片 使用預設 - 設為 音量 亮度 Do not ask again in this session diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 99c1c1e81..d5cb6030c 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -20,7 +20,6 @@ Change cover image Select photo Use default - Set as Volume Brightness Do not ask again in this session