Definition at line 33 of file SessionViewModel.java.
◆ com::freerdp::freerdpcore::presentation::SessionViewModel::ConnectionState
| enum com::freerdp::freerdpcore::presentation::SessionViewModel::ConnectionState |
◆ SessionViewModel()
| com.freerdp.freerdpcore.presentation.SessionViewModel.SessionViewModel |
( |
@NonNull Application |
application | ) |
|
|
inline |
Definition at line 53 of file SessionViewModel.java.
54 {
55 super(application);
56 manualBookmarkGateway =
57 new ManualBookmarkGateway(AppDatabase.getInstance(application).bookmarkDao());
58 quickConnectHistoryGateway =
59 new QuickConnectHistoryGateway(HistoryDatabase.getInstance(application).historyDao());
60 }
◆ getState()
| LiveData< ConnectionState > com.freerdp.freerdpcore.presentation.SessionViewModel.getState |
( |
| ) |
|
|
inline |
◆ loadBookmarkById()
| void com.freerdp.freerdpcore.presentation.SessionViewModel.loadBookmarkById |
( |
long |
bookmarkId, |
|
|
@NonNull Consumer< BookmarkBase > |
callback |
|
) |
| |
|
inline |
Loads a bookmark by id off the UI thread and delivers the result on the main thread.
Definition at line 102 of file SessionViewModel.java.
103 {
104 executor.execute(() -> {
105 final BookmarkBase bookmark = manualBookmarkGateway.findById(bookmarkId);
106 mainHandler.post(() -> callback.accept(bookmark));
107 });
108 }
◆ onCleared()
| void com.freerdp.freerdpcore.presentation.SessionViewModel.onCleared |
( |
| ) |
|
|
inlineprotected |
Definition at line 121 of file SessionViewModel.java.
122 {
123 unregister();
124 executor.shutdown();
125 super.onCleared();
126 }
◆ recordQuickConnectHistory()
| void com.freerdp.freerdpcore.presentation.SessionViewModel.recordQuickConnectHistory |
( |
@NonNull String |
hostname | ) |
|
|
inline |
Inserts the given hostname into quick-connect history off the UI thread (no-op on duplicate).
Definition at line 113 of file SessionViewModel.java.
114 {
115 executor.execute(() -> {
116 if (!quickConnectHistoryGateway.historyItemExists(hostname))
117 quickConnectHistoryGateway.addHistoryItem(hostname);
118 });
119 }
◆ register()
| void com.freerdp.freerdpcore.presentation.SessionViewModel.register |
( |
long |
instance | ) |
|
|
inline |
Definition at line 67 of file SessionViewModel.java.
68 {
69 unregister();
70 registeredInstance = instance;
71 state.setValue(ConnectionState.CONNECTING);
72 GlobalApp.registerSessionListener(instance, new GlobalApp.SessionEventListener() {
73 @Override public void onConnectionSuccess()
74 {
75 state.setValue(ConnectionState.CONNECTED);
76 }
77
78 @Override public void onConnectionFailure()
79 {
80 state.setValue(ConnectionState.FAILED);
81 }
82
83 @Override public void onDisconnected()
84 {
85 state.setValue(ConnectionState.DISCONNECTED);
86 }
87 });
88 }
◆ unregister()
| void com.freerdp.freerdpcore.presentation.SessionViewModel.unregister |
( |
| ) |
|
|
inline |
Definition at line 90 of file SessionViewModel.java.
91 {
92 if (registeredInstance != 0)
93 {
94 GlobalApp.unregisterSessionListener(registeredInstance);
95 registeredInstance = 0;
96 }
97 }
The documentation for this class was generated from the following file: