11package com.freerdp.freerdpcore.presentation;
13import android.app.Application;
15import androidx.annotation.NonNull;
16import androidx.lifecycle.AndroidViewModel;
17import androidx.lifecycle.LiveData;
18import androidx.lifecycle.MutableLiveData;
20import com.freerdp.freerdpcore.data.AppDatabase;
21import com.freerdp.freerdpcore.domain.BookmarkBase;
22import com.freerdp.freerdpcore.services.ManualBookmarkGateway;
24import java.util.Collections;
26import java.util.concurrent.ExecutorService;
27import java.util.concurrent.Executors;
31 private final MutableLiveData<List<BookmarkBase>> bookmarks =
32 new MutableLiveData<>(Collections.emptyList());
33 private final ExecutorService executor = Executors.newSingleThreadExecutor();
34 private final ManualBookmarkGateway manualBookmarkGateway;
39 manualBookmarkGateway =
40 new ManualBookmarkGateway(AppDatabase.getInstance(application).bookmarkDao());
43 public LiveData<List<BookmarkBase>> getBookmarks()
48 public void loadBookmarks()
50 executor.execute(() -> bookmarks.postValue(manualBookmarkGateway.findAll()));
53 @Override
protected void onCleared()