Fix solarized

This commit is contained in:
Thomas 2022-12-18 15:23:11 +01:00
parent 8dedd7a907
commit dcb584eeb4
2 changed files with 27 additions and 4 deletions

View file

@ -150,9 +150,7 @@ public class MastodonListActivity extends BaseBarActivity implements MastodonLis
timelinesVM.getAccountsInList(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, mastodonList.id, null, null, 0) timelinesVM.getAccountsInList(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, mastodonList.id, null, null, 0)
.observe(MastodonListActivity.this, accounts -> { .observe(MastodonListActivity.this, accounts -> {
if (accounts != null && accounts.size() > 0) { if (accounts != null && accounts.size() > 0) {
for (Account account : accounts) { accountsVM.muteAccountsHome(MainActivity.currentAccount, accounts);
accountsVM.muteHome(MainActivity.currentAccount, account);
}
} }
}); });
dialog.dismiss(); dialog.dismiss();

View file

@ -813,7 +813,6 @@ public class AccountsVM extends AndroidViewModel {
public LiveData<Account> muteHome(@NonNull BaseAccount forAccount, @NonNull Account target) { public LiveData<Account> muteHome(@NonNull BaseAccount forAccount, @NonNull Account target) {
accountMutableLiveData = new MutableLiveData<>(); accountMutableLiveData = new MutableLiveData<>();
new Thread(() -> { new Thread(() -> {
try { try {
new MutedAccounts(getApplication().getApplicationContext()).muteAccount(forAccount, target); new MutedAccounts(getApplication().getApplicationContext()).muteAccount(forAccount, target);
addMutedAccount(target); addMutedAccount(target);
@ -828,6 +827,32 @@ public class AccountsVM extends AndroidViewModel {
return accountMutableLiveData; return accountMutableLiveData;
} }
/**
* Mute the given account in db
*
* @return {@link LiveData} containing the {@link Account} to the given account
*/
public LiveData<List<Account>> muteAccountsHome(@NonNull BaseAccount forAccount, @NonNull List<Account> targets) {
accountListMutableLiveData = new MutableLiveData<>();
new Thread(() -> {
try {
for (Account target : targets) {
new MutedAccounts(getApplication().getApplicationContext()).muteAccount(forAccount, target);
sendAction(getApplication().getApplicationContext(), Helper.ARG_STATUS_ACCOUNT_ID_DELETED, null, target.id);
addMutedAccount(target);
}
} catch (DBException e) {
e.printStackTrace();
}
Handler mainHandler = new Handler(Looper.getMainLooper());
Runnable myRunnable = () -> accountListMutableLiveData.setValue(targets);
mainHandler.post(myRunnable);
}).start();
return accountListMutableLiveData;
}
/** /**
* Unmute the given account in db * Unmute the given account in db
* *