mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 02:39:05 +01:00
@@ -190,6 +190,7 @@
|
||||
<string name="introduction_message_text">You can compose a message that will be sent to %1$s and %2$s along with your introduction:</string>
|
||||
<string name="introduction_message_hint">Type message (optional)</string>
|
||||
<string name="introduction_button">Make Introduction</string>
|
||||
<string name="introduction_sent">Your introduction has been sent.</string>
|
||||
<string name="introduction_error">There was an error making the introduction.</string>
|
||||
<string name="introduction_response_error">Error when responding to introduction</string>
|
||||
<string name="introduction_warn_different_identities_title">Warning: Different Identities</string>
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.briarproject.android.contact;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.design.widget.Snackbar;
|
||||
import android.support.v4.app.ActivityCompat;
|
||||
import android.support.v4.app.ActivityOptionsCompat;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
@@ -80,6 +81,7 @@ import javax.inject.Inject;
|
||||
import de.hdodenhof.circleimageview.CircleImageView;
|
||||
import im.delight.android.identicons.IdenticonDrawable;
|
||||
|
||||
import static android.support.v4.app.ActivityOptionsCompat.makeCustomAnimation;
|
||||
import static android.widget.Toast.LENGTH_SHORT;
|
||||
import static java.util.logging.Level.INFO;
|
||||
import static java.util.logging.Level.WARNING;
|
||||
@@ -92,11 +94,12 @@ public class ConversationActivity extends BriarActivity
|
||||
|
||||
private static final Logger LOG =
|
||||
Logger.getLogger(ConversationActivity.class.getName());
|
||||
private static final int REQUEST_CODE_INTRODUCTION = 1;
|
||||
|
||||
@Inject
|
||||
AndroidNotificationManager notificationManager;
|
||||
@Inject
|
||||
protected ConnectionRegistry connectionRegistry;
|
||||
ConnectionRegistry connectionRegistry;
|
||||
@Inject
|
||||
@CryptoExecutor
|
||||
protected Executor cryptoExecutor;
|
||||
@@ -182,6 +185,18 @@ public class ConversationActivity extends BriarActivity
|
||||
component.inject(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int request, int result, Intent data) {
|
||||
super.onActivityResult(request, result, data);
|
||||
|
||||
if (request == REQUEST_CODE_INTRODUCTION && result == RESULT_OK) {
|
||||
Snackbar snackbar = Snackbar.make(list, R.string.introduction_sent,
|
||||
Snackbar.LENGTH_SHORT);
|
||||
snackbar.getView().setBackgroundResource(R.color.briar_primary);
|
||||
snackbar.show();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
@@ -223,10 +238,11 @@ public class ConversationActivity extends BriarActivity
|
||||
Intent intent = new Intent(this, IntroductionActivity.class);
|
||||
intent.putExtra(IntroductionActivity.CONTACT_ID,
|
||||
contactId.getInt());
|
||||
ActivityOptionsCompat options = ActivityOptionsCompat
|
||||
.makeCustomAnimation(this, android.R.anim.slide_in_left,
|
||||
ActivityOptionsCompat options =
|
||||
makeCustomAnimation(this, android.R.anim.slide_in_left,
|
||||
android.R.anim.slide_out_right);
|
||||
ActivityCompat.startActivity(this, intent, options.toBundle());
|
||||
ActivityCompat.startActivityForResult(this, intent,
|
||||
REQUEST_CODE_INTRODUCTION, options.toBundle());
|
||||
return true;
|
||||
case R.id.action_social_remove_person:
|
||||
askToRemoveContact();
|
||||
|
||||
@@ -85,11 +85,11 @@ public class IntroductionActivity extends BriarActivity implements
|
||||
}
|
||||
}
|
||||
|
||||
public int getContactId() {
|
||||
int getContactId() {
|
||||
return contactId;
|
||||
}
|
||||
|
||||
public void showMessageScreen(View view, Contact c1, Contact c2) {
|
||||
void showMessageScreen(View view, Contact c1, Contact c2) {
|
||||
|
||||
IntroductionMessageFragment messageFragment =
|
||||
IntroductionMessageFragment
|
||||
|
||||
@@ -29,6 +29,7 @@ import javax.inject.Inject;
|
||||
import de.hdodenhof.circleimageview.CircleImageView;
|
||||
import im.delight.android.identicons.IdenticonDrawable;
|
||||
|
||||
import static android.app.Activity.RESULT_OK;
|
||||
import static android.view.View.GONE;
|
||||
import static android.view.View.VISIBLE;
|
||||
import static android.widget.Toast.LENGTH_SHORT;
|
||||
@@ -170,7 +171,7 @@ public class IntroductionMessageFragment extends BaseFragment {
|
||||
});
|
||||
}
|
||||
|
||||
public void onButtonClick(final Contact c1, final Contact c2) {
|
||||
private void onButtonClick(final Contact c1, final Contact c2) {
|
||||
// disable button to prevent accidental double invitations
|
||||
ui.button.setEnabled(false);
|
||||
|
||||
@@ -179,7 +180,8 @@ public class IntroductionMessageFragment extends BaseFragment {
|
||||
|
||||
// don't wait for the introduction to be made before finishing activity
|
||||
introductionActivity.hideSoftKeyboard(ui.message);
|
||||
introductionActivity.finish();
|
||||
introductionActivity.setResult(RESULT_OK);
|
||||
introductionActivity.supportFinishAfterTransition();
|
||||
}
|
||||
|
||||
private void makeIntroduction(final Contact c1, final Contact c2,
|
||||
|
||||
Reference in New Issue
Block a user