1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2025-01-01 04:35:57 +00:00

Implemented unread tile poll

This commit is contained in:
M66B 2019-12-07 21:11:21 +01:00
parent 252ffa8ee4
commit 9864465e8a

View file

@ -20,6 +20,7 @@ package eu.faircode.email;
*/
import android.annotation.TargetApi;
import android.content.Context;
import android.content.Intent;
import android.graphics.drawable.Icon;
import android.os.Build;
@ -40,7 +41,9 @@ public class ServiceTileUnseen extends TileService {
public void onCreate() {
super.onCreate();
DB.getInstance(this).message().liveUnseenNotify().observe(owner, new Observer<List<TupleMessageEx>>() {
DB db = DB.getInstance(this);
db.message().liveUnseenNotify().observe(owner, new Observer<List<TupleMessageEx>>() {
@Override
public void onChanged(List<TupleMessageEx> messages) {
if (messages == null)
@ -94,6 +97,12 @@ public class ServiceTileUnseen extends TileService {
public void onClick() {
Log.i("Click tile unseen");
// TODO: sync all
final Context context = getApplicationContext();
new Thread(new Runnable() {
@Override
public void run() {
WorkerPoll.sync(context);
}
}).start();
}
}