blob: b9ba588df089aac58cbd29b4b845d143645b6e65 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
package it.niedermann.nextcloud.deck.ui;
import androidx.annotation.Nullable;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;
import it.niedermann.nextcloud.deck.model.Account;
import it.niedermann.nextcloud.deck.model.Board;
@SuppressWarnings("WeakerAccess")
public class MainViewModel extends ViewModel {
private MutableLiveData<Account> currentAccount = new MutableLiveData<>();
private Board currentBoard;
private boolean currentAccountHasArchivedBoards = false;
private boolean currentAccountIsSupportedVersion = false;
public Account getCurrentAccount() {
return currentAccount.getValue();
}
public LiveData<Account> getCurrentAccountLiveData() {
return this.currentAccount;
}
public void setCurrentAccount(Account currentAccount, boolean versionIsSupported) {
this.currentAccount.setValue(currentAccount);
this.currentAccountIsSupportedVersion = versionIsSupported;
}
public void setCurrentBoard(Board currentBoard) {
this.currentBoard = currentBoard;
}
public Long getCurrentBoardLocalId() {
return this.currentBoard.getLocalId();
}
@Nullable
public Long getCurrentBoardRemoteId() {
return this.currentBoard.getId();
}
public boolean currentBoardHasEditPermission() {
return this.currentBoard != null && this.currentBoard.isPermissionEdit() && currentAccountIsSupportedVersion;
}
public boolean currentAccountHasArchivedBoards() {
return currentAccountHasArchivedBoards;
}
public void setCurrentAccountHasArchivedBoards(boolean currentAccountHasArchivedBoards) {
this.currentAccountHasArchivedBoards = currentAccountHasArchivedBoards;
}
public boolean isCurrentAccountIsSupportedVersion() {
return currentAccountIsSupportedVersion;
}
}
|