mirror of
https://github.com/deltachat/deltachat-android.git
synced 2025-10-03 01:39:18 +02:00
use new call_info RPC API
This commit is contained in:
parent
e5b1becf13
commit
fddc80e60b
4 changed files with 26 additions and 9 deletions
|
@ -1 +1 @@
|
||||||
Subproject commit 738dc5ce197f589131479801db2fbd0fb0964599
|
Subproject commit 1ba448fe199751e0854fccccde8c768229a5f44e
|
|
@ -584,7 +584,11 @@ public class ConversationItem extends BaseConversationItem
|
||||||
if (stickerStub.resolved()) stickerStub.get().setVisibility(View.GONE);
|
if (stickerStub.resolved()) stickerStub.get().setVisibility(View.GONE);
|
||||||
if (vcardViewStub.resolved()) vcardViewStub.get().setVisibility(View.GONE);
|
if (vcardViewStub.resolved()) vcardViewStub.get().setVisibility(View.GONE);
|
||||||
|
|
||||||
callViewStub.get().setCallItem(messageRecord);
|
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().setOnClickListener(passthroughClickListener);
|
callViewStub.get().setOnClickListener(passthroughClickListener);
|
||||||
callViewStub.get().setOnLongClickListener(passthroughClickListener);
|
callViewStub.get().setOnLongClickListener(passthroughClickListener);
|
||||||
|
|
||||||
|
|
|
@ -4,18 +4,17 @@ import android.content.Context;
|
||||||
import android.content.res.TypedArray;
|
import android.content.res.TypedArray;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.util.Log;
|
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
|
|
||||||
import com.b44t.messenger.DcMsg;
|
|
||||||
|
|
||||||
import org.thoughtcrime.securesms.R;
|
import org.thoughtcrime.securesms.R;
|
||||||
|
|
||||||
|
import chat.delta.rpc.types.CallInfo;
|
||||||
|
import chat.delta.rpc.types.CallState;
|
||||||
|
|
||||||
public class CallItemView extends FrameLayout {
|
public class CallItemView extends FrameLayout {
|
||||||
private static final String TAG = CallItemView.class.getSimpleName();
|
private static final String TAG = CallItemView.class.getSimpleName();
|
||||||
|
|
||||||
|
@ -41,9 +40,18 @@ public class CallItemView extends FrameLayout {
|
||||||
this.footer = findViewById(R.id.footer);
|
this.footer = findViewById(R.id.footer);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCallItem(final @NonNull DcMsg dcMsg) {
|
public void setCallItem(boolean isOutgoing, CallInfo callInfo) {
|
||||||
title.setText(dcMsg.getText());
|
if (callInfo.state instanceof CallState.Missed) {
|
||||||
if (dcMsg.isOutgoing()) {
|
title.setText(R.string.missed_call);
|
||||||
|
} else if (callInfo.state instanceof CallState.Cancelled) {
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isOutgoing) {
|
||||||
int[] attrs = new int[]{
|
int[] attrs = new int[]{
|
||||||
R.attr.conversation_item_outgoing_text_secondary_color,
|
R.attr.conversation_item_outgoing_text_secondary_color,
|
||||||
};
|
};
|
||||||
|
|
|
@ -372,6 +372,11 @@
|
||||||
<string name="calls">Calls</string>
|
<string name="calls">Calls</string>
|
||||||
<string name="answer_call">Answer</string>
|
<string name="answer_call">Answer</string>
|
||||||
<string name="end_call">Decline</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>
|
||||||
|
|
||||||
<!-- deprecated -->
|
<!-- deprecated -->
|
||||||
<string name="videochat">Video Chat</string>
|
<string name="videochat">Video Chat</string>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue