mirror of
https://github.com/M66B/FairEmail.git
synced 2025-01-01 12:44:42 +00:00
Added option to sync subscribed folders
This commit is contained in:
parent
b05ef291e5
commit
b6964662d1
4 changed files with 28 additions and 3 deletions
|
@ -1529,6 +1529,7 @@ class Core {
|
|||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
boolean sync_folders = (prefs.getBoolean("sync_folders", true) || force);
|
||||
boolean sync_shared_folders = prefs.getBoolean("sync_shared_folders", false);
|
||||
boolean sync_subscribed = prefs.getBoolean("sync_subscribed", false);
|
||||
|
||||
// Get folder names
|
||||
Map<String, EntityFolder> local = new HashMap<>();
|
||||
|
@ -1709,7 +1710,7 @@ class Core {
|
|||
folder.account = account.id;
|
||||
folder.name = fullName;
|
||||
folder.type = (EntityFolder.SYSTEM.equals(type) ? type : EntityFolder.USER);
|
||||
folder.synchronize = false;
|
||||
folder.synchronize = (subscribed && sync_subscribed);
|
||||
folder.subscribed = subscribed;
|
||||
folder.poll = true;
|
||||
folder.sync_days = EntityFolder.DEFAULT_SYNC;
|
||||
|
|
|
@ -81,6 +81,7 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr
|
|||
private SwitchCompat swSyncFolders;
|
||||
private SwitchCompat swSyncSharedFolders;
|
||||
private SwitchCompat swSubscriptions;
|
||||
private SwitchCompat swSyncSubscribed;
|
||||
private SwitchCompat swCheckMx;
|
||||
private SwitchCompat swCheckReply;
|
||||
private SwitchCompat swTuneKeepAlive;
|
||||
|
@ -91,7 +92,7 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr
|
|||
private final static String[] RESET_OPTIONS = new String[]{
|
||||
"enabled", "poll_interval", "auto_optimize", "schedule", "schedule_start", "schedule_end",
|
||||
"sync_nodate", "sync_unseen", "sync_flagged", "delete_unseen", "sync_kept", "gmail_thread_id",
|
||||
"sync_folders", "sync_shared_folders", "subscriptions",
|
||||
"sync_folders", "sync_shared_folders", "subscriptions", "sync_subscribed",
|
||||
"check_mx", "check_reply", "tune_keep_alive"
|
||||
};
|
||||
|
||||
|
@ -135,6 +136,7 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr
|
|||
swSyncFolders = view.findViewById(R.id.swSyncFolders);
|
||||
swSyncSharedFolders = view.findViewById(R.id.swSyncSharedFolders);
|
||||
swSubscriptions = view.findViewById(R.id.swSubscriptions);
|
||||
swSyncSubscribed = view.findViewById(R.id.swSyncSubscribed);
|
||||
swCheckMx = view.findViewById(R.id.swCheckMx);
|
||||
swCheckReply = view.findViewById(R.id.swCheckReply);
|
||||
swTuneKeepAlive = view.findViewById(R.id.swTuneKeepAlive);
|
||||
|
@ -308,6 +310,14 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr
|
|||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("subscriptions", checked).apply();
|
||||
swSyncSubscribed.setEnabled(checked);
|
||||
}
|
||||
});
|
||||
|
||||
swSyncSubscribed.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("sync_subscribed", checked).apply();
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -420,6 +430,8 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr
|
|||
swSyncSharedFolders.setChecked(prefs.getBoolean("sync_shared_folders", false));
|
||||
swSyncSharedFolders.setEnabled(swSyncFolders.isChecked());
|
||||
swSubscriptions.setChecked(prefs.getBoolean("subscriptions", false));
|
||||
swSyncSubscribed.setChecked(prefs.getBoolean("sync_subscribed", false));
|
||||
swSyncSubscribed.setEnabled(swSubscriptions.isChecked());
|
||||
swCheckMx.setChecked(prefs.getBoolean("check_mx", false));
|
||||
swCheckReply.setChecked(prefs.getBoolean("check_reply", false));
|
||||
swTuneKeepAlive.setChecked(prefs.getBoolean("tune_keep_alive", true));
|
||||
|
|
|
@ -466,6 +466,17 @@
|
|||
app:layout_constraintTop_toBottomOf="@id/swSyncSharedFolders"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swSyncSubscribed"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="@string/title_advanced_sync_subscribed"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swSubscriptions"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swCheckMx"
|
||||
android:layout_width="0dp"
|
||||
|
@ -474,7 +485,7 @@
|
|||
android:text="@string/title_advanced_check_mx"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swSubscriptions"
|
||||
app:layout_constraintTop_toBottomOf="@id/swSyncSubscribed"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<eu.faircode.email.FixedTextView
|
||||
|
|
|
@ -297,6 +297,7 @@
|
|||
<string name="title_advanced_sync_folders">Synchronize folder list</string>
|
||||
<string name="title_advanced_sync_shared_folders">Synchronize shared folder lists</string>
|
||||
<string name="title_advanced_subscriptions">Manage folder subscriptions</string>
|
||||
<string name="title_advanced_sync_subscribed">Automatically synchronize subscribed folders</string>
|
||||
<string name="title_advanced_check_mx">Check sender email addresses on synchronizing messages</string>
|
||||
<string name="title_advanced_check_reply">Check reply email addresses on synchronizing messages</string>
|
||||
<string name="title_advanced_tune_keep_alive">Automatically tune the keep-alive interval</string>
|
||||
|
|
Loading…
Reference in a new issue