mirror of
https://github.com/deltachat/deltachat-android.git
synced 2025-10-03 17:59:39 +02:00
Add OnlyFetchMvbox option (#2206)
* [WIP] Add OnlyFetchMvbox option * Update res/values/strings.xml * Adapt to the core changes * Update res/values/strings.xml Co-authored-by: bjoern <r10s@b44t.com> * Remove unnecessary startIo() addition * Update res/values/strings.xml Co-authored-by: bjoern <r10s@b44t.com> Co-authored-by: bjoern <r10s@b44t.com>
This commit is contained in:
parent
4607af4459
commit
0bc9f4735c
4 changed files with 30 additions and 7 deletions
|
@ -607,6 +607,8 @@
|
||||||
<string name="pref_send_copy_to_self">Send Copy to Self</string>
|
<string name="pref_send_copy_to_self">Send Copy to Self</string>
|
||||||
<string name="pref_auto_folder_moves">Automatic Moves to DeltaChat Folder</string>
|
<string name="pref_auto_folder_moves">Automatic Moves to DeltaChat Folder</string>
|
||||||
<string name="pref_auto_folder_moves_explain">Chat conversations are moved to avoid cluttering the Inbox</string>
|
<string name="pref_auto_folder_moves_explain">Chat conversations are moved to avoid cluttering the Inbox</string>
|
||||||
|
<string name="pref_only_fetch_mvbox_title">Only Fetch from DeltaChat Folder</string>
|
||||||
|
<string name="pref_only_fetch_mvbox_explain">Ignore other folders. Requires your server to move chat messages to the DeltaChat folder.</string>
|
||||||
<string name="pref_show_emails">Show Classic E-Mails</string>
|
<string name="pref_show_emails">Show Classic E-Mails</string>
|
||||||
<string name="pref_show_emails_no">No, chats only</string>
|
<string name="pref_show_emails_no">No, chats only</string>
|
||||||
<string name="pref_show_emails_accepted_contacts">For accepted contacts</string>
|
<string name="pref_show_emails_accepted_contacts">For accepted contacts</string>
|
||||||
|
|
|
@ -36,6 +36,12 @@
|
||||||
android:title="@string/pref_auto_folder_moves"
|
android:title="@string/pref_auto_folder_moves"
|
||||||
android:summary="@string/pref_auto_folder_moves_explain"/>
|
android:summary="@string/pref_auto_folder_moves_explain"/>
|
||||||
|
|
||||||
|
<org.thoughtcrime.securesms.components.SwitchPreferenceCompat
|
||||||
|
android:defaultValue="false"
|
||||||
|
android:key="pref_only_fetch_mvbox"
|
||||||
|
android:title="@string/pref_only_fetch_mvbox_title"
|
||||||
|
android:summary="@string/pref_only_fetch_mvbox_explain" />
|
||||||
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -58,6 +58,7 @@ public class DcHelper {
|
||||||
public static final String CONFIG_SENTBOX_WATCH = "sentbox_watch";
|
public static final String CONFIG_SENTBOX_WATCH = "sentbox_watch";
|
||||||
public static final String CONFIG_MVBOX_WATCH = "mvbox_watch";
|
public static final String CONFIG_MVBOX_WATCH = "mvbox_watch";
|
||||||
public static final String CONFIG_MVBOX_MOVE = "mvbox_move";
|
public static final String CONFIG_MVBOX_MOVE = "mvbox_move";
|
||||||
|
public static final String CONFIG_ONLY_FETCH_MVBOX = "only_fetch_mvbox";
|
||||||
public static final String CONFIG_BCC_SELF = "bcc_self";
|
public static final String CONFIG_BCC_SELF = "bcc_self";
|
||||||
public static final String CONFIG_SHOW_EMAILS = "show_emails";
|
public static final String CONFIG_SHOW_EMAILS = "show_emails";
|
||||||
public static final String CONFIG_MEDIA_QUALITY = "media_quality";
|
public static final String CONFIG_MEDIA_QUALITY = "media_quality";
|
||||||
|
|
|
@ -1,5 +1,13 @@
|
||||||
package org.thoughtcrime.securesms.preferences;
|
package org.thoughtcrime.securesms.preferences;
|
||||||
|
|
||||||
|
import static android.app.Activity.RESULT_OK;
|
||||||
|
import static android.text.InputType.TYPE_TEXT_VARIATION_URI;
|
||||||
|
import static org.thoughtcrime.securesms.connect.DcHelper.CONFIG_BCC_SELF;
|
||||||
|
import static org.thoughtcrime.securesms.connect.DcHelper.CONFIG_E2EE_ENABLED;
|
||||||
|
import static org.thoughtcrime.securesms.connect.DcHelper.CONFIG_MVBOX_MOVE;
|
||||||
|
import static org.thoughtcrime.securesms.connect.DcHelper.CONFIG_ONLY_FETCH_MVBOX;
|
||||||
|
import static org.thoughtcrime.securesms.connect.DcHelper.CONFIG_SENTBOX_WATCH;
|
||||||
|
|
||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
|
@ -32,13 +40,6 @@ import org.thoughtcrime.securesms.util.ScreenLockUtil;
|
||||||
import org.thoughtcrime.securesms.util.Util;
|
import org.thoughtcrime.securesms.util.Util;
|
||||||
import org.thoughtcrime.securesms.util.views.ProgressDialog;
|
import org.thoughtcrime.securesms.util.views.ProgressDialog;
|
||||||
|
|
||||||
import static android.app.Activity.RESULT_OK;
|
|
||||||
import static android.text.InputType.TYPE_TEXT_VARIATION_URI;
|
|
||||||
import static org.thoughtcrime.securesms.connect.DcHelper.CONFIG_BCC_SELF;
|
|
||||||
import static org.thoughtcrime.securesms.connect.DcHelper.CONFIG_E2EE_ENABLED;
|
|
||||||
import static org.thoughtcrime.securesms.connect.DcHelper.CONFIG_MVBOX_MOVE;
|
|
||||||
import static org.thoughtcrime.securesms.connect.DcHelper.CONFIG_SENTBOX_WATCH;
|
|
||||||
|
|
||||||
|
|
||||||
public class AdvancedPreferenceFragment extends ListSummaryPreferenceFragment
|
public class AdvancedPreferenceFragment extends ListSummaryPreferenceFragment
|
||||||
implements DcEventCenter.DcEventDelegate
|
implements DcEventCenter.DcEventDelegate
|
||||||
|
@ -52,6 +53,7 @@ public class AdvancedPreferenceFragment extends ListSummaryPreferenceFragment
|
||||||
CheckBoxPreference sentboxWatchCheckbox;
|
CheckBoxPreference sentboxWatchCheckbox;
|
||||||
CheckBoxPreference bccSelfCheckbox;
|
CheckBoxPreference bccSelfCheckbox;
|
||||||
CheckBoxPreference mvboxMoveCheckbox;
|
CheckBoxPreference mvboxMoveCheckbox;
|
||||||
|
CheckBoxPreference onlyFetchMvboxCheckbox;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle paramBundle) {
|
public void onCreate(Bundle paramBundle) {
|
||||||
|
@ -82,10 +84,21 @@ public class AdvancedPreferenceFragment extends ListSummaryPreferenceFragment
|
||||||
mvboxMoveCheckbox = (CheckBoxPreference) this.findPreference("pref_mvbox_move");
|
mvboxMoveCheckbox = (CheckBoxPreference) this.findPreference("pref_mvbox_move");
|
||||||
mvboxMoveCheckbox.setOnPreferenceChangeListener((preference, newValue) -> {
|
mvboxMoveCheckbox.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||||
boolean enabled = (Boolean) newValue;
|
boolean enabled = (Boolean) newValue;
|
||||||
|
DcHelper.getAccounts(getContext()).stopIo();
|
||||||
dcContext.setConfigInt(CONFIG_MVBOX_MOVE, enabled? 1 : 0);
|
dcContext.setConfigInt(CONFIG_MVBOX_MOVE, enabled? 1 : 0);
|
||||||
|
DcHelper.getAccounts(getContext()).startIo();
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
onlyFetchMvboxCheckbox = this.findPreference("pref_only_fetch_mvbox");
|
||||||
|
onlyFetchMvboxCheckbox.setOnPreferenceChangeListener(((preference, newValue) -> {
|
||||||
|
boolean enabled = (Boolean) newValue;
|
||||||
|
DcHelper.getAccounts(getContext()).stopIo();
|
||||||
|
dcContext.setConfigInt(CONFIG_ONLY_FETCH_MVBOX, enabled? 1 : 0);
|
||||||
|
DcHelper.getAccounts(getContext()).startIo();
|
||||||
|
return true;
|
||||||
|
}));
|
||||||
|
|
||||||
Preference manageKeys = this.findPreference("pref_manage_keys");
|
Preference manageKeys = this.findPreference("pref_manage_keys");
|
||||||
manageKeys.setOnPreferenceClickListener(new ManageKeysListener());
|
manageKeys.setOnPreferenceClickListener(new ManageKeysListener());
|
||||||
|
|
||||||
|
@ -151,6 +164,7 @@ public class AdvancedPreferenceFragment extends ListSummaryPreferenceFragment
|
||||||
sentboxWatchCheckbox.setChecked(0!=dcContext.getConfigInt(CONFIG_SENTBOX_WATCH));
|
sentboxWatchCheckbox.setChecked(0!=dcContext.getConfigInt(CONFIG_SENTBOX_WATCH));
|
||||||
bccSelfCheckbox.setChecked(0!=dcContext.getConfigInt(CONFIG_BCC_SELF));
|
bccSelfCheckbox.setChecked(0!=dcContext.getConfigInt(CONFIG_BCC_SELF));
|
||||||
mvboxMoveCheckbox.setChecked(0!=dcContext.getConfigInt(CONFIG_MVBOX_MOVE));
|
mvboxMoveCheckbox.setChecked(0!=dcContext.getConfigInt(CONFIG_MVBOX_MOVE));
|
||||||
|
onlyFetchMvboxCheckbox.setChecked(0!=dcContext.getConfigInt(CONFIG_ONLY_FETCH_MVBOX));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue