Incoming call activity.
This commit is contained in:
parent
70a52abf30
commit
54388a2026
4 changed files with 143 additions and 4 deletions
|
@ -37,13 +37,30 @@
|
|||
</activity>
|
||||
|
||||
|
||||
<activity android:name="org.linphone.IncomingCallActivity" android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity android:name="org.linphone.UriPickerActivity" android:theme="@android:style/Theme.NoTitleBar">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:name="org.linphone.UriPickerActivity$DialerActivity" android:theme="@android:style/Theme.NoTitleBar">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity android:name="org.linphone.FirstLoginActivity" android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:name="org.linphone.ConferenceActivity"
|
||||
android:launchMode="singleTop"
|
||||
android:launchMode="singleTop"
|
||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
|
54
res/layout/incoming.xml
Normal file
54
res/layout/incoming.xml
Normal file
|
@ -0,0 +1,54 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout android:orientation="vertical"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent" android:layout_height="fill_parent">
|
||||
|
||||
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="25sp" android:layout_alignParentTop="true"
|
||||
android:text="Incoming call" android:textAppearance="?android:attr/textAppearanceLarge">
|
||||
</TextView>
|
||||
|
||||
<LinearLayout android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" android:orientation="vertical"
|
||||
android:layout_centerInParent="true">
|
||||
<TextView android:id="@+id/incoming_caller_name"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:text="Caller name" android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:layout_gravity="center_horizontal">
|
||||
</TextView>
|
||||
<TextView android:id="@+id/incoming_caller_number"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8sp"
|
||||
android:text="Caller phone"
|
||||
android:textAppearance="?android:attr/textAppearance"
|
||||
android:layout_gravity="center_horizontal">
|
||||
</TextView>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<org.linphone.ui.CallButton android:src="@drawable/startcall_green" android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" android:id="@+id/Answer"
|
||||
android:text="answer"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:layout_alignParentLeft="true" android:layout_marginBottom="40sp"
|
||||
android:layout_alignParentBottom="true"/>
|
||||
|
||||
<org.linphone.ui.HangCallButton android:src="@drawable/stopcall_red" android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" android:id="@+id/Decline"
|
||||
android:text="decline"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:layout_alignParentRight="true" android:layout_alignBottom="@id/Answer"/>
|
||||
|
||||
|
||||
|
||||
<!-- <org.linphone.ui.CallButton android:src="@drawable/startvideo_green" android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content" android:id="@+id/AnswerWithVideo"-->
|
||||
<!-- android:text="answer with video"-->
|
||||
<!-- android:textAppearance="?android:attr/textAppearanceLarge"-->
|
||||
<!-- android:layout_alignParentLeft="true" android:layout_marginBottom="30sp"-->
|
||||
<!-- android:layout_above="@id/Answer"/>-->
|
||||
|
||||
|
||||
</RelativeLayout>
|
|
@ -27,7 +27,6 @@ import org.linphone.core.LinphoneCore;
|
|||
import org.linphone.core.Log;
|
||||
import org.linphone.core.LinphoneCall.State;
|
||||
import org.linphone.mediastream.Version;
|
||||
import org.linphone.mediastream.video.capture.hwconf.Hacks;
|
||||
import org.linphone.ui.AddVideoButton;
|
||||
import org.linphone.ui.AddressAware;
|
||||
import org.linphone.ui.AddressText;
|
||||
|
@ -93,6 +92,7 @@ public class DialerActivity extends LinphoneManagerWaitActivity implements Linph
|
|||
private static final String CURRENT_DISPLAYNAME = "org.linphone.current-displayname";
|
||||
|
||||
private static final int incomingCallDialogId = 1;
|
||||
private static final int INCOMING_CALL_ACTIVITY = 10;
|
||||
|
||||
/**
|
||||
* @return null if not ready yet
|
||||
|
@ -274,7 +274,8 @@ public class DialerActivity extends LinphoneManagerWaitActivity implements Linph
|
|||
private void exitCallMode() {
|
||||
// Remove dialog if existing
|
||||
try {
|
||||
dismissDialog(incomingCallDialogId);
|
||||
// dismissDialog(incomingCallDialogId);
|
||||
finishActivity(INCOMING_CALL_ACTIVITY);
|
||||
} catch (Throwable e) {/* Exception if never created */}
|
||||
|
||||
if (useIncallActivity) {
|
||||
|
@ -307,7 +308,15 @@ public class DialerActivity extends LinphoneManagerWaitActivity implements Linph
|
|||
|
||||
|
||||
private void callPending(final LinphoneCall call) {
|
||||
showDialog(incomingCallDialogId);
|
||||
// showDialog(incomingCallDialogId);
|
||||
LinphoneAddress address = LinphoneManager.getLc().getRemoteAddress();
|
||||
String from = LinphoneManager.extractADisplayName(getResources(), address);
|
||||
Intent intent = new Intent()
|
||||
.setClass(this, IncomingCallActivity.class)
|
||||
.putExtra("name", from)
|
||||
.putExtra("number", address.asStringUriOnly());
|
||||
|
||||
startActivityForResult(intent, INCOMING_CALL_ACTIVITY);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
59
src/org/linphone/IncomingCallActivity.java
Normal file
59
src/org/linphone/IncomingCallActivity.java
Normal file
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
IncomingCallActivity.java
|
||||
Copyright (C) 2011 Belledonne Communications, Grenoble, France
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
package org.linphone;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.TextView;
|
||||
|
||||
/**
|
||||
* Activity displayed when a call comes in.
|
||||
* It should bypass the screen lock mechanism.
|
||||
*
|
||||
* @author Guillaume Beraudo
|
||||
*/
|
||||
public class IncomingCallActivity extends Activity {
|
||||
|
||||
private TextView mNameView;
|
||||
private TextView mNumberView;
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.incoming);
|
||||
|
||||
mNameView = (TextView) findViewById(R.id.incoming_caller_name);
|
||||
mNumberView = (TextView) findViewById(R.id.incoming_caller_number);
|
||||
|
||||
|
||||
// set this flag so this activity will stay in front of the keyguard
|
||||
int flags = WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED;
|
||||
flags |= WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD;
|
||||
getWindow().addFlags(flags);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
mNameView.setText(getIntent().getStringExtra("name"));
|
||||
mNumberView.setText(getIntent().getStringExtra("number"));
|
||||
super.onResume();
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue