Better incall display
This commit is contained in:
parent
ebca161b7e
commit
ca7c941930
3 changed files with 70 additions and 70 deletions
|
@ -1,28 +1,46 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:background="@drawable/sel_call_first"
|
||||
android:gravity="center_vertical">
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/contactNameOrNumber"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.3"
|
||||
android:gravity="left"
|
||||
android:paddingLeft="20dp"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="22dp" />
|
||||
|
||||
<Chronometer
|
||||
android:id="@+id/callTimer"
|
||||
<LinearLayout
|
||||
android:id="@+id/row"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:paddingRight="20dp"
|
||||
android:gravity="right"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="22dp" />
|
||||
android:layout_height="50dp"
|
||||
android:background="@drawable/sel_call_first"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/contactNameOrNumber"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.3"
|
||||
android:gravity="left"
|
||||
android:paddingLeft="20dp"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="22dp" />
|
||||
|
||||
<Chronometer
|
||||
android:id="@+id/callTimer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:paddingRight="20dp"
|
||||
android:gravity="right"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="22dp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/contactPicture"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:layout_gravity="center"
|
||||
android:contentDescription="@string/content_description_contact_picture"
|
||||
android:paddingBottom="10sp"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/unknown_small" />
|
||||
|
||||
</LinearLayout>
|
|
@ -1,38 +1,14 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/numpad_background">
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
<LinearLayout
|
||||
android:id="@+id/calls"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical">
|
||||
android:gravity="top"
|
||||
android:background="@drawable/numpad_background"
|
||||
android:orientation="vertical" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_below="@id/calls"
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="30dip">
|
||||
|
||||
<ImageView
|
||||
android:contentDescription="@string/content_description_contact_picture"
|
||||
android:id="@+id/contactPicture"
|
||||
android:src="@drawable/unknown_small"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:scaleType="fitCenter"
|
||||
android:minWidth="128dp"
|
||||
android:minHeight="128dp"
|
||||
android:paddingBottom="10sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
</ScrollView>
|
|
@ -23,11 +23,13 @@ import org.linphone.core.LinphoneCoreFactory;
|
|||
|
||||
import android.app.Activity;
|
||||
import android.content.res.Resources;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
|
@ -53,10 +55,10 @@ public class AudioCallFragment extends Fragment {
|
|||
return view;
|
||||
}
|
||||
|
||||
private void displayCall(Resources resources, LinearLayout callView, LinphoneCall call) {
|
||||
private void displayCall(Resources resources, LinearLayout callView, LinphoneCall call, boolean first, boolean hide) {
|
||||
String sipUri = call.getRemoteAddress().asStringUriOnly();
|
||||
LinphoneAddress lAddress = LinphoneCoreFactory.instance().createLinphoneAddress(sipUri);
|
||||
// Uri pictureUri = LinphoneUtils.findUriPictureOfContactAndSetDisplayName(lAddress, callView.getContext().getContentResolver());
|
||||
Uri pictureUri = LinphoneUtils.findUriPictureOfContactAndSetDisplayName(lAddress, callView.getContext().getContentResolver());
|
||||
|
||||
TextView contact = (TextView) callView.findViewById(R.id.contactNameOrNumber);
|
||||
if (lAddress.getDisplayName() == null) {
|
||||
|
@ -69,10 +71,19 @@ public class AudioCallFragment extends Fragment {
|
|||
contact.setText(lAddress.getDisplayName());
|
||||
}
|
||||
|
||||
// ImageView contactPicture = (ImageView) callView.findViewById(R.id.contactPicture);
|
||||
// if (pictureUri != null) {
|
||||
// LinphoneUtils.setImagePictureFromUri(callView.getContext(), contactPicture, Uri.parse(pictureUri.toString()), R.drawable.unknown_small);
|
||||
// }
|
||||
ImageView contactPicture = (ImageView) callView.findViewById(R.id.contactPicture);
|
||||
if (pictureUri != null) {
|
||||
LinphoneUtils.setImagePictureFromUri(callView.getContext(), contactPicture, Uri.parse(pictureUri.toString()), R.drawable.unknown_small);
|
||||
}
|
||||
if (hide) {
|
||||
contactPicture.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if (first) {
|
||||
callView.findViewById(R.id.row).setBackgroundResource(R.drawable.sel_call_first);
|
||||
} else {
|
||||
callView.findViewById(R.id.row).setBackgroundResource(R.drawable.sel_call);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -101,21 +112,16 @@ public class AudioCallFragment extends Fragment {
|
|||
|
||||
public void refreshCallList(Resources resources) {
|
||||
callsList.removeAllViews();
|
||||
int callsNb = LinphoneManager.getLc().getCallsNb();
|
||||
int index = 0;
|
||||
|
||||
boolean first = true;
|
||||
for (LinphoneCall call : LinphoneManager.getLc().getCalls()) {
|
||||
LinearLayout callView = (LinearLayout) inflater.inflate(R.layout.active_call, container, false);
|
||||
displayCall(resources, callView, call);
|
||||
|
||||
if (first) {
|
||||
callView.setBackgroundResource(R.drawable.sel_call_first);
|
||||
first = false;
|
||||
} else {
|
||||
callView.setBackgroundResource(R.drawable.sel_call);
|
||||
}
|
||||
|
||||
displayCall(resources, callView, call, index == 0, index != callsNb - 1);
|
||||
callsList.addView(callView);
|
||||
index++;
|
||||
}
|
||||
|
||||
callsList.invalidate();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue