mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-16 04:39:54 +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_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_message_hint">Type message (optional)</string>
|
||||||
<string name="introduction_button">Make Introduction</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_error">There was an error making the introduction.</string>
|
||||||
<string name="introduction_response_error">Error when responding to introduction</string>
|
<string name="introduction_response_error">Error when responding to introduction</string>
|
||||||
<string name="introduction_warn_different_identities_title">Warning: Different Identities</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.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.support.design.widget.Snackbar;
|
||||||
import android.support.v4.app.ActivityCompat;
|
import android.support.v4.app.ActivityCompat;
|
||||||
import android.support.v4.app.ActivityOptionsCompat;
|
import android.support.v4.app.ActivityOptionsCompat;
|
||||||
import android.support.v4.content.ContextCompat;
|
import android.support.v4.content.ContextCompat;
|
||||||
@@ -80,6 +81,7 @@ import javax.inject.Inject;
|
|||||||
import de.hdodenhof.circleimageview.CircleImageView;
|
import de.hdodenhof.circleimageview.CircleImageView;
|
||||||
import im.delight.android.identicons.IdenticonDrawable;
|
import im.delight.android.identicons.IdenticonDrawable;
|
||||||
|
|
||||||
|
import static android.support.v4.app.ActivityOptionsCompat.makeCustomAnimation;
|
||||||
import static android.widget.Toast.LENGTH_SHORT;
|
import static android.widget.Toast.LENGTH_SHORT;
|
||||||
import static java.util.logging.Level.INFO;
|
import static java.util.logging.Level.INFO;
|
||||||
import static java.util.logging.Level.WARNING;
|
import static java.util.logging.Level.WARNING;
|
||||||
@@ -92,11 +94,12 @@ public class ConversationActivity extends BriarActivity
|
|||||||
|
|
||||||
private static final Logger LOG =
|
private static final Logger LOG =
|
||||||
Logger.getLogger(ConversationActivity.class.getName());
|
Logger.getLogger(ConversationActivity.class.getName());
|
||||||
|
private static final int REQUEST_CODE_INTRODUCTION = 1;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
AndroidNotificationManager notificationManager;
|
AndroidNotificationManager notificationManager;
|
||||||
@Inject
|
@Inject
|
||||||
protected ConnectionRegistry connectionRegistry;
|
ConnectionRegistry connectionRegistry;
|
||||||
@Inject
|
@Inject
|
||||||
@CryptoExecutor
|
@CryptoExecutor
|
||||||
protected Executor cryptoExecutor;
|
protected Executor cryptoExecutor;
|
||||||
@@ -182,6 +185,18 @@ public class ConversationActivity extends BriarActivity
|
|||||||
component.inject(this);
|
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
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
@@ -223,10 +238,11 @@ public class ConversationActivity extends BriarActivity
|
|||||||
Intent intent = new Intent(this, IntroductionActivity.class);
|
Intent intent = new Intent(this, IntroductionActivity.class);
|
||||||
intent.putExtra(IntroductionActivity.CONTACT_ID,
|
intent.putExtra(IntroductionActivity.CONTACT_ID,
|
||||||
contactId.getInt());
|
contactId.getInt());
|
||||||
ActivityOptionsCompat options = ActivityOptionsCompat
|
ActivityOptionsCompat options =
|
||||||
.makeCustomAnimation(this, android.R.anim.slide_in_left,
|
makeCustomAnimation(this, android.R.anim.slide_in_left,
|
||||||
android.R.anim.slide_out_right);
|
android.R.anim.slide_out_right);
|
||||||
ActivityCompat.startActivity(this, intent, options.toBundle());
|
ActivityCompat.startActivityForResult(this, intent,
|
||||||
|
REQUEST_CODE_INTRODUCTION, options.toBundle());
|
||||||
return true;
|
return true;
|
||||||
case R.id.action_social_remove_person:
|
case R.id.action_social_remove_person:
|
||||||
askToRemoveContact();
|
askToRemoveContact();
|
||||||
|
|||||||
@@ -85,11 +85,11 @@ public class IntroductionActivity extends BriarActivity implements
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getContactId() {
|
int getContactId() {
|
||||||
return contactId;
|
return contactId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showMessageScreen(View view, Contact c1, Contact c2) {
|
void showMessageScreen(View view, Contact c1, Contact c2) {
|
||||||
|
|
||||||
IntroductionMessageFragment messageFragment =
|
IntroductionMessageFragment messageFragment =
|
||||||
IntroductionMessageFragment
|
IntroductionMessageFragment
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import javax.inject.Inject;
|
|||||||
import de.hdodenhof.circleimageview.CircleImageView;
|
import de.hdodenhof.circleimageview.CircleImageView;
|
||||||
import im.delight.android.identicons.IdenticonDrawable;
|
import im.delight.android.identicons.IdenticonDrawable;
|
||||||
|
|
||||||
|
import static android.app.Activity.RESULT_OK;
|
||||||
import static android.view.View.GONE;
|
import static android.view.View.GONE;
|
||||||
import static android.view.View.VISIBLE;
|
import static android.view.View.VISIBLE;
|
||||||
import static android.widget.Toast.LENGTH_SHORT;
|
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
|
// disable button to prevent accidental double invitations
|
||||||
ui.button.setEnabled(false);
|
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
|
// don't wait for the introduction to be made before finishing activity
|
||||||
introductionActivity.hideSoftKeyboard(ui.message);
|
introductionActivity.hideSoftKeyboard(ui.message);
|
||||||
introductionActivity.finish();
|
introductionActivity.setResult(RESULT_OK);
|
||||||
|
introductionActivity.supportFinishAfterTransition();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void makeIntroduction(final Contact c1, final Contact c2,
|
private void makeIntroduction(final Contact c1, final Contact c2,
|
||||||
|
|||||||
Reference in New Issue
Block a user