From 9f304f372a8b18e69c4a52c6ddbe86cbda91067f Mon Sep 17 00:00:00 2001 From: "B. Petersen" Date: Mon, 19 Dec 2016 13:19:16 +0100 Subject: [PATCH] Remove save-to-gallery option. We save all stuff internally; this avoids probles if a user deletes an image. Additionally, photos taken are always saved in the gallery; plus, the user can explicitly save data to the gallery (this avoids saving all files twice). --- .../java/com/b44t/messenger/ClearCacheService.java | 2 ++ .../main/java/com/b44t/messenger/ImageLoader.java | 4 ++-- .../java/com/b44t/messenger/MediaController.java | 12 ++++++++---- .../src/main/java/com/b44t/ui/SettingsActivity.java | 10 +++++----- MessengerProj/src/main/res/values-de/strings.xml | 2 +- 5 files changed, 18 insertions(+), 12 deletions(-) diff --git a/MessengerProj/src/main/java/com/b44t/messenger/ClearCacheService.java b/MessengerProj/src/main/java/com/b44t/messenger/ClearCacheService.java index 08e680453..4c9b9342e 100644 --- a/MessengerProj/src/main/java/com/b44t/messenger/ClearCacheService.java +++ b/MessengerProj/src/main/java/com/b44t/messenger/ClearCacheService.java @@ -29,6 +29,7 @@ public class ClearCacheService extends IntentService { protected void onHandleIntent(Intent intent) { ApplicationLoader.postInitApplication(); + /* SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE); final int keepMedia = preferences.getInt("keep_media", 2); if (keepMedia == 2) { @@ -78,5 +79,6 @@ public class ClearCacheService extends IntentService { } } }); + */ } } diff --git a/MessengerProj/src/main/java/com/b44t/messenger/ImageLoader.java b/MessengerProj/src/main/java/com/b44t/messenger/ImageLoader.java index d73df2c6d..1ab17a392 100644 --- a/MessengerProj/src/main/java/com/b44t/messenger/ImageLoader.java +++ b/MessengerProj/src/main/java/com/b44t/messenger/ImageLoader.java @@ -1159,11 +1159,11 @@ public class ImageLoader { AndroidUtilities.runOnUIThread(new Runnable() { @Override public void run() { - if (MediaController.getInstance().canSaveToGallery() && messengerPath != null && finalFile != null && (location.endsWith(".mp4") || location.endsWith(".jpg"))) { + /*if (MediaController.getInstance().canSaveToGallery() && messengerPath != null && finalFile != null && (location.endsWith(".mp4") || location.endsWith(".jpg"))) { if (finalFile.toString().startsWith(messengerPath.toString())) { AndroidUtilities.addMediaToGallery(finalFile.toString()); } - } + }*/ NotificationCenter.getInstance().postNotificationName(NotificationCenter.FileDidLoaded, location); ImageLoader.this.fileDidLoaded(location, finalFile, type); } diff --git a/MessengerProj/src/main/java/com/b44t/messenger/MediaController.java b/MessengerProj/src/main/java/com/b44t/messenger/MediaController.java index bcf1d5beb..e493f7953 100644 --- a/MessengerProj/src/main/java/com/b44t/messenger/MediaController.java +++ b/MessengerProj/src/main/java/com/b44t/messenger/MediaController.java @@ -273,8 +273,8 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener, private ArrayList videoDownloadQueue = new ArrayList<>(); private HashMap downloadQueueKeys = new HashMap<>(); - private boolean saveToGallery = true; - private boolean autoplayGifs = true; + private final boolean saveToGallery = false; + private final boolean autoplayGifs = true; private boolean raiseToSpeak = true; private boolean directShare = true; private boolean shuffleMusic; @@ -598,8 +598,8 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener, mobileDataDownloadMask = preferences.getInt("mobileDataDownloadMask", AUTODOWNLOAD_MASK_PHOTO | AUTODOWNLOAD_MASK_AUDIO | AUTODOWNLOAD_MASK_MUSIC | AUTODOWNLOAD_MASK_GIF); wifiDownloadMask = preferences.getInt("wifiDownloadMask", AUTODOWNLOAD_MASK_PHOTO | AUTODOWNLOAD_MASK_AUDIO | AUTODOWNLOAD_MASK_MUSIC | AUTODOWNLOAD_MASK_GIF); roamingDownloadMask = preferences.getInt("roamingDownloadMask", 0); - saveToGallery = preferences.getBoolean("save_gallery", false); - autoplayGifs = preferences.getBoolean("autoplay_gif", true); + //saveToGallery = preferences.getBoolean("save_gallery", false); + //autoplayGifs = preferences.getBoolean("autoplay_gif", true); raiseToSpeak = preferences.getBoolean("raise_to_speak", true); directShare = preferences.getBoolean("direct_share", true); shuffleMusic = preferences.getBoolean("shuffleMusic", false); @@ -2961,6 +2961,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener, return null; } + /* public void toggleSaveToGallery() { saveToGallery = !saveToGallery; SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE); @@ -2977,6 +2978,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener, editor.putBoolean("autoplay_gif", autoplayGifs); editor.commit(); } + */ public void toogleRaiseToSpeak() { raiseToSpeak = !raiseToSpeak; @@ -3022,9 +3024,11 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener, } } + /* public boolean canSaveToGallery() { return saveToGallery; } + */ public boolean canAutoplayGifs() { return autoplayGifs; diff --git a/MessengerProj/src/main/java/com/b44t/ui/SettingsActivity.java b/MessengerProj/src/main/java/com/b44t/ui/SettingsActivity.java index d3f0d93ed..bf80afeb5 100644 --- a/MessengerProj/src/main/java/com/b44t/ui/SettingsActivity.java +++ b/MessengerProj/src/main/java/com/b44t/ui/SettingsActivity.java @@ -185,7 +185,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter mobileDownloadRow = -1;//rowCount++; wifiDownloadRow = -1;//rowCount++; roamingDownloadRow = -1;//rowCount++; - saveToGalleryRow = -1;//rowCount++; -- for now, we do not use this option, this results in confusing folders ("AppName" and "AppName Images" etc.); instead, for now, the user can use the option to manually save a media + saveToGalleryRow = -1;//rowCount++; -- for now, we do not use this option, this results in confusing folders ("AppName" and "AppName Images" etc.); instead, for now, the user can use the option to manually save a media. Moreover, we also avoid the problem to double-save each image _or_ to handle the case a user deletes an image in the gallery. messagesSectionRow = rowCount++; messagesSectionRow2 = rowCount++; @@ -419,7 +419,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter if (view instanceof TextCheckCell) { ((TextCheckCell) view).setChecked(MediaController.getInstance().canRaiseToSpeak()); } - } else if (i == autoplayGifsRow) { + /*} else if (i == autoplayGifsRow) { MediaController.getInstance().toggleAutoplayGifs(); if (view instanceof TextCheckCell) { ((TextCheckCell) view).setChecked(MediaController.getInstance().canAutoplayGifs()); @@ -428,7 +428,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter MediaController.getInstance().toggleSaveToGallery(); if (view instanceof TextCheckCell) { ((TextCheckCell) view).setChecked(MediaController.getInstance().canSaveToGallery()); - } + }*/ } else if(i == directShareRow) { MediaController.getInstance().toggleDirectShare(); if (view instanceof TextCheckCell) { @@ -1244,10 +1244,10 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter textCell.setTextAndCheck(LocaleController.getString("EnableAnimations", R.string.EnableAnimations), preferences.getBoolean("view_animations", true), false); } else if (i == sendByEnterRow) { textCell.setTextAndCheck(LocaleController.getString("SendByEnter", R.string.SendByEnter), preferences.getBoolean("send_by_enter", false), true); - } else if (i == saveToGalleryRow) { + /*} else if (i == saveToGalleryRow) { textCell.setTextAndCheck(LocaleController.getString("SaveToGallerySettings", R.string.SaveToGallerySettings), MediaController.getInstance().canSaveToGallery(), true); } else if (i == autoplayGifsRow) { - textCell.setTextAndCheck(LocaleController.getString("AutoplayGifs", R.string.AutoplayGifs), MediaController.getInstance().canAutoplayGifs(), true); + textCell.setTextAndCheck(LocaleController.getString("AutoplayGifs", R.string.AutoplayGifs), MediaController.getInstance().canAutoplayGifs(), true);*/ } else if (i == raiseToSpeakRow) { textCell.setTextAndCheck(LocaleController.getString("RaiseToSpeak", R.string.RaiseToSpeak), MediaController.getInstance().canRaiseToSpeak(), true); } else if (i == directShareRow) { diff --git a/MessengerProj/src/main/res/values-de/strings.xml b/MessengerProj/src/main/res/values-de/strings.xml index 64fe6eee0..fc60c7cec 100644 --- a/MessengerProj/src/main/res/values-de/strings.xml +++ b/MessengerProj/src/main/res/values-de/strings.xml @@ -695,6 +695,6 @@ Konto konfigurieren... Einladungen versenden Ich verwende nun auch den Delta Chat Messenger - %1$s - und bin dort unter %2$s erreichbar. - Erweiterte Einstellungen + Fortgeschrittene Einstellungen