Incoming and outgoing call

This commit is contained in:
Margaux Clerc 2015-09-18 18:44:59 +02:00
parent b24b1a43f3
commit c5dbf76fef
4 changed files with 45 additions and 32 deletions

View file

@ -1,17 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/topLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorH">
android:layout_height="match_parent">
<include layout="@layout/status" android:id="@+id/statusBar" />
<fragment
android:id="@+id/status"
android:name="org.linphone.StatusFragment"
android:layout_width="match_parent"
android:layout_height="40dp"
tools:layout="@layout/status" />
<RelativeLayout
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_below="@id/statusBar"
android:layout_below="@id/status"
android:background="@color/colorF">
<TextView
@ -42,8 +47,8 @@
<ImageView
android:id="@+id/incoming_picture"
android:layout_width="220dp"
android:layout_height="220dp"
android:layout_width="200dp"
android:layout_height="200dp"
android:src="@drawable/avatar"
android:paddingBottom="10dp"
android:layout_marginTop="10dp"/>
@ -85,28 +90,23 @@
<ImageView
android:id="@+id/decline"
android:src="@drawable/call_hangup"
android:background="@drawable/hangup"
android:contentDescription="@string/content_description_pause"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/hangup"
android:adjustViewBounds="true"
android:contentDescription="@string/content_description_pause"
android:scaleType="center"
android:src="@drawable/call_hangup" />
android:padding="15dp"/>
<ImageView
android:id="@+id/accept"
android:src="@drawable/call_audio_start"
android:background="@drawable/call"
android:contentDescription="@string/content_description_pause"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/call"
android:adjustViewBounds="true"
android:contentDescription="@string/content_description_pause"
android:scaleType="center"
android:src="@drawable/call_audio_start" />
android:padding="15dp"/>
</LinearLayout>
</RelativeLayout>

View file

@ -1,17 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/topLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorH">
<include layout="@layout/status" android:id="@+id/statusBar" />
<fragment
android:id="@+id/status"
android:name="org.linphone.StatusFragment"
android:layout_width="match_parent"
android:layout_height="40dp"
tools:layout="@layout/status" />
<RelativeLayout
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_below="@id/statusBar"
android:layout_below="@id/status"
android:background="@color/colorF">
<TextView
@ -42,8 +48,8 @@
<ImageView
android:id="@+id/incoming_picture"
android:layout_width="220dp"
android:layout_height="220dp"
android:layout_width="200dp"
android:layout_height="200dp"
android:src="@drawable/avatar"
android:paddingBottom="10dp"
android:layout_marginTop="10dp"/>
@ -90,9 +96,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:adjustViewBounds="true"
android:contentDescription="@string/content_description_pause"
android:scaleType="center"/>
android:padding="15dp"/>
<ImageView
android:id="@+id/speaker"
@ -101,9 +106,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:adjustViewBounds="true"
android:contentDescription="@string/content_description_pause"
android:scaleType="center"/>
android:padding="20dp"/>
<ImageView
android:id="@+id/hang_up"
@ -113,8 +117,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.7"
android:adjustViewBounds="true"
android:scaleType="center"/>
android:padding="15dp"/>
</LinearLayout>

View file

@ -27,11 +27,9 @@ import org.linphone.core.LinphoneCallParams;
import org.linphone.core.LinphoneCore;
import org.linphone.core.LinphoneCoreListenerBase;
import org.linphone.mediastream.Log;
import org.linphone.ui.LinphoneSliders;
import org.linphone.ui.LinphoneSliders.LinphoneSliderTriggered;
import android.app.Activity;
import android.net.Uri;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
@ -55,6 +53,7 @@ public class IncomingCallActivity extends Activity implements LinphoneSliderTrig
private ImageView mPictureView;
private LinphoneCall mCall;
private LinphoneCoreListenerBase mListener;
private StatusFragment status;
public static IncomingCallActivity instance() {
return instance;
@ -66,6 +65,8 @@ public class IncomingCallActivity extends Activity implements LinphoneSliderTrig
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
setContentView(R.layout.incoming);
@ -171,7 +172,9 @@ public class IncomingCallActivity extends Activity implements LinphoneSliderTrig
return super.onKeyDown(keyCode, event);
}
public void updateStatusFragment(StatusFragment fragment) {
status = fragment;
}
private void decline() {
LinphoneManager.getLc().terminateCall(mCall);

View file

@ -55,6 +55,7 @@ public class OutgoingCallActivity extends Activity {
private LinphoneCall mCall;
private LinphoneCoreListenerBase mListener;
private boolean isMicMuted, isSpeakerEnabled;
private StatusFragment status;
public static OutgoingCallActivity instance() {
return instance;
@ -64,8 +65,14 @@ public class OutgoingCallActivity extends Activity {
return instance != null;
}
public void updateStatusFragment(StatusFragment fragment) {
status = fragment;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
setContentView(R.layout.outgoing_call);