Hook up conversation screen

This commit is contained in:
Niels Andriesse 2019-06-07 13:27:48 +10:00
parent 0349978321
commit f22be7262b
4 changed files with 14 additions and 4 deletions

View File

@ -51,7 +51,6 @@
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginTop="20dp"
android:layout_gravity="center_horizontal"
android:background="@color/white"
android:textColor="@color/signal_primary"
android:text="@string/activity_key_pair_copy_button_title"

View File

@ -1534,9 +1534,11 @@
<string name="activity_settings_show_seed_button_title">Show Seed</string>
<string name="activity_settings_seed_dialog_title">Your Seed</string>
<string name="activity_settings_seed_dialog_copy_button_title">Copy</string>
<string name="activity_settings_seed_dialog_cancel_button_title">Cancel</string>
<string name="activity_settings_seed_dialog_ok_button_title">OK</string>
<string name="activity_settings_seed_copied_message">Copied to Clipboard</string>
<!-- Contact selection activity -->
<string name="activity_contact_selection_search_bar_placeholder">Search by name or public key</string>
<!-- New conversation activity -->
<string name="activity_new_conversation_invalid_public_key_message">Invalid Public Key</string>
</resources>

View File

@ -305,7 +305,7 @@ public class ApplicationPreferencesActivity extends PassphraseRequiredActionBarA
clipboard.setPrimaryClip(clip);
Toast.makeText(getContext(), R.string.activity_settings_seed_copied_message, Toast.LENGTH_SHORT).show();
})
.setNeutralButton(R.string.activity_settings_seed_dialog_cancel_button_title, null)
.setNeutralButton(R.string.activity_settings_seed_dialog_ok_button_title, null)
.show();
break;
default:

View File

@ -19,12 +19,14 @@ package org.thoughtcrime.securesms;
import android.content.Intent;
import android.os.Bundle;
import android.view.MenuItem;
import android.widget.Toast;
import org.thoughtcrime.securesms.conversation.ConversationActivity;
import org.thoughtcrime.securesms.database.Address;
import org.thoughtcrime.securesms.database.DatabaseFactory;
import org.thoughtcrime.securesms.database.ThreadDatabase;
import org.thoughtcrime.securesms.recipients.Recipient;
import org.whispersystems.signalservice.loki.utilities.PublicKeyValidation;
/**
* Activity container for starting a new conversation.
@ -46,7 +48,14 @@ public class NewConversationActivity extends ContactSelectionActivity {
@Override
public void onContactSelected(String number) {
Recipient recipient = Recipient.from(this, Address.fromExternal(this, number), true);
boolean isValid = PublicKeyValidation.isValid(number);
if (!isValid) {
Toast.makeText(this, R.string.activity_new_conversation_invalid_public_key_message, Toast.LENGTH_SHORT).show();
return;
}
Recipient recipient = Recipient.from(this, Address.fromSerialized(number), true);
Intent intent = new Intent(this, ConversationActivity.class);
intent.putExtra(ConversationActivity.ADDRESS_EXTRA, recipient.getAddress());