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

@ -1,21 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
xmlns:app="http://schemas.android.com/apk/res-auto">
<LinearLayout
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"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/your_account"/>
android:text="@string/your_account" />
<Spinner
android:id="@+id/account"
@ -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.
@ -15,11 +14,12 @@
-->
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
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:paddingLeft="8dp"
android:paddingRight="8dp"
android:minHeight="?android:attr/listPreferredItemHeightSmall" />
android:id="@android:id/text1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:minHeight="?android:attr/listPreferredItemHeightSmall"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:textAppearance="@style/TextAppearance.Conversations.Body1"
android:textColor="?attr/edit_text_color" />