Simplified starting FTS indexing

This commit is contained in:
M66B
2020-01-15 12:07:45 +01:00
parent 7997ee74c5
commit 36e68347d0
8 changed files with 28 additions and 17 deletions

View File

@@ -170,6 +170,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
});
liveAccountNetworkState.observeForever(new Observer<List<TupleAccountNetworkState>>() {
private boolean fts = false;
private List<TupleAccountNetworkState> accountStates = new ArrayList<>();
private ExecutorService queue = Helper.getBackgroundExecutor(1, "service");
@@ -258,6 +259,13 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
if (lastAccounts != accounts || lastOperations != operations) {
lastAccounts = accounts;
lastOperations = operations;
if (operations == 0) {
fts = true;
WorkerFts.init(ServiceSynchronize.this, false);
} else if (fts) {
fts = false;
WorkerFts.cancel(ServiceSynchronize.this);
}
NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
nm.notify(Helper.NOTIFICATION_SYNCHRONIZE, getNotificationService(lastAccounts, lastOperations).build());
}