Disable select all contextual menu item when current account is FreshRSS

This commit is contained in:
Shinokuni 2019-08-17 12:32:34 +02:00
parent 5eb4353f8a
commit 46d4d8a868
3 changed files with 7 additions and 1 deletions

View File

@ -308,6 +308,8 @@ public class MainActivity extends AppCompatActivity implements SwipeRefreshLayou
public boolean onPrepareActionMode(ActionMode actionMode, Menu menu) {
menu.findItem(R.id.item_mark_read).setVisible(!itemWithFeed.getItem().isRead());
menu.findItem(R.id.item_mark_unread).setVisible(itemWithFeed.getItem().isRead());
menu.findItem(R.id.item_select_all).setVisible(!(viewModel.getCurrentAccount()
.is(Account.AccountType.FRESHRSS)));
return true;
}

View File

@ -256,6 +256,10 @@ public class Account implements Parcelable {
return accountType == AccountType.LOCAL;
}
public boolean is(AccountType accountType) {
return this.accountType == accountType;
}
@Override
public boolean equals(@Nullable Object obj) {
if (obj == null)

View File

@ -99,7 +99,7 @@ public class EditFeedDialog extends DialogFragment implements AdapterView.OnItem
folder = v.findViewById(R.id.edit_feed_folder_spinner);
//TODO : this is temporary and should be changed when other service APIs are implemented
if (account.getAccountType() == Account.AccountType.NEXTCLOUD_NEWS)
if (account.is(Account.AccountType.NEXTCLOUD_NEWS))
feedUrl.setEnabled(false);
feedName.setText(feedWithFolder.getFeed().getName());