mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
Merge pull request #3785 from deltachat/adb/integrated-videocalls
Android calls UI
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
* properly display "Messages are end-to-end encrypted." in all encrypted groups
|
||||
* show dialog if user has permanently denied camera permission and tries to take picture for group avatar
|
||||
* several small fixes and improvements
|
||||
* add experimental built-in calls
|
||||
* update to core 2.17.0
|
||||
|
||||
## v2.11.0
|
||||
|
||||
@@ -735,12 +735,6 @@ JNIEXPORT jint Java_com_b44t_messenger_DcContext_sendTextMsg(JNIEnv *env, jobjec
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jint Java_com_b44t_messenger_DcContext_sendVideochatInvitation(JNIEnv *env, jobject obj, jint chat_id)
|
||||
{
|
||||
return (jint)dc_send_videochat_invitation(get_dc_context(env, obj), chat_id);
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jboolean Java_com_b44t_messenger_DcContext_sendWebxdcStatusUpdate(JNIEnv *env, jobject obj, jint msg_id, jstring payload)
|
||||
{
|
||||
CHAR_REF(payload);
|
||||
@@ -1609,21 +1603,6 @@ JNIEXPORT jstring Java_com_b44t_messenger_DcMsg_getSetupCodeBegin(JNIEnv *env, j
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jstring Java_com_b44t_messenger_DcMsg_getVideochatUrl(JNIEnv *env, jobject obj)
|
||||
{
|
||||
char* temp = dc_msg_get_videochat_url(get_dc_msg(env, obj));
|
||||
jstring ret = JSTRING_NEW(temp);
|
||||
dc_str_unref(temp);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jint Java_com_b44t_messenger_DcMsg_getVideochatType(JNIEnv *env, jobject obj)
|
||||
{
|
||||
return (jint)dc_msg_get_videochat_type(get_dc_msg(env, obj));
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT void Java_com_b44t_messenger_DcMsg_setText(JNIEnv *env, jobject obj, jstring text)
|
||||
{
|
||||
CHAR_REF(text);
|
||||
|
||||
@@ -371,6 +371,13 @@
|
||||
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize">
|
||||
</activity>
|
||||
|
||||
<activity android:name=".calls.CallActivity"
|
||||
android:label=""
|
||||
android:theme="@style/TextSecure.LightTheme"
|
||||
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize|uiMode"
|
||||
android:exported="true">
|
||||
</activity>
|
||||
|
||||
<activity android:name=".WebxdcActivity"
|
||||
android:label=""
|
||||
android:theme="@style/TextSecure.LightTheme"
|
||||
@@ -430,6 +437,14 @@
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<receiver android:name=".notifications.DeclineCallReceiver"
|
||||
android:enabled="true"
|
||||
android:exported="false">
|
||||
<intent-filter>
|
||||
<action android:name="org.thoughtcrime.securesms.notifications.DECLINE_CALL_NOTICED"/>
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<receiver android:name=".notifications.RemoteReplyReceiver"
|
||||
android:enabled="true"
|
||||
android:exported="false">
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -31,6 +31,10 @@ public class DcContext {
|
||||
public final static int DC_EVENT_WEBXDC_INSTANCE_DELETED = 2121;
|
||||
public final static int DC_EVENT_WEBXDC_REALTIME_DATA = 2150;
|
||||
public final static int DC_EVENT_ACCOUNTS_BACKGROUND_FETCH_DONE = 2200;
|
||||
public final static int DC_EVENT_INCOMING_CALL = 2550;
|
||||
public final static int DC_EVENT_INCOMING_CALL_ACCEPTED = 2560;
|
||||
public final static int DC_EVENT_OUTGOING_CALL_ACCEPTED = 2570;
|
||||
public final static int DC_EVENT_CALL_ENDED = 2580;
|
||||
|
||||
public final static int DC_IMEX_EXPORT_SELF_KEYS = 1;
|
||||
public final static int DC_IMEX_IMPORT_SELF_KEYS = 2;
|
||||
@@ -199,7 +203,6 @@ public class DcContext {
|
||||
public native boolean resendMsgs (int msg_ids[]);
|
||||
public native int sendMsg (int chat_id, DcMsg msg);
|
||||
public native int sendTextMsg (int chat_id, String text);
|
||||
public native int sendVideochatInvitation(int chat_id);
|
||||
public native boolean sendWebxdcStatusUpdate(int msg_id, String payload);
|
||||
public native String getWebxdcStatusUpdates(int msg_id, int last_known_serial);
|
||||
public native void setWebxdcIntegration (String file);
|
||||
|
||||
@@ -18,7 +18,7 @@ public class DcMsg {
|
||||
public final static int DC_MSG_VOICE = 41;
|
||||
public final static int DC_MSG_VIDEO = 50;
|
||||
public final static int DC_MSG_FILE = 60;
|
||||
public final static int DC_MSG_VIDEOCHAT_INVITATION = 70;
|
||||
public final static int DC_MSG_CALL = 71;
|
||||
public final static int DC_MSG_WEBXDC = 80;
|
||||
public final static int DC_MSG_VCARD = 90;
|
||||
|
||||
@@ -154,8 +154,6 @@ public class DcMsg {
|
||||
public native boolean isInfo ();
|
||||
public native boolean hasHtml ();
|
||||
public native String getSetupCodeBegin ();
|
||||
public native String getVideochatUrl ();
|
||||
public native int getVideochatType ();
|
||||
public native void setText (String text);
|
||||
public native void setFileAndDeduplicate(String file, String name, String filemime);
|
||||
public native void setDimension (int width, int height);
|
||||
@@ -191,7 +189,7 @@ public class DcMsg {
|
||||
|
||||
public boolean canSave() {
|
||||
// saving info-messages out of context results in confusion, see https://github.com/deltachat/deltachat-ios/issues/2567
|
||||
return !isInfo() && getType() != DC_MSG_VIDEOCHAT_INVITATION;
|
||||
return !isInfo();
|
||||
}
|
||||
|
||||
public File getFileAsFile() {
|
||||
|
||||
@@ -117,7 +117,7 @@ import org.thoughtcrime.securesms.util.concurrent.AssertedSuccessListener;
|
||||
import org.thoughtcrime.securesms.util.guava.Optional;
|
||||
import org.thoughtcrime.securesms.util.views.ProgressDialog;
|
||||
import org.thoughtcrime.securesms.video.recode.VideoRecoder;
|
||||
import org.thoughtcrime.securesms.videochat.VideochatUtil;
|
||||
import org.thoughtcrime.securesms.calls.CallUtil;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
@@ -444,6 +444,14 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
||||
menu.findItem(R.id.menu_show_map).setVisible(false);
|
||||
}
|
||||
|
||||
menu.findItem(R.id.menu_start_call).setVisible(
|
||||
Prefs.isCallsEnabled(this)
|
||||
&& dcChat.canSend()
|
||||
&& dcChat.isEncrypted()
|
||||
&& !dcChat.isSelfTalk()
|
||||
&& !dcChat.isMultiUser()
|
||||
);
|
||||
|
||||
if (!dcChat.isEncrypted() || !dcChat.canSend() || dcChat.isMailingList() ) {
|
||||
menu.findItem(R.id.menu_ephemeral_messages).setVisible(false);
|
||||
}
|
||||
@@ -534,6 +542,9 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
||||
} else if (itemId == R.id.menu_show_map) {
|
||||
WebxdcActivity.openMaps(this, chatId);
|
||||
return true;
|
||||
} else if (itemId == R.id.menu_start_call) {
|
||||
CallUtil.startCall(this, chatId);
|
||||
return true;
|
||||
} else if (itemId == R.id.menu_all_media) {
|
||||
handleAllMedia();
|
||||
return true;
|
||||
@@ -967,8 +978,6 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
||||
AttachmentManager.selectGallery(this, PICK_GALLERY); break;
|
||||
case AttachmentTypeSelector.ADD_DOCUMENT:
|
||||
AttachmentManager.selectDocument(this, PICK_DOCUMENT); break;
|
||||
case AttachmentTypeSelector.INVITE_VIDEO_CHAT:
|
||||
new VideochatUtil().invite(this, chatId); break;
|
||||
case AttachmentTypeSelector.ADD_CONTACT_INFO:
|
||||
startContactChooserActivity(); break;
|
||||
case AttachmentTypeSelector.ADD_LOCATION:
|
||||
@@ -1458,7 +1467,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
||||
Recipient author = new Recipient(this, dcContext.getContact(msg.getFromId()));
|
||||
|
||||
SlideDeck slideDeck = new SlideDeck();
|
||||
if (msg.getType() != DcMsg.DC_MSG_TEXT) {
|
||||
if (msg.hasFile()) {
|
||||
slideDeck.addSlide(MediaUtil.getSlideForMsg(this, msg));
|
||||
}
|
||||
|
||||
|
||||
@@ -77,9 +77,8 @@ public class ConversationAdapter <V extends View & BindableConversationItem>
|
||||
private static final int MESSAGE_TYPE_THUMBNAIL_INCOMING = 6;
|
||||
private static final int MESSAGE_TYPE_DOCUMENT_OUTGOING = 7;
|
||||
private static final int MESSAGE_TYPE_DOCUMENT_INCOMING = 8;
|
||||
private static final int MESSAGE_TYPE_VIDEOCHAT_INVITE = 9;
|
||||
private static final int MESSAGE_TYPE_STICKER_INCOMING = 10;
|
||||
private static final int MESSAGE_TYPE_STICKER_OUTGOING = 11;
|
||||
private static final int MESSAGE_TYPE_STICKER_INCOMING = 9;
|
||||
private static final int MESSAGE_TYPE_STICKER_OUTGOING = 10;
|
||||
|
||||
private final Set<DcMsg> batchSelected = Collections.synchronizedSet(new HashSet<DcMsg>());
|
||||
|
||||
@@ -279,7 +278,6 @@ public class ConversationAdapter <V extends View & BindableConversationItem>
|
||||
case MESSAGE_TYPE_STICKER_INCOMING:
|
||||
case MESSAGE_TYPE_INCOMING: return R.layout.conversation_item_received;
|
||||
case MESSAGE_TYPE_INFO: return R.layout.conversation_item_update;
|
||||
case MESSAGE_TYPE_VIDEOCHAT_INVITE:return R.layout.conversation_item_videochat;
|
||||
default: throw new IllegalArgumentException("unsupported item view type given to ConversationAdapter");
|
||||
}
|
||||
}
|
||||
@@ -303,9 +301,6 @@ public class ConversationAdapter <V extends View & BindableConversationItem>
|
||||
else if (type == DcMsg.DC_MSG_STICKER) {
|
||||
return dcMsg.isOutgoing()? MESSAGE_TYPE_STICKER_OUTGOING : MESSAGE_TYPE_STICKER_INCOMING;
|
||||
}
|
||||
else if (type == DcMsg.DC_MSG_VIDEOCHAT_INVITATION) {
|
||||
return MESSAGE_TYPE_VIDEOCHAT_INVITE;
|
||||
}
|
||||
else {
|
||||
return dcMsg.isOutgoing()? MESSAGE_TYPE_OUTGOING : MESSAGE_TYPE_INCOMING;
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ import org.thoughtcrime.securesms.util.StickyHeaderDecoration;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
import org.thoughtcrime.securesms.util.ViewUtil;
|
||||
import org.thoughtcrime.securesms.util.views.ConversationAdaptiveActionsToolbar;
|
||||
import org.thoughtcrime.securesms.videochat.VideochatUtil;
|
||||
import org.thoughtcrime.securesms.calls.CallUtil;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedList;
|
||||
@@ -362,11 +362,11 @@ public class ConversationFragment extends MessageSelectorFragment
|
||||
}
|
||||
|
||||
static boolean canReplyToMsg(DcMsg dcMsg) {
|
||||
return !dcMsg.isInfo() && dcMsg.getType() != DcMsg.DC_MSG_VIDEOCHAT_INVITATION;
|
||||
return !dcMsg.isInfo();
|
||||
}
|
||||
|
||||
static boolean canEditMsg(DcMsg dcMsg) {
|
||||
return dcMsg.isOutgoing() && !dcMsg.isInfo() && dcMsg.getType() != DcMsg.DC_MSG_VIDEOCHAT_INVITATION && !dcMsg.hasHtml() && !dcMsg.getText().isEmpty();
|
||||
return dcMsg.isOutgoing() && !dcMsg.isInfo() && dcMsg.getType() != DcMsg.DC_MSG_CALL && !dcMsg.hasHtml() && !dcMsg.getText().isEmpty();
|
||||
}
|
||||
|
||||
public void handleClearChat() {
|
||||
@@ -738,9 +738,6 @@ public class ConversationFragment extends MessageSelectorFragment
|
||||
actionMode.setTitleOptionalHint(false); // the title represents important information, also indicating implicitly, more items can be selected
|
||||
}
|
||||
}
|
||||
else if (messageRecord.getType()==DcMsg.DC_MSG_VIDEOCHAT_INVITATION) {
|
||||
new VideochatUtil().join(getActivity(), messageRecord.getId());
|
||||
}
|
||||
else if(DozeReminder.isDozeReminderMsg(getContext(), messageRecord)) {
|
||||
DozeReminder.dozeReminderTapped(getContext());
|
||||
}
|
||||
|
||||
@@ -45,6 +45,7 @@ import org.thoughtcrime.securesms.audio.AudioSlidePlayer;
|
||||
import org.thoughtcrime.securesms.components.AudioView;
|
||||
import org.thoughtcrime.securesms.components.AvatarImageView;
|
||||
import org.thoughtcrime.securesms.components.BorderlessImageView;
|
||||
import org.thoughtcrime.securesms.components.CallItemView;
|
||||
import org.thoughtcrime.securesms.components.ConversationItemFooter;
|
||||
import org.thoughtcrime.securesms.components.ConversationItemThumbnail;
|
||||
import org.thoughtcrime.securesms.components.DocumentView;
|
||||
@@ -69,11 +70,14 @@ import org.thoughtcrime.securesms.util.MediaUtil;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
import org.thoughtcrime.securesms.util.ViewUtil;
|
||||
import org.thoughtcrime.securesms.util.views.Stub;
|
||||
import org.thoughtcrime.securesms.calls.CallUtil;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import chat.delta.rpc.RpcException;
|
||||
import chat.delta.rpc.types.CallInfo;
|
||||
import chat.delta.rpc.types.CallState;
|
||||
import chat.delta.rpc.types.Reactions;
|
||||
import chat.delta.rpc.types.VcardContact;
|
||||
|
||||
@@ -118,6 +122,7 @@ public class ConversationItem extends BaseConversationItem
|
||||
private @NonNull Stub<WebxdcView> webxdcViewStub;
|
||||
private Stub<BorderlessImageView> stickerStub;
|
||||
private Stub<VcardView> vcardViewStub;
|
||||
private Stub<CallItemView> callViewStub;
|
||||
private @Nullable EventListener eventListener;
|
||||
|
||||
private int measureCalls;
|
||||
@@ -152,6 +157,7 @@ public class ConversationItem extends BaseConversationItem
|
||||
this.webxdcViewStub = new Stub<>(findViewById(R.id.webxdc_view_stub));
|
||||
this.stickerStub = new Stub<>(findViewById(R.id.sticker_view_stub));
|
||||
this.vcardViewStub = new Stub<>(findViewById(R.id.vcard_view_stub));
|
||||
this.callViewStub = new Stub<>(findViewById(R.id.call_view_stub));
|
||||
this.groupSenderHolder = findViewById(R.id.group_sender_holder);
|
||||
this.quoteView = findViewById(R.id.quote_view);
|
||||
this.container = findViewById(R.id.container);
|
||||
@@ -322,6 +328,11 @@ public class ConversationItem extends BaseConversationItem
|
||||
vcardViewStub.get().setFocusable(!shouldInterceptClicks(messageRecord) && batchSelected.isEmpty());
|
||||
vcardViewStub.get().setClickable(batchSelected.isEmpty());
|
||||
}
|
||||
|
||||
if (callViewStub.resolved()) {
|
||||
callViewStub.get().setFocusable(!shouldInterceptClicks(messageRecord) && batchSelected.isEmpty());
|
||||
callViewStub.get().setClickable(batchSelected.isEmpty());
|
||||
}
|
||||
}
|
||||
|
||||
private void setContentDescription() {
|
||||
@@ -338,6 +349,8 @@ public class ConversationItem extends BaseConversationItem
|
||||
desc += webxdcViewStub.get().getDescription() + "\n";
|
||||
} else if (vcardViewStub.resolved() && vcardViewStub.get().getVisibility() == View.VISIBLE) {
|
||||
desc += vcardViewStub.get().getDescription() + "\n";
|
||||
} else if (callViewStub.resolved() && callViewStub.get().getVisibility() == View.VISIBLE) {
|
||||
desc += callViewStub.get().getDescription() + "\n";
|
||||
} else if (mediaThumbnailStub.resolved() && mediaThumbnailStub.get().getVisibility() == View.VISIBLE) {
|
||||
desc += mediaThumbnailStub.get().getDescription() + "\n";
|
||||
} else if (stickerStub.resolved() && stickerStub.get().getVisibility() == View.VISIBLE) {
|
||||
@@ -399,7 +412,7 @@ public class ConversationItem extends BaseConversationItem
|
||||
|
||||
String text = messageRecord.getText();
|
||||
|
||||
if (text.isEmpty()) {
|
||||
if (messageRecord.getType() == DcMsg.DC_MSG_CALL || text.isEmpty()) {
|
||||
bodyText.setVisibility(View.GONE);
|
||||
}
|
||||
else {
|
||||
@@ -490,6 +503,7 @@ public class ConversationItem extends BaseConversationItem
|
||||
if (webxdcViewStub.resolved()) webxdcViewStub.get().setVisibility(View.GONE);
|
||||
if (stickerStub.resolved()) stickerStub.get().setVisibility(View.GONE);
|
||||
if (vcardViewStub.resolved()) vcardViewStub.get().setVisibility(View.GONE);
|
||||
if (callViewStub.resolved()) callViewStub.get().setVisibility(View.GONE);
|
||||
|
||||
//noinspection ConstantConditions
|
||||
int duration = messageRecord.getDuration();
|
||||
@@ -515,6 +529,7 @@ public class ConversationItem extends BaseConversationItem
|
||||
if (webxdcViewStub.resolved()) webxdcViewStub.get().setVisibility(View.GONE);
|
||||
if (stickerStub.resolved()) stickerStub.get().setVisibility(View.GONE);
|
||||
if (vcardViewStub.resolved()) vcardViewStub.get().setVisibility(View.GONE);
|
||||
if (callViewStub.resolved()) callViewStub.get().setVisibility(View.GONE);
|
||||
|
||||
//noinspection ConstantConditions
|
||||
documentViewStub.get().setDocument(new DocumentSlide(context, messageRecord));
|
||||
@@ -533,6 +548,7 @@ public class ConversationItem extends BaseConversationItem
|
||||
if (documentViewStub.resolved()) documentViewStub.get().setVisibility(View.GONE);
|
||||
if (stickerStub.resolved()) stickerStub.get().setVisibility(View.GONE);
|
||||
if (vcardViewStub.resolved()) vcardViewStub.get().setVisibility(View.GONE);
|
||||
if (callViewStub.resolved()) callViewStub.get().setVisibility(View.GONE);
|
||||
|
||||
webxdcViewStub.get().setWebxdc(messageRecord, context.getString(R.string.webxdc_app));
|
||||
webxdcViewStub.get().setWebxdcClickListener(new ThumbnailClickListener());
|
||||
@@ -550,6 +566,7 @@ public class ConversationItem extends BaseConversationItem
|
||||
if (documentViewStub.resolved()) documentViewStub.get().setVisibility(View.GONE);
|
||||
if (webxdcViewStub.resolved()) webxdcViewStub.get().setVisibility(View.GONE);
|
||||
if (stickerStub.resolved()) stickerStub.get().setVisibility(View.GONE);
|
||||
if (callViewStub.resolved()) callViewStub.get().setVisibility(View.GONE);
|
||||
|
||||
vcardViewStub.get().setVcard(glideRequests, new VcardSlide(context, messageRecord), rpc);
|
||||
vcardViewStub.get().setVcardClickListener(new ThumbnailClickListener());
|
||||
@@ -561,6 +578,27 @@ public class ConversationItem extends BaseConversationItem
|
||||
ViewUtil.updateLayoutParams(groupSenderHolder, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
footer.setVisibility(VISIBLE);
|
||||
}
|
||||
else if (messageRecord.getType() == DcMsg.DC_MSG_CALL) {
|
||||
callViewStub.get().setVisibility(View.VISIBLE);
|
||||
if (mediaThumbnailStub.resolved()) mediaThumbnailStub.get().setVisibility(View.GONE);
|
||||
if (audioViewStub.resolved()) audioViewStub.get().setVisibility(View.GONE);
|
||||
if (documentViewStub.resolved()) documentViewStub.get().setVisibility(View.GONE);
|
||||
if (webxdcViewStub.resolved()) webxdcViewStub.get().setVisibility(View.GONE);
|
||||
if (stickerStub.resolved()) stickerStub.get().setVisibility(View.GONE);
|
||||
if (vcardViewStub.resolved()) vcardViewStub.get().setVisibility(View.GONE);
|
||||
|
||||
try {
|
||||
callViewStub.get().setCallItem(messageRecord.isOutgoing(), rpc.callInfo(dcContext.getAccountId(), messageRecord.getId()));
|
||||
} catch (RpcException e) {
|
||||
Log.e(TAG, "Error in Rpc.callInfo", e);
|
||||
}
|
||||
callViewStub.get().setCallClickListener(new CallClickListener());
|
||||
callViewStub.get().setOnLongClickListener(passthroughClickListener);
|
||||
|
||||
callViewStub.get().setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS);
|
||||
|
||||
ViewUtil.updateLayoutParams(groupSenderHolder, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
}
|
||||
else if (hasThumbnail(messageRecord)) {
|
||||
mediaThumbnailStub.get().setVisibility(View.VISIBLE);
|
||||
if (audioViewStub.resolved()) audioViewStub.get().setVisibility(View.GONE);
|
||||
@@ -568,6 +606,7 @@ public class ConversationItem extends BaseConversationItem
|
||||
if (webxdcViewStub.resolved()) webxdcViewStub.get().setVisibility(View.GONE);
|
||||
if (stickerStub.resolved()) stickerStub.get().setVisibility(View.GONE);
|
||||
if (vcardViewStub.resolved()) vcardViewStub.get().setVisibility(View.GONE);
|
||||
if (callViewStub.resolved()) callViewStub.get().setVisibility(View.GONE);
|
||||
|
||||
Slide slide = MediaUtil.getSlideForMsg(context, messageRecord);
|
||||
|
||||
@@ -607,6 +646,7 @@ public class ConversationItem extends BaseConversationItem
|
||||
if (webxdcViewStub.resolved()) webxdcViewStub.get().setVisibility(View.GONE);
|
||||
if (mediaThumbnailStub.resolved()) mediaThumbnailStub.get().setVisibility(View.GONE);
|
||||
if (vcardViewStub.resolved()) vcardViewStub.get().setVisibility(View.GONE);
|
||||
if (callViewStub.resolved()) callViewStub.get().setVisibility(View.GONE);
|
||||
|
||||
bodyBubble.setBackgroundColor(Color.TRANSPARENT);
|
||||
|
||||
@@ -627,6 +667,7 @@ public class ConversationItem extends BaseConversationItem
|
||||
if (documentViewStub.resolved()) documentViewStub.get().setVisibility(View.GONE);
|
||||
if (webxdcViewStub.resolved()) webxdcViewStub.get().setVisibility(View.GONE);
|
||||
if (vcardViewStub.resolved()) vcardViewStub.get().setVisibility(View.GONE);
|
||||
if (callViewStub.resolved()) callViewStub.get().setVisibility(View.GONE);
|
||||
|
||||
ViewUtil.updateLayoutParams(bodyText, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
ViewUtil.updateLayoutParams(groupSenderHolder, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
@@ -780,6 +821,8 @@ public class ConversationItem extends BaseConversationItem
|
||||
return stickerStub.get().getFooter();
|
||||
} else if (hasOnlyThumbnail(messageRecord) && TextUtils.isEmpty(messageRecord.getText())) {
|
||||
return mediaThumbnailStub.get().getFooter();
|
||||
} else if (messageRecord.getType() == DcMsg.DC_MSG_CALL) {
|
||||
return callViewStub.get().getFooter();
|
||||
} else {
|
||||
return footer;
|
||||
}
|
||||
@@ -881,6 +924,7 @@ public class ConversationItem extends BaseConversationItem
|
||||
else if (documentViewStub.resolved()) documentViewStub.get().performClick();
|
||||
else if (webxdcViewStub.resolved()) webxdcViewStub.get().performClick();
|
||||
else if (vcardViewStub.resolved()) vcardViewStub.get().performClick();
|
||||
else if (callViewStub.resolved()) callViewStub.get().performClick();
|
||||
}
|
||||
|
||||
/// Event handlers
|
||||
@@ -942,4 +986,21 @@ public class ConversationItem extends BaseConversationItem
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class CallClickListener implements CallItemView.CallClickListener {
|
||||
public void onClick(final View v, final CallInfo callInfo) {
|
||||
if (shouldInterceptClicks(messageRecord) || !batchSelected.isEmpty()) {
|
||||
performClick();
|
||||
} else {
|
||||
int accId = dcContext.getAccountId();
|
||||
int chatId = messageRecord.getChatId();
|
||||
if (!messageRecord.isOutgoing() && callInfo.state instanceof CallState.Alerting) {
|
||||
int callId = messageRecord.getId();
|
||||
CallUtil.openCall(getContext(), accId, chatId, callId, callInfo.sdpOffer);
|
||||
} else {
|
||||
CallUtil.startCall(getContext(), accId, chatId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,99 +0,0 @@
|
||||
package org.thoughtcrime.securesms;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.b44t.messenger.DcChat;
|
||||
import com.b44t.messenger.DcContact;
|
||||
import com.b44t.messenger.DcContext;
|
||||
import com.b44t.messenger.DcMsg;
|
||||
|
||||
import org.thoughtcrime.securesms.components.AvatarImageView;
|
||||
import org.thoughtcrime.securesms.components.ConversationItemFooter;
|
||||
import org.thoughtcrime.securesms.connect.DcHelper;
|
||||
import org.thoughtcrime.securesms.mms.GlideRequests;
|
||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
import org.thoughtcrime.securesms.util.ViewUtil;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
public class ConversationVideochatItem extends LinearLayout
|
||||
implements BindableConversationItem
|
||||
{
|
||||
private TextView body;
|
||||
private ConversationItemFooter footer;
|
||||
private AvatarImageView contactPhoto;
|
||||
private ViewGroup contactPhotoHolder;
|
||||
private DcMsg dcMsg;
|
||||
|
||||
public ConversationVideochatItem(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public ConversationVideochatItem(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinishInflate() {
|
||||
super.onFinishInflate();
|
||||
this.body = findViewById(R.id.conversation_update_body);
|
||||
this.footer = findViewById(R.id.conversation_item_footer);
|
||||
this.contactPhoto = findViewById(R.id.contact_photo);
|
||||
this.contactPhotoHolder = findViewById(R.id.contact_photo_container);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bind(@NonNull DcMsg dcMsg,
|
||||
@NonNull DcChat dcChat,
|
||||
@NonNull GlideRequests glideRequests,
|
||||
@NonNull Set<DcMsg> batchSelected,
|
||||
@NonNull Recipient conversationRecipient,
|
||||
boolean pulseUpdate)
|
||||
{
|
||||
this.dcMsg = dcMsg;
|
||||
DcContext dcContext = DcHelper.getContext(getContext());
|
||||
DcContact dcContact = dcContext.getContact(dcMsg.getFromId());
|
||||
|
||||
CharSequence line1 = dcMsg.isOutgoing()? getContext().getString(R.string.videochat_you_invited_hint) :
|
||||
getContext().getString(R.string.videochat_contact_invited_hint, dcContact.getDisplayName());
|
||||
CharSequence line2 = Util.getBoldedString(dcMsg.isOutgoing()? getContext().getString(R.string.videochat_tap_to_open) :
|
||||
getContext().getString(R.string.videochat_tap_to_join));
|
||||
|
||||
body.setText(TextUtils.concat(line1, "\n", line2));
|
||||
|
||||
contactPhoto.setAvatar(glideRequests, new Recipient(getContext(), dcContact), true);
|
||||
|
||||
setSelected(batchSelected.contains(dcMsg));
|
||||
setFooter(dcMsg);
|
||||
}
|
||||
|
||||
private void setFooter(@NonNull DcMsg dcMsg) {
|
||||
ViewUtil.updateLayoutParams(footer, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
|
||||
|
||||
footer.setVisibility(VISIBLE);
|
||||
footer.setMessageRecord(dcMsg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEventListener(@Nullable EventListener listener) {
|
||||
// No events to report yet
|
||||
}
|
||||
|
||||
@Override
|
||||
public DcMsg getMessageRecord() {
|
||||
return dcMsg;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unbind() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,203 @@
|
||||
package org.thoughtcrime.securesms.calls;
|
||||
|
||||
import android.Manifest;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Base64;
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
import android.webkit.JavascriptInterface;
|
||||
import android.webkit.PermissionRequest;
|
||||
import android.webkit.WebChromeClient;
|
||||
import android.webkit.WebSettings;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.b44t.messenger.DcChat;
|
||||
import com.b44t.messenger.DcContext;
|
||||
import com.b44t.messenger.DcEvent;
|
||||
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.WebViewActivity;
|
||||
import org.thoughtcrime.securesms.connect.DcEventCenter;
|
||||
import org.thoughtcrime.securesms.connect.DcHelper;
|
||||
import org.thoughtcrime.securesms.permissions.Permissions;
|
||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
import org.thoughtcrime.securesms.util.AvatarUtil;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Objects;
|
||||
|
||||
import chat.delta.rpc.Rpc;
|
||||
import chat.delta.rpc.RpcException;
|
||||
|
||||
public class CallActivity extends WebViewActivity implements DcEventCenter.DcEventDelegate {
|
||||
private static final String TAG = CallActivity.class.getSimpleName();
|
||||
|
||||
public static final String EXTRA_ACCOUNT_ID = "acc_id";
|
||||
public static final String EXTRA_CHAT_ID = "chat_id";
|
||||
public static final String EXTRA_CALL_ID = "call_id";
|
||||
public static final String EXTRA_HASH = "hash";
|
||||
|
||||
private DcContext dcContext;
|
||||
private Rpc rpc;
|
||||
private int accId;
|
||||
private int chatId;
|
||||
private int callId;
|
||||
private boolean ended = false;
|
||||
|
||||
@SuppressLint("SetJavaScriptEnabled")
|
||||
@Override
|
||||
protected void onCreate(Bundle state, boolean ready) {
|
||||
super.onCreate(state, ready);
|
||||
|
||||
Bundle bundle = getIntent().getExtras();
|
||||
assert bundle != null;
|
||||
String hash = bundle.getString(EXTRA_HASH, "");
|
||||
accId = bundle.getInt(EXTRA_ACCOUNT_ID, -1);
|
||||
chatId = bundle.getInt(EXTRA_CHAT_ID, 0);
|
||||
callId = bundle.getInt(EXTRA_CALL_ID, 0);
|
||||
rpc = DcHelper.getRpc(this);
|
||||
dcContext = DcHelper.getAccounts(this).getAccount(accId);
|
||||
|
||||
DcHelper.getNotificationCenter(this).removeCallNotification(accId, callId);
|
||||
|
||||
WebSettings webSettings = webView.getSettings();
|
||||
webSettings.setJavaScriptEnabled(true);
|
||||
webSettings.setMediaPlaybackRequiresUserGesture(false);
|
||||
webView.addJavascriptInterface(new InternalJSApi(), "calls");
|
||||
|
||||
webView.setWebChromeClient(new WebChromeClient() {
|
||||
@Override
|
||||
public void onPermissionRequest(PermissionRequest request) {
|
||||
Util.runOnMain(() -> request.grant(request.getResources()));
|
||||
}
|
||||
});
|
||||
|
||||
DcEventCenter eventCenter = DcHelper.getEventCenter(getApplicationContext());
|
||||
eventCenter.addObserver(DcContext.DC_EVENT_OUTGOING_CALL_ACCEPTED, this);
|
||||
eventCenter.addObserver(DcContext.DC_EVENT_CALL_ENDED, this);
|
||||
|
||||
Util.runOnAnyBackgroundThread(() -> {
|
||||
final DcChat chat = dcContext.getChat(chatId);
|
||||
Util.runOnMain(() -> Objects.requireNonNull(getSupportActionBar()).setTitle(chat.getName()));
|
||||
});
|
||||
|
||||
Permissions.with(this)
|
||||
.request(Manifest.permission.CAMERA, Manifest.permission.RECORD_AUDIO)
|
||||
.ifNecessary()
|
||||
.withPermanentDenialDialog(getString(R.string.perm_explain_access_to_camera_denied))
|
||||
.onAllGranted(() -> {
|
||||
String url = "file:///android_asset/calls/index.html";
|
||||
webView.loadUrl(url + hash);
|
||||
}).onAnyDenied(this::finish)
|
||||
.execute();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
|
||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||
Permissions.onRequestPermissionsResult(this, requestCode, permissions, grantResults);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
DcHelper.getEventCenter(this).removeObservers(this);
|
||||
if (callId != 0 && !ended) {
|
||||
try {
|
||||
rpc.endCall(accId, callId);
|
||||
} catch (RpcException e) {
|
||||
Log.e(TAG, "Error", e);
|
||||
}
|
||||
}
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPrepareOptionsMenu(Menu menu) {
|
||||
// do not call super.onPrepareOptionsMenu() as the default "Search" menu is not needed
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean openOnlineUrl(String url) {
|
||||
finish();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleEvent(@NonNull DcEvent event) {
|
||||
switch (event.getId()) {
|
||||
case DcContext.DC_EVENT_OUTGOING_CALL_ACCEPTED:
|
||||
if (event.getData1Int() == callId) {
|
||||
try {
|
||||
String base64 = Base64.encodeToString(event.getData2Str().getBytes(StandardCharsets.UTF_8), Base64.NO_WRAP);
|
||||
String hash = "#onAnswer=" + URLEncoder.encode(base64, "UTF-8");
|
||||
webView.evaluateJavascript("window.location.hash = `"+hash+"`", null);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
Log.e(TAG, "Error", e);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case DcContext.DC_EVENT_CALL_ENDED:
|
||||
if (event.getData1Int() == callId) {
|
||||
ended = true;
|
||||
finish();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class InternalJSApi {
|
||||
@JavascriptInterface
|
||||
public String getIceServers() {
|
||||
try {
|
||||
return rpc.iceServers(accId);
|
||||
} catch (RpcException e) {
|
||||
Log.e(TAG, "Error", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void startCall(String payload) {
|
||||
try {
|
||||
callId = rpc.placeOutgoingCall(accId, chatId, payload);
|
||||
} catch (RpcException e) {
|
||||
Log.e(TAG, "Error", e);
|
||||
}
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void acceptCall(String payload) {
|
||||
try {
|
||||
rpc.acceptIncomingCall(accId, callId, payload);
|
||||
} catch (RpcException e) {
|
||||
Log.e(TAG, "Error", e);
|
||||
}
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void endCall() {
|
||||
finish();
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public String getAvatar() {
|
||||
final Context context = CallActivity.this;
|
||||
final DcChat dcChat = dcContext.getChat(chatId);
|
||||
if (!TextUtils.isEmpty(dcChat.getProfileImage())) {
|
||||
return AvatarUtil.asDataUri(dcChat.getProfileImage());
|
||||
} else {
|
||||
final Recipient recipient = new Recipient(context, dcChat);
|
||||
return AvatarUtil.asDataUri(recipient.getFallbackAvatarDrawable(context, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package org.thoughtcrime.securesms.calls;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.util.Base64;
|
||||
import android.util.Log;
|
||||
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.connect.DcHelper;
|
||||
import org.thoughtcrime.securesms.permissions.Permissions;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
public class CallUtil {
|
||||
private static final String TAG = CallUtil.class.getSimpleName();
|
||||
|
||||
public static void startCall(Activity activity, int chatId) {
|
||||
Permissions.with(activity)
|
||||
.request(Manifest.permission.CAMERA, Manifest.permission.RECORD_AUDIO)
|
||||
.ifNecessary()
|
||||
.withPermanentDenialDialog(activity.getString(R.string.perm_explain_access_to_camera_denied))
|
||||
.onAllGranted(() -> {
|
||||
int accId = DcHelper.getContext(activity).getAccountId();
|
||||
startCall(activity, accId, chatId);
|
||||
})
|
||||
.execute();
|
||||
}
|
||||
|
||||
public static void startCall(Context context, int accId, int chatId) {
|
||||
Intent intent = new Intent(context, CallActivity.class);
|
||||
intent.setAction(Intent.ACTION_VIEW);
|
||||
intent.putExtra(CallActivity.EXTRA_ACCOUNT_ID, accId);
|
||||
intent.putExtra(CallActivity.EXTRA_CHAT_ID, chatId);
|
||||
intent.putExtra(CallActivity.EXTRA_HASH, "#startCall");
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
public static void openCall(Context context, int accId, int chatId, int callId, String payload) {
|
||||
String base64 = Base64.encodeToString(payload.getBytes(StandardCharsets.UTF_8), Base64.NO_WRAP);
|
||||
String hash = "";
|
||||
try {
|
||||
hash = "#offerIncomingCall=" + URLEncoder.encode(base64, "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
Log.e(TAG, "Error", e);
|
||||
}
|
||||
|
||||
Intent intent = new Intent(context, CallActivity.class);
|
||||
intent.setAction(Intent.ACTION_VIEW);
|
||||
intent.putExtra(CallActivity.EXTRA_ACCOUNT_ID, accId);
|
||||
intent.putExtra(CallActivity.EXTRA_CHAT_ID, chatId);
|
||||
intent.putExtra(CallActivity.EXTRA_CALL_ID, callId);
|
||||
intent.putExtra(CallActivity.EXTRA_HASH, hash);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -35,19 +35,17 @@ public class AttachmentTypeSelector extends PopupWindow {
|
||||
|
||||
public static final int ADD_GALLERY = 1;
|
||||
public static final int ADD_DOCUMENT = 2;
|
||||
public static final int INVITE_VIDEO_CHAT = 3;
|
||||
public static final int ADD_CONTACT_INFO = 4;
|
||||
public static final int TAKE_PHOTO = 5;
|
||||
public static final int ADD_LOCATION = 6;
|
||||
public static final int RECORD_VIDEO = 7;
|
||||
public static final int ADD_WEBXDC = 8;
|
||||
public static final int ADD_CONTACT_INFO = 3;
|
||||
public static final int TAKE_PHOTO = 4;
|
||||
public static final int ADD_LOCATION = 5;
|
||||
public static final int RECORD_VIDEO = 6;
|
||||
public static final int ADD_WEBXDC = 7;
|
||||
|
||||
private static final int ANIMATION_DURATION = 300;
|
||||
|
||||
private final @NonNull LoaderManager loaderManager;
|
||||
private final @NonNull RecentPhotoViewRail recentRail;
|
||||
private final @NonNull ImageView imageButton;
|
||||
private final @NonNull ImageView videoChatButton;
|
||||
private final @NonNull ImageView documentButton;
|
||||
private final @NonNull ImageView contactButton;
|
||||
private final @NonNull ImageView cameraButton;
|
||||
@@ -70,7 +68,6 @@ public class AttachmentTypeSelector extends PopupWindow {
|
||||
this.chatId = chatId;
|
||||
this.recentRail = ViewUtil.findById(layout, R.id.recent_photos);
|
||||
this.imageButton = ViewUtil.findById(layout, R.id.gallery_button);
|
||||
this.videoChatButton = ViewUtil.findById(layout, R.id.invite_video_chat_button);
|
||||
this.documentButton = ViewUtil.findById(layout, R.id.document_button);
|
||||
this.contactButton = ViewUtil.findById(layout, R.id.contact_button);
|
||||
this.cameraButton = ViewUtil.findById(layout, R.id.camera_button);
|
||||
@@ -79,7 +76,6 @@ public class AttachmentTypeSelector extends PopupWindow {
|
||||
this.webxdcButton = ViewUtil.findById(layout, R.id.webxdc_button);
|
||||
|
||||
this.imageButton.setOnClickListener(new PropagatingClickListener(ADD_GALLERY));
|
||||
this.videoChatButton.setOnClickListener(new PropagatingClickListener(INVITE_VIDEO_CHAT));
|
||||
this.documentButton.setOnClickListener(new PropagatingClickListener(ADD_DOCUMENT));
|
||||
this.contactButton.setOnClickListener(new PropagatingClickListener(ADD_CONTACT_INFO));
|
||||
this.cameraButton.setOnClickListener(new PropagatingClickListener(TAKE_PHOTO));
|
||||
@@ -92,10 +88,6 @@ public class AttachmentTypeSelector extends PopupWindow {
|
||||
ViewUtil.findById(layout, R.id.location_linear_layout).setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if (!DcHelper.isWebrtcConfigOk(DcHelper.getContext(context))) {
|
||||
ViewUtil.findById(layout, R.id.invite_video_chat_linear_layout).setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
setLocationButtonImage(context);
|
||||
|
||||
setContentView(layout);
|
||||
@@ -139,7 +131,6 @@ public class AttachmentTypeSelector extends PopupWindow {
|
||||
animateButtonIn(locationButton, ANIMATION_DURATION / 4);
|
||||
animateButtonIn(documentButton, ANIMATION_DURATION / 4);
|
||||
animateButtonIn(webxdcButton, 0);
|
||||
animateButtonIn(videoChatButton, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
package org.thoughtcrime.securesms.components;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Color;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import org.thoughtcrime.securesms.R;
|
||||
|
||||
import chat.delta.rpc.types.CallInfo;
|
||||
import chat.delta.rpc.types.CallState;
|
||||
|
||||
public class CallItemView extends FrameLayout {
|
||||
private static final String TAG = CallItemView.class.getSimpleName();
|
||||
|
||||
private final @NonNull ImageView icon;
|
||||
private final @NonNull TextView title;
|
||||
private final @NonNull ConversationItemFooter footer;
|
||||
private CallInfo callInfo;
|
||||
private CallClickListener viewListener;
|
||||
|
||||
public CallItemView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public CallItemView(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public CallItemView(final Context context, AttributeSet attrs, int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
|
||||
inflate(context, R.layout.call_item_view, this);
|
||||
|
||||
this.icon = findViewById(R.id.call_icon);
|
||||
this.title = findViewById(R.id.title);
|
||||
this.footer = findViewById(R.id.footer);
|
||||
|
||||
setOnClickListener(v -> {
|
||||
if (viewListener != null && callInfo != null) {
|
||||
viewListener.onClick(v, callInfo);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void setCallClickListener(CallClickListener listener) {
|
||||
viewListener = listener;
|
||||
}
|
||||
|
||||
public void setCallItem(boolean isOutgoing, CallInfo callInfo) {
|
||||
this.callInfo = callInfo;
|
||||
if (callInfo.state instanceof CallState.Completed) {
|
||||
footer.setCallDuration(((CallState.Completed) callInfo.state).duration);
|
||||
} else {
|
||||
footer.setCallDuration(0); // reset
|
||||
}
|
||||
|
||||
if (callInfo.state instanceof CallState.Missed) {
|
||||
title.setText(R.string.missed_call);
|
||||
} else if (callInfo.state instanceof CallState.Canceled) {
|
||||
title.setText(R.string.canceled_call);
|
||||
} else if (callInfo.state instanceof CallState.Declined) {
|
||||
title.setText(R.string.declined_call);
|
||||
} else {
|
||||
title.setText(isOutgoing? R.string.outgoing_call : R.string.incoming_call);
|
||||
}
|
||||
|
||||
int[] attrs;
|
||||
if (isOutgoing) {
|
||||
attrs = new int[]{
|
||||
R.attr.conversation_item_outgoing_text_primary_color,
|
||||
R.attr.conversation_item_outgoing_text_secondary_color,
|
||||
};
|
||||
} else {
|
||||
attrs = new int[]{
|
||||
R.attr.conversation_item_incoming_text_primary_color,
|
||||
R.attr.conversation_item_incoming_text_secondary_color,
|
||||
};
|
||||
}
|
||||
try (TypedArray ta = getContext().obtainStyledAttributes(attrs)) {
|
||||
icon.setColorFilter(ta.getColor(0, Color.BLACK));
|
||||
footer.setTextColor(ta.getColor(1, Color.BLACK));
|
||||
}
|
||||
}
|
||||
|
||||
public ConversationItemFooter getFooter() {
|
||||
return footer;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return title.getText() + "\n" + footer.getDescription();
|
||||
}
|
||||
|
||||
public interface CallClickListener {
|
||||
void onClick(View v, CallInfo callInfo);
|
||||
}
|
||||
}
|
||||
@@ -26,6 +26,7 @@ public class ConversationItemFooter extends LinearLayout {
|
||||
private ImageView locationIndicatorView;
|
||||
private DeliveryStatusView deliveryStatusView;
|
||||
private Integer textColor = null;
|
||||
private int callDuration = 0;
|
||||
|
||||
public ConversationItemFooter(Context context) {
|
||||
super(context);
|
||||
@@ -54,12 +55,16 @@ public class ConversationItemFooter extends LinearLayout {
|
||||
|
||||
if (attrs != null) {
|
||||
try (TypedArray typedArray = getContext().getTheme().obtainStyledAttributes(attrs, R.styleable.ConversationItemFooter, 0, 0)) {
|
||||
textColor = typedArray.getInt(R.styleable.ConversationItemFooter_footer_text_color, getResources().getColor(R.color.core_white));
|
||||
setTextColor(textColor);
|
||||
setTextColor(typedArray.getInt(R.styleable.ConversationItemFooter_footer_text_color, getResources().getColor(R.color.core_white)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Call duration in seconds. Only >0 if this is a call message */
|
||||
public void setCallDuration(int duration) {
|
||||
callDuration = duration;
|
||||
}
|
||||
|
||||
public void setMessageRecord(@NonNull DcMsg messageRecord) {
|
||||
presentDate(messageRecord);
|
||||
boolean bookmark = messageRecord.getOriginalMsgId() != 0 || messageRecord.getSavedMsgId() != 0;
|
||||
@@ -77,7 +82,8 @@ public class ConversationItemFooter extends LinearLayout {
|
||||
presentDeliveryStatus(messageRecord);
|
||||
}
|
||||
|
||||
private void setTextColor(int color) {
|
||||
public void setTextColor(int color) {
|
||||
textColor = color;
|
||||
dateView.setTextColor(color);
|
||||
editedView.setTextColor(color);
|
||||
bookmarkIndicatorView.setColorFilter(color);
|
||||
@@ -86,18 +92,29 @@ public class ConversationItemFooter extends LinearLayout {
|
||||
deliveryStatusView.setTint(color);
|
||||
}
|
||||
|
||||
private void presentDate(@NonNull DcMsg messageRecord) {
|
||||
private void presentDate(@NonNull DcMsg dcMsg) {
|
||||
dateView.forceLayout();
|
||||
dateView.setText(DateUtils.getExtendedRelativeTimeSpanString(getContext(), messageRecord.getTimestamp()));
|
||||
Context context = getContext();
|
||||
String date = dcMsg.getType() == DcMsg.DC_MSG_CALL?
|
||||
DateUtils.getExtendedTimeSpanString(context, dcMsg.getTimestamp())
|
||||
: DateUtils.getExtendedRelativeTimeSpanString(context, dcMsg.getTimestamp());
|
||||
if (callDuration > 0) {
|
||||
String duration = DateUtils.getFormattedCallDuration(context, callDuration);
|
||||
dateView.setText(context.getString(R.string.call_date_and_duration, date, duration));
|
||||
} else {
|
||||
dateView.setText(date);
|
||||
}
|
||||
}
|
||||
|
||||
private void presentDeliveryStatus(@NonNull DcMsg messageRecord) {
|
||||
// isDownloading is temporary and should be checked first.
|
||||
boolean isDownloading = messageRecord.getDownloadState() == DcMsg.DC_DOWNLOAD_IN_PROGRESS;
|
||||
boolean isCall = messageRecord.getType() == DcMsg.DC_MSG_CALL;
|
||||
|
||||
if (isDownloading) deliveryStatusView.setDownloading();
|
||||
else if (messageRecord.isPending()) deliveryStatusView.setPending();
|
||||
else if (messageRecord.isFailed()) deliveryStatusView.setFailed();
|
||||
else if (!messageRecord.isOutgoing()) deliveryStatusView.setNone();
|
||||
else if (!messageRecord.isOutgoing() || isCall) deliveryStatusView.setNone();
|
||||
else if (messageRecord.isRemoteRead()) deliveryStatusView.setRead();
|
||||
else if (messageRecord.isDelivered()) deliveryStatusView.setSent();
|
||||
else if (messageRecord.isPreparing()) deliveryStatusView.setPreparing();
|
||||
|
||||
@@ -183,6 +183,15 @@ public class DcEventCenter {
|
||||
DcHelper.getNotificationCenter(context).notifyWebxdc(accountId, event.getData1Int(), event.getData2Int(), event.getData2Str());
|
||||
break;
|
||||
|
||||
case DcContext.DC_EVENT_INCOMING_CALL:
|
||||
DcHelper.getNotificationCenter(context).notifyCall(accountId, event.getData1Int(), event.getData2Str());
|
||||
break;
|
||||
|
||||
case DcContext.DC_EVENT_INCOMING_CALL_ACCEPTED:
|
||||
case DcContext.DC_EVENT_CALL_ENDED:
|
||||
DcHelper.getNotificationCenter(context).removeCallNotification(accountId, event.getData1Int());
|
||||
break;
|
||||
|
||||
case DcContext.DC_EVENT_MSGS_NOTICED:
|
||||
DcHelper.getNotificationCenter(context).removeNotifications(accountId, event.getData1Int());
|
||||
break;
|
||||
|
||||
@@ -70,7 +70,6 @@ public class DcHelper {
|
||||
public static final String CONFIG_BCC_SELF = "bcc_self";
|
||||
public static final String CONFIG_SHOW_EMAILS = "show_emails";
|
||||
public static final String CONFIG_MEDIA_QUALITY = "media_quality";
|
||||
public static final String CONFIG_WEBRTC_INSTANCE = "webrtc_instance";
|
||||
public static final String CONFIG_PROXY_ENABLED = "proxy_enabled";
|
||||
public static final String CONFIG_PROXY_URL = "proxy_url";
|
||||
public static final String CONFIG_VERIFIED_ONE_ON_ONE_CHATS = "verified_one_on_one_chats";
|
||||
@@ -245,6 +244,11 @@ public class DcHelper {
|
||||
dcContext.setStockTranslation(177, context.getString(R.string.reaction_by_other));
|
||||
dcContext.setStockTranslation(190, context.getString(R.string.secure_join_wait));
|
||||
dcContext.setStockTranslation(193, context.getString(R.string.donate_device_msg));
|
||||
dcContext.setStockTranslation(194, context.getString(R.string.outgoing_call));
|
||||
dcContext.setStockTranslation(195, context.getString(R.string.incoming_call));
|
||||
dcContext.setStockTranslation(196, context.getString(R.string.declined_call));
|
||||
dcContext.setStockTranslation(197, context.getString(R.string.canceled_call));
|
||||
dcContext.setStockTranslation(198, context.getString(R.string.missed_call));
|
||||
}
|
||||
|
||||
public static File getImexDir() {
|
||||
@@ -398,11 +402,6 @@ public class DcHelper {
|
||||
|
||||
}
|
||||
|
||||
public static boolean isWebrtcConfigOk(DcContext dcContext) {
|
||||
String instance = dcContext.getConfig(DcHelper.CONFIG_WEBRTC_INSTANCE);
|
||||
return (instance != null && !instance.isEmpty());
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public static ThreadRecord getThreadRecord(Context context, DcLot summary, DcChat chat) { // adapted from ThreadDatabase.getCurrent()
|
||||
int chatId = chat.getId();
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
package org.thoughtcrime.securesms.notifications;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.util.Log;
|
||||
|
||||
import org.thoughtcrime.securesms.connect.DcHelper;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
|
||||
import chat.delta.rpc.RpcException;
|
||||
|
||||
public class DeclineCallReceiver extends BroadcastReceiver {
|
||||
private static final String TAG = DeclineCallReceiver.class.getSimpleName();
|
||||
|
||||
public static final String DECLINE_ACTION = "org.thoughtcrime.securesms.notifications.DECLINE_CALL";
|
||||
public static final String ACCOUNT_ID_EXTRA = "account_id";
|
||||
public static final String CALL_ID_EXTRA = "call_id";
|
||||
|
||||
@Override
|
||||
public void onReceive(final Context context, Intent intent) {
|
||||
if (!DECLINE_ACTION.equals(intent.getAction())) {
|
||||
return;
|
||||
}
|
||||
|
||||
final int accountId = intent.getIntExtra(ACCOUNT_ID_EXTRA, 0);
|
||||
final int callId = intent.getIntExtra(CALL_ID_EXTRA, 0);
|
||||
if (accountId == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
Util.runOnAnyBackgroundThread(() -> {
|
||||
DcHelper.getNotificationCenter(context).removeCallNotification(accountId, callId);
|
||||
try {
|
||||
DcHelper.getRpc(context).endCall(accountId, callId);
|
||||
} catch (RpcException e) {
|
||||
Log.e(TAG, "Error", e);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -13,9 +13,11 @@ import android.graphics.Bitmap;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.media.AudioAttributes;
|
||||
import android.media.RingtoneManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Base64;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
@@ -47,8 +49,12 @@ import org.thoughtcrime.securesms.util.JsonUtils;
|
||||
import org.thoughtcrime.securesms.util.Pair;
|
||||
import org.thoughtcrime.securesms.util.Prefs;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
import org.thoughtcrime.securesms.calls.CallActivity;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.math.BigInteger;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.MessageDigest;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@@ -158,6 +164,41 @@ public class NotificationCenter {
|
||||
return PendingIntent.getBroadcast(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT | IntentUtils.FLAG_MUTABLE());
|
||||
}
|
||||
|
||||
public PendingIntent getOpenCallIntent(ChatData chatData, int callId, String payload, boolean autoAccept) {
|
||||
final Intent chatIntent = new Intent(context, ConversationActivity.class)
|
||||
.putExtra(ConversationActivity.ACCOUNT_ID_EXTRA, chatData.accountId)
|
||||
.putExtra(ConversationActivity.CHAT_ID_EXTRA, chatData.chatId)
|
||||
.setAction(Intent.ACTION_VIEW);
|
||||
|
||||
String base64 = Base64.encodeToString(payload.getBytes(StandardCharsets.UTF_8), Base64.NO_WRAP);
|
||||
String hash = "";
|
||||
try {
|
||||
hash = (autoAccept? "#acceptCall=" : "#offerIncomingCall=") + URLEncoder.encode(base64, "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
Log.e(TAG, "Error", e);
|
||||
}
|
||||
|
||||
Intent intent = new Intent(context, CallActivity.class);
|
||||
intent.setAction(autoAccept? Intent.ACTION_ANSWER : Intent.ACTION_VIEW);
|
||||
intent.putExtra(CallActivity.EXTRA_ACCOUNT_ID, chatData.accountId);
|
||||
intent.putExtra(CallActivity.EXTRA_CHAT_ID, chatData.chatId);
|
||||
intent.putExtra(CallActivity.EXTRA_CALL_ID, callId);
|
||||
intent.putExtra(CallActivity.EXTRA_HASH, hash);
|
||||
intent.setPackage(context.getPackageName());
|
||||
return TaskStackBuilder.create(context)
|
||||
.addNextIntentWithParentStack(chatIntent)
|
||||
.addNextIntent(intent)
|
||||
.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT | IntentUtils.FLAG_MUTABLE());
|
||||
}
|
||||
|
||||
public PendingIntent getDeclineCallIntent(ChatData chatData, int callId) {
|
||||
Intent intent = new Intent(DeclineCallReceiver.DECLINE_ACTION);
|
||||
intent.setClass(context, DeclineCallReceiver.class);
|
||||
intent.putExtra(DeclineCallReceiver.ACCOUNT_ID_EXTRA, chatData.accountId);
|
||||
intent.putExtra(DeclineCallReceiver.CALL_ID_EXTRA, callId);
|
||||
intent.setPackage(context.getPackageName());
|
||||
return PendingIntent.getBroadcast(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT | IntentUtils.FLAG_MUTABLE());
|
||||
}
|
||||
|
||||
// Groups and Notification channel groups
|
||||
// --------------------------------------------------------------------------------------------
|
||||
@@ -202,6 +243,7 @@ public class NotificationCenter {
|
||||
public static final String CH_MSG_VERSION = "5";
|
||||
public static final String CH_PERMANENT = "dc_foreground_notification_ch";
|
||||
public static final String CH_GENERIC = "ch_generic";
|
||||
public static final String CH_CALLS_PREFIX = "call_chan";
|
||||
|
||||
private boolean notificationChannelsSupported() {
|
||||
return Build.VERSION.SDK_INT >= 26;
|
||||
@@ -333,10 +375,107 @@ public class NotificationCenter {
|
||||
return channelId;
|
||||
}
|
||||
|
||||
public String getCallNotificationChannel(NotificationManagerCompat notificationManager, ChatData chatData, String name) {
|
||||
String channelId = CH_CALLS_PREFIX + "-" + chatData.accountId + "-"+ chatData.chatId;
|
||||
|
||||
if (notificationChannelsSupported()) {
|
||||
try {
|
||||
name = "(calls) " + name;
|
||||
|
||||
// check if there is already a channel with the given name
|
||||
List<NotificationChannel> channels = notificationManager.getNotificationChannels();
|
||||
boolean channelExists = false;
|
||||
for (int i = 0; i < channels.size(); i++) {
|
||||
String currChannelId = channels.get(i).getId();
|
||||
if (currChannelId.startsWith(CH_CALLS_PREFIX)) {
|
||||
// this is one of the calls channels handled here ...
|
||||
if (currChannelId.equals(channelId)) {
|
||||
// ... this is the actually required channel, fine :)
|
||||
// update the name to reflect localize changes and chat renames
|
||||
channelExists = true;
|
||||
channels.get(i).setName(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// create a the channel
|
||||
if(!channelExists) {
|
||||
NotificationChannel channel = new NotificationChannel(channelId, name, NotificationManager.IMPORTANCE_MAX);
|
||||
channel.setDescription("Informs about incoming calls.");
|
||||
channel.setShowBadge(true);
|
||||
|
||||
Uri ringtone = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_RINGTONE);
|
||||
channel.setSound(ringtone, new AudioAttributes.Builder()
|
||||
.setUsage(AudioAttributes.USAGE_NOTIFICATION_RINGTONE)
|
||||
.setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
|
||||
.build());
|
||||
notificationManager.createNotificationChannel(channel);
|
||||
}
|
||||
} catch(Exception e) {
|
||||
Log.e(TAG, "Error in getCallNotificationChannel()", e);
|
||||
}
|
||||
}
|
||||
|
||||
return channelId;
|
||||
}
|
||||
|
||||
|
||||
// add notifications & co.
|
||||
// --------------------------------------------------------------------------------------------
|
||||
|
||||
public void notifyCall(int accId, int callId, String payload) {
|
||||
Util.runOnAnyBackgroundThread(() -> {
|
||||
NotificationManagerCompat notificationManager = NotificationManagerCompat.from(context);
|
||||
DcContext dcContext = context.dcAccounts.getAccount(accId);
|
||||
int chatId = dcContext.getMsg(callId).getChatId();
|
||||
DcChat dcChat = dcContext.getChat(chatId);
|
||||
String name = dcChat.getName();
|
||||
ChatData chatData = new ChatData(accId, chatId);
|
||||
String notificationChannel = getCallNotificationChannel(notificationManager, chatData, name);
|
||||
|
||||
PendingIntent declineCallIntent = getDeclineCallIntent(chatData, callId);
|
||||
PendingIntent openCallIntent = getOpenCallIntent(chatData, callId, payload, false);
|
||||
|
||||
NotificationCompat.Builder builder = new NotificationCompat.Builder(context, notificationChannel)
|
||||
.setSmallIcon(R.drawable.icon_notification)
|
||||
.setColor(context.getResources().getColor(R.color.delta_primary))
|
||||
.setPriority(NotificationCompat.PRIORITY_HIGH)
|
||||
.setCategory(NotificationCompat.CATEGORY_CALL)
|
||||
.setOngoing(true)
|
||||
.setOnlyAlertOnce(false)
|
||||
.setTicker(name)
|
||||
.setContentTitle(name)
|
||||
.setFullScreenIntent(openCallIntent, true)
|
||||
.setContentIntent(openCallIntent)
|
||||
.setContentText("Incoming Call");
|
||||
|
||||
builder.addAction(
|
||||
new NotificationCompat.Action.Builder(
|
||||
R.drawable.baseline_call_end_24,
|
||||
context.getString(R.string.end_call),
|
||||
declineCallIntent).build());
|
||||
|
||||
builder.addAction(
|
||||
new NotificationCompat.Action.Builder(
|
||||
R.drawable.baseline_call_24,
|
||||
context.getString(R.string.answer_call),
|
||||
getOpenCallIntent(chatData, callId, payload, true)).build());
|
||||
|
||||
Bitmap bitmap = getAvatar(dcChat);
|
||||
if (bitmap != null) {
|
||||
builder.setLargeIcon(bitmap);
|
||||
}
|
||||
|
||||
Notification notif = builder.build();
|
||||
notif.flags = notif.flags | Notification.FLAG_INSISTENT;
|
||||
try {
|
||||
notificationManager.notify("call-" + accId, callId, notif);
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "cannot add notification", e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void notifyMessage(int accountId, int chatId, int msgId) {
|
||||
Util.runOnAnyBackgroundThread(() -> {
|
||||
DcContext dcContext = context.dcAccounts.getAccount(accountId);
|
||||
@@ -495,31 +634,11 @@ public class NotificationCenter {
|
||||
}
|
||||
|
||||
// set avatar
|
||||
Recipient recipient = new Recipient(context, dcChat);
|
||||
if (privacy.isDisplayContact()) {
|
||||
try {
|
||||
Drawable drawable;
|
||||
ContactPhoto contactPhoto = recipient.getContactPhoto(context);
|
||||
if (contactPhoto != null) {
|
||||
drawable = GlideApp.with(context.getApplicationContext())
|
||||
.load(contactPhoto)
|
||||
.diskCacheStrategy(DiskCacheStrategy.NONE)
|
||||
.circleCrop()
|
||||
.submit(context.getResources().getDimensionPixelSize(android.R.dimen.notification_large_icon_width),
|
||||
context.getResources().getDimensionPixelSize(android.R.dimen.notification_large_icon_height))
|
||||
.get();
|
||||
|
||||
} else {
|
||||
drawable = recipient.getFallbackContactPhoto().asDrawable(context, recipient.getFallbackAvatarColor());
|
||||
}
|
||||
if (drawable != null) {
|
||||
int wh = context.getResources().getDimensionPixelSize(R.dimen.contact_photo_target_size);
|
||||
Bitmap bitmap = BitmapUtil.createFromDrawable(drawable, wh, wh);
|
||||
if (bitmap != null) {
|
||||
builder.setLargeIcon(bitmap);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) { Log.w(TAG, e); }
|
||||
Bitmap bitmap = getAvatar(dcChat);
|
||||
if (bitmap != null) {
|
||||
builder.setLargeIcon(bitmap);
|
||||
}
|
||||
}
|
||||
|
||||
// add buttons that allow some actions without opening Delta Chat.
|
||||
@@ -619,6 +738,40 @@ public class NotificationCenter {
|
||||
}
|
||||
}
|
||||
|
||||
public Bitmap getAvatar(DcChat dcChat) {
|
||||
Recipient recipient = new Recipient(context, dcChat);
|
||||
try {
|
||||
Drawable drawable;
|
||||
ContactPhoto contactPhoto = recipient.getContactPhoto(context);
|
||||
if (contactPhoto != null) {
|
||||
drawable = GlideApp.with(context.getApplicationContext())
|
||||
.load(contactPhoto)
|
||||
.diskCacheStrategy(DiskCacheStrategy.NONE)
|
||||
.circleCrop()
|
||||
.submit(context.getResources().getDimensionPixelSize(android.R.dimen.notification_large_icon_width),
|
||||
context.getResources().getDimensionPixelSize(android.R.dimen.notification_large_icon_height))
|
||||
.get();
|
||||
|
||||
} else {
|
||||
drawable = recipient.getFallbackContactPhoto().asDrawable(context, recipient.getFallbackAvatarColor());
|
||||
}
|
||||
if (drawable != null) {
|
||||
int wh = context.getResources().getDimensionPixelSize(R.dimen.contact_photo_target_size);
|
||||
return BitmapUtil.createFromDrawable(drawable, wh, wh);
|
||||
}
|
||||
} catch (Exception e) { Log.w(TAG, e); }
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void removeCallNotification(int accountId, int callId) {
|
||||
try {
|
||||
NotificationManagerCompat notificationManager = NotificationManagerCompat.from(context);
|
||||
String tag = "call-" + accountId;
|
||||
notificationManager.cancel(tag, callId);
|
||||
} catch (Exception e) { Log.w(TAG, e); }
|
||||
}
|
||||
|
||||
public void removeNotifications(int accountId, int chatId) {
|
||||
boolean removeSummary;
|
||||
synchronized (inboxes) {
|
||||
@@ -692,7 +845,7 @@ public class NotificationCenter {
|
||||
}
|
||||
}
|
||||
|
||||
private static class ChatData {
|
||||
public static class ChatData {
|
||||
public final int accountId;
|
||||
public final int chatId;
|
||||
|
||||
|
||||
+16
-37
@@ -159,12 +159,6 @@ public class AdvancedPreferenceFragment extends ListSummaryPreferenceFragment
|
||||
submitDebugLog.setOnPreferenceClickListener(new ViewLogListener());
|
||||
}
|
||||
|
||||
Preference webrtcInstance = this.findPreference("pref_webrtc_instance");
|
||||
if (webrtcInstance != null) {
|
||||
webrtcInstance.setOnPreferenceClickListener(new WebrtcInstanceListener());
|
||||
}
|
||||
updateWebrtcSummary();
|
||||
|
||||
Preference webxdcStore = this.findPreference(Prefs.WEBXDC_STORE_URL_PREF);
|
||||
if (webxdcStore != null) {
|
||||
webxdcStore.setOnPreferenceClickListener(new WebxdcStoreUrlListener());
|
||||
@@ -211,6 +205,22 @@ public class AdvancedPreferenceFragment extends ListSummaryPreferenceFragment
|
||||
});
|
||||
}
|
||||
|
||||
Preference callsEnabled = this.findPreference("pref_calls_enabled");
|
||||
if (callsEnabled != null) {
|
||||
callsEnabled.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||
if ((Boolean)newValue) {
|
||||
new AlertDialog.Builder(requireActivity())
|
||||
.setTitle("Thanks for helping to debug \"Calls\"!")
|
||||
.setMessage("• You can now debug calls using the \"phone\" icon in one-to-one-chats\n\n"
|
||||
+ "• The experiment is about making decentralised calls work and reliable at all, not about options or UI. We're happy about focused feedback at support.delta.chat\n\n")
|
||||
.setCancelable(false)
|
||||
.setPositiveButton(R.string.ok, null)
|
||||
.show();
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
Preference selfReporting = this.findPreference("pref_self_reporting");
|
||||
if (selfReporting != null) {
|
||||
selfReporting.setOnPreferenceClickListener(((preference) -> {
|
||||
@@ -331,29 +341,6 @@ public class AdvancedPreferenceFragment extends ListSummaryPreferenceFragment
|
||||
}
|
||||
}
|
||||
|
||||
private class WebrtcInstanceListener implements Preference.OnPreferenceClickListener {
|
||||
@Override
|
||||
public boolean onPreferenceClick(@NonNull Preference preference) {
|
||||
View gl = View.inflate(requireActivity(), R.layout.single_line_input, null);
|
||||
EditText inputField = gl.findViewById(R.id.input_field);
|
||||
inputField.setHint(R.string.videochat_instance_placeholder);
|
||||
inputField.setText(dcContext.getConfig(DcHelper.CONFIG_WEBRTC_INSTANCE));
|
||||
inputField.setSelection(inputField.getText().length());
|
||||
inputField.setInputType(TYPE_TEXT_VARIATION_URI);
|
||||
new AlertDialog.Builder(requireActivity())
|
||||
.setTitle(R.string.videochat_instance)
|
||||
.setMessage(getString(R.string.videochat_instance_explain_2)+"\n\n"+getString(R.string.videochat_instance_example))
|
||||
.setView(gl)
|
||||
.setNegativeButton(android.R.string.cancel, null)
|
||||
.setPositiveButton(android.R.string.ok, (dialog, which) -> {
|
||||
dcContext.setConfig(DcHelper.CONFIG_WEBRTC_INSTANCE, inputField.getText().toString());
|
||||
updateWebrtcSummary();
|
||||
})
|
||||
.show();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private class WebxdcStoreUrlListener implements Preference.OnPreferenceClickListener {
|
||||
@Override
|
||||
public boolean onPreferenceClick(@NonNull Preference preference) {
|
||||
@@ -377,14 +364,6 @@ public class AdvancedPreferenceFragment extends ListSummaryPreferenceFragment
|
||||
}
|
||||
}
|
||||
|
||||
private void updateWebrtcSummary() {
|
||||
Preference webrtcInstance = this.findPreference("pref_webrtc_instance");
|
||||
if (webrtcInstance != null) {
|
||||
webrtcInstance.setSummary(DcHelper.isWebrtcConfigOk(dcContext)?
|
||||
dcContext.getConfig(DcHelper.CONFIG_WEBRTC_INSTANCE) : getString(R.string.none));
|
||||
}
|
||||
}
|
||||
|
||||
private void updateWebxdcStoreSummary() {
|
||||
Preference preference = this.findPreference(Prefs.WEBXDC_STORE_URL_PREF);
|
||||
if (preference != null) {
|
||||
|
||||
@@ -69,7 +69,6 @@ public class AddReactionView extends LinearLayout {
|
||||
init(); // init delayed as needed
|
||||
|
||||
if ( msgToReactTo.isInfo()
|
||||
|| msgToReactTo.getType() == DcMsg.DC_MSG_VIDEOCHAT_INVITATION
|
||||
|| !dcContext.getChat(msgToReactTo.getChatId()).canSend()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
package org.thoughtcrime.securesms.util;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.Base64;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
||||
public class AvatarUtil {
|
||||
|
||||
/**
|
||||
* convert image path to data URI.
|
||||
*
|
||||
* @param filePath File path to image
|
||||
* @return data URI like "data:image/jpeg;base64,..."
|
||||
*/
|
||||
public static String asDataUri(String filePath) {
|
||||
Bitmap bitmap = BitmapFactory.decodeFile(filePath);
|
||||
if (bitmap == null) return null;
|
||||
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
bitmap.compress(Bitmap.CompressFormat.JPEG, 90, baos);
|
||||
byte[] bytes = baos.toByteArray();
|
||||
String base64 = Base64.encodeToString(bytes, Base64.NO_WRAP);
|
||||
return "data:image/jpeg;base64," + base64;
|
||||
}
|
||||
|
||||
/**
|
||||
* convert Drawable to data URI.
|
||||
*
|
||||
* @param drawable avatar image as Drawable
|
||||
* @return data URI like "data:image/png;base64,..."
|
||||
*/
|
||||
public static String asDataUri(Drawable drawable) {
|
||||
int w = Math.max(1, drawable.getIntrinsicWidth());
|
||||
int h = Math.max(1, drawable.getIntrinsicHeight());
|
||||
Bitmap bitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);
|
||||
Canvas canvas = new Canvas(bitmap);
|
||||
drawable.setBounds(0, 0, w, h);
|
||||
drawable.draw(canvas);
|
||||
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
bitmap.compress(Bitmap.CompressFormat.JPEG, 90, baos);
|
||||
byte[] bytes = baos.toByteArray();
|
||||
String base64 = Base64.encodeToString(bytes, Base64.NO_WRAP);
|
||||
return "data:image/jpeg;base64," + base64;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -119,6 +119,15 @@ public class DateUtils extends android.text.format.DateUtils {
|
||||
TimeUnit.MILLISECONDS.toSeconds(millis-(TimeUnit.MILLISECONDS.toMinutes(millis)*60000)));
|
||||
}
|
||||
|
||||
public static String getFormattedCallDuration(Context c, int seconds) {
|
||||
if (seconds < 60) {
|
||||
return c.getResources().getQuantityString(R.plurals.n_seconds_ext, seconds, seconds);
|
||||
}
|
||||
|
||||
int mins = seconds / 60;
|
||||
return c.getResources().getQuantityString(R.plurals.n_minutes_ext, mins, mins);
|
||||
}
|
||||
|
||||
public static String getFormattedTimespan(Context c, int timestamp) {
|
||||
int mins = timestamp / (1000 * 60);
|
||||
if (mins / 60 == 0) {
|
||||
|
||||
@@ -179,6 +179,11 @@ public class Prefs {
|
||||
return getBooleanPreference(context, "pref_new_broadcast_list", false);
|
||||
}
|
||||
|
||||
|
||||
public static boolean isCallsEnabled(Context context) {
|
||||
return getBooleanPreference(context, "pref_calls_enabled", false);
|
||||
}
|
||||
|
||||
// ringtone
|
||||
|
||||
public static @NonNull Uri getNotificationRingtone(Context context) {
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
package org.thoughtcrime.securesms.videochat;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
|
||||
import com.b44t.messenger.DcChat;
|
||||
import com.b44t.messenger.DcContext;
|
||||
import com.b44t.messenger.DcMsg;
|
||||
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.connect.DcHelper;
|
||||
import org.thoughtcrime.securesms.util.IntentUtils;
|
||||
|
||||
public class VideochatUtil {
|
||||
|
||||
public void invite(Activity activity, int chatId) {
|
||||
DcContext dcContext = DcHelper.getContext(activity);
|
||||
DcChat dcChat = dcContext.getChat(chatId);
|
||||
|
||||
new AlertDialog.Builder(activity)
|
||||
.setTitle(activity.getString(R.string.videochat_invite_user_to_videochat, dcChat.getName()))
|
||||
.setMessage(R.string.videochat_invite_user_hint)
|
||||
.setNegativeButton(R.string.cancel, null)
|
||||
.setPositiveButton(R.string.ok, (dialog, which) -> {
|
||||
int msgId = dcContext.sendVideochatInvitation(dcChat.getId());
|
||||
if (msgId != 0) {
|
||||
join(activity, msgId);
|
||||
}
|
||||
})
|
||||
.show();
|
||||
}
|
||||
|
||||
public void join(Activity activity, int msgId) {
|
||||
DcContext dcContext = DcHelper.getContext(activity);
|
||||
DcMsg dcMsg = dcContext.getMsg(msgId);
|
||||
String videochatUrl = dcMsg.getVideochatUrl();
|
||||
IntentUtils.showInBrowser(activity, videochatUrl);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:tint="#FFFFFF" android:viewportHeight="24" android:viewportWidth="24" android:width="24dp">
|
||||
|
||||
<path android:fillColor="@android:color/white" android:pathData="M12,9c-1.6,0 -3.15,0.25 -4.6,0.72v3.1c0,0.39 -0.23,0.74 -0.56,0.9 -0.98,0.49 -1.87,1.12 -2.66,1.85 -0.18,0.18 -0.43,0.28 -0.7,0.28 -0.28,0 -0.53,-0.11 -0.71,-0.29L0.29,13.08c-0.18,-0.17 -0.29,-0.42 -0.29,-0.7 0,-0.28 0.11,-0.53 0.29,-0.71C3.34,8.78 7.46,7 12,7s8.66,1.78 11.71,4.67c0.18,0.18 0.29,0.43 0.29,0.71 0,0.28 -0.11,0.53 -0.29,0.71l-2.48,2.48c-0.18,0.18 -0.43,0.29 -0.71,0.29 -0.27,0 -0.52,-0.11 -0.7,-0.28 -0.79,-0.74 -1.69,-1.36 -2.67,-1.85 -0.33,-0.16 -0.56,-0.5 -0.56,-0.9v-3.1C15.15,9.25 13.6,9 12,9z"/>
|
||||
|
||||
</vector>
|
||||
@@ -209,30 +209,6 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:layout_width="match_parent"
|
||||
android:id="@+id/invite_video_chat_linear_layout"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<org.thoughtcrime.securesms.components.CircleColorImageView
|
||||
android:id="@+id/invite_video_chat_button"
|
||||
android:layout_width="53dp"
|
||||
android:layout_height="53dp"
|
||||
android:src="@drawable/baseline_call_24"
|
||||
android:scaleType="center"
|
||||
android:contentDescription="@string/videochat"
|
||||
app:circleColor="@color/audio_icon"/>
|
||||
|
||||
<TextView android:layout_marginTop="10dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/AttachmentTypeLabel"
|
||||
android:text="@string/videochat"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minWidth="210dp"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical"
|
||||
android:focusable="true">
|
||||
|
||||
<LinearLayout android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="marquee"
|
||||
android:singleLine="true"
|
||||
android:fontFamily="sans-serif"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="?conversation_item_outgoing_text_primary_color"
|
||||
tools:text="Incoming call" />
|
||||
|
||||
<org.thoughtcrime.securesms.components.ConversationItemFooter
|
||||
android:id="@+id/footer"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="start"
|
||||
android:gravity="start"
|
||||
android:clipChildren="false"
|
||||
android:clipToPadding="false"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/call_icon"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:contentDescription="@null"
|
||||
android:src="@drawable/baseline_call_24"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<org.thoughtcrime.securesms.components.CallItemView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/call_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"/>
|
||||
@@ -172,6 +172,16 @@
|
||||
android:layout_marginLeft="@dimen/message_bubble_horizontal_padding"
|
||||
android:layout_marginRight="@dimen/message_bubble_horizontal_padding" />
|
||||
|
||||
<ViewStub
|
||||
android:id="@+id/call_view_stub"
|
||||
android:layout="@layout/conversation_item_call"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/message_bubble_top_padding"
|
||||
android:layout_marginBottom="@dimen/message_bubble_collapsed_footer_padding"
|
||||
android:layout_marginLeft="@dimen/message_bubble_horizontal_padding"
|
||||
android:layout_marginRight="@dimen/message_bubble_horizontal_padding" />
|
||||
|
||||
<org.thoughtcrime.securesms.components.emoji.AutoScaledEmojiTextView
|
||||
android:id="@+id/conversation_item_body"
|
||||
android:layout_width="wrap_content"
|
||||
|
||||
@@ -154,6 +154,16 @@
|
||||
android:layout_marginLeft="@dimen/message_bubble_horizontal_padding"
|
||||
android:layout_marginRight="@dimen/message_bubble_horizontal_padding" />
|
||||
|
||||
<ViewStub
|
||||
android:id="@+id/call_view_stub"
|
||||
android:layout="@layout/conversation_item_call"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/message_bubble_top_padding"
|
||||
android:layout_marginBottom="@dimen/message_bubble_collapsed_footer_padding"
|
||||
android:layout_marginLeft="@dimen/message_bubble_horizontal_padding"
|
||||
android:layout_marginRight="@dimen/message_bubble_horizontal_padding" />
|
||||
|
||||
<org.thoughtcrime.securesms.components.emoji.AutoScaledEmojiTextView
|
||||
android:id="@+id/conversation_item_body"
|
||||
android:layout_width="wrap_content"
|
||||
|
||||
@@ -1,105 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<org.thoughtcrime.securesms.ConversationVideochatItem
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/conversation_item_background"
|
||||
android:focusable="true"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="13dp"
|
||||
android:paddingBottom="13dp"
|
||||
android:paddingLeft="28dp"
|
||||
android:paddingRight="28dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/video_icon_container"
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="36dp"
|
||||
android:layout_marginLeft="2dp"
|
||||
android:layout_marginRight="2dp"
|
||||
android:background="@drawable/circle_universal_overlay"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentBottom="true">
|
||||
<ImageView android:id="@+id/video_icon"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
app:srcCompat="@drawable/ic_videocam_white_24dp" />
|
||||
</FrameLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/contact_photo_container"
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="2dp"
|
||||
android:layout_marginRight="2dp"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentBottom="true">
|
||||
<org.thoughtcrime.securesms.components.AvatarImageView
|
||||
android:id="@+id/contact_photo"
|
||||
android:foreground="@drawable/contact_photo_background"
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="36dp"
|
||||
android:cropToPadding="true"
|
||||
android:contentDescription="@null" />
|
||||
</FrameLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/conversation_update_body"
|
||||
style="@style/Delta.Text.UpdateHeader"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:autoLink="none"
|
||||
android:linksClickable="false"
|
||||
android:gravity="center"
|
||||
android:textColor="?attr/conversation_item_update_text_color"
|
||||
android:background="@drawable/conversation_item_update_background"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingTop="9dp"
|
||||
android:paddingRight="10dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:lineSpacingMultiplier="1.3"
|
||||
tools:text="Paddy invited to a video chat" />
|
||||
|
||||
<org.thoughtcrime.securesms.components.ConversationItemFooter
|
||||
android:id="@+id/conversation_item_footer"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/message_bubble_horizontal_padding"
|
||||
android:layout_marginBottom="@dimen/message_bubble_bottom_padding"
|
||||
android:layout_marginTop="3dp"
|
||||
android:paddingTop="2dp"
|
||||
android:paddingBottom="2dp"
|
||||
android:paddingLeft="@dimen/message_bubble_horizontal_padding"
|
||||
android:paddingRight="@dimen/message_bubble_horizontal_padding"
|
||||
android:layout_gravity="end"
|
||||
android:gravity="end"
|
||||
android:clipChildren="false"
|
||||
android:clipToPadding="false"
|
||||
android:background="@drawable/conversation_item_update_background"
|
||||
app:footer_text_color="@color/core_dark_05"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</org.thoughtcrime.securesms.ConversationVideochatItem>
|
||||
@@ -25,6 +25,11 @@
|
||||
android:visible="false"
|
||||
app:showAsAction="always"/>
|
||||
|
||||
<item android:id="@+id/menu_start_call"
|
||||
android:title="@string/start_call"
|
||||
android:icon="@drawable/baseline_call_24"
|
||||
app:showAsAction="always" />
|
||||
|
||||
<item android:id="@+id/menu_all_media"
|
||||
android:title="@string/apps_and_media"
|
||||
android:icon="@drawable/ic_apps_24"
|
||||
|
||||
@@ -118,11 +118,22 @@
|
||||
<!-- Refers to the time a contact was last seen. Shown below contact name in the profile. The placeholder will be replaced by a relative point in time as "3 minutes ago" (see https://momentjs.com for more examples and languages)-->
|
||||
<string name="last_seen_relative">Last seen %1$s</string>
|
||||
<string name="last_seen_unknown">Last seen: Unknown</string>
|
||||
<!-- Shown in call duration. Avoid abbreviations, prefer full words ex. "N seconds". -->
|
||||
<plurals name="n_seconds_ext">
|
||||
<item quantity="one">%d second</item>
|
||||
<item quantity="other">%d seconds</item>
|
||||
</plurals>
|
||||
<!-- Shown in call duration. Avoid abbreviations, prefer full words ex. "N minutes". -->
|
||||
<plurals name="n_minutes_ext">
|
||||
<item quantity="one">%d minute</item>
|
||||
<item quantity="other">%d minutes</item>
|
||||
</plurals>
|
||||
<!-- Shown beside messages that are "N minutes old". Prefer short strings, or well-known abbreviations. -->
|
||||
<plurals name="n_minutes">
|
||||
<item quantity="one">%d min</item>
|
||||
<item quantity="other">%d min</item>
|
||||
</plurals>
|
||||
|
||||
<!-- Shown beside messages that are "N hours old". Prefer short strings, or well-known abbreviations. -->
|
||||
<plurals name="n_hours">
|
||||
<item quantity="one">%d hour</item>
|
||||
@@ -368,6 +379,18 @@
|
||||
</plurals>
|
||||
<string name="file_saved_to">File saved to \"%1$s\".</string>
|
||||
|
||||
<string name="start_call">Call</string>
|
||||
<string name="calls">Calls</string>
|
||||
<string name="answer_call">Answer</string>
|
||||
<string name="end_call">Decline</string>
|
||||
<string name="outgoing_call">Outgoing call</string>
|
||||
<string name="incoming_call">Incoming call</string>
|
||||
<string name="declined_call">Declined call</string>
|
||||
<string name="canceled_call">Canceled call</string>
|
||||
<string name="missed_call">Missed call</string>
|
||||
<!-- the first placeholder will be replaced by a date, the second placeholder by duration, example: "Thu, 08:12 pm, 2 minutes" -->
|
||||
<string name="call_date_and_duration">%1$s, %2$s</string>
|
||||
|
||||
<!-- deprecated -->
|
||||
<string name="videochat">Video Chat</string>
|
||||
<!-- deprecated -->
|
||||
|
||||
@@ -16,14 +16,15 @@
|
||||
|
||||
<PreferenceCategory android:title="@string/pref_experimental_features">
|
||||
|
||||
<Preference android:key="pref_webrtc_instance"
|
||||
android:title="@string/videochat_instance"
|
||||
android:summary="@string/none"/>
|
||||
|
||||
<Preference android:key="pref_webxdc_store_url"
|
||||
android:title="@string/webxdc_store_url"
|
||||
android:summary="@string/none"/>
|
||||
|
||||
<org.thoughtcrime.securesms.components.SwitchPreferenceCompat
|
||||
android:defaultValue="false"
|
||||
android:key="pref_calls_enabled"
|
||||
android:title="Debug Calls"/>
|
||||
|
||||
<org.thoughtcrime.securesms.components.SwitchPreferenceCompat
|
||||
android:defaultValue="false"
|
||||
android:key="pref_new_broadcast_list"
|
||||
|
||||
Reference in New Issue
Block a user