|
|
|
@ -17,8 +17,6 @@
|
|
|
|
|
package org.thoughtcrime.securesms.conversation;
|
|
|
|
|
|
|
|
|
|
import android.Manifest;
|
|
|
|
|
import android.animation.Animator;
|
|
|
|
|
import android.animation.AnimatorListenerAdapter;
|
|
|
|
|
import android.annotation.SuppressLint;
|
|
|
|
|
import android.annotation.TargetApi;
|
|
|
|
|
import android.content.ActivityNotFoundException;
|
|
|
|
@ -58,9 +56,7 @@ import android.view.View.OnFocusChangeListener;
|
|
|
|
|
import android.view.View.OnKeyListener;
|
|
|
|
|
import android.view.WindowManager;
|
|
|
|
|
import android.view.inputmethod.EditorInfo;
|
|
|
|
|
import android.view.inputmethod.InputMethodManager;
|
|
|
|
|
import android.widget.Button;
|
|
|
|
|
import android.widget.EditText;
|
|
|
|
|
import android.widget.ImageButton;
|
|
|
|
|
import android.widget.ImageView;
|
|
|
|
|
import android.widget.ProgressBar;
|
|
|
|
@ -242,11 +238,11 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
|
|
|
|
public static final String LAST_SEEN_EXTRA = "last_seen";
|
|
|
|
|
public static final String STARTING_POSITION_EXTRA = "starting_position";
|
|
|
|
|
|
|
|
|
|
// private static final int PICK_GALLERY = 1;
|
|
|
|
|
// private static final int PICK_GALLERY = 1;
|
|
|
|
|
private static final int PICK_DOCUMENT = 2;
|
|
|
|
|
private static final int PICK_AUDIO = 3;
|
|
|
|
|
private static final int PICK_CONTACT = 4;
|
|
|
|
|
// private static final int GET_CONTACT_DETAILS = 5;
|
|
|
|
|
// private static final int GET_CONTACT_DETAILS = 5;
|
|
|
|
|
// private static final int GROUP_EDIT = 6;
|
|
|
|
|
private static final int TAKE_PHOTO = 7;
|
|
|
|
|
private static final int ADD_CONTACT = 8;
|
|
|
|
@ -261,7 +257,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
|
|
|
|
private ImageButton sendButton;
|
|
|
|
|
private ImageButton attachButton;
|
|
|
|
|
private ProfilePictureView profilePictureView;
|
|
|
|
|
private EditText titleTextView;
|
|
|
|
|
private TextView titleTextView;
|
|
|
|
|
private ConversationFragment fragment;
|
|
|
|
|
private Button unblockButton;
|
|
|
|
|
private Button makeDefaultSmsButton;
|
|
|
|
@ -274,7 +270,6 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
|
|
|
|
private ImageView muteIndicatorImageView;
|
|
|
|
|
private TextView subtitleTextView;
|
|
|
|
|
private View homeButtonContainer;
|
|
|
|
|
private View cancelButtonContainer;
|
|
|
|
|
|
|
|
|
|
private AttachmentTypeSelector attachmentTypeSelector;
|
|
|
|
|
private AttachmentManager attachmentManager;
|
|
|
|
@ -378,52 +373,6 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (isGroupConversation()) {
|
|
|
|
|
titleTextView.setEnabled(false);
|
|
|
|
|
} else {
|
|
|
|
|
titleTextView.setImeOptions(EditorInfo.IME_ACTION_DONE);
|
|
|
|
|
titleTextView.setOnEditorActionListener((v, actionId, event) -> {
|
|
|
|
|
if (actionId == EditorInfo.IME_ACTION_DONE) {
|
|
|
|
|
String nickname = v.getText().toString().trim();
|
|
|
|
|
SSKEnvironment.shared.getProfileManager().setDisplayName(this, getRecipient(), nickname);
|
|
|
|
|
v.clearFocus();
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
});
|
|
|
|
|
titleTextView.setOnFocusChangeListener((v, hasFocus) -> {
|
|
|
|
|
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
|
|
|
|
|
if (!hasFocus) {
|
|
|
|
|
EditText textView = (EditText) v;
|
|
|
|
|
if (textView.getText().toString().isEmpty()) {
|
|
|
|
|
textView.setText(getRecipient().getName());
|
|
|
|
|
}
|
|
|
|
|
imm.hideSoftInputFromWindow(v.getWindowToken(),0);
|
|
|
|
|
inputPanel.animate().alpha(1f).setListener(new AnimatorListenerAdapter() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onAnimationEnd(Animator animation) {
|
|
|
|
|
inputPanel.setVisibility(View.VISIBLE);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
cancelButtonContainer.setVisibility(View.GONE);
|
|
|
|
|
} else {
|
|
|
|
|
inputPanel.animate().alpha(0f).setListener(new AnimatorListenerAdapter() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onAnimationEnd(Animator animation) {
|
|
|
|
|
inputPanel.setVisibility(View.INVISIBLE);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
String nickname = DatabaseFactory.getStorage(this).getDisplayName(getRecipient().getAddress().serialize());
|
|
|
|
|
titleTextView.setText(nickname);
|
|
|
|
|
if (nickname != null) {
|
|
|
|
|
titleTextView.setSelection(nickname.length());
|
|
|
|
|
}
|
|
|
|
|
imm.showSoftInput(v, 0);
|
|
|
|
|
cancelButtonContainer.setVisibility(View.VISIBLE);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MentionManagerUtilities.INSTANCE.populateUserPublicKeyCacheIfNeeded(threadId, this);
|
|
|
|
|
|
|
|
|
|
OpenGroup publicChat = DatabaseFactory.getLokiThreadDatabase(this).getPublicChat(threadId);
|
|
|
|
@ -722,14 +671,10 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
|
|
|
|
if (isSingleConversation() && getRecipient().getContactUri() == null) {
|
|
|
|
|
inflater.inflate(R.menu.conversation_add_to_contacts, menu);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (recipient != null && recipient.isLocalNumber()) {
|
|
|
|
|
if (isSecureText) menu.findItem(R.id.menu_call_secure).setVisible(false);
|
|
|
|
|
else menu.findItem(R.id.menu_call_insecure).setVisible(false);
|
|
|
|
|
|
|
|
|
|
MenuItem muteItem = menu.findItem(R.id.menu_mute_notifications);
|
|
|
|
|
|
|
|
|
|
if (muteItem != null) {
|
|
|
|
|
muteItem.setVisible(false);
|
|
|
|
|
}
|
|
|
|
@ -1142,7 +1087,6 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
|
|
|
|
/* Loki - We don't support SMS
|
|
|
|
|
if (!isSecureText && !isPushGroupConversation()) sendButton.disableTransport(Type.TEXTSECURE);
|
|
|
|
|
if (recipient.isPushGroupRecipient()) sendButton.disableTransport(Type.SMS);
|
|
|
|
|
|
|
|
|
|
if (!recipient.isPushGroupRecipient() && recipient.isForceSmsSelection()) {
|
|
|
|
|
sendButton.setDefaultTransport(Type.SMS);
|
|
|
|
|
} else {
|
|
|
|
@ -1314,7 +1258,6 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
|
|
|
|
muteIndicatorImageView = ViewUtil.findById(this, R.id.muteIndicatorImageView);
|
|
|
|
|
subtitleTextView = ViewUtil.findById(this, R.id.subtitleTextView);
|
|
|
|
|
homeButtonContainer = ViewUtil.findById(this, R.id.homeButtonContainer);
|
|
|
|
|
cancelButtonContainer = ViewUtil.findById(this, R.id.cancelButtonContainer);
|
|
|
|
|
|
|
|
|
|
ImageButton quickCameraToggle = ViewUtil.findById(this, R.id.quick_camera_toggle);
|
|
|
|
|
ImageButton inlineAttachmentButton = ViewUtil.findById(this, R.id.inline_attachment_button);
|
|
|
|
@ -1360,12 +1303,6 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
|
|
|
|
inlineAttachmentButton.setOnClickListener(v -> handleAddAttachment());
|
|
|
|
|
|
|
|
|
|
homeButtonContainer.setOnClickListener(v -> onSupportNavigateUp());
|
|
|
|
|
|
|
|
|
|
cancelButtonContainer.setOnClickListener(v -> {
|
|
|
|
|
titleTextView.setText("");
|
|
|
|
|
SSKEnvironment.shared.getProfileManager().setDisplayName(this, getRecipient(), "");
|
|
|
|
|
titleTextView.clearFocus();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void initializeActionBar() {
|
|
|
|
@ -2382,8 +2319,9 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
|
|
|
|
} else if (recipient.getAddress().toString().toLowerCase().equals(userPublicKey)) {
|
|
|
|
|
titleTextView.setText(getResources().getString(R.string.note_to_self));
|
|
|
|
|
} else {
|
|
|
|
|
boolean hasName = (recipient.getName() != null && !recipient.getName().isEmpty());
|
|
|
|
|
titleTextView.setText(hasName ? recipient.getName() : recipient.getAddress().toString());
|
|
|
|
|
String displayName = SSKEnvironment.shared.getProfileManager().getDisplayName(getApplicationContext(), recipient);
|
|
|
|
|
boolean hasName = displayName != null;
|
|
|
|
|
titleTextView.setText(hasName ? displayName : recipient.getAddress().toString());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|