Revert "Refactoring"

This reverts commit 0d8ba072f2.
pull/175/head
M66B 6 years ago
parent 1818685eee
commit a4b48591fc

@ -128,18 +128,6 @@ public class ActivitySetup extends ActivityBase implements FragmentManager.OnBac
static final int REQUEST_IMPORT_CERTIFICATE = 7; static final int REQUEST_IMPORT_CERTIFICATE = 7;
static final int REQUEST_OAUTH = 8; static final int REQUEST_OAUTH = 8;
static final int REQUEST_ACCOUNT_COLOR = 21;
static final int REQUEST_ACCOUNT_SAVE = 22;
static final int REQUEST_ACCOUNT_DELETE = 23;
static final int REQUEST_IDENTITY_COLOR = 31;
static final int REQUEST_IDENTITY_SAVE = 32;
static final int REQUEST_IDENTITY_DELETE = 33;
static final int REQUEST_IDENITY_SIGNATURE = 34;
static final int REQUEST_POP_COLOR = 41;
static final int REQUEST_POP_DELETE = 42;
static final String ACTION_QUICK_GMAIL = BuildConfig.APPLICATION_ID + ".ACTION_QUICK_GMAIL"; static final String ACTION_QUICK_GMAIL = BuildConfig.APPLICATION_ID + ".ACTION_QUICK_GMAIL";
static final String ACTION_QUICK_OAUTH = BuildConfig.APPLICATION_ID + ".ACTION_QUICK_OAUTH"; static final String ACTION_QUICK_OAUTH = BuildConfig.APPLICATION_ID + ".ACTION_QUICK_OAUTH";
static final String ACTION_QUICK_SETUP = BuildConfig.APPLICATION_ID + ".ACTION_QUICK_SETUP"; static final String ACTION_QUICK_SETUP = BuildConfig.APPLICATION_ID + ".ACTION_QUICK_SETUP";

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

