diff --git a/app/src/main/java/com/simplemobiletools/camera/Config.java b/app/src/main/java/com/simplemobiletools/camera/Config.java index 8abd6a8f..22fbfdf9 100644 --- a/app/src/main/java/com/simplemobiletools/camera/Config.java +++ b/app/src/main/java/com/simplemobiletools/camera/Config.java @@ -3,6 +3,7 @@ package com.simplemobiletools.camera; import android.content.Context; import android.content.SharedPreferences; import android.hardware.Camera; +import android.os.Environment; public class Config { private SharedPreferences mPrefs; @@ -31,12 +32,12 @@ public class Config { mPrefs.edit().putBoolean(Constants.IS_DARK_THEME, isDarkTheme).apply(); } - public boolean getUseDCIMFolder() { - return mPrefs.getBoolean(Constants.USE_DCIM, true); + public String getSavePhotosFolder() { + return mPrefs.getString(Constants.SAVE_PHOTOS, Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM).toString()); } - public void setUseDCIMFolder(boolean useDCIM) { - mPrefs.edit().putBoolean(Constants.USE_DCIM, useDCIM).apply(); + public void setSavePhotosFolder(String path) { + mPrefs.edit().putString(Constants.SAVE_PHOTOS, path).apply(); } public boolean getForceRatioEnabled() { diff --git a/app/src/main/java/com/simplemobiletools/camera/Constants.java b/app/src/main/java/com/simplemobiletools/camera/Constants.java index 1c3813e3..df868e53 100644 --- a/app/src/main/java/com/simplemobiletools/camera/Constants.java +++ b/app/src/main/java/com/simplemobiletools/camera/Constants.java @@ -9,7 +9,7 @@ public class Constants { public static final String PREFS_KEY = "Camera"; public static final String IS_FIRST_RUN = "is_first_run"; public static final String IS_DARK_THEME = "is_dark_theme"; - public static final String USE_DCIM = "use_dcim"; + public static final String SAVE_PHOTOS = "save_photos"; public static final String SOUND = "sound"; public static final String FORCE_RATIO = "force_ratio"; public static final String MAX_RESOLUTION = "max_resolution"; diff --git a/app/src/main/java/com/simplemobiletools/camera/Utils.java b/app/src/main/java/com/simplemobiletools/camera/Utils.java index 20db3f35..d15af525 100644 --- a/app/src/main/java/com/simplemobiletools/camera/Utils.java +++ b/app/src/main/java/com/simplemobiletools/camera/Utils.java @@ -7,7 +7,6 @@ import android.content.pm.PackageManager; import android.content.res.Resources; import android.graphics.Point; import android.hardware.Camera; -import android.os.Environment; import android.support.v4.content.ContextCompat; import android.view.Display; import android.widget.Toast; @@ -50,7 +49,7 @@ public class Utils { } public static String getOutputMediaFile(Context context, boolean isPhoto) { - final File mediaStorageDir = getFolderName(context, isPhoto); + final File mediaStorageDir = new File(Config.newInstance(context).getSavePhotosFolder()); if (!mediaStorageDir.exists()) { if (!mediaStorageDir.mkdirs()) { @@ -66,28 +65,6 @@ public class Utils { } } - private static File getFolderName(Context context, boolean isPhoto) { - if (Config.newInstance(context).getUseDCIMFolder()) { - return Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM); - } - - final Resources res = context.getResources(); - String typeDirectory = res.getString(R.string.photo_directory); - if (!isPhoto) { - typeDirectory = res.getString(R.string.video_directory); - } - - return new File(getMainDirectory(isPhoto), typeDirectory); - } - - private static File getMainDirectory(boolean isPhoto) { - String type = Environment.DIRECTORY_MOVIES; - if (isPhoto) { - type = Environment.DIRECTORY_PICTURES; - } - return Environment.getExternalStoragePublicDirectory(type); - } - public static String formatSeconds(int duration) { final StringBuilder sb = new StringBuilder(8); final int hours = duration / (60 * 60); diff --git a/app/src/main/kotlin/com/simplemobiletools/camera/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/camera/activities/SettingsActivity.kt index af4421ce..14cceec4 100644 --- a/app/src/main/kotlin/com/simplemobiletools/camera/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/camera/activities/SettingsActivity.kt @@ -48,10 +48,9 @@ class SettingsActivity : SimpleActivity() { } private fun setupUseDCIM() { - settings_use_dcim.isChecked = mConfig.useDCIMFolder - settings_use_dcim_holder.setOnClickListener { - settings_use_dcim.toggle() - mConfig.useDCIMFolder = settings_use_dcim.isChecked + settings_save_photos.text = mConfig.savePhotosFolder.substring(mConfig.savePhotosFolder.lastIndexOf("/") + 1) + settings_save_photos_holder.setOnClickListener { + } } diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index ff3d0f11..154eda0f 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -39,7 +39,7 @@ + android:text="@string/save_photos"/> - Beim Speichern des Videos ist ein Fehler aufgetreten Beim Starten der Aufnahme ist ein Fehler aufgetreten Beim Umschalten zum Videomodus ist ein Fehler aufgetreten - Simple Videos - Simple Photos Kamerawechsel fehlgeschlagen Ohne Zugriff auf Kamera und Speicher ist hier nicht viel zu tun Wir benötigen Zugriff auf das Mirkofon um Videos aufnehmen zu können @@ -18,7 +16,7 @@ Einstellungen Dunkles Design - Speichere Dateien im vorgegebenen DCIM Ordner + Save photos and videos to Erzwinge 16:9 Format Maximale Fotoauflösung Maximale Videoauflösung diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index a1f5d247..a99189aa 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -7,8 +7,6 @@ Errore nel salvataggio del file video Errore nella preparazione del registratore video Passaggio alla modalità video fallita - Simple Video - Simple Foto Cambio fotocamera fallito Non c\'è molto da fare senza l\'accesso alla fotocamera e all\'archiviazione È necessario l\'accesso al microfono per registrare i video @@ -18,7 +16,7 @@ Impostazioni Tema scuro - Store media in the default DCIM folder + Save photos and videos to Forza proporzione 16:9 Limite risoluzione foto Video resolution limit diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 0163d94e..e5e85de7 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -7,8 +7,6 @@ ビデオファイルの保存時にエラーが発生しました レコーダーのセットアップ時にエラーが発生しました ビデオモードへの切り替えに失敗しました - シンプル ビデオ - シンプル フォト カメラの切り替えに失敗しました お使いのカメラやストレージにアクセスしないと、ほとんど行うことはありません ビデオを記録するためにオーディオのアクセス許可が必要です @@ -18,7 +16,7 @@ 設定 ダークテーマ - Store media in the default DCIM folder + Save photos and videos to 強制的に 16:9 レシオにする 写真解像度の限度 Video resolution limit diff --git a/app/src/main/res/values-pt-rPT/strings.xml b/app/src/main/res/values-pt-rPT/strings.xml index 8734aac6..049748c1 100644 --- a/app/src/main/res/values-pt-rPT/strings.xml +++ b/app/src/main/res/values-pt-rPT/strings.xml @@ -7,8 +7,6 @@ Ocorreu um erro ao guardar o ficheiro de vídeo Ocorreu um erro ao configurar a gravação Falha ao mudar para o modo vídeo - Vídeos simples - Fotografias simples Falha ao mudar de câmara É necessária a permissão para aceder à câmara e ao armazenamento A permissão de áudio é necessária para a gravação de vídeos @@ -18,7 +16,7 @@ Definições Tema escuro - Armazenar multimédia na pasta pré-definida \"DCIM\" + Save photos and videos to Usar rácio 16:9 Resolução máxima das fotografias Resolução máxima dos vídeos diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index e347bbe5..eea9bf91 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -7,8 +7,6 @@ Произошла ошибка записи видео файла Произошла ошибка настройки рекордера Переключение в режим видео не удалось - Просто Видео - Просто Фото Переключение камеры не удалось Не так много можно сделать без доступа к камере и хранилищу Нам нужно аудио разрешение для записи видео @@ -18,7 +16,7 @@ Настройки темная тема - Store media in the default DCIM folder + Save photos and videos to Принудительное соотношение сторон 16:9 Лимит разрешения фото Video resolution limit diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index c4a79293..adba660b 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -7,8 +7,6 @@ Ett fel uppstod när videofilen skulle sparas Ett fel uppstod när inspelningen skulle starta Byte till videoläge misslyckades - Simple videos - Simple bilder Byte av kamera misslyckades Inte mycket att göra utan tillgång till din kamera och lagring För att spela in video krävs ljudrättigheter @@ -18,7 +16,7 @@ Inställningar Mörkt tema - Store media in the default DCIM folder + Save photos and videos to Tvinga 16:9-förhållande Bildupplösningsgräns Video resolution limit diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 089582b4..5c28766f 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -7,8 +7,6 @@ An error occurred saving the video file An error occurred setting up the recorder Switching to video mode failed - Simple Videos - Simple Photos Switching camera failed Not much to do without accessing your camera and storage We need the audio permission for recording videos @@ -18,7 +16,7 @@ Settings Dark theme - Store media in the default DCIM folder + Save photos and videos to Use 16:9 ratio Max photo resolution limit Max video resolution limit