mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
use new call_info RPC API
This commit is contained in:
@@ -584,7 +584,11 @@ public class ConversationItem extends BaseConversationItem
|
||||
if (stickerStub.resolved()) stickerStub.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().setOnLongClickListener(passthroughClickListener);
|
||||
|
||||
|
||||
@@ -4,18 +4,17 @@ import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Color;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.b44t.messenger.DcMsg;
|
||||
|
||||
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();
|
||||
|
||||
@@ -41,9 +40,18 @@ public class CallItemView extends FrameLayout {
|
||||
this.footer = findViewById(R.id.footer);
|
||||
}
|
||||
|
||||
public void setCallItem(final @NonNull DcMsg dcMsg) {
|
||||
title.setText(dcMsg.getText());
|
||||
if (dcMsg.isOutgoing()) {
|
||||
public void setCallItem(boolean isOutgoing, CallInfo callInfo) {
|
||||
if (callInfo.state instanceof CallState.Missed) {
|
||||
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[]{
|
||||
R.attr.conversation_item_outgoing_text_secondary_color,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user