mirror of https://github.com/M66B/FairEmail.git
Select identity: add
This commit is contained in:
parent
2a7a4f659a
commit
e90392ee6c
|
@ -2481,8 +2481,11 @@ public class FragmentCompose extends FragmentBase {
|
|||
}
|
||||
|
||||
private void onMenuIdentitySelect() {
|
||||
Bundle args = new Bundle();
|
||||
args.putBoolean("add", true);
|
||||
|
||||
FragmentDialogSelectIdentity fragment = new FragmentDialogSelectIdentity();
|
||||
fragment.setArguments(new Bundle());
|
||||
fragment.setArguments(args);
|
||||
fragment.setTargetFragment(this, REQUEST_SELECT_IDENTITY);
|
||||
fragment.show(getParentFragmentManager(), "select:identity");
|
||||
}
|
||||
|
@ -4795,6 +4798,15 @@ public class FragmentCompose extends FragmentBase {
|
|||
}
|
||||
|
||||
private void onSelectIdentity(Bundle args) {
|
||||
long id = args.getLong("id");
|
||||
if (id < 0) {
|
||||
getContext().startActivity(new Intent(getContext(), ActivitySetup.class)
|
||||
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK)
|
||||
.putExtra("manual", true)
|
||||
.putExtra("scroll", true));
|
||||
return;
|
||||
}
|
||||
|
||||
new SimpleTask<EntityIdentity>() {
|
||||
@Override
|
||||
protected EntityIdentity onExecute(Context context, Bundle args) throws Throwable {
|
||||
|
|
|
@ -23,6 +23,7 @@ import static android.app.Activity.RESULT_OK;
|
|||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
|
@ -46,6 +47,8 @@ public class FragmentDialogSelectIdentity extends FragmentDialogBase {
|
|||
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
|
||||
final Context context = getContext();
|
||||
|
||||
final Bundle args = getArguments();
|
||||
|
||||
final View dview = LayoutInflater.from(context).inflate(R.layout.dialog_account_select, null);
|
||||
RecyclerView rvSelect = dview.findViewById(R.id.rvSelect);
|
||||
final ContentLoadingProgressBar pbWait = dview.findViewById(R.id.pbWait);
|
||||
|
@ -54,12 +57,22 @@ public class FragmentDialogSelectIdentity extends FragmentDialogBase {
|
|||
rvSelect.setHasFixedSize(false);
|
||||
rvSelect.setLayoutManager(new LinearLayoutManager(context));
|
||||
|
||||
Dialog dialog = new AlertDialog.Builder(context)
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(context)
|
||||
.setIcon(R.drawable.twotone_person_24)
|
||||
.setTitle(R.string.title_list_identities)
|
||||
.setView(dview)
|
||||
.setNegativeButton(android.R.string.cancel, null)
|
||||
.create();
|
||||
.setNegativeButton(android.R.string.cancel, null);
|
||||
|
||||
if (args != null && args.getBoolean("add"))
|
||||
builder.setNeutralButton(R.string.title_add, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
args.putLong("id", -1L);
|
||||
sendResult(RESULT_OK);
|
||||
}
|
||||
});
|
||||
|
||||
Dialog dialog = builder.create();
|
||||
|
||||
new SimpleTask<List<TupleIdentityEx>>() {
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue