mirror of https://github.com/readrops/Readrops.git
Add a method to know if an account is local or not
This commit is contained in:
parent
5cf6089301
commit
c540a5c57e
|
@ -190,7 +190,7 @@ public class MainActivity extends AppCompatActivity implements SwipeRefreshLayou
|
|||
finish();
|
||||
}
|
||||
|
||||
if (accountWeakReference.get() != null && !(accountWeakReference.get().getAccountType() == Account.AccountType.LOCAL)) {
|
||||
if (accountWeakReference.get() != null && !accountWeakReference.get().isLocal()) {
|
||||
refreshLayout.setRefreshing(true);
|
||||
onRefresh();
|
||||
accountWeakReference.clear();
|
||||
|
|
|
@ -228,6 +228,10 @@ public class Account implements Parcelable {
|
|||
return new Credentials(login, password, url);
|
||||
}
|
||||
|
||||
public boolean isLocal() {
|
||||
return accountType == AccountType.LOCAL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(@Nullable Object obj) {
|
||||
if (obj == null)
|
||||
|
|
|
@ -63,7 +63,7 @@ public class AccountSettingsFragment extends PreferenceFragmentCompat {
|
|||
});
|
||||
|
||||
credentialsPref.setOnPreferenceClickListener(preference -> {
|
||||
if (account.getAccountType() != Account.AccountType.LOCAL) {
|
||||
if (!account.isLocal()) {
|
||||
Intent intent = new Intent(getContext(), AddAccountActivity.class);
|
||||
intent.putExtra(AddAccountActivity.EDIT_ACCOUNT, account);
|
||||
startActivity(intent);
|
||||
|
|
|
@ -238,7 +238,7 @@ public class MainViewModel extends AndroidViewModel {
|
|||
}
|
||||
|
||||
public boolean isAccountLocal() {
|
||||
return currentAccount.getAccountType() == Account.AccountType.LOCAL;
|
||||
return currentAccount.isLocal();
|
||||
}
|
||||
|
||||
//endregion
|
||||
|
|
Loading…
Reference in New Issue