Refactoring

This commit is contained in:
M66B
2020-03-11 11:57:46 +01:00
parent 619238232b
commit 0d8ba072f2
4 changed files with 30 additions and 31 deletions

View File

@@ -162,10 +162,6 @@ public class FragmentAccount extends FragmentBase {
private String certificate = null;
private boolean saving = false;
private static final int REQUEST_COLOR = 1;
private static final int REQUEST_SAVE = 2;
private static final int REQUEST_DELETE = 3;
static final Long SWIPE_ACTION_ASK = -1L;
static final Long SWIPE_ACTION_SEEN = -2L;
static final Long SWIPE_ACTION_SNOOZE = -3L;
@@ -398,7 +394,7 @@ public class FragmentAccount extends FragmentBase {
FragmentDialogColor fragment = new FragmentDialogColor();
fragment.setArguments(args);
fragment.setTargetFragment(FragmentAccount.this, REQUEST_COLOR);
fragment.setTargetFragment(FragmentAccount.this, ActivitySetup.REQUEST_ACCOUNT_COLOR);
fragment.show(getParentFragmentManager(), "account:color");
}
});
@@ -1240,7 +1236,7 @@ public class FragmentAccount extends FragmentBase {
FragmentDialogAsk fragment = new FragmentDialogAsk();
fragment.setArguments(aargs);
fragment.setTargetFragment(FragmentAccount.this, REQUEST_SAVE);
fragment.setTargetFragment(FragmentAccount.this, ActivitySetup.REQUEST_ACCOUNT_SAVE);
fragment.show(getParentFragmentManager(), "account:save");
} else if (getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED)) {
getParentFragmentManager().popBackStack();
@@ -1573,7 +1569,7 @@ public class FragmentAccount extends FragmentBase {
FragmentDialogAsk fragment = new FragmentDialogAsk();
fragment.setArguments(aargs);
fragment.setTargetFragment(FragmentAccount.this, REQUEST_DELETE);
fragment.setTargetFragment(FragmentAccount.this, ActivitySetup.REQUEST_ACCOUNT_DELETE);
fragment.show(getParentFragmentManager(), "account:delete");
}
@@ -1583,7 +1579,7 @@ public class FragmentAccount extends FragmentBase {
try {
switch (requestCode) {
case REQUEST_COLOR:
case ActivitySetup.REQUEST_ACCOUNT_COLOR:
if (resultCode == RESULT_OK && data != null) {
if (ActivityBilling.isPro(getContext())) {
Bundle args = data.getBundleExtra("args");
@@ -1592,7 +1588,7 @@ public class FragmentAccount extends FragmentBase {
startActivity(new Intent(getContext(), ActivityBilling.class));
}
break;
case REQUEST_SAVE:
case ActivitySetup.REQUEST_ACCOUNT_SAVE:
if (resultCode == RESULT_OK) {
final boolean save = (btnSave.getVisibility() == View.VISIBLE);
new Handler().post(new Runnable() {
@@ -1608,7 +1604,7 @@ public class FragmentAccount extends FragmentBase {
} else if (getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED))
getParentFragmentManager().popBackStack();
break;
case REQUEST_DELETE:
case ActivitySetup.REQUEST_ACCOUNT_DELETE:
if (resultCode == RESULT_OK)
onDelete();
break;