@ -32,6 +32,7 @@ import android.text.Editable;
import android.text.TextUtils; import android.text.TextUtils;
import android.text.TextWatcher; import android.text.TextWatcher;
import android.text.method.LinkMovementMethod; import android.text.method.LinkMovementMethod;
import android.util.Patterns;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.Menu; import android.view.Menu;
@ -134,6 +135,11 @@ public class FragmentIdentity extends FragmentBase {
private String signature = null; private String signature = null;
private boolean saving = false; 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;
private static final int REQUEST_SIGNATURE = 4;
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
@ -323,7 +329,7 @@ public class FragmentIdentity extends FragmentBase {
FragmentDialogColor fragment = new FragmentDialogColor(); FragmentDialogColor fragment = new FragmentDialogColor();
fragment.setArguments(args); fragment.setArguments(args);
fragment.setTargetFragment(FragmentIdentity.this, ActivitySetup.REQUEST_IDENTITY_COLOR); fragment.setTargetFragment(FragmentIdentity.this, REQUEST_COLOR);
fragment.show(getParentFragmentManager(), "identity:color"); fragment.show(getParentFragmentManager(), "identity:color");
} }
}); });
@ -335,7 +341,7 @@ public class FragmentIdentity extends FragmentBase {
public void onClick(View v) { public void onClick(View v) {
Intent intent = new Intent(getContext(), ActivitySignature.class); Intent intent = new Intent(getContext(), ActivitySignature.class);
intent.putExtra("html", signature); intent.putExtra("html", signature);
startActivityForResult(intent, ActivitySetup.REQUEST_IDENITY_SIGNATURE); startActivityForResult(intent, REQUEST_SIGNATURE);
} }
}); });
@ -864,7 +870,7 @@ public class FragmentIdentity extends FragmentBase {
FragmentDialogAsk fragment = new FragmentDialogAsk(); FragmentDialogAsk fragment = new FragmentDialogAsk();
fragment.setArguments(aargs); fragment.setArguments(aargs);
fragment.setTargetFragment(FragmentIdentity.this, ActivitySetup.REQUEST_IDENTITY_SAVE); fragment.setTargetFragment(FragmentIdentity.this, REQUEST_SAVE);
fragment.show(getParentFragmentManager(), "identity:save"); fragment.show(getParentFragmentManager(), "identity:save");
} else if (getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED)) } else if (getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED))
getParentFragmentManager().popBackStack(); getParentFragmentManager().popBackStack();
@ -1188,7 +1194,7 @@ public class FragmentIdentity extends FragmentBase {
FragmentDialogAsk fragment = new FragmentDialogAsk(); FragmentDialogAsk fragment = new FragmentDialogAsk();
fragment.setArguments(aargs); fragment.setArguments(aargs);
fragment.setTargetFragment(FragmentIdentity.this, ActivitySetup.REQUEST_IDENTITY_DELETE); fragment.setTargetFragment(FragmentIdentity.this, REQUEST_DELETE);
fragment.show(getParentFragmentManager(), "identity:delete"); fragment.show(getParentFragmentManager(), "identity:delete");
} }
@ -1198,7 +1204,7 @@ public class FragmentIdentity extends FragmentBase {
try { try {
switch (requestCode) { switch (requestCode) {
case ActivitySetup.REQUEST_IDENTITY_COLOR: case REQUEST_COLOR:
if (resultCode == RESULT_OK && data != null) { if (resultCode == RESULT_OK && data != null) {
if (ActivityBilling.isPro(getContext())) { if (ActivityBilling.isPro(getContext())) {
Bundle args = data.getBundleExtra("args"); Bundle args = data.getBundleExtra("args");
@ -1207,7 +1213,7 @@ public class FragmentIdentity extends FragmentBase {
startActivity(new Intent(getContext(), ActivityBilling.class)); startActivity(new Intent(getContext(), ActivityBilling.class));
} }
break; break;
case ActivitySetup.REQUEST_IDENTITY_SAVE: case REQUEST_SAVE:
if (resultCode == RESULT_OK) { if (resultCode == RESULT_OK) {
new Handler().post(new Runnable() { new Handler().post(new Runnable() {
@Override @Override
@ -1219,11 +1225,11 @@ public class FragmentIdentity extends FragmentBase {
} else if (getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED)) } else if (getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED))
getParentFragmentManager().popBackStack(); getParentFragmentManager().popBackStack();
break; break;
case ActivitySetup.REQUEST_IDENTITY_DELETE: case REQUEST_DELETE:
if (resultCode == RESULT_OK) if (resultCode == RESULT_OK)
onDelete(); onDelete();
break; break;
case ActivitySetup.REQUEST_IDENITY_SIGNATURE: case REQUEST_SIGNATURE:
if (resultCode == RESULT_OK) if (resultCode == RESULT_OK)
onHtml(data.getExtras()); onHtml(data.getExtras());
break; break;

@ -95,6 +95,9 @@ public class FragmentPop extends FragmentBase {
private long id = -1; private long id = -1;
private boolean saving = false; private boolean saving = false;
private static final int REQUEST_COLOR = 1;
private static final int REQUEST_DELETE = 2;
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
@ -177,7 +180,7 @@ public class FragmentPop extends FragmentBase {
FragmentDialogColor fragment = new FragmentDialogColor(); FragmentDialogColor fragment = new FragmentDialogColor();
fragment.setArguments(args); fragment.setArguments(args);
fragment.setTargetFragment(FragmentPop.this, ActivitySetup.REQUEST_POP_COLOR); fragment.setTargetFragment(FragmentPop.this, REQUEST_COLOR);
fragment.show(getParentFragmentManager(), "account:color"); fragment.show(getParentFragmentManager(), "account:color");
} }
}); });
@ -598,7 +601,7 @@ public class FragmentPop extends FragmentBase {
FragmentDialogAsk fragment = new FragmentDialogAsk(); FragmentDialogAsk fragment = new FragmentDialogAsk();
fragment.setArguments(aargs); fragment.setArguments(aargs);
fragment.setTargetFragment(FragmentPop.this, ActivitySetup.REQUEST_POP_DELETE); fragment.setTargetFragment(FragmentPop.this, REQUEST_DELETE);
fragment.show(getParentFragmentManager(), "account:delete"); fragment.show(getParentFragmentManager(), "account:delete");
} }
@ -608,7 +611,7 @@ public class FragmentPop extends FragmentBase {
try { try {
switch (requestCode) { switch (requestCode) {
case ActivitySetup.REQUEST_POP_COLOR: case REQUEST_COLOR:
if (resultCode == RESULT_OK && data != null) { if (resultCode == RESULT_OK && data != null) {
if (ActivityBilling.isPro(getContext())) { if (ActivityBilling.isPro(getContext())) {
Bundle args = data.getBundleExtra("args"); Bundle args = data.getBundleExtra("args");
@ -617,7 +620,7 @@ public class FragmentPop extends FragmentBase {
startActivity(new Intent(getContext(), ActivityBilling.class)); startActivity(new Intent(getContext(), ActivityBilling.class));
} }
break; break;
case ActivitySetup.REQUEST_POP_DELETE: case REQUEST_DELETE:
if (resultCode == RESULT_OK) if (resultCode == RESULT_OK)
onDelete(); onDelete();
break; break;

Loading…
Cancel
Save