Disable poll for non synchronizing user folders

pull/178/head
M66B 5 years ago
parent eafdaee090
commit 7ce73427e3

File diff suppressed because it is too large Load Diff

@ -61,7 +61,7 @@ import io.requery.android.database.sqlite.SQLiteDatabase;
// https://developer.android.com/topic/libraries/architecture/room.html
@Database(
version = 154,
version = 155,
entities = {
EntityIdentity.class,
EntityAccount.class,
@ -1545,6 +1545,13 @@ public abstract class DB extends RoomDatabase {
Log.i("DB migration from version " + startVersion + " to " + endVersion);
db.execSQL("ALTER TABLE `identity` ADD COLUMN `ehlo` TEXT");
}
})
.addMigrations(new Migration(154, 155) {
@Override
public void migrate(@NonNull SupportSQLiteDatabase db) {
Log.i("DB migration from version " + startVersion + " to " + endVersion);
db.execSQL("UPDATE `folder` SET `poll` = 1 WHERE `synchronize` = 0");
}
});
}

@ -156,13 +156,14 @@ public class FragmentFolder extends FragmentBase {
cbPoll.setEnabled(isChecked);
etPoll.setEnabled(isChecked);
tvPoll.setEnabled(isChecked);
grpPoll.setVisibility(isChecked && cbPoll.isChecked() ? View.VISIBLE : View.GONE);
}
});
cbPoll.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
grpPoll.setVisibility(isChecked ? View.VISIBLE : View.GONE);
grpPoll.setVisibility(cbPoll.isEnabled() && isChecked ? View.VISIBLE : View.GONE);
}
});
@ -253,7 +254,6 @@ public class FragmentFolder extends FragmentBase {
cbPoll.setChecked(folder == null ? false : folder.poll);
etPoll.setText(folder == null ? null : Integer.toString(folder.poll_factor));
tvPoll.setText(getString(R.string.title_factor_minutes, interval));
grpPoll.setVisibility(cbPoll.isChecked() ? View.VISIBLE : View.GONE);
cbDownload.setChecked(folder == null ? true : folder.download);
etSyncDays.setText(Integer.toString(folder == null ? EntityFolder.DEFAULT_SYNC : folder.sync_days));
if (folder != null && folder.keep_days == Integer.MAX_VALUE)
@ -280,6 +280,7 @@ public class FragmentFolder extends FragmentBase {
cbPoll.setEnabled(cbSynchronize.isChecked());
etPoll.setEnabled(cbSynchronize.isChecked());
tvPoll.setEnabled(cbSynchronize.isChecked());
grpPoll.setVisibility(cbPoll.isEnabled() && cbPoll.isChecked() ? View.VISIBLE : View.GONE);
etKeepDays.setEnabled(!cbKeepAll.isChecked());
cbAutoDelete.setEnabled(!cbKeepAll.isChecked());
btnSave.setEnabled(true);

Loading…
Cancel
Save