Fix useless button disable stuff

Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
Mario Danic 2018-02-12 21:14:55 +01:00
parent 011f15a3ef
commit b4bf672062

View file

@ -179,11 +179,9 @@ public class SettingsController extends BaseController {
if (!TextUtils.isEmpty(getResources().getString(R.string.nc_gpl3_url))) { if (!TextUtils.isEmpty(getResources().getString(R.string.nc_gpl3_url))) {
licenceButton.addPreferenceClickListener(view1 -> { licenceButton.addPreferenceClickListener(view1 -> {
sourceCodeButton.setEnabled(false);
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(getResources(). Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(getResources().
getString(R.string.nc_gpl3_url))); getString(R.string.nc_gpl3_url)));
startActivity(browserIntent); startActivity(browserIntent);
sourceCodeButton.setEnabled(true);
}); });
} else { } else {
licenceButton.setVisibility(View.GONE); licenceButton.setVisibility(View.GONE);
@ -191,11 +189,9 @@ public class SettingsController extends BaseController {
if (!TextUtils.isEmpty(getResources().getString(R.string.nc_privacy_url))) { if (!TextUtils.isEmpty(getResources().getString(R.string.nc_privacy_url))) {
privacyButton.addPreferenceClickListener(view12 -> { privacyButton.addPreferenceClickListener(view12 -> {
sourceCodeButton.setEnabled(false);
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(getResources(). Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(getResources().
getString(R.string.nc_privacy_url))); getString(R.string.nc_privacy_url)));
startActivity(browserIntent); startActivity(browserIntent);
sourceCodeButton.setEnabled(true);
}); });
} else { } else {
privacyButton.setVisibility(View.GONE); privacyButton.setVisibility(View.GONE);
@ -203,11 +199,9 @@ public class SettingsController extends BaseController {
if (!TextUtils.isEmpty(getResources().getString(R.string.nc_source_code_url))) { if (!TextUtils.isEmpty(getResources().getString(R.string.nc_source_code_url))) {
sourceCodeButton.addPreferenceClickListener(view13 -> { sourceCodeButton.addPreferenceClickListener(view13 -> {
sourceCodeButton.setEnabled(false);
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(getResources(). Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(getResources().
getString(R.string.nc_source_code_url))); getString(R.string.nc_source_code_url)));
startActivity(browserIntent); startActivity(browserIntent);
sourceCodeButton.setEnabled(true);
}); });
} else { } else {
sourceCodeButton.setVisibility(View.GONE); sourceCodeButton.setVisibility(View.GONE);
@ -217,14 +211,12 @@ public class SettingsController extends BaseController {
addAccountButton.addPreferenceClickListener(view15 -> { addAccountButton.addPreferenceClickListener(view15 -> {
addAccountButton.setEnabled(false);
getParentController().getRouter().pushController(RouterTransaction.with(new getParentController().getRouter().pushController(RouterTransaction.with(new
ServerSelectionController()).pushChangeHandler(new VerticalChangeHandler()) ServerSelectionController()).pushChangeHandler(new VerticalChangeHandler())
.popChangeHandler(new VerticalChangeHandler())); .popChangeHandler(new VerticalChangeHandler()));
}); });
switchAccountButton.addPreferenceClickListener(view16 -> { switchAccountButton.addPreferenceClickListener(view16 -> {
switchAccountButton.setEnabled(false);
getParentController().getRouter().pushController(RouterTransaction.with(new getParentController().getRouter().pushController(RouterTransaction.with(new
SwitchAccountController()).pushChangeHandler(new VerticalChangeHandler()) SwitchAccountController()).pushChangeHandler(new VerticalChangeHandler())
.popChangeHandler(new VerticalChangeHandler())); .popChangeHandler(new VerticalChangeHandler()));
@ -259,12 +251,10 @@ public class SettingsController extends BaseController {
baseUrlTextView.setText(userEntity.getBaseUrl()); baseUrlTextView.setText(userEntity.getBaseUrl());
reauthorizeButton.addPreferenceClickListener(view14 -> { reauthorizeButton.addPreferenceClickListener(view14 -> {
reauthorizeButton.setEnabled(false);
getParentController().getRouter().pushController(RouterTransaction.with( getParentController().getRouter().pushController(RouterTransaction.with(
new WebViewLoginController(userEntity.getBaseUrl(), true)) new WebViewLoginController(userEntity.getBaseUrl(), true))
.pushChangeHandler(new VerticalChangeHandler()) .pushChangeHandler(new VerticalChangeHandler())
.popChangeHandler(new VerticalChangeHandler())); .popChangeHandler(new VerticalChangeHandler()));
reauthorizeButton.setEnabled(true);
}); });
if (userEntity.getDisplayName() != null) { if (userEntity.getDisplayName() != null) {
@ -318,10 +308,8 @@ public class SettingsController extends BaseController {
dispose(profileQueryDisposable); dispose(profileQueryDisposable);
}, () -> dispose(profileQueryDisposable)); }, () -> dispose(profileQueryDisposable));
removeAccountButton.setEnabled(true);
removeAccountButton.addPreferenceClickListener(view1 -> { removeAccountButton.addPreferenceClickListener(view1 -> {
removeAccountButton.setEnabled(false);
cookieManager.getCookieStore().removeAll(); cookieManager.getCookieStore().removeAll();
boolean otherUserExists = userUtils.scheduleUserForDeletionWithId(userEntity.getId()); boolean otherUserExists = userUtils.scheduleUserForDeletionWithId(userEntity.getId());
new JobRequest.Builder(AccountRemovalJob.TAG).setUpdateCurrent(true) new JobRequest.Builder(AccountRemovalJob.TAG).setUpdateCurrent(true)
@ -350,12 +338,8 @@ public class SettingsController extends BaseController {
if (userUtils.getUsers().size() <= 1) { if (userUtils.getUsers().size() <= 1) {
switchAccountButton.setVisibility(View.GONE); switchAccountButton.setVisibility(View.GONE);
} else {
switchAccountButton.setEnabled(true);
} }
addAccountButton.setEnabled(true);
if (ApplicationWideMessageHolder.getInstance().getMessageType() != null) { if (ApplicationWideMessageHolder.getInstance().getMessageType() != null) {
switch (ApplicationWideMessageHolder.getInstance().getMessageType()) { switch (ApplicationWideMessageHolder.getInstance().getMessageType()) {
case ACCOUNT_UPDATED_NOT_ADDED: case ACCOUNT_UPDATED_NOT_ADDED: