Refactoring

This commit is contained in:
M66B 2019-01-14 12:58:33 +00:00
parent ae60ef75b8
commit f628fa0942
1 changed files with 20 additions and 13 deletions

View File

@ -691,22 +691,29 @@ public class ActivitySetup extends ActivityBilling implements FragmentManager.On
}.execute(this, args, "setup:import");
}
private void onEditAccount(Intent intent) {
FragmentAccount fragment = new FragmentAccount();
fragment.setArguments(intent.getExtras());
FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
fragmentTransaction.replace(R.id.content_frame, fragment).addToBackStack("account");
fragmentTransaction.commit();
}
private void onEditIdentity(Intent intent) {
FragmentIdentity fragment = new FragmentIdentity();
fragment.setArguments(intent.getExtras());
FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
fragmentTransaction.replace(R.id.content_frame, fragment).addToBackStack("identity");
fragmentTransaction.commit();
}
BroadcastReceiver receiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
if (ACTION_EDIT_ACCOUNT.equals(intent.getAction())) {
FragmentAccount fragment = new FragmentAccount();
fragment.setArguments(intent.getExtras());
FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
fragmentTransaction.replace(R.id.content_frame, fragment).addToBackStack("account");
fragmentTransaction.commit();
} else if (ACTION_EDIT_IDENTITY.equals(intent.getAction())) {
FragmentIdentity fragment = new FragmentIdentity();
fragment.setArguments(intent.getExtras());
FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
fragmentTransaction.replace(R.id.content_frame, fragment).addToBackStack("identity");
fragmentTransaction.commit();
}
if (ACTION_EDIT_ACCOUNT.equals(intent.getAction()))
onEditAccount(intent);
else if (ACTION_EDIT_IDENTITY.equals(intent.getAction()))
onEditIdentity(intent);
}
};
}