mirror of
https://github.com/M66B/FairEmail.git
synced 2025-01-01 12:44:42 +00:00
Folder polling is available with always sync only
This commit is contained in:
parent
ad7ce25ef8
commit
73864b23bd
1 changed files with 13 additions and 5 deletions
|
@ -21,6 +21,7 @@ package eu.faircode.email;
|
|||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
|
@ -43,6 +44,7 @@ import androidx.annotation.NonNull;
|
|||
import androidx.annotation.Nullable;
|
||||
import androidx.constraintlayout.widget.Group;
|
||||
import androidx.lifecycle.Lifecycle;
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
|
||||
|
@ -234,8 +236,10 @@ public class FragmentFolder extends FragmentBase {
|
|||
|
||||
if (folder != null) {
|
||||
EntityAccount account = db.account().getAccount(folder.account);
|
||||
if (account != null)
|
||||
if (account != null) {
|
||||
args.putInt("interval", account.poll_interval);
|
||||
args.putBoolean("exempted", account.poll_exempted);
|
||||
}
|
||||
}
|
||||
|
||||
return folder;
|
||||
|
@ -243,8 +247,12 @@ public class FragmentFolder extends FragmentBase {
|
|||
|
||||
@Override
|
||||
protected void onExecuted(Bundle args, EntityFolder folder) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
||||
int pollInterval = prefs.getInt("poll_interval", ServiceSynchronize.DEFAULT_POLL_INTERVAL);
|
||||
int interval = args.getInt("interval", EntityAccount.DEFAULT_KEEP_ALIVE_INTERVAL);
|
||||
boolean exempted = args.getBoolean("exempted", false);
|
||||
|
||||
if (savedInstanceState == null) {
|
||||
int interval = args.getInt("interval", EntityAccount.DEFAULT_KEEP_ALIVE_INTERVAL);
|
||||
etName.setText(folder == null ? null : folder.name);
|
||||
etDisplay.setText(folder == null ? null : folder.display);
|
||||
etDisplay.setHint(folder == null ? null : EntityFolder.localizeName(getContext(), folder.name));
|
||||
|
@ -282,9 +290,9 @@ public class FragmentFolder extends FragmentBase {
|
|||
Helper.setViewsEnabled(view, true);
|
||||
|
||||
etName.setEnabled(folder == null || EntityFolder.USER.equals(folder.type));
|
||||
cbPoll.setEnabled(cbSynchronize.isChecked());
|
||||
etPoll.setEnabled(cbSynchronize.isChecked());
|
||||
tvPoll.setEnabled(cbSynchronize.isChecked());
|
||||
cbPoll.setEnabled(cbSynchronize.isChecked() && (pollInterval == 0 || exempted));
|
||||
etPoll.setEnabled(cbSynchronize.isChecked() && (pollInterval == 0 || exempted));
|
||||
tvPoll.setEnabled(cbSynchronize.isChecked() && (pollInterval == 0 || exempted));
|
||||
grpPoll.setVisibility(cbPoll.isEnabled() && cbPoll.isChecked() ? View.VISIBLE : View.GONE);
|
||||
etKeepDays.setEnabled(!cbKeepAll.isChecked());
|
||||
cbAutoDelete.setEnabled(!cbKeepAll.isChecked());
|
||||
|
|
Loading…
Reference in a new issue