Improved display of calls when more than one
This commit is contained in:
parent
dd64d09eae
commit
ea1b7823e5
5 changed files with 19 additions and 15 deletions
|
@ -7,7 +7,7 @@
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/row"
|
android:id="@+id/row"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="50dp"
|
android:layout_height="75dp"
|
||||||
android:background="@drawable/sel_call_first"
|
android:background="@drawable/sel_call_first"
|
||||||
android:gravity="center_vertical">
|
android:gravity="center_vertical">
|
||||||
|
|
||||||
|
|
|
@ -3,12 +3,11 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<LinearLayout
|
<FrameLayout
|
||||||
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:gravity="top"
|
android:gravity="top"
|
||||||
android:background="@drawable/background"
|
android:background="@drawable/background" />
|
||||||
android:orientation="vertical" />
|
|
||||||
|
|
||||||
</ScrollView>
|
</ScrollView>
|
|
@ -32,6 +32,7 @@ import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.Chronometer;
|
import android.widget.Chronometer;
|
||||||
|
import android.widget.FrameLayout;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
@ -41,9 +42,12 @@ import android.widget.TextView;
|
||||||
*/
|
*/
|
||||||
public class AudioCallFragment extends Fragment {
|
public class AudioCallFragment extends Fragment {
|
||||||
private static AudioCallFragment instance;
|
private static AudioCallFragment instance;
|
||||||
private LinearLayout callsList;
|
private FrameLayout callsList;
|
||||||
private LayoutInflater inflater;
|
private LayoutInflater inflater;
|
||||||
private ViewGroup container;
|
private ViewGroup container;
|
||||||
|
private static final int rowHeight = 75; // Value set in active_call.xml
|
||||||
|
private static final int rowThickRatio = 85; // Ratio dependent from the image
|
||||||
|
private static final int topMargin = (int) ((rowHeight * rowThickRatio) / 100);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
|
@ -53,12 +57,12 @@ public class AudioCallFragment extends Fragment {
|
||||||
this.container = container;
|
this.container = container;
|
||||||
|
|
||||||
View view = inflater.inflate(R.layout.audio, container, false);
|
View view = inflater.inflate(R.layout.audio, container, false);
|
||||||
callsList = (LinearLayout) view.findViewById(R.id.calls);
|
callsList = (FrameLayout) view.findViewById(R.id.calls);
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void displayCall(Resources resources, LinearLayout callView, LinphoneCall call, boolean first, boolean hide) {
|
private void displayCall(Resources resources, LinearLayout callView, LinphoneCall call, int index, 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());
|
||||||
|
@ -89,10 +93,11 @@ public class AudioCallFragment extends Fragment {
|
||||||
contactPicture.setVisibility(View.GONE);
|
contactPicture.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (first) {
|
if (index == 0) {
|
||||||
callView.findViewById(R.id.row).setBackgroundResource(R.drawable.sel_call_first);
|
callView.findViewById(R.id.row).setBackgroundResource(R.drawable.sel_call_first);
|
||||||
} else {
|
} else {
|
||||||
callView.findViewById(R.id.row).setBackgroundResource(R.drawable.sel_call);
|
callView.findViewById(R.id.row).setBackgroundResource(R.drawable.sel_call);
|
||||||
|
callView.setPadding(0, LinphoneUtils.pixelsToDpi(resources, topMargin * index), 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
registerCallDurationTimer(callView, call);
|
registerCallDurationTimer(callView, call);
|
||||||
|
@ -148,7 +153,7 @@ public class AudioCallFragment extends Fragment {
|
||||||
|
|
||||||
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, index == 0, index != callsNb - 1);
|
displayCall(resources, callView, call, index, index != callsNb - 1);
|
||||||
callsList.addView(callView);
|
callsList.addView(callView);
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,9 +18,7 @@ along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.linphone.LinphoneSimpleListener.LinphoneOnCallEncryptionChangedListener;
|
import org.linphone.LinphoneSimpleListener.LinphoneOnCallEncryptionChangedListener;
|
||||||
import org.linphone.LinphoneSimpleListener.LinphoneOnCallStateChangedListener;
|
import org.linphone.LinphoneSimpleListener.LinphoneOnCallStateChangedListener;
|
||||||
|
@ -43,11 +41,9 @@ import android.view.View.OnClickListener;
|
||||||
import android.view.animation.Animation;
|
import android.view.animation.Animation;
|
||||||
import android.view.animation.Animation.AnimationListener;
|
import android.view.animation.Animation.AnimationListener;
|
||||||
import android.view.animation.AnimationUtils;
|
import android.view.animation.AnimationUtils;
|
||||||
import android.widget.Chronometer;
|
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
|
|
||||||
//FIXME : Chronometer for calls
|
|
||||||
/**
|
/**
|
||||||
* @author Sylvain Berfini
|
* @author Sylvain Berfini
|
||||||
*/
|
*/
|
||||||
|
@ -67,7 +63,6 @@ public class InCallActivity extends FragmentActivity implements
|
||||||
private VideoCallFragment videoCallFragment;
|
private VideoCallFragment videoCallFragment;
|
||||||
private boolean isSpeakerEnabled = false, isMicMuted = false, isVideoEnabled = false;
|
private boolean isSpeakerEnabled = false, isMicMuted = false, isVideoEnabled = false;
|
||||||
private LinearLayout mControlsLayout;
|
private LinearLayout mControlsLayout;
|
||||||
private Set<Chronometer> mChronometers = new HashSet<Chronometer>();
|
|
||||||
|
|
||||||
static final boolean isInstanciated() {
|
static final boolean isInstanciated() {
|
||||||
return instance != null;
|
return instance != null;
|
||||||
|
|
|
@ -42,10 +42,12 @@ import android.app.Activity;
|
||||||
import android.content.ContentResolver;
|
import android.content.ContentResolver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.res.Resources;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.BitmapFactory;
|
import android.graphics.BitmapFactory;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
|
import android.util.TypedValue;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
|
@ -234,5 +236,8 @@ public final class LinphoneUtils {
|
||||||
v.setOnClickListener(l);
|
v.setOnClickListener(l);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int pixelsToDpi(Resources res, int pixels) {
|
||||||
|
return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, (float) pixels, res.getDisplayMetrics());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue