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

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