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"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="50dp"
|
android:layout_height="wrap_content"
|
||||||
android:background="@drawable/sel_call_first"
|
android:orientation="vertical">
|
||||||
android:gravity="center_vertical">
|
|
||||||
|
|
||||||
<TextView
|
<LinearLayout
|
||||||
android:id="@+id/contactNameOrNumber"
|
android:id="@+id/row"
|
||||||
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_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="50dp"
|
||||||
android:layout_weight="1"
|
android:background="@drawable/sel_call_first"
|
||||||
android:paddingRight="20dp"
|
android:gravity="center_vertical">
|
||||||
android:gravity="right"
|
|
||||||
android:textColor="@android:color/white"
|
<TextView
|
||||||
android:textSize="22dp" />
|
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>
|
</LinearLayout>
|
|
@ -1,38 +1,14 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?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_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent">
|
||||||
android:background="@drawable/numpad_background">
|
|
||||||
|
<LinearLayout
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/calls"
|
android:id="@+id/calls"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentTop="true"
|
android:gravity="top"
|
||||||
android:gravity="center_vertical"
|
android:background="@drawable/numpad_background"
|
||||||
android:orientation="vertical">
|
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.app.Activity;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
@ -53,10 +55,10 @@ public class AudioCallFragment extends Fragment {
|
||||||
return view;
|
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();
|
String sipUri = call.getRemoteAddress().asStringUriOnly();
|
||||||
LinphoneAddress lAddress = LinphoneCoreFactory.instance().createLinphoneAddress(sipUri);
|
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);
|
TextView contact = (TextView) callView.findViewById(R.id.contactNameOrNumber);
|
||||||
if (lAddress.getDisplayName() == null) {
|
if (lAddress.getDisplayName() == null) {
|
||||||
|
@ -69,10 +71,19 @@ public class AudioCallFragment extends Fragment {
|
||||||
contact.setText(lAddress.getDisplayName());
|
contact.setText(lAddress.getDisplayName());
|
||||||
}
|
}
|
||||||
|
|
||||||
// ImageView contactPicture = (ImageView) callView.findViewById(R.id.contactPicture);
|
ImageView contactPicture = (ImageView) callView.findViewById(R.id.contactPicture);
|
||||||
// if (pictureUri != null) {
|
if (pictureUri != null) {
|
||||||
// LinphoneUtils.setImagePictureFromUri(callView.getContext(), contactPicture, Uri.parse(pictureUri.toString()), R.drawable.unknown_small);
|
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
|
@Override
|
||||||
|
@ -101,21 +112,16 @@ public class AudioCallFragment extends Fragment {
|
||||||
|
|
||||||
public void refreshCallList(Resources resources) {
|
public void refreshCallList(Resources resources) {
|
||||||
callsList.removeAllViews();
|
callsList.removeAllViews();
|
||||||
|
int callsNb = LinphoneManager.getLc().getCallsNb();
|
||||||
|
int index = 0;
|
||||||
|
|
||||||
boolean first = true;
|
|
||||||
for (LinphoneCall call : LinphoneManager.getLc().getCalls()) {
|
for (LinphoneCall call : LinphoneManager.getLc().getCalls()) {
|
||||||
LinearLayout callView = (LinearLayout) inflater.inflate(R.layout.active_call, container, false);
|
LinearLayout callView = (LinearLayout) inflater.inflate(R.layout.active_call, container, false);
|
||||||
displayCall(resources, callView, call);
|
displayCall(resources, callView, call, index == 0, index != callsNb - 1);
|
||||||
|
|
||||||
if (first) {
|
|
||||||
callView.setBackgroundResource(R.drawable.sel_call_first);
|
|
||||||
first = false;
|
|
||||||
} else {
|
|
||||||
callView.setBackgroundResource(R.drawable.sel_call);
|
|
||||||
}
|
|
||||||
|
|
||||||
callsList.addView(callView);
|
callsList.addView(callView);
|
||||||
|
index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
callsList.invalidate();
|
callsList.invalidate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue