6package com.freerdp.freerdpcore.presentation;
8import android.app.Application;
10import androidx.annotation.NonNull;
11import androidx.lifecycle.AndroidViewModel;
12import androidx.lifecycle.LiveData;
13import androidx.lifecycle.MutableLiveData;
15import com.freerdp.freerdpcore.data.AppDatabase;
16import com.freerdp.freerdpcore.domain.BookmarkBase;
17import com.freerdp.freerdpcore.services.ManualBookmarkGateway;
19import java.util.Collections;
21import java.util.concurrent.ExecutorService;
22import java.util.concurrent.Executors;
26 private final MutableLiveData<List<BookmarkBase>> bookmarks =
27 new MutableLiveData<>(Collections.emptyList());
28 private final ExecutorService executor = Executors.newSingleThreadExecutor();
29 private final ManualBookmarkGateway manualBookmarkGateway;
34 manualBookmarkGateway =
35 new ManualBookmarkGateway(AppDatabase.getInstance(application).bookmarkDao());
38 public LiveData<List<BookmarkBase>> getBookmarks()
43 public void loadBookmarks()
45 executor.execute(() -> bookmarks.postValue(manualBookmarkGateway.findAll()));
48 @Override
protected void onCleared()