Chronometer, abstract callee activity.
This commit is contained in:
parent
e82587ae94
commit
db02aec518
11 changed files with 394 additions and 403 deletions
|
@ -80,7 +80,8 @@
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
<activity android:name="org.linphone.ConferenceDetailsActivity"
|
<activity android:name="org.linphone.ConferenceDetailsActivity"
|
||||||
android:theme="@android:style/Theme.NoTitleBar">
|
android:theme="@android:style/Theme.NoTitleBar"
|
||||||
|
android:screenOrientation="portrait">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:minHeight="60sp"
|
android:minHeight="60sp" android:background="@drawable/conf_callee_bg"
|
||||||
android:layout_width="fill_parent" android:layout_height="fill_parent" >
|
android:layout_width="fill_parent" android:layout_height="fill_parent" >
|
||||||
|
|
||||||
<ImageView android:id="@+id/picture" android:layout_width="wrap_content"
|
<ImageView android:id="@+id/picture" android:layout_width="wrap_content"
|
||||||
|
@ -35,7 +35,11 @@
|
||||||
android:layout_width="fill_parent" android:layout_height="fill_parent"
|
android:layout_width="fill_parent" android:layout_height="fill_parent"
|
||||||
android:layout_centerVertical="true">
|
android:layout_centerVertical="true">
|
||||||
<TextView android:id="@+id/name" style="@style/callee_name" />
|
<TextView android:id="@+id/name" style="@style/callee_name" />
|
||||||
<TextView android:id="@+id/address" style="@style/callee_address" />
|
<LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content">
|
||||||
|
<Chronometer android:id="@+id/callee_duration" style="@style/callee_address"
|
||||||
|
android:paddingRight="10sp"/>
|
||||||
|
<TextView android:id="@+id/address" style="@style/callee_address" />
|
||||||
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<?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="fill_parent" android:layout_height="48px" >
|
android:layout_width="fill_parent" android:layout_height="48px"
|
||||||
|
android:background="@drawable/conf_callee_bg">
|
||||||
|
|
||||||
<ImageView android:id="@+id/picture" android:layout_width="48px"
|
<ImageView android:id="@+id/picture" android:layout_width="48px"
|
||||||
android:src="@drawable/unknown_person" android:layout_height="48px"
|
android:src="@drawable/unknown_person" android:layout_height="48px"
|
||||||
|
@ -8,9 +9,14 @@
|
||||||
|
|
||||||
|
|
||||||
<LinearLayout android:id="@+id/callee_block" android:orientation="vertical"
|
<LinearLayout android:id="@+id/callee_block" android:orientation="vertical"
|
||||||
android:layout_width="wrap_content" android:layout_height="48px">
|
android:layout_toRightOf="@id/picture" android:layout_toLeftOf="@id/callee_statuses"
|
||||||
|
android:layout_width="fill_parent" android:layout_height="48px">
|
||||||
<TextView android:id="@+id/name" style="@style/callee_name" />
|
<TextView android:id="@+id/name" style="@style/callee_name" />
|
||||||
<TextView android:id="@+id/address" style="@style/callee_address" />
|
<LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content">
|
||||||
|
<Chronometer android:id="@+id/callee_duration" style="@style/callee_address"
|
||||||
|
android:paddingRight="10sp"/>
|
||||||
|
<TextView android:id="@+id/address" style="@style/callee_address" />
|
||||||
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<View android:layout_height="fill_parent" android:layout_width="wrap_content" android:layout_weight="1"/>
|
<View android:layout_height="fill_parent" android:layout_width="wrap_content" android:layout_weight="1"/>
|
||||||
|
|
|
@ -1,47 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:minHeight="60sp"
|
|
||||||
android:layout_width="fill_parent" android:layout_height="fill_parent"
|
|
||||||
android:background="@drawable/conf_callee_bg">
|
|
||||||
|
|
||||||
<ImageView android:id="@+id/picture" android:layout_width="wrap_content"
|
|
||||||
android:src="@drawable/unknown_person" android:layout_height="wrap_content"
|
|
||||||
android:layout_alignParentLeft="true" android:layout_centerVertical="true"
|
|
||||||
android:paddingRight="3sp"/>
|
|
||||||
|
|
||||||
<LinearLayout android:id="@+id/callee_statuses" android:layout_alignParentRight="true"
|
|
||||||
android:layout_width="wrap_content" android:layout_height="fill_parent"
|
|
||||||
android:layout_centerVertical="true">
|
|
||||||
<TextView android:id="@+id/status_label" style="@style/callee_status" />
|
|
||||||
<ImageView android:id="@+id/callee_status_paused" style="@style/callee_status" android:src="@drawable/conf_status_paused" android:visibility="gone"/>
|
|
||||||
<ImageView android:id="@+id/callee_status_secured" style="@style/callee_status" android:src="@drawable/conf_secured" android:visibility="gone"/>
|
|
||||||
<ImageView android:id="@+id/callee_status_maybe_secured" style="@style/callee_status" android:src="@drawable/conf_maybe_secured" android:visibility="gone"/>
|
|
||||||
<ImageView android:id="@+id/callee_status_not_secured" style="@style/callee_status" android:src="@drawable/conf_not_secured" android:visibility="gone"/>
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/callee_buttons"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="fill_parent"
|
|
||||||
android:layout_alignParentRight="true"
|
|
||||||
android:layout_centerVertical="true" >
|
|
||||||
|
|
||||||
<ImageButton
|
|
||||||
android:id="@+id/remove_from_conference"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:src="@drawable/conf_remove"
|
|
||||||
android:visibility="gone" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<LinearLayout android:id="@+id/callee_block" android:orientation="vertical"
|
|
||||||
android:layout_toRightOf="@id/picture" android:layout_toLeftOf="@id/callee_buttons"
|
|
||||||
android:layout_width="fill_parent" android:layout_height="fill_parent"
|
|
||||||
android:layout_centerVertical="true">
|
|
||||||
<TextView android:id="@+id/name" style="@style/callee_name" />
|
|
||||||
<TextView android:id="@+id/address" style="@style/callee_address"/>
|
|
||||||
<org.linphone.ui.IncallTimer android:id="@+id/callee_duration" style="@style/callee_name"/>
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
|
|
||||||
</RelativeLayout>
|
|
|
@ -52,6 +52,9 @@
|
||||||
<LinearLayout android:id="@+id/conf_advanced_buttons"
|
<LinearLayout android:id="@+id/conf_advanced_buttons"
|
||||||
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
android:layout_width="fill_parent" android:layout_height="wrap_content"
|
||||||
android:layout_above="@id/conf_terminate_row">
|
android:layout_above="@id/conf_terminate_row">
|
||||||
|
<Button android:id="@+id/conf_simple_video" style="@style/conf_icon_text_button"
|
||||||
|
android:drawableTop="@drawable/conf_video"
|
||||||
|
android:text="@string/conf_simple_video_bt_txt"/>
|
||||||
<Button android:id="@+id/conf_simple_merge" style="@style/conf_icon_text_button"
|
<Button android:id="@+id/conf_simple_merge" style="@style/conf_icon_text_button"
|
||||||
android:drawableTop="@drawable/conf_merge"
|
android:drawableTop="@drawable/conf_merge"
|
||||||
android:text="@string/conf_simple_merge_bt_txt"/>
|
android:text="@string/conf_simple_merge_bt_txt"/>
|
||||||
|
@ -67,6 +70,7 @@
|
||||||
android:layout_centerInParent="true"
|
android:layout_centerInParent="true"
|
||||||
android:layout_gravity="center" android:scaleType="fitCenter"
|
android:layout_gravity="center" android:scaleType="fitCenter"
|
||||||
android:minWidth="192px" android:minHeight="192px"
|
android:minWidth="192px" android:minHeight="192px"
|
||||||
|
android:paddingBottom="60px"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<ListView android:id="@android:id/list"
|
<ListView android:id="@android:id/list"
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
<string name="state_streams_running"></string>
|
<string name="state_streams_running"></string>
|
||||||
<string name="state_incoming_received">incoming</string>
|
<string name="state_incoming_received">incoming</string>
|
||||||
<string name="state_outgoing_ringing">ringing</string>
|
<string name="state_outgoing_ringing">ringing</string>
|
||||||
|
<string name="state_outgoing_progress">calling</string>
|
||||||
|
|
||||||
<string name="mutemic_button_txt">Mute</string>
|
<string name="mutemic_button_txt">Mute</string>
|
||||||
<string name="speaker_button_txt">Speaker</string>
|
<string name="speaker_button_txt">Speaker</string>
|
||||||
|
@ -54,12 +55,11 @@
|
||||||
<string name="conf_choice_terminate">Terminate</string>
|
<string name="conf_choice_terminate">Terminate</string>
|
||||||
|
|
||||||
<string name="hangup">Hang up</string>
|
<string name="hangup">Hang up</string>
|
||||||
<string name="conf_simple_resume_bt_txt">Resume</string>
|
|
||||||
<string name="conf_simple_merge_bt_txt">Merge</string>
|
<string name="conf_simple_merge_bt_txt">Merge</string>
|
||||||
<string name="conf_simple_transfer_bt_txt">Transfer</string>
|
<string name="conf_simple_transfer_bt_txt">Transfer</string>
|
||||||
<string name="conf_simple_permute_bt_txt">Permute</string>
|
<string name="conf_simple_video_bt_txt">Add video</string>
|
||||||
<string name="conf_simple_no_current_call">No active call</string>
|
<string name="conf_simple_no_current_call">No active call</string>
|
||||||
<string name="show_send_dtmfs_button">DTMFs</string>
|
<string name="show_send_dtmfs_button">Dialpad</string>
|
||||||
|
|
||||||
<string name="conf_conference">Conference</string>
|
<string name="conf_conference">Conference</string>
|
||||||
<string name="in_conf">You are part of it</string>
|
<string name="in_conf">You are part of it</string>
|
||||||
|
|
225
src/org/linphone/AbstractCalleesActivity.java
Normal file
225
src/org/linphone/AbstractCalleesActivity.java
Normal file
|
@ -0,0 +1,225 @@
|
||||||
|
/*
|
||||||
|
ConferenceActivity.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 java.util.Collections;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.linphone.LinphoneSimpleListener.LinphoneOnAudioChangedListener;
|
||||||
|
import org.linphone.LinphoneSimpleListener.LinphoneOnCallStateChangedListener;
|
||||||
|
import org.linphone.core.LinphoneAddress;
|
||||||
|
import org.linphone.core.LinphoneCall;
|
||||||
|
import org.linphone.core.LinphoneCore;
|
||||||
|
import org.linphone.core.LinphoneCall.State;
|
||||||
|
|
||||||
|
import android.app.ListActivity;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.os.SystemClock;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.View.OnClickListener;
|
||||||
|
import android.widget.BaseAdapter;
|
||||||
|
import android.widget.Chronometer;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.ToggleButton;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Guillaume Beraudo
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public abstract class AbstractCalleesActivity extends ListActivity implements LinphoneOnCallStateChangedListener, OnClickListener, LinphoneOnAudioChangedListener {
|
||||||
|
|
||||||
|
private CalleeListAdapter mListAdapter;
|
||||||
|
private List<LinphoneCall> mSpecificCalls = Collections.emptyList();
|
||||||
|
private Handler mHandler = new Handler();
|
||||||
|
|
||||||
|
private ToggleButton mMuteMicButton;
|
||||||
|
private ToggleButton mSpeakerButton;
|
||||||
|
|
||||||
|
protected abstract boolean isActive();
|
||||||
|
protected abstract void setActive(boolean active);
|
||||||
|
|
||||||
|
protected abstract List<LinphoneCall> updateSpecificCallsList();
|
||||||
|
|
||||||
|
private Set<Chronometer> mChronometers = new HashSet<Chronometer>();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
/**
|
||||||
|
* Called by the child classes AFTER their own onCreate.
|
||||||
|
*/
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
setListAdapter(mListAdapter = createCalleeListAdapter());
|
||||||
|
|
||||||
|
mMuteMicButton = (ToggleButton) findViewById(R.id.toggleMuteMic);
|
||||||
|
mMuteMicButton.setOnClickListener(this);
|
||||||
|
mSpeakerButton = (ToggleButton) findViewById(R.id.toggleSpeaker);
|
||||||
|
mSpeakerButton.setOnClickListener(this);
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract CalleeListAdapter createCalleeListAdapter();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onResume() {
|
||||||
|
mSpecificCalls = updateSpecificCallsList();
|
||||||
|
if (!finishOnEmptySpecificCallsWhileResuming() || mSpecificCalls.size() != 0) {
|
||||||
|
setActive(true);
|
||||||
|
updateUI();
|
||||||
|
mSpeakerButton.setChecked(LinphoneManager.getInstance().isSpeakerOn());
|
||||||
|
mMuteMicButton.setChecked(LinphoneManager.getLc().isMicMuted());
|
||||||
|
LinphoneManager.addListener(this);
|
||||||
|
LinphoneManager.startProximitySensorForActivity(this);
|
||||||
|
} else {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
super.onResume();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean finishOnEmptySpecificCallsWhileResuming() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPause() {
|
||||||
|
LinphoneManager.removeListener(this);
|
||||||
|
LinphoneManager.stopProximitySensorForActivity(this);
|
||||||
|
setActive(false);
|
||||||
|
if (isFinishing()) {
|
||||||
|
stopChronometers();
|
||||||
|
}
|
||||||
|
super.onPause();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCallStateChanged(LinphoneCall c, State s, String m) {
|
||||||
|
mHandler.post(new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
mSpecificCalls = updateSpecificCallsList();
|
||||||
|
updateUI();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected LinphoneCore lc() {
|
||||||
|
return LinphoneManager.getLc();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void stopChronometers() {
|
||||||
|
for (Chronometer chrono : mChronometers) {
|
||||||
|
chrono.stop();
|
||||||
|
}
|
||||||
|
mChronometers.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void updateUI() {
|
||||||
|
stopChronometers();
|
||||||
|
mListAdapter.notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected void enableView(View root, int id, OnClickListener l, boolean enable) {
|
||||||
|
LinphoneUtils.enableView(root, id, l, enable);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String getCalleeDisplayOrUserName(LinphoneAddress address) {
|
||||||
|
if (!TextUtils.isEmpty(address.getDisplayName())) {
|
||||||
|
return address.getDisplayName();
|
||||||
|
} else {
|
||||||
|
return address.getUserName();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setCalleePicture(ImageView pictureView, LinphoneAddress address) {
|
||||||
|
// May be greatly sped up using a drawable cache
|
||||||
|
Uri uri = LinphoneUtils.findUriPictureOfContactAndSetDisplayName(address, getContentResolver());
|
||||||
|
LinphoneUtils.setImagePictureFromUri(AbstractCalleesActivity.this, pictureView, uri, R.drawable.unknown_person);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setVisibility(View v, int id, boolean visible) {
|
||||||
|
LinphoneUtils.setVisibility(v, id, visible);
|
||||||
|
}
|
||||||
|
protected void setVisibility(View v, boolean visible) {
|
||||||
|
LinphoneUtils.setVisibility(v, visible);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract class CalleeListAdapter extends BaseAdapter {
|
||||||
|
protected final List<LinphoneCall> getSpecificCalls() {
|
||||||
|
return mSpecificCalls;
|
||||||
|
}
|
||||||
|
public int getCount() {
|
||||||
|
return mSpecificCalls.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
public LinphoneCall getItem(int position) {
|
||||||
|
return mSpecificCalls.get(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getItemId(int position) {
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected final void registerCallDurationTimer(View v, LinphoneCall call) {
|
||||||
|
Chronometer timer = (Chronometer) v.findViewById(R.id.callee_duration);
|
||||||
|
if (timer == null) throw new IllegalArgumentException("no callee_duration view found");
|
||||||
|
timer.setBase(SystemClock.elapsedRealtime() - 1000 * call.getDuration());
|
||||||
|
timer.start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
switch (v.getId()) {
|
||||||
|
case R.id.toggleMuteMic:
|
||||||
|
lc().muteMic(((ToggleButton) v).isChecked());
|
||||||
|
break;
|
||||||
|
case R.id.toggleSpeaker:
|
||||||
|
if (((ToggleButton) v).isChecked()) {
|
||||||
|
LinphoneManager.getInstance().routeAudioToSpeaker();
|
||||||
|
} else {
|
||||||
|
LinphoneManager.getInstance().routeAudioToReceiver();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAudioStateChanged(final AudioState state) {
|
||||||
|
mSpeakerButton.post(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
switch (state) {
|
||||||
|
case SPEAKER:
|
||||||
|
mSpeakerButton.setChecked(true);
|
||||||
|
break;
|
||||||
|
case EARPIECE:
|
||||||
|
mSpeakerButton.setChecked(false);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new RuntimeException("Unknown audio state " + state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -18,34 +18,20 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
package org.linphone;
|
package org.linphone;
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.linphone.LinphoneSimpleListener.LinphoneOnCallStateChangedListener;
|
|
||||||
import org.linphone.core.LinphoneAddress;
|
import org.linphone.core.LinphoneAddress;
|
||||||
import org.linphone.core.LinphoneCall;
|
import org.linphone.core.LinphoneCall;
|
||||||
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.Version;
|
||||||
import org.linphone.ui.IncallTimer;
|
|
||||||
|
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.app.ListActivity;
|
|
||||||
import android.net.Uri;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
|
||||||
import android.text.TextUtils;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
import android.widget.BaseAdapter;
|
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.ToggleButton;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List participants of a conference call.
|
* List participants of a conference call.
|
||||||
|
@ -53,130 +39,43 @@ import android.widget.ToggleButton;
|
||||||
* @author Guillaume Beraudo
|
* @author Guillaume Beraudo
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class ConferenceDetailsActivity extends ListActivity implements LinphoneOnCallStateChangedListener, OnClickListener {
|
public class ConferenceDetailsActivity extends AbstractCalleesActivity {
|
||||||
|
|
||||||
private ConfListAdapter mListAdapter;
|
|
||||||
private List<LinphoneCall> mLinphoneCalls = Collections.emptyList();
|
|
||||||
private Handler mHandler = new Handler();
|
|
||||||
public static boolean active;
|
public static boolean active;
|
||||||
|
@Override protected void setActive(boolean a) {active = a;}
|
||||||
private ToggleButton mMuteMicButton;
|
@Override protected boolean isActive() {return active;}
|
||||||
private ToggleButton mSpeakerButton;
|
|
||||||
private Runnable mDurationUpdateRunnable;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
setContentView(R.layout.conference_details_layout);
|
setContentView(R.layout.conference_details_layout);
|
||||||
setListAdapter(mListAdapter = new ConfListAdapter());
|
|
||||||
mMuteMicButton = (ToggleButton) findViewById(R.id.toggleMuteMic);
|
|
||||||
mMuteMicButton.setOnClickListener(this);
|
|
||||||
mSpeakerButton = (ToggleButton) findViewById(R.id.toggleSpeaker);
|
|
||||||
mSpeakerButton.setOnClickListener(this);
|
|
||||||
mDurationUpdateRunnable = new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
updateCallDurations();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
protected CalleeListAdapter createCalleeListAdapter() {
|
||||||
protected void onResume() {
|
return new ConfListAdapter();
|
||||||
mLinphoneCalls = LinphoneUtils.getLinphoneCallsInConf(lc());
|
|
||||||
if (mLinphoneCalls.size() != 0) {
|
|
||||||
active = true;
|
|
||||||
updateUI();
|
|
||||||
mSpeakerButton.setChecked(LinphoneManager.getInstance().isSpeakerOn());
|
|
||||||
mMuteMicButton.setChecked(LinphoneManager.getLc().isMicMuted());
|
|
||||||
LinphoneManager.addListener(this);
|
|
||||||
LinphoneManager.startProximitySensorForActivity(this);
|
|
||||||
mHandler.post(mDurationUpdateRunnable);
|
|
||||||
} else {
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
super.onResume();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPause() {
|
protected boolean finishOnEmptySpecificCallsWhileResuming() {
|
||||||
LinphoneManager.removeListener(this);
|
return true;
|
||||||
LinphoneManager.stopProximitySensorForActivity(this);
|
|
||||||
active = false;
|
|
||||||
super.onPause();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private class ConfListAdapter extends CalleeListAdapter {
|
||||||
public void onCallStateChanged(LinphoneCall c, State s, String m) {
|
|
||||||
mHandler.post(new Runnable() {
|
|
||||||
public void run() {
|
|
||||||
mLinphoneCalls = LinphoneUtils.getLinphoneCallsInConf(lc());
|
|
||||||
updateUI();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private LinphoneCore lc() {
|
|
||||||
return LinphoneManager.getLc();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateUI() {
|
|
||||||
mCallDurationsMap.clear();
|
|
||||||
mListAdapter.notifyDataSetChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
private Map<LinphoneCall, IncallTimer> mCallDurationsMap = new HashMap<LinphoneCall, IncallTimer>();
|
|
||||||
private void updateCallDurations() {
|
|
||||||
for (LinphoneCall call : mCallDurationsMap.keySet()) {
|
|
||||||
IncallTimer timer = mCallDurationsMap.get(call);
|
|
||||||
timer.setDuration(call.getDuration());
|
|
||||||
}
|
|
||||||
if (active) mHandler.postDelayed(mDurationUpdateRunnable, 1000);
|
|
||||||
}
|
|
||||||
|
|
||||||
private class ConfListAdapter extends BaseAdapter {
|
|
||||||
public int getCount() {
|
|
||||||
return mLinphoneCalls.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Object getItem(int position) {
|
|
||||||
return mLinphoneCalls.get(position);
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getItemId(int position) {
|
|
||||||
return position;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View getView(int position, View v, ViewGroup parent) {
|
public View getView(int position, View v, ViewGroup parent) {
|
||||||
Log.i("IncallActivity.getView(",position,") out of ", mLinphoneCalls.size());
|
|
||||||
if (v == null) {
|
if (v == null) {
|
||||||
if (Version.sdkAboveOrEqual(Version.API06_ECLAIR_201)) {
|
if (Version.sdkAboveOrEqual(Version.API06_ECLAIR_201)) {
|
||||||
v = getLayoutInflater().inflate(R.layout.conf_details_participant, null);
|
v = getLayoutInflater().inflate(R.layout.conf_callee, null);
|
||||||
} else {
|
} else {
|
||||||
throw new RuntimeException("to implement");
|
v = getLayoutInflater().inflate(R.layout.conf_callee_older_devices, null);
|
||||||
// v = getLayoutInflater().inflate(R.layout.conf_callee_older_devices, null);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final LinphoneCall call = mLinphoneCalls.get(position);
|
final LinphoneCall call = getItem(position);
|
||||||
LinphoneAddress address = call.getRemoteAddress();
|
LinphoneAddress address = call.getRemoteAddress();
|
||||||
String mainText = address.getDisplayName();
|
final String mainText = getCalleeDisplayOrUserName(address);
|
||||||
String complText = address.getUserName();
|
((TextView) v.findViewById(R.id.name)).setText(mainText);
|
||||||
if (Version.sdkAboveOrEqual(Version.API05_ECLAIR_20)
|
((TextView) v.findViewById(R.id.address)).setText("");
|
||||||
&& getResources().getBoolean(R.bool.show_full_remote_address_on_incoming_call)) {
|
|
||||||
complText += "@" + address.getDomain();
|
|
||||||
}
|
|
||||||
TextView mainTextView = (TextView) v.findViewById(R.id.name);
|
|
||||||
TextView complTextView = (TextView) v.findViewById(R.id.address);
|
|
||||||
if (TextUtils.isEmpty(mainText)) {
|
|
||||||
mainTextView.setText(complText);
|
|
||||||
complTextView.setVisibility(View.GONE);
|
|
||||||
} else {
|
|
||||||
mainTextView.setText(mainText);
|
|
||||||
complTextView.setText(complText);
|
|
||||||
complTextView.setVisibility(View.VISIBLE);
|
|
||||||
}
|
|
||||||
|
|
||||||
v.setOnClickListener(new OnClickListener() {
|
v.setOnClickListener(new OnClickListener() {
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
@ -190,18 +89,13 @@ public class ConferenceDetailsActivity extends ListActivity implements LinphoneO
|
||||||
enableView(content, R.id.terminate_call, l, true);
|
enableView(content, R.id.terminate_call, l, true);
|
||||||
dialog.show();
|
dialog.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void enableView(View root, int id, OnClickListener l, boolean enable) {
|
|
||||||
LinphoneUtils.enableView(root, id, l, enable);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
ImageView pictureView = (ImageView) v.findViewById(R.id.picture);
|
|
||||||
// May be greatly sped up using a drawable cache
|
// May be greatly sped up using a drawable cache
|
||||||
Uri uri = LinphoneUtils.findUriPictureOfContactAndSetDisplayName(address, getContentResolver());
|
ImageView pictureView = (ImageView) v.findViewById(R.id.picture);
|
||||||
LinphoneUtils.setImagePictureFromUri(ConferenceDetailsActivity.this, pictureView, uri, R.drawable.unknown_person);
|
setCalleePicture(pictureView, address);
|
||||||
|
|
||||||
mCallDurationsMap.put(call, (IncallTimer) findViewById(R.id.callee_duration));
|
registerCallDurationTimer(v, call);
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -232,21 +126,10 @@ public class ConferenceDetailsActivity extends ListActivity implements LinphoneO
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
protected List<LinphoneCall> updateSpecificCallsList() {
|
||||||
switch (v.getId()) {
|
return LinphoneUtils.getLinphoneCallsInConf(lc());
|
||||||
case R.id.toggleMuteMic:
|
|
||||||
lc().muteMic(((ToggleButton) v).isChecked());
|
|
||||||
break;
|
|
||||||
case R.id.toggleSpeaker:
|
|
||||||
if (((ToggleButton) v).isChecked()) {
|
|
||||||
LinphoneManager.getInstance().routeAudioToSpeaker();
|
|
||||||
} else {
|
|
||||||
LinphoneManager.getInstance().routeAudioToReceiver();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -22,16 +22,13 @@ import static android.view.View.GONE;
|
||||||
import static android.view.View.VISIBLE;
|
import static android.view.View.VISIBLE;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.linphone.LinphoneSimpleListener.LinphoneOnAudioChangedListener;
|
import org.linphone.LinphoneSimpleListener.LinphoneOnAudioChangedListener;
|
||||||
import org.linphone.LinphoneSimpleListener.LinphoneOnCallEncryptionChangedListener;
|
import org.linphone.LinphoneSimpleListener.LinphoneOnCallEncryptionChangedListener;
|
||||||
import org.linphone.LinphoneSimpleListener.LinphoneOnCallStateChangedListener;
|
|
||||||
import org.linphone.core.LinphoneAddress;
|
import org.linphone.core.LinphoneAddress;
|
||||||
import org.linphone.core.LinphoneCall;
|
import org.linphone.core.LinphoneCall;
|
||||||
import org.linphone.core.LinphoneCore;
|
|
||||||
import org.linphone.core.LinphoneCoreException;
|
import org.linphone.core.LinphoneCoreException;
|
||||||
import org.linphone.core.Log;
|
import org.linphone.core.Log;
|
||||||
import org.linphone.core.LinphoneCall.State;
|
import org.linphone.core.LinphoneCall.State;
|
||||||
|
@ -40,11 +37,9 @@ import org.linphone.ui.Numpad;
|
||||||
|
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.app.ListActivity;
|
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.net.Uri;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
@ -54,7 +49,6 @@ import android.view.ViewGroup;
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
import android.view.View.OnLongClickListener;
|
import android.view.View.OnLongClickListener;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.BaseAdapter;
|
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.ListAdapter;
|
import android.widget.ListAdapter;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
@ -64,29 +58,22 @@ import android.widget.ToggleButton;
|
||||||
/**
|
/**
|
||||||
* @author Guillaume Beraudo
|
* @author Guillaume Beraudo
|
||||||
*/
|
*/
|
||||||
public class IncallActivity extends ListActivity implements
|
public class IncallActivity extends AbstractCalleesActivity implements
|
||||||
LinphoneOnAudioChangedListener,
|
LinphoneOnAudioChangedListener,
|
||||||
LinphoneOnCallStateChangedListener,
|
|
||||||
LinphoneOnCallEncryptionChangedListener,
|
LinphoneOnCallEncryptionChangedListener,
|
||||||
Comparator<LinphoneCall>,
|
Comparator<LinphoneCall>,
|
||||||
OnLongClickListener,
|
OnLongClickListener,
|
||||||
OnClickListener {
|
OnClickListener {
|
||||||
|
|
||||||
static boolean active;
|
|
||||||
|
|
||||||
private boolean mUnMuteOnReturnFromUriPicker;
|
private boolean mUnMuteOnReturnFromUriPicker;
|
||||||
|
|
||||||
// Start Override to test block
|
private static final int numpadDialogId = 1;
|
||||||
protected LinphoneCore lc() {
|
private static final int addCallId = 1;
|
||||||
return LinphoneManager.getLc();
|
private static final int transferCallId = 2;
|
||||||
}
|
|
||||||
|
|
||||||
// End override to test block
|
|
||||||
|
|
||||||
private static final int numpad_dialog_id = 1;
|
|
||||||
private static final int ID_ADD_CALL = 1;
|
|
||||||
private static final int ID_TRANSFER_CALL = 2;
|
|
||||||
|
|
||||||
|
public static boolean active;
|
||||||
|
@Override protected void setActive(boolean a) {active = a;}
|
||||||
|
@Override protected boolean isActive() {return active;}
|
||||||
|
|
||||||
|
|
||||||
private void pauseCurrentCallOrLeaveConference() {
|
private void pauseCurrentCallOrLeaveConference() {
|
||||||
|
@ -95,13 +82,9 @@ public class IncallActivity extends ListActivity implements
|
||||||
lc().leaveConference();
|
lc().leaveConference();
|
||||||
}
|
}
|
||||||
|
|
||||||
private ToggleButton mMuteMicButton;
|
|
||||||
private ToggleButton mSpeakerButton;
|
|
||||||
private View mConferenceVirtualCallee;
|
private View mConferenceVirtualCallee;
|
||||||
private int mMultipleCallsLimit;
|
private int mMultipleCallsLimit;
|
||||||
private boolean mAllowTransfers;
|
private boolean mAllowTransfers;
|
||||||
private List<LinphoneCall> mNotInConfCalls = Collections.emptyList();
|
|
||||||
private CalleeListAdapter mListAdapter;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
@ -119,23 +102,39 @@ public class IncallActivity extends ListActivity implements
|
||||||
transferView.setVisibility(View.GONE);
|
transferView.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
mMuteMicButton = (ToggleButton) findViewById(R.id.toggleMuteMic);
|
|
||||||
mMuteMicButton.setOnClickListener(this);
|
|
||||||
mSpeakerButton = (ToggleButton) findViewById(R.id.toggleSpeaker);
|
|
||||||
mSpeakerButton.setOnClickListener(this);
|
|
||||||
|
|
||||||
setListAdapter(mListAdapter = new CalleeListAdapter());
|
|
||||||
|
|
||||||
findViewById(R.id.incallHang).setOnClickListener(this);
|
findViewById(R.id.incallHang).setOnClickListener(this);
|
||||||
mMultipleCallsLimit = lc().getMaxCalls();
|
mMultipleCallsLimit = lc().getMaxCalls();
|
||||||
|
|
||||||
mConferenceVirtualCallee = findViewById(R.id.conf_header);
|
mConferenceVirtualCallee = findViewById(R.id.conf_header);
|
||||||
mConferenceVirtualCallee.setOnClickListener(this);
|
mConferenceVirtualCallee.setOnClickListener(this);
|
||||||
mConferenceVirtualCallee.setOnLongClickListener(this);
|
mConferenceVirtualCallee.setOnLongClickListener(this);
|
||||||
// workaroundStatusBarBug();
|
|
||||||
|
boolean mMayDoVideo = Version.isVideoCapable()
|
||||||
|
&& LinphoneManager.getInstance().isVideoEnabled();
|
||||||
|
if (mMayDoVideo) {
|
||||||
|
findViewById(R.id.conf_simple_video).setOnClickListener(this);
|
||||||
|
} else {
|
||||||
|
findViewById(R.id.conf_simple_video).setVisibility(GONE);
|
||||||
|
}
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected CalleeListAdapter createCalleeListAdapter() {
|
||||||
|
return new IncallListAdapter();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<LinphoneCall> updateSpecificCallsList() {
|
||||||
|
return LinphoneUtils.getLinphoneCallsNotInConf(lc());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void updateSoundLock() {
|
private void updateSoundLock() {
|
||||||
boolean locked = lc().soundResourcesLocked();
|
boolean locked = lc().soundResourcesLocked();
|
||||||
findViewById(R.id.addCall).setEnabled(!locked);
|
findViewById(R.id.addCall).setEnabled(!locked);
|
||||||
|
@ -149,35 +148,10 @@ public class IncallActivity extends ListActivity implements
|
||||||
findViewById(R.id.addCall).setVisibility(limitReached? View.INVISIBLE : VISIBLE);
|
findViewById(R.id.addCall).setVisibility(limitReached? View.INVISIBLE : VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateDtmfButton() {
|
private void updateNumpadButton() {
|
||||||
LinphoneCall currentCall = lc().getCurrentCall();
|
LinphoneCall currentCall = lc().getCurrentCall();
|
||||||
boolean enableDtmf = currentCall != null && currentCall.getState() == State.StreamsRunning;
|
boolean enable = currentCall != null && currentCall.getState() == State.StreamsRunning;
|
||||||
findViewById(R.id.incallNumpadShow).setEnabled(enableDtmf);
|
findViewById(R.id.incallNumpadShow).setEnabled(enable);
|
||||||
}
|
|
||||||
@Override
|
|
||||||
protected void onNewIntent(Intent intent) {
|
|
||||||
super.onNewIntent(intent);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onResume() {
|
|
||||||
active=true;
|
|
||||||
mNotInConfCalls = LinphoneUtils.getLinphoneCallsNotInConf(lc());
|
|
||||||
LinphoneManager.addListener(this);
|
|
||||||
LinphoneManager.startProximitySensorForActivity(this);
|
|
||||||
mSpeakerButton.setChecked(LinphoneManager.getInstance().isSpeakerOn());
|
|
||||||
mMuteMicButton.setChecked(LinphoneManager.getLc().isMicMuted());
|
|
||||||
|
|
||||||
recreateActivity();
|
|
||||||
super.onResume();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onPause() {
|
|
||||||
active=false;
|
|
||||||
LinphoneManager.removeListener(this);
|
|
||||||
LinphoneManager.stopProximitySensorForActivity(this);
|
|
||||||
super.onPause();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateCalleeImage() {
|
private void updateCalleeImage() {
|
||||||
|
@ -189,20 +163,22 @@ public class IncallActivity extends ListActivity implements
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Uri picture = LinphoneUtils.findUriPictureOfContactAndSetDisplayName(
|
setCalleePicture(view, currentCall.getRemoteAddress());
|
||||||
currentCall.getRemoteAddress(), getContentResolver());
|
|
||||||
LinphoneUtils.setImagePictureFromUri(this, view, picture, R.drawable.unknown_person);
|
|
||||||
view.setVisibility(VISIBLE);
|
view.setVisibility(VISIBLE);
|
||||||
|
if (Version.sdkStrictlyBelow(Version.API06_ECLAIR_201)) {
|
||||||
|
// Fix really big image on older devices
|
||||||
|
ViewGroup.LayoutParams layout = view.getLayoutParams();
|
||||||
|
layout.height = 96;
|
||||||
|
layout.width = 96;
|
||||||
|
view.setLayoutParams(layout);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void enableView(View root, int id, OnClickListener l, boolean enable) {
|
|
||||||
LinphoneUtils.enableView(root, id, l, enable);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Dialog onCreateDialog(final int id) {
|
protected Dialog onCreateDialog(final int id) {
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case numpad_dialog_id:
|
case numpadDialogId:
|
||||||
Numpad numpad = new Numpad(this, true);
|
Numpad numpad = new Numpad(this, true);
|
||||||
return new AlertDialog.Builder(this).setView(numpad)
|
return new AlertDialog.Builder(this).setView(numpad)
|
||||||
// .setIcon(R.drawable.logo_linphone_57x57)
|
// .setIcon(R.drawable.logo_linphone_57x57)
|
||||||
|
@ -216,20 +192,19 @@ public class IncallActivity extends ListActivity implements
|
||||||
})
|
})
|
||||||
.create();
|
.create();
|
||||||
default:
|
default:
|
||||||
throw new RuntimeException("unkown dialog id " + id);
|
throw new IllegalArgumentException("unkown dialog id " + id);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private LinphoneCall activateCallOnReturnFromUriPicker;
|
private LinphoneCall mActivateCallOnReturnFromUriPicker;
|
||||||
private boolean enterConferenceOnReturnFromUriPicker;
|
private boolean mEnterConferenceOnReturnFromUriPicker;
|
||||||
private void openUriPicker(String pickerType, int requestCode) {
|
private void openUriPicker(String pickerType, int requestCode) {
|
||||||
if (lc().soundResourcesLocked()) {
|
if (lc().soundResourcesLocked()) {
|
||||||
Toast.makeText(this, R.string.not_ready_to_make_new_call, Toast.LENGTH_LONG).show();
|
Toast.makeText(this, R.string.not_ready_to_make_new_call, Toast.LENGTH_LONG).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
activateCallOnReturnFromUriPicker = lc().getCurrentCall();
|
mActivateCallOnReturnFromUriPicker = lc().getCurrentCall();
|
||||||
enterConferenceOnReturnFromUriPicker = lc().isInConference();
|
mEnterConferenceOnReturnFromUriPicker = lc().isInConference();
|
||||||
pauseCurrentCallOrLeaveConference();
|
pauseCurrentCallOrLeaveConference();
|
||||||
Intent intent = new Intent().setClass(this, UriPickerActivity.class);
|
Intent intent = new Intent().setClass(this, UriPickerActivity.class);
|
||||||
intent.putExtra(UriPickerActivity.EXTRA_PICKER_TYPE, pickerType);
|
intent.putExtra(UriPickerActivity.EXTRA_PICKER_TYPE, pickerType);
|
||||||
|
@ -244,21 +219,14 @@ public class IncallActivity extends ListActivity implements
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onLongClick(View v) {
|
public boolean onLongClick(View v) {
|
||||||
switch (v.getId()) {
|
if (v.getId() == R.id.conf_header) {
|
||||||
case R.id.conf_header:
|
LinphoneActivity.instance().startConferenceDetailsActivity();
|
||||||
if (Version.sdkAboveOrEqual(Version.API05_ECLAIR_20)) {
|
return true;
|
||||||
LinphoneActivity.instance().startConferenceDetailsActivity();
|
|
||||||
} else {
|
|
||||||
Log.i("conference details disabled for older phones");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void enterConferenceAndUpdateUI(boolean enterConf) {
|
private void enterConferenceAndVirtualConfView(boolean enterConf) {
|
||||||
if (enterConf) {
|
if (enterConf) {
|
||||||
boolean success = lc().enterConference();
|
boolean success = lc().enterConference();
|
||||||
if (success) {
|
if (success) {
|
||||||
|
@ -280,25 +248,23 @@ public class IncallActivity extends ListActivity implements
|
||||||
lc().terminateAllCalls();
|
lc().terminateAllCalls();
|
||||||
}
|
}
|
||||||
|
|
||||||
// activity should be closed automatically by LinphoneActivity when no more calls exist
|
// activity wille be closed automatically by LinphoneActivity when no more calls exist
|
||||||
// setResult(RESULT_OK);
|
|
||||||
// finish();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
switch (v.getId()) {
|
switch (v.getId()) {
|
||||||
case R.id.addCall:
|
case R.id.addCall:
|
||||||
openUriPicker(UriPickerActivity.EXTRA_PICKER_TYPE_ADD, ID_ADD_CALL);
|
openUriPicker(UriPickerActivity.EXTRA_PICKER_TYPE_ADD, addCallId);
|
||||||
break;
|
break;
|
||||||
case R.id.incallHang:
|
case R.id.incallHang:
|
||||||
terminateCurrentCallOrConferenceOrAll();
|
terminateCurrentCallOrConferenceOrAll();
|
||||||
break;
|
break;
|
||||||
case R.id.conf_header:
|
case R.id.conf_header:
|
||||||
boolean enterConf = !lc().isInConference();
|
boolean enterConf = !lc().isInConference();
|
||||||
enterConferenceAndUpdateUI(enterConf);
|
enterConferenceAndVirtualConfView(enterConf);
|
||||||
break;
|
break;
|
||||||
case R.id.incallNumpadShow:
|
case R.id.incallNumpadShow:
|
||||||
showDialog(numpad_dialog_id);
|
showDialog(numpadDialogId);
|
||||||
break;
|
break;
|
||||||
case R.id.conf_simple_merge:
|
case R.id.conf_simple_merge:
|
||||||
lc().addAllToConference();
|
lc().addAllToConference();
|
||||||
|
@ -311,28 +277,30 @@ public class IncallActivity extends ListActivity implements
|
||||||
Toast.makeText(this, R.string.conf_simple_no_current_call, Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, R.string.conf_simple_no_current_call, Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case R.id.toggleMuteMic:
|
case R.id.conf_simple_video:
|
||||||
lc().muteMic(((ToggleButton) v).isChecked());
|
LinphoneCall vCall = lc().getCurrentCall();
|
||||||
break;
|
if (vCall != null) {
|
||||||
case R.id.toggleSpeaker:
|
if (!LinphoneManager.getInstance().addVideo()) {
|
||||||
if (((ToggleButton) v).isChecked()) {
|
LinphoneActivity.instance().startVideoActivity(vCall, 0);
|
||||||
LinphoneManager.getInstance().routeAudioToSpeaker();
|
}
|
||||||
} else {
|
} else {
|
||||||
LinphoneManager.getInstance().routeAudioToReceiver();
|
Toast.makeText(this, R.string.conf_simple_no_current_call, Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
// mic, speaker
|
||||||
|
super.onClick(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void prepareForTransferingExistingOrNewCall(final LinphoneCall call) {
|
private void prepareForTransferingExistingOrNewCall(final LinphoneCall call) {
|
||||||
|
// Include inconf calls
|
||||||
final List<LinphoneCall> existingCalls = LinphoneUtils.getLinphoneCalls(lc());
|
final List<LinphoneCall> existingCalls = LinphoneUtils.getLinphoneCalls(lc());
|
||||||
if (existingCalls.size() == 1) {
|
if (existingCalls.size() == 1) {
|
||||||
// Only possible choice is transfer to new call: doing it directly.
|
// Only possible choice is transfer to new call: doing it directly.
|
||||||
mCallToTransfer = call;
|
mCallToTransfer = call;
|
||||||
openUriPicker(UriPickerActivity.EXTRA_PICKER_TYPE_TRANSFER, ID_TRANSFER_CALL);
|
openUriPicker(UriPickerActivity.EXTRA_PICKER_TYPE_TRANSFER, transferCallId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
existingCalls.remove(call);
|
existingCalls.remove(call);
|
||||||
|
@ -348,7 +316,7 @@ public class IncallActivity extends ListActivity implements
|
||||||
if (which == numbers.size() -1) {
|
if (which == numbers.size() -1) {
|
||||||
// Last one is transfer to new call
|
// Last one is transfer to new call
|
||||||
mCallToTransfer = call;
|
mCallToTransfer = call;
|
||||||
openUriPicker(UriPickerActivity.EXTRA_PICKER_TYPE_TRANSFER, ID_TRANSFER_CALL);
|
openUriPicker(UriPickerActivity.EXTRA_PICKER_TYPE_TRANSFER, transferCallId);
|
||||||
} else {
|
} else {
|
||||||
lc().transferCallToAnother(call, existingCalls.get(which));
|
lc().transferCallToAnother(call, existingCalls.get(which));
|
||||||
}
|
}
|
||||||
|
@ -379,7 +347,7 @@ public class IncallActivity extends ListActivity implements
|
||||||
prepareForTransferingExistingOrNewCall(call);
|
prepareForTransferingExistingOrNewCall(call);
|
||||||
break;
|
break;
|
||||||
case R.id.transfer_new:
|
case R.id.transfer_new:
|
||||||
openUriPicker(UriPickerActivity.EXTRA_PICKER_TYPE_TRANSFER, ID_TRANSFER_CALL);
|
openUriPicker(UriPickerActivity.EXTRA_PICKER_TYPE_TRANSFER, transferCallId);
|
||||||
mCallToTransfer = call;
|
mCallToTransfer = call;
|
||||||
break;
|
break;
|
||||||
case R.id.addVideo:
|
case R.id.addVideo:
|
||||||
|
@ -402,25 +370,14 @@ public class IncallActivity extends ListActivity implements
|
||||||
if (dialog != null) dialog.dismiss();
|
if (dialog != null) dialog.dismiss();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private class CalleeListAdapter extends BaseAdapter {
|
|
||||||
public int getCount() {
|
|
||||||
return mNotInConfCalls.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Object getItem(int position) {
|
|
||||||
return mNotInConfCalls.get(position);
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getItemId(int position) {
|
|
||||||
return position;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
private class IncallListAdapter extends CalleeListAdapter {
|
||||||
private boolean aConferenceIsPossible() {
|
private boolean aConferenceIsPossible() {
|
||||||
if (lc().getCallsNb() < 2) {
|
if (lc().getCallsNb() < 2) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (LinphoneCall call : mNotInConfCalls) {
|
for (LinphoneCall call : getSpecificCalls()) {
|
||||||
final LinphoneCall.State state = call.getState();
|
final LinphoneCall.State state = call.getState();
|
||||||
boolean connectionEstablished = state == State.StreamsRunning
|
boolean connectionEstablished = state == State.StreamsRunning
|
||||||
|| state == State.Paused
|
|| state == State.Paused
|
||||||
|
@ -433,17 +390,6 @@ public class IncallActivity extends ListActivity implements
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setVisibility(View v, int id, boolean visible) {
|
|
||||||
LinphoneUtils.setVisibility(v, id, visible);
|
|
||||||
}
|
|
||||||
private void setVisibility(View v, boolean visible) {
|
|
||||||
LinphoneUtils.setVisibility(v, visible);
|
|
||||||
}
|
|
||||||
private void setStatusLabel(View v, State state, boolean activeOne) {
|
|
||||||
String statusLabel = getStateText(state);
|
|
||||||
((TextView) v.findViewById(R.id.status_label)).setText(statusLabel);
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean highlightCall(LinphoneCall call) {
|
private boolean highlightCall(LinphoneCall call) {
|
||||||
final State state = call.getState();
|
final State state = call.getState();
|
||||||
return state == State.StreamsRunning
|
return state == State.StreamsRunning
|
||||||
|
@ -455,7 +401,6 @@ public class IncallActivity extends ListActivity implements
|
||||||
}
|
}
|
||||||
|
|
||||||
public View getView(int position, View v, ViewGroup parent) {
|
public View getView(int position, View v, ViewGroup parent) {
|
||||||
Log.i("IncallActivity.getView(",position,") out of ", mNotInConfCalls.size());
|
|
||||||
if (v == null) {
|
if (v == null) {
|
||||||
if (Version.sdkAboveOrEqual(Version.API06_ECLAIR_201)) {
|
if (Version.sdkAboveOrEqual(Version.API06_ECLAIR_201)) {
|
||||||
v = getLayoutInflater().inflate(R.layout.conf_callee, null);
|
v = getLayoutInflater().inflate(R.layout.conf_callee, null);
|
||||||
|
@ -464,26 +409,21 @@ public class IncallActivity extends ListActivity implements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final LinphoneCall call = mNotInConfCalls.get(position);
|
final LinphoneCall call = getItem(position);
|
||||||
final LinphoneCall.State state = call.getState();
|
final LinphoneCall.State state = call.getState();
|
||||||
|
|
||||||
LinphoneAddress address = call.getRemoteAddress();
|
LinphoneAddress address = call.getRemoteAddress();
|
||||||
String mainText = address.getDisplayName();
|
|
||||||
String complText = address.getUserName();
|
|
||||||
TextView mainTextView = (TextView) v.findViewById(R.id.name);
|
TextView mainTextView = (TextView) v.findViewById(R.id.name);
|
||||||
TextView complTextView = (TextView) v.findViewById(R.id.address);
|
if (!TextUtils.isEmpty(address.getDisplayName())) {
|
||||||
if (TextUtils.isEmpty(mainText)) {
|
mainTextView.setText(address.getDisplayName());
|
||||||
mainTextView.setText(complText);
|
|
||||||
complTextView.setVisibility(View.GONE);
|
|
||||||
} else {
|
} else {
|
||||||
mainTextView.setText(mainText);
|
mainTextView.setText(address.getUserName());
|
||||||
complTextView.setText(complText);
|
|
||||||
complTextView.setVisibility(View.VISIBLE);
|
|
||||||
}
|
}
|
||||||
|
String statusLabel = getStateText(state);
|
||||||
|
((TextView) v.findViewById(R.id.address)).setText(statusLabel);
|
||||||
|
|
||||||
|
|
||||||
boolean highlighted = highlightCall(call);
|
boolean highlighted = highlightCall(call);
|
||||||
setStatusLabel(v, state, highlighted);
|
|
||||||
|
|
||||||
|
|
||||||
int bgDrawableId = R.drawable.conf_callee_selector_normal;
|
int bgDrawableId = R.drawable.conf_callee_selector_normal;
|
||||||
if (state == State.IncomingReceived) {
|
if (state == State.IncomingReceived) {
|
||||||
|
@ -500,19 +440,13 @@ public class IncallActivity extends ListActivity implements
|
||||||
final boolean showMergeToConf = connectionEstablished && aConferenceIsPossible();
|
final boolean showMergeToConf = connectionEstablished && aConferenceIsPossible();
|
||||||
setVisibility(confButton, false);
|
setVisibility(confButton, false);
|
||||||
|
|
||||||
final int numberOfCalls = mNotInConfCalls.size();
|
final int numberOfCalls = getSpecificCalls().size();
|
||||||
boolean showAddVideo = State.StreamsRunning == state
|
|
||||||
&& Version.isVideoCapable()
|
|
||||||
&& LinphoneManager.getInstance().isVideoEnabled();
|
|
||||||
View addVideoButton = v.findViewById(R.id.addVideo);
|
|
||||||
setVisibility(addVideoButton, showAddVideo);
|
|
||||||
|
|
||||||
boolean statusPaused = state== State.Paused || state == State.PausedByRemote;
|
boolean statusPaused = state== State.Paused || state == State.PausedByRemote;
|
||||||
setVisibility(v, R.id.callee_status_paused, statusPaused);
|
setVisibility(v, R.id.callee_status_paused, statusPaused);
|
||||||
|
|
||||||
final OnClickListener l = new CallActionListener(call);
|
final OnClickListener l = new CallActionListener(call);
|
||||||
confButton.setOnClickListener(l);
|
confButton.setOnClickListener(l);
|
||||||
addVideoButton.setOnClickListener(l);
|
|
||||||
|
|
||||||
String mediaEncryption = call.getCurrentParamsCopy().getMediaEncryption();
|
String mediaEncryption = call.getCurrentParamsCopy().getMediaEncryption();
|
||||||
if ("none".equals(mediaEncryption)) {
|
if ("none".equals(mediaEncryption)) {
|
||||||
|
@ -580,13 +514,12 @@ public class IncallActivity extends ListActivity implements
|
||||||
ImageView pictureView = (ImageView) v.findViewById(R.id.picture);
|
ImageView pictureView = (ImageView) v.findViewById(R.id.picture);
|
||||||
if (numberOfCalls != 1) {
|
if (numberOfCalls != 1) {
|
||||||
// May be greatly sped up using a drawable cache
|
// May be greatly sped up using a drawable cache
|
||||||
Uri uri = LinphoneUtils.findUriPictureOfContactAndSetDisplayName(address, getContentResolver());
|
setCalleePicture(pictureView, address);
|
||||||
LinphoneUtils.setImagePictureFromUri(IncallActivity.this, pictureView, uri, R.drawable.unknown_person);
|
|
||||||
pictureView.setVisibility(VISIBLE);
|
|
||||||
} else {
|
} else {
|
||||||
pictureView.setVisibility(GONE);
|
pictureView.setVisibility(GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
registerCallDurationTimer(v, call);
|
||||||
|
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
@ -604,36 +537,38 @@ public class IncallActivity extends ListActivity implements
|
||||||
id=R.string.state_incoming_received;
|
id=R.string.state_incoming_received;
|
||||||
} else if (state == State.OutgoingRinging) {
|
} else if (state == State.OutgoingRinging) {
|
||||||
id=R.string.state_outgoing_ringing;
|
id=R.string.state_outgoing_ringing;
|
||||||
|
} else if (state == State.OutgoingProgress) {
|
||||||
|
id=R.string.state_outgoing_progress;
|
||||||
} else {
|
} else {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
return getString(id);
|
return getString(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Handler mHandler = new Handler();
|
|
||||||
|
|
||||||
private void updateAdvancedButtons() {
|
private void updateAdvancedButtons() {
|
||||||
LinphoneCall activeCall = lc().getCurrentCall();
|
LinphoneCall activeCall = lc().getCurrentCall();
|
||||||
View bar = findViewById(R.id.conf_advanced_buttons);
|
View bar = findViewById(R.id.conf_advanced_buttons);
|
||||||
|
|
||||||
|
if (activeCall == null) {
|
||||||
|
bar.setVisibility(GONE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int nonConfCallsNb = LinphoneUtils.countNonConferenceCalls(lc());
|
int nonConfCallsNb = LinphoneUtils.countNonConferenceCalls(lc());
|
||||||
|
// in this part, we know nonConfCallsNb > 0 as the active call cannot be a conf call
|
||||||
|
|
||||||
View merge = bar.findViewById(R.id.conf_simple_merge);
|
View merge = bar.findViewById(R.id.conf_simple_merge);
|
||||||
boolean showMerge = nonConfCallsNb >=2
|
boolean enableMerge = nonConfCallsNb >=2 || lc().getConferenceSize() > 0;
|
||||||
|| (lc().getConferenceSize() > 0 && nonConfCallsNb > 0);
|
enableMerge = true;
|
||||||
merge.setEnabled(showMerge);
|
merge.setEnabled(enableMerge);
|
||||||
|
|
||||||
View transfer = bar.findViewById(R.id.conf_simple_transfer);
|
View transfer = bar.findViewById(R.id.conf_simple_transfer);
|
||||||
boolean showTransfer = mAllowTransfers && activeCall != null;
|
boolean enableTransfer = mAllowTransfers && activeCall != null;
|
||||||
transfer.setEnabled(showTransfer);
|
transfer.setEnabled(enableTransfer);
|
||||||
}
|
|
||||||
|
|
||||||
public void onCallStateChanged(final LinphoneCall c, final State s, String m) {
|
// video always enabled when a call active (though may not be shown)
|
||||||
mHandler.post(new Runnable() {
|
|
||||||
public void run() {
|
bar.setVisibility(VISIBLE);
|
||||||
mNotInConfCalls = LinphoneUtils.getLinphoneCallsNotInConf(lc());
|
|
||||||
recreateActivity();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateConfItem() {
|
private void updateConfItem() {
|
||||||
|
@ -650,15 +585,15 @@ public class IncallActivity extends ListActivity implements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void recreateActivity() {
|
protected void updateUI() {
|
||||||
updateAdvancedButtons();
|
updateAdvancedButtons();
|
||||||
updateCalleeImage();
|
updateCalleeImage();
|
||||||
updateSoundLock();
|
updateSoundLock();
|
||||||
updateAddCallButton();
|
updateAddCallButton();
|
||||||
updateDtmfButton();
|
updateNumpadButton();
|
||||||
updateConfItem();
|
updateConfItem();
|
||||||
|
|
||||||
mListAdapter.notifyDataSetChanged();
|
super.updateUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int compare(LinphoneCall c1, LinphoneCall c2) {
|
public int compare(LinphoneCall c1, LinphoneCall c2) {
|
||||||
|
@ -726,7 +661,7 @@ public class IncallActivity extends ListActivity implements
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (requestCode) {
|
switch (requestCode) {
|
||||||
case ID_ADD_CALL:
|
case addCallId:
|
||||||
try {
|
try {
|
||||||
lc().invite(uri);
|
lc().invite(uri);
|
||||||
eventuallyResumeConfOrCallOnPickerReturn(false);
|
eventuallyResumeConfOrCallOnPickerReturn(false);
|
||||||
|
@ -735,12 +670,12 @@ public class IncallActivity extends ListActivity implements
|
||||||
Toast.makeText(this, R.string.error_adding_new_call, Toast.LENGTH_LONG).show();
|
Toast.makeText(this, R.string.error_adding_new_call, Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ID_TRANSFER_CALL:
|
case transferCallId:
|
||||||
lc().transferCall(mCallToTransfer, uri);
|
lc().transferCall(mCallToTransfer, uri);
|
||||||
// don't re-enter conference if call to transfer from conference
|
// don't re-enter conference if call to transfer from conference
|
||||||
boolean doResume = !mCallToTransfer.isInConference();
|
boolean doResume = !mCallToTransfer.isInConference();
|
||||||
// don't resume call if it is the call to transfer
|
// don't resume call if it is the call to transfer
|
||||||
doResume &= activateCallOnReturnFromUriPicker != mCallToTransfer;
|
doResume &= mActivateCallOnReturnFromUriPicker != mCallToTransfer;
|
||||||
eventuallyResumeConfOrCallOnPickerReturn(doResume);
|
eventuallyResumeConfOrCallOnPickerReturn(doResume);
|
||||||
Toast.makeText(this, R.string.transfer_started, Toast.LENGTH_LONG).show();
|
Toast.makeText(this, R.string.transfer_started, Toast.LENGTH_LONG).show();
|
||||||
break;
|
break;
|
||||||
|
@ -751,14 +686,14 @@ public class IncallActivity extends ListActivity implements
|
||||||
|
|
||||||
private void eventuallyResumeConfOrCallOnPickerReturn(boolean doCallConfResuming) {
|
private void eventuallyResumeConfOrCallOnPickerReturn(boolean doCallConfResuming) {
|
||||||
if (doCallConfResuming) {
|
if (doCallConfResuming) {
|
||||||
if (activateCallOnReturnFromUriPicker != null) {
|
if (mActivateCallOnReturnFromUriPicker != null) {
|
||||||
lc().resumeCall(activateCallOnReturnFromUriPicker);
|
lc().resumeCall(mActivateCallOnReturnFromUriPicker);
|
||||||
} else if (enterConferenceOnReturnFromUriPicker) {
|
} else if (mEnterConferenceOnReturnFromUriPicker) {
|
||||||
enterConferenceAndUpdateUI(true);
|
enterConferenceAndVirtualConfView(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
activateCallOnReturnFromUriPicker = null;
|
mActivateCallOnReturnFromUriPicker = null;
|
||||||
enterConferenceOnReturnFromUriPicker = false;
|
mEnterConferenceOnReturnFromUriPicker = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -768,31 +703,14 @@ public class IncallActivity extends ListActivity implements
|
||||||
return super.onKeyDown(keyCode, event);
|
return super.onKeyDown(keyCode, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onAudioStateChanged(final AudioState state) {
|
|
||||||
mSpeakerButton.post(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
switch (state) {
|
|
||||||
case SPEAKER:
|
|
||||||
mSpeakerButton.setChecked(true);
|
|
||||||
break;
|
|
||||||
case EARPIECE:
|
|
||||||
mSpeakerButton.setChecked(false);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw new RuntimeException("Unknown audio state " + state);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
private Handler mHandler = new Handler();
|
||||||
@Override
|
@Override
|
||||||
public void onCallEncryptionChanged(LinphoneCall call, boolean encrypted,
|
public void onCallEncryptionChanged(LinphoneCall call, boolean encrypted,
|
||||||
String authenticationToken) {
|
String authenticationToken) {
|
||||||
mHandler.post(new Runnable() {
|
mHandler.post(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
recreateActivity();
|
updateUI();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -503,17 +503,14 @@ public class LinphoneActivity extends TabActivity implements
|
||||||
|
|
||||||
if (state==State.Error){
|
if (state==State.Error){
|
||||||
showToast(R.string.call_error, message);
|
showToast(R.string.call_error, message);
|
||||||
if (lc.getCallsNb() == 0){
|
|
||||||
exitIncallActivity();
|
|
||||||
}
|
|
||||||
}else if (state==State.CallEnd){
|
|
||||||
if (lc.getCallsNb() == 0){
|
|
||||||
exitIncallActivity();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
if (state==State.Error || state==State.CallEnd) {
|
||||||
if (ConferenceDetailsActivity.active && lc.getConferenceSize() == 0) {
|
if (lc.getCallsNb() == 0){
|
||||||
finishActivity(conferenceDetailsActivity);
|
exitIncallActivity();
|
||||||
|
}
|
||||||
|
if (ConferenceDetailsActivity.active && lc.getConferenceSize() == 0) {
|
||||||
|
finishActivity(conferenceDetailsActivity);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,13 +53,13 @@ public class IncallTimer extends TextView {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String formatTime(final int seconds) {
|
protected String formatTime(final int seconds) {
|
||||||
String time = String.format("%02d : %02d",
|
String time = String.format("%02d:%02d",
|
||||||
(seconds / 60) % 60,
|
(seconds / 60) % 60,
|
||||||
seconds % 60);
|
seconds % 60);
|
||||||
|
|
||||||
int hours = seconds / 3600;
|
int hours = seconds / 3600;
|
||||||
if (hours != 0) {
|
if (hours != 0) {
|
||||||
return hours + " - " + time;
|
return hours + ":" + time;
|
||||||
} else {
|
} else {
|
||||||
return time;
|
return time;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue