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).

This commit is contained in:
B. Petersen
2016-12-19 13:19:16 +01:00
parent 341580191f
commit 9f304f372a
5 changed files with 18 additions and 12 deletions
@@ -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 {
}
}
});
*/
}
}
@@ -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);
}
@@ -273,8 +273,8 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
private ArrayList<DownloadObject> videoDownloadQueue = new ArrayList<>();
private HashMap<String, DownloadObject> 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;
@@ -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) {
@@ -695,6 +695,6 @@
<string name="ConfiguringAccount">Konto konfigurieren...</string>
<string name="InviteMenuEntry">Einladungen versenden</string>
<string name="InviteText">Ich verwende nun auch den Delta Chat Messenger - %1$s - und bin dort unter %2$s erreichbar.</string>
<string name="AdvancedSettings">Erweiterte Einstellungen</string>
<string name="AdvancedSettings">Fortgeschrittene Einstellungen</string>
<string name="CannotConnect"></string>
</resources>