Auto select insert contact group target

This commit is contained in:
M66B 2020-02-03 10:48:24 +01:00
parent 13277bf3e4
commit adbebd29b0
1 changed files with 14 additions and 0 deletions

View File

@ -1221,6 +1221,17 @@ public class FragmentCompose extends FragmentBase {
Bundle args = new Bundle(); Bundle args = new Bundle();
args.putLong("working", working); args.putLong("working", working);
int focussed = 0;
View v = view.findFocus();
if (v != null) {
if (v.getId() == R.id.etCc)
focussed = 1;
else if (v.getId() == R.id.etBcc)
focussed = 2;
}
args.putInt("focussed", focussed);
FragmentDialogContactGroup fragment = new FragmentDialogContactGroup(); FragmentDialogContactGroup fragment = new FragmentDialogContactGroup();
fragment.setArguments(args); fragment.setArguments(args);
fragment.setTargetFragment(this, REQUEST_CONTACT_GROUP); fragment.setTargetFragment(this, REQUEST_CONTACT_GROUP);
@ -4184,6 +4195,7 @@ public class FragmentCompose extends FragmentBase {
@Override @Override
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) { public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
final long working = getArguments().getLong("working"); final long working = getArguments().getLong("working");
int focussed = getArguments().getInt("focussed");
View dview = LayoutInflater.from(getContext()).inflate(R.layout.dialog_contact_group, null); View dview = LayoutInflater.from(getContext()).inflate(R.layout.dialog_contact_group, null);
final Spinner spGroup = dview.findViewById(R.id.spGroup); final Spinner spGroup = dview.findViewById(R.id.spGroup);
@ -4211,6 +4223,8 @@ public class FragmentCompose extends FragmentBase {
0); 0);
spGroup.setAdapter(adapter); spGroup.setAdapter(adapter);
spTarget.setSelection(focussed);
return new AlertDialog.Builder(getContext()) return new AlertDialog.Builder(getContext())
.setView(dview) .setView(dview)
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {