mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-24 08:47:46 +00:00
parent
f1cec5a2ca
commit
efdb57e76b
@ -21,6 +21,7 @@ import android.content.Context;
|
|||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.provider.ContactsContract;
|
import android.provider.ContactsContract;
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
@ -41,14 +42,16 @@ import org.thoughtcrime.securesms.recipients.Recipient;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class CallCard extends LinearLayout {
|
public class CallCard extends LinearLayout implements Recipient.RecipientModifiedListener {
|
||||||
|
|
||||||
private ImageView photo;
|
private ImageView photo;
|
||||||
private TextView name;
|
private TextView name;
|
||||||
private TextView phoneNumber;
|
private TextView phoneNumber;
|
||||||
private TextView label;
|
private TextView label;
|
||||||
private TextView elapsedTime;
|
private TextView elapsedTime;
|
||||||
private TextView status;
|
private TextView status;
|
||||||
|
|
||||||
|
private Recipient recipient;
|
||||||
|
|
||||||
public CallCard(Context context) {
|
public CallCard(Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
@ -63,14 +66,19 @@ public class CallCard extends LinearLayout {
|
|||||||
public void reset() {
|
public void reset() {
|
||||||
setPersonInfo(Recipient.getUnknownRecipient());
|
setPersonInfo(Recipient.getUnknownRecipient());
|
||||||
this.status.setText("");
|
this.status.setText("");
|
||||||
|
this.recipient = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setElapsedTime(String time) {
|
public void setElapsedTime(String time) {
|
||||||
this.elapsedTime.setText(time);
|
this.elapsedTime.setText(time);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setPersonInfo(final Recipient recipient) {
|
private void setPersonInfo(final @NonNull Recipient recipient) {
|
||||||
|
this.recipient = recipient;
|
||||||
|
this.recipient.addListener(this);
|
||||||
|
|
||||||
final Context context = getContext();
|
final Context context = getContext();
|
||||||
|
|
||||||
new AsyncTask<Void, Void, ContactPhoto>() {
|
new AsyncTask<Void, Void, ContactPhoto>() {
|
||||||
@Override
|
@Override
|
||||||
protected ContactPhoto doInBackground(Void... params) {
|
protected ContactPhoto doInBackground(Void... params) {
|
||||||
@ -110,4 +118,10 @@ public class CallCard extends LinearLayout {
|
|||||||
this.status = (TextView)findViewById(R.id.callStateLabel);
|
this.status = (TextView)findViewById(R.id.callStateLabel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onModified(Recipient recipient) {
|
||||||
|
if (recipient == this.recipient) {
|
||||||
|
setPersonInfo(recipient);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user