preselect proper account in create contact dialog after following invite

This commit is contained in:
Daniel Gultsch 2020-01-09 17:39:55 +01:00
parent 6205574bcb
commit e57bd477a9
5 changed files with 24 additions and 21 deletions

View file

@ -435,6 +435,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
if (wasFirstAccount) {
intent.putExtra("init", true);
}
intent.putExtra(EXTRA_ACCOUNT, mAccount.getJid().asBareJid().toEscapedString());
} else {
intent = new Intent(getApplicationContext(), PublishProfilePictureActivity.class);
intent.putExtra(EXTRA_ACCOUNT, mAccount.getJid().asBareJid().toString());

View file

@ -55,6 +55,7 @@ public class PublishProfilePictureActivity extends XmppActivity implements XmppC
Intent intent = new Intent(getApplicationContext(), StartConversationActivity.class);
StartConversationActivity.addInviteUri(intent, getIntent());
intent.putExtra("init", true);
intent.putExtra(EXTRA_ACCOUNT, account.getJid().asBareJid().toEscapedString());
startActivity(intent);
}
Toast.makeText(PublishProfilePictureActivity.this,
@ -100,6 +101,7 @@ public class PublishProfilePictureActivity extends XmppActivity implements XmppC
intent.putExtra("init", true);
}
StartConversationActivity.addInviteUri(intent, getIntent());
intent.putExtra(EXTRA_ACCOUNT, account.getJid().asBareJid().toEscapedString());
startActivity(intent);
}
finish();

View file

@ -499,7 +499,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
getString(R.string.add_contact),
getString(R.string.add),
prefilledJid,
null,
invite == null ? null : invite.account,
invite == null || !invite.hasFingerprints(),
true
);
@ -821,7 +821,8 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
protected boolean processViewIntent(@NonNull Intent intent) {
final String inviteUri = intent.getStringExtra(EXTRA_INVITE_URI);
if (inviteUri != null) {
Invite invite = new Invite(inviteUri);
final Invite invite = new Invite(inviteUri);
invite.account = intent.getStringExtra(EXTRA_ACCOUNT);
if (invite.isJidValid()) {
return invite.invite();
}
@ -836,7 +837,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
Uri uri = intent.getData();
if (uri != null) {
Invite invite = new Invite(intent.getData(), intent.getBooleanExtra("scanned", false));
invite.account = intent.getStringExtra("account");
invite.account = intent.getStringExtra(EXTRA_ACCOUNT);
invite.forceDialog = intent.getBooleanExtra("force_dialog", false);
return invite.invite();
} else {
@ -857,8 +858,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
showJoinConferenceDialog(invite.getJid().asBareJid().toString());
return false;
}
} else if (contacts.size() == 0) { //TODO or init mode
//TODO if init mode; prefill dialog with account jid
} else if (contacts.size() == 0) {
showCreateContactDialog(invite.getJid().toString(), invite);
return false;
} else if (contacts.size() == 1) {

View file

@ -6,10 +6,10 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="?attr/dialog_vertical_padding"
android:paddingLeft="?attr/dialog_horizontal_padding"
android:paddingTop="?attr/dialog_vertical_padding"
android:paddingRight="?attr/dialog_horizontal_padding"
android:paddingTop="?attr/dialog_vertical_padding">
android:paddingBottom="?attr/dialog_vertical_padding">
<TextView
style="@style/InputLabel"
@ -35,8 +35,8 @@
style="@style/Widget.Conversations.EditText"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="textEmailAddress"
android:imeOptions="actionDone|flagNoExtractUi"/>
android:imeOptions="actionDone|flagNoExtractUi"
android:inputType="textEmailAddress" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
</layout>

View file

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2006 The Android Open Source Project
<?xml version="1.0" encoding="utf-8"?><!-- Copyright (C) 2006 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -18,8 +17,9 @@
android:id="@android:id/text1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="@style/TextAppearance.Conversations.Body1"
android:gravity="center_vertical"
android:minHeight="?android:attr/listPreferredItemHeightSmall"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:minHeight="?android:attr/listPreferredItemHeightSmall" />
android:textAppearance="@style/TextAppearance.Conversations.Body1"
android:textColor="?attr/edit_text_color" />