Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate folder setting for images and albums #1001

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,10 @@ public String getKey() {
// Saving
public static final SavedFilesBaseDirSetting saveLocation;
public static final LocalThreadsBaseDirSetting localThreadLocation;
public static final BooleanSetting saveBoardFolder;
public static final BooleanSetting saveThreadFolder;
public static final BooleanSetting saveImageBoardFolder;
public static final BooleanSetting saveImageThreadFolder;
public static final BooleanSetting saveAlbumBoardFolder;
public static final BooleanSetting saveAlbumThreadFolder;
public static final BooleanSetting saveServerFilename;
public static final BooleanSetting incrementalThreadDownloadingEnabled;

Expand Down Expand Up @@ -442,8 +444,10 @@ public String getKey() {
// Saving
saveLocation = new SavedFilesBaseDirSetting(p);
localThreadLocation = new LocalThreadsBaseDirSetting(p);
saveBoardFolder = new BooleanSetting(p, "preference_save_subboard", false);
saveThreadFolder = new BooleanSetting(p, "preference_save_subthread", false);
saveImageBoardFolder = new BooleanSetting(p, "preference_save_image_subboard", false);
saveImageThreadFolder = new BooleanSetting(p, "preference_save_image_subthread", false);
saveAlbumBoardFolder = new BooleanSetting(p, "preference_save_album_subboard", false);
saveAlbumThreadFolder = new BooleanSetting(p, "preference_save_album_subthread", false);
saveServerFilename = new BooleanSetting(p, "preference_image_save_original", false);
incrementalThreadDownloadingEnabled = new BooleanSetting(p, "incremental_thread_downloading", true);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public void onClick(View v) {
showToast(context, R.string.album_download_none_checked);
} else {
String siteNameSafe = StringUtils.dirNameRemoveBadCharacters(loadable.site.name());
String subFolder = ChanSettings.saveBoardFolder.get() ? (ChanSettings.saveThreadFolder.get()
String subFolder = ChanSettings.saveAlbumBoardFolder.get() ? (ChanSettings.saveAlbumThreadFolder.get()
? appendAdditionalSubDirectories()
: siteNameSafe + File.separator + loadable.boardCode) : null;
String message = getString(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,10 +308,10 @@ private void saveShare(boolean share, PostImage postImage) {
shareLink(postImage.imageUrl.toString());
} else {
ImageSaveTask task = new ImageSaveTask(loadable, postImage, share);
if (ChanSettings.saveBoardFolder.get()) {
if (ChanSettings.saveImageBoardFolder.get()) {
String subFolderName;

if (ChanSettings.saveThreadFolder.get()) {
if (ChanSettings.saveImageThreadFolder.get()) {
subFolderName = appendAdditionalSubDirectories(postImage);
} else {
String siteNameSafe = StringUtils.dirNameRemoveBadCharacters(presenter.getLoadable().site.name());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,10 @@ public class MediaSettingsController
implements SaveLocationSetupDelegate.MediaControllerCallbacks,
ThreadsLocationSetupDelegate.MediaControllerCallbacks {
// Special setting views
private BooleanSettingView boardFolderSetting;
private BooleanSettingView threadFolderSetting;
private BooleanSettingView imageBoardFolderSetting;
private BooleanSettingView imageThreadFolderSetting;
private BooleanSettingView albumBoardFolderSetting;
private BooleanSettingView albumThreadFolderSetting;
private BooleanSettingView videoDefaultMutedSetting;
private BooleanSettingView headsetDefaultMutedSetting;
private LinkSettingView saveLocation;
Expand Down Expand Up @@ -119,7 +121,8 @@ public void onCreate() {

onPreferenceChange(imageAutoLoadView);

threadFolderSetting.setEnabled(ChanSettings.saveBoardFolder.get());
imageThreadFolderSetting.setEnabled(ChanSettings.saveImageBoardFolder.get());
albumThreadFolderSetting.setEnabled(ChanSettings.saveAlbumBoardFolder.get());
headsetDefaultMutedSetting.setEnabled(ChanSettings.videoDefaultMuted.get());
}

Expand All @@ -137,8 +140,10 @@ public void onPreferenceChange(SettingView item) {

if (item == imageAutoLoadView) {
updateVideoLoadModes();
} else if (item == boardFolderSetting) {
updateThreadFolderSetting();
} else if (item == imageBoardFolderSetting) {
updateImageThreadFolderSetting();
} else if (item == albumBoardFolderSetting) {
updateAlbumThreadFolderSetting();
} else if (item == videoDefaultMutedSetting) {
updateHeadsetDefaultMutedSetting();
} else if (item == incrementalThreadDownloadingSetting
Expand Down Expand Up @@ -176,16 +181,28 @@ private void populatePreferences() {
setupLocalThreadLocationSetting(media);

//Save modifications
boardFolderSetting = (BooleanSettingView) media.add(new BooleanSettingView(this,
ChanSettings.saveBoardFolder,
R.string.setting_save_board_folder,
R.string.setting_save_board_folder_description
imageBoardFolderSetting = (BooleanSettingView) media.add(new BooleanSettingView(this,
ChanSettings.saveImageBoardFolder,
R.string.setting_save_image_board_folder,
R.string.setting_save_image_board_folder_description
));

threadFolderSetting = (BooleanSettingView) media.add(new BooleanSettingView(this,
ChanSettings.saveThreadFolder,
R.string.setting_save_thread_folder,
R.string.setting_save_thread_folder_description
imageThreadFolderSetting = (BooleanSettingView) media.add(new BooleanSettingView(this,
ChanSettings.saveImageThreadFolder,
R.string.setting_save_image_thread_folder,
R.string.setting_save_image_thread_folder_description
));

albumBoardFolderSetting = (BooleanSettingView) media.add(new BooleanSettingView(this,
ChanSettings.saveAlbumBoardFolder,
R.string.setting_save_album_board_folder,
R.string.setting_save_album_board_folder_description
));

albumThreadFolderSetting = (BooleanSettingView) media.add(new BooleanSettingView(this,
ChanSettings.saveAlbumThreadFolder,
R.string.setting_save_album_thread_folder,
R.string.setting_save_album_thread_folder_description
));

media.add(new BooleanSettingView(this,
Expand Down Expand Up @@ -424,15 +441,27 @@ private void updateVideoLoadModes() {
}
}

private void updateThreadFolderSetting() {
if (ChanSettings.saveBoardFolder.get()) {
threadFolderSetting.setEnabled(true);
private void updateImageThreadFolderSetting() {
if (ChanSettings.saveImageBoardFolder.get()) {
imageThreadFolderSetting.setEnabled(true);
} else {
if (ChanSettings.saveImageThreadFolder.get()) {
imageThreadFolderSetting.onClick(imageThreadFolderSetting.view);
}
imageThreadFolderSetting.setEnabled(false);
ChanSettings.saveImageThreadFolder.set(false);
}
}

private void updateAlbumThreadFolderSetting() {
if (ChanSettings.saveAlbumBoardFolder.get()) {
albumThreadFolderSetting.setEnabled(true);
} else {
if (ChanSettings.saveThreadFolder.get()) {
threadFolderSetting.onClick(threadFolderSetting.view);
if (ChanSettings.saveAlbumThreadFolder.get()) {
albumThreadFolderSetting.onClick(albumThreadFolderSetting.view);
}
threadFolderSetting.setEnabled(false);
ChanSettings.saveThreadFolder.set(false);
albumThreadFolderSetting.setEnabled(false);
ChanSettings.saveAlbumThreadFolder.set(false);
}
}

Expand Down
18 changes: 11 additions & 7 deletions Kuroba/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -505,18 +505,22 @@ Enabled filters have priority from top to bottom in your list. Filter precedence

<!-- Behavior proxy group -->
<string name="setting_proxy_port">Proxy server port</string>
<string name="settings_screen_media">Media</string>
<string name="settings_group_saving">Media saving</string>
<string name="setting_save_board_folder">Save images in board folders</string>



<!-- Media -->
<string name="setting_save_board_folder_description">Create a folder for each board when saving</string>
<string name="settings_screen_media">Media</string>

<!-- Media general group -->
<string name="setting_save_thread_folder">Save images in thread folders</string>

<string name="setting_save_thread_folder_description">Create a folder for each thread when saving</string>
<string name="settings_group_saving">Media saving</string>
<string name="setting_save_image_board_folder">Save images in board folders</string>
<string name="setting_save_image_board_folder_description">Create a folder for each board when saving individual images</string>
<string name="setting_save_image_thread_folder">Save images in thread folders</string>
<string name="setting_save_image_thread_folder_description">Create a folder for each thread when saving individual images</string>
<string name="setting_save_album_board_folder">Save albums in board folders</string>
<string name="setting_save_album_board_folder_description">Create a folder for each board when saving image albums</string>
<string name="setting_save_album_thread_folder">Save albums in thread folders</string>
<string name="setting_save_album_thread_folder_description">Create a folder for each thread when saving image albums</string>
<string name="setting_save_server_filename">Save server filename</string>
<string name="setting_save_server_filename_description">Save the image with the filename the site assigned. If disabled, save the image with the filename the uploader assigned.</string>
<string name="setting_video_default_muted">Start videos muted</string>
Expand Down