Fix merge

This commit is contained in:
Margaux Clerc 2015-12-08 17:13:12 +01:00
parent c3027ec959
commit 72328025d2
10 changed files with 347 additions and 222 deletions

View file

@ -12,17 +12,15 @@
android:layout_height="35dp"
tools:layout="@layout/status" />
<android.support.v4.widget.DrawerLayout
android:id="@+id/side_menu"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/status">
android:layout_below="@+id/status">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/status">
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/fragmentContainer"
@ -35,9 +33,9 @@
android:layout_height="match_parent"
android:layout_above="@+id/menu">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/conference_list"
@ -61,92 +59,99 @@
android:orientation="vertical">
</LinearLayout>
<ImageView
android:id="@+id/contact_picture"
android:src="@drawable/avatar_big"
android:contentDescription="@string/content_description_contact_picture"
android:layout_centerInParent="true"
android:layout_width="200dp"
android:layout_height="200dp"
android:paddingBottom="20dp"/>
<LinearLayout
android:id="@+id/active_call_info"
android:background="@color/colorG"
<RelativeLayout
android:id="@+id/active_call"
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
android:orientation="vertical">
android:layout_height="wrap_content"
android:layout_above="@id/calls_list"
android:visibility="visible">
<TextView
android:id="@+id/current_contact_name"
style="@style/font13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="5dp"
android:layout_alignParentTop="true"
android:layout_gravity="center"/>
<LinearLayout
android:id="@+id/active_call_info"
android:background="@color/colorG"
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
android:orientation="vertical">
<Chronometer
android:id="@+id/current_call_timer"
style="@style/font11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/current_contact_name"
android:layout_gravity="center"/>
</LinearLayout>
<TextView
android:id="@+id/current_contact_name"
style="@style/font13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="5dp"
android:layout_alignParentTop="true"
android:layout_gravity="center"/>
<LinearLayout
android:id="@+id/remote_pause"
android:background="@color/colorA"
android:alpha="0.9"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical"
android:visibility="gone">
<Chronometer
android:id="@+id/current_call_timer"
style="@style/font11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/current_contact_name"
android:layout_gravity="center"/>
</LinearLayout>
<ImageView
android:src="@drawable/waiting_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"/>
android:id="@+id/contact_picture"
android:src="@drawable/avatar_big"
android:contentDescription="@string/content_description_contact_picture"
android:layout_centerInParent="true"
android:layout_width="200dp"
android:layout_height="200dp"
android:paddingBottom="20dp"/>
<TextView
android:text="@string/call_paused_by_remote"
style="@style/font4"
<LinearLayout
android:id="@+id/remote_pause"
android:background="@color/colorA"
android:alpha="0.9"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:layout_margin="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"/>
android:orientation="vertical"
android:visibility="gone">
</LinearLayout>
<ImageView
android:src="@drawable/waiting_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"/>
<ImageView
android:id="@+id/pause"
android:src="@drawable/pause_big_default"
android:contentDescription="@string/content_description_pause"
android:layout_width="80dp"
android:layout_height="80dp"
android:padding="15dp"
android:layout_below="@+id/active_call_info"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"/>
<TextView
android:text="@string/call_paused_by_remote"
style="@style/font4"
android:gravity="center"
android:layout_margin="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"/>
<ImageView
android:id="@+id/switchCamera"
android:src="@drawable/switch_camera"
android:layout_width="80dp"
android:layout_height="80dp"
android:padding="15dp"
android:contentDescription="@string/content_description_switch_camera"
android:visibility="invisible"
android:layout_alignParentTop="true"
android:layout_below="@+id/active_call_info"
android:layout_alignParentLeft="true"/>
</RelativeLayout>
</LinearLayout>
<ImageView
android:id="@+id/pause"
android:src="@drawable/pause_big_default"
android:contentDescription="@string/content_description_pause"
android:layout_width="80dp"
android:layout_height="80dp"
android:padding="15dp"
android:layout_below="@+id/active_call_info"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"/>
<ImageView
android:id="@+id/switchCamera"
android:src="@drawable/switch_camera"
android:layout_width="80dp"
android:layout_height="80dp"
android:padding="15dp"
android:contentDescription="@string/content_description_switch_camera"
android:visibility="invisible"
android:layout_alignParentTop="true"
android:layout_below="@+id/active_call_info"
android:layout_alignParentLeft="true"/>
</RelativeLayout>
<LinearLayout
android:id="@+id/no_current_call"
@ -173,7 +178,9 @@
android:layout_margin="10dp"
android:layout_gravity="center"/>
</LinearLayout>
</FrameLayout>
</RelativeLayout>
</FrameLayout>
<org.linphone.ui.Numpad
android:id="@+id/numpad"
@ -302,89 +309,90 @@
</LinearLayout>
<LinearLayout
android:id="@+id/menu_bottom"
android:layout_width="match_parent"
android:layout_height="70dp"
android:layout_above="@id/menu"
android:orientation="horizontal" >
<TextView
<LinearLayout
android:id="@+id/menu_bottom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="invisible"
android:layout_weight="0.5"/>
android:layout_height="70dp"
android:layout_above="@id/menu"
android:orientation="horizontal" >
<TextView
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="invisible"
android:layout_weight="0.5"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="invisible"
android:layout_weight="0.5"/>
<ImageView
android:id="@+id/route_bluetooth"
android:src="@drawable/route_bluetooth"
android:background="@drawable/button_call_background"
android:padding="20dp"
android:visibility="invisible"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.5" />
<ImageView
android:id="@+id/add_call"
android:src="@drawable/add_call_button"
android:background="@drawable/button_call_background"
android:padding="20dp"
android:visibility="invisible"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.5" />
</LinearLayout>
<LinearLayout
android:id="@+id/menu_middle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="invisible"
android:layout_weight="0.5"/>
android:layout_height="70dp"
android:layout_above="@id/menu_bottom"
android:orientation="horizontal" >
<ImageView
android:id="@+id/route_bluetooth"
android:src="@drawable/route_bluetooth"
android:background="@drawable/button_call_background"
android:padding="20dp"
android:visibility="invisible"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.5" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="invisible"
android:layout_weight="0.5"/>
<ImageView
android:id="@+id/add_call"
android:src="@drawable/add_call_button"
android:background="@drawable/button_call_background"
android:padding="20dp"
android:visibility="invisible"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.5" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="invisible"
android:layout_weight="0.5"/>
</LinearLayout>
<ImageView
android:id="@+id/route_earpiece"
android:src="@drawable/route_earpiece"
android:background="@drawable/button_call_background"
android:padding="20dp"
android:visibility="invisible"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.5"/>
<LinearLayout
android:id="@+id/menu_middle"
android:layout_width="match_parent"
android:layout_height="70dp"
android:layout_above="@id/menu_bottom"
android:orientation="horizontal" >
<ImageView
android:id="@+id/transfer"
android:src="@drawable/transfer_button"
android:background="@drawable/button_call_background"
android:padding="20dp"
android:visibility="invisible"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.5"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="invisible"
android:layout_weight="0.5"/>
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="invisible"
android:layout_weight="0.5"/>
<ImageView
android:id="@+id/route_earpiece"
android:src="@drawable/route_earpiece"
android:background="@drawable/button_call_background"
android:padding="20dp"
android:visibility="invisible"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.5"/>
<ImageView
android:id="@+id/transfer"
android:src="@drawable/transfer_button"
android:background="@drawable/button_call_background"
android:padding="20dp"
android:visibility="invisible"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.5"/>
</LinearLayout>
<LinearLayout
<LinearLayout
android:layout_above="@id/menu_middle"
android:layout_width="match_parent"
android:layout_height="70dp"

View file

@ -7,33 +7,33 @@
<RelativeLayout
android:id="@+id/top_bar"
android:layout_width="match_parent"
android:layout_height="60dp">
android:layout_height="50dp">
<ImageView
android:id="@+id/back"
android:src="@drawable/back_button"
android:contentDescription="@string/content_description_back"
android:layout_width="60dp"
android:layout_width="70dp"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:padding="20dp"/>
android:padding="15dp"/>
<ImageView
android:id="@+id/edit"
android:src="@drawable/edit_list_button"
android:contentDescription="@string/content_description_edit"
android:layout_width="60dp"
android:layout_width="70dp"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:padding="15dp"/>
android:padding="12dp"/>
<ImageView
android:id="@+id/start_call"
android:src="@drawable/call_alt_start"
android:contentDescription="@string/content_description_call"
android:layout_width="60dp"
android:layout_width="70dp"
android:layout_height="match_parent"
android:padding="15dp"
android:padding="12dp"
android:layout_toLeftOf="@+id/edit"/>
<ImageView
@ -41,10 +41,10 @@
android:src="@drawable/call_back_button"
android:contentDescription="@string/content_description_call"
android:layout_toLeftOf="@id/edit"
android:layout_width="60dp"
android:layout_width="70dp"
android:layout_height="match_parent"
android:visibility="gone"
android:padding="15dp"/>
android:padding="12dp"/>
<TextView
android:id="@+id/contact_name"
@ -158,6 +158,6 @@
android:layout_below="@id/top_bar"
android:layout_width="match_parent"
android:layout_height="40dp"
android:paddingRight="5dp"/>
android:paddingLeft="10dp"/>
</RelativeLayout>

View file

@ -46,7 +46,7 @@
android:maxHeight="250dp" />
<RelativeLayout
android:id="@+id/imageLayout"
android:id="@+id/file_transfer_layout"
android:visibility="gone"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
@ -62,10 +62,13 @@
<Button
android:id="@+id/accept_download"
android:text="@string/accept"
android:background="@drawable/resizable_assistant_button"
style="@style/font8"
android:text="@string/download"
android:background="@drawable/resizable_confirm_delete_button"
style="@style/font7"
android:textAllCaps="true"
android:contentDescription="@string/content_description_validate"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"

View file

@ -29,8 +29,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingLeft="10dp"
android:paddingRight="10dp">
android:paddingLeft="10dp">
<TextView
android:id="@+id/contact_header"
@ -64,10 +63,10 @@
<ProgressBar
android:id="@+id/progress_bar"
style="@android:style/Widget.ProgressBar.Horizontal"
android:paddingRight="5dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
style="@android:style/Widget.ProgressBar.Horizontal"
android:layout_width="150dp"
android:layout_height="5dp"/>
@ -75,9 +74,14 @@
android:id="@+id/cancel_upload"
android:text="@string/cancel"
android:background="@drawable/resizable_confirm_delete_button"
style="@style/font15"
style="@style/font7"
android:textAllCaps="true"
android:contentDescription="@string/content_description_validate"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_below="@id/progress_bar"/>
</RelativeLayout>
@ -88,7 +92,7 @@
android:id="@+id/status"
android:contentDescription="@string/content_description_message_status"
android:visibility="invisible"
android:padding="5dp"
android:paddingRight="5dp"
android:layout_gravity="top|right"
android:layout_width="20dp"
android:layout_height="20dp"

View file

@ -1,8 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:background="@color/colorA"
android:alpha="0.5"
android:layout_height="50dp"
android:background="@color/colorG"
android:layout_height="60dp"
android:layout_width="match_parent"
android:layout_margin="2dp"
android:gravity="center_vertical"
@ -18,7 +17,7 @@
<TextView
android:id="@+id/contact_name"
android:text="@string/conference"
style="@style/font14"
style="@style/font9"
android:singleLine="true"
android:layout_width="0dip"
android:layout_height="wrap_content"
@ -29,7 +28,7 @@
<ImageView
android:id="@+id/call_pause"
android:src="@drawable/pause_small_default"
android:src="@drawable/pause_big_default"
android:contentDescription="@string/content_description_pause"
android:layout_width="40dp"
android:layout_height="40dp"

View file

@ -31,7 +31,7 @@
<TextView
android:id="@+id/main_account_address"
style="@style/font12"
android:editable="false"
android:singleLine="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
@ -42,9 +42,8 @@
android:src="@drawable/led_connected"
android:layout_width="25dp"
android:layout_height="25dp"
android:padding="5dp"
android:layout_marginBottom="10dp"
android:layout_alignParentRight="true"
android:layout_alignBottom="@id/layout"/>
android:padding="7dp"
android:layout_marginTop="10dp"/>
</RelativeLayout>

View file

@ -27,6 +27,7 @@ import org.linphone.core.LinphoneCallParams;
import org.linphone.core.LinphoneCore;
import org.linphone.core.LinphoneCoreException;
import org.linphone.core.LinphoneCoreListenerBase;
import org.linphone.core.LinphoneFriend;
import org.linphone.core.LinphonePlayer;
import org.linphone.mediastream.Log;
import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration;
@ -36,6 +37,7 @@ import android.app.Activity;
import android.app.Dialog;
import android.app.FragmentTransaction;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.drawable.ColorDrawable;
@ -124,6 +126,12 @@ public class CallActivity extends Activity implements OnClickListener {
BluetoothManager.getInstance().initBluetooth();
}
if (getResources().getBoolean(R.bool.isTablet) && getRequestedOrientation() != ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
} else if (getResources().getBoolean(R.bool.orientation_portrait_only)) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
isAnimationDisabled = getApplicationContext().getResources().getBoolean(R.bool.disable_animations) || !LinphonePreferences.instance().areAnimationsEnabled();
cameraNumber = AndroidCameraConfiguration.retrieveCameras().length;
@ -337,7 +345,7 @@ public class CallActivity extends Activity implements OnClickListener {
pause.setOnClickListener(this);
enabledPauseButton(false);
//mActiveCallHeader = (RelativeLayout) findViewById(R.id.active_call);
mActiveCallHeader = (RelativeLayout) findViewById(R.id.active_call);
mNoCurrentCall = (LinearLayout) findViewById(R.id.no_current_call);
mCallPaused = (LinearLayout) findViewById(R.id.remote_pause);
@ -432,6 +440,16 @@ public class CallActivity extends Activity implements OnClickListener {
}
private void refreshIncallUi(){
if(LinphoneManager.getLc().getCurrentCall() != null){
if(isTransferAllowed)
transfer.setEnabled(true);
if(!isVideoEnabled(LinphoneManager.getLc().getCurrentCall())) {
callInfo.setVisibility(View.VISIBLE);
mActiveCallHeader.setVisibility(View.VISIBLE);
}
}
List<LinphoneCall> pausedCalls = LinphoneUtils.getCallsInState(LinphoneManager.getLc(), Arrays.asList(State.PausedByRemote));
if (pausedCalls.size() == 1) {
displayCallPaused(true);
@ -439,12 +457,6 @@ public class CallActivity extends Activity implements OnClickListener {
displayCallPaused(false);
}
if(LinphoneManager.getLc().getCurrentCall() != null){
if(isTransferAllowed)
transfer.setEnabled(true);
if(!isVideoEnabled(LinphoneManager.getLc().getCurrentCall()))
callInfo.setVisibility(View.VISIBLE);
}
if(LinphoneManager.getLc().getCallsNb() > 1){
callsList.setVisibility(View.VISIBLE);
@ -1441,7 +1453,13 @@ public class CallActivity extends Activity implements OnClickListener {
private void displayCurrentCall(LinphoneCall call){
LinphoneAddress lAddress = call.getRemoteAddress();
TextView currentContactName = (TextView) findViewById(R.id.current_contact_name);
currentContactName.setText(LinphoneUtils.getAddressDisplayName(lAddress));
LinphoneFriend friend = LinphoneManager.getLc().findFriendByAddress(lAddress.asStringUriOnly());
if(friend != null){
currentContactName.setText(LinphoneUtils.getAddressDisplayName(friend.getAddress()));
} else {
currentContactName.setText(LinphoneUtils.getAddressDisplayName(lAddress));
}
registerCallDurationTimer(null, call);
}
@ -1541,7 +1559,7 @@ public class CallActivity extends Activity implements OnClickListener {
isConfPaused = true;
index++;
} else {
if (call != LinphoneManager.getLc().getCurrentCall()) {
if (call != LinphoneManager.getLc().getCurrentCall() && !call.isInConference()) {
displayPausedCalls(resources, call, index);
index++;
} else {
@ -1550,15 +1568,19 @@ public class CallActivity extends Activity implements OnClickListener {
}
}
if(isConfPaused && !isConferenceRunning){
displayPausedCalls(resources, null, index);
}
if (LinphoneManager.getLc().getCurrentCall() == null && !isConferenceRunning) {
showAudioView();
mActiveCallHeader.setVisibility(View.GONE);
mNoCurrentCall.setVisibility(View.VISIBLE);
video.setEnabled(false);
if(!isConferenceRunning) {
if (isConfPaused) {
displayPausedCalls(resources, null, index);
}
if (LinphoneManager.getLc().getCurrentCall() == null) {
showAudioView();
mActiveCallHeader.setVisibility(View.GONE);
mNoCurrentCall.setVisibility(View.VISIBLE);
video.setEnabled(false);
} else {
mActiveCallHeader.setVisibility(View.VISIBLE);
mNoCurrentCall.setVisibility(View.GONE);
}
}
}
@ -1587,10 +1609,10 @@ public class CallActivity extends Activity implements OnClickListener {
public void pauseOrResumeConference() {
LinphoneCore lc = LinphoneManager.getLc();
if (lc.isInConference()) {
conferenceStatus.setImageResource(R.drawable.pause_big_over);
//conferenceStatus.setImageResource(R.drawable.pause_big_over);
lc.leaveConference();
} else {
conferenceStatus.setImageResource(R.drawable.pause_big_default);
//conferenceStatus.setImageResource(R.drawable.pause_big_default);
lc.enterConference();
}
refreshCallList(getResources());

View file

@ -162,7 +162,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
searchContactField = (AutoCompleteTextView) view.findViewById(R.id.search_contact_field);
editList = (RelativeLayout) view.findViewById(R.id.edit_list);
textLayout = (LinearLayout) view.findViewById(R.id.message_layout);
//textLayout = (LinearLayout) view.findViewById(R.id.message_layout);
topBar = (RelativeLayout) view.findViewById(R.id.top_bar);
sendMessage = (ImageView) view.findViewById(R.id.send_message);
@ -499,11 +499,13 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
}
private void displayChatHeader(LinphoneAddress address) {
//if(contact != null) {
// contactName.setText(contact.getName());
//} else if(address != null){
LinphoneFriend friend = LinphoneManager.getLc().findFriendByAddress(address.asStringUriOnly());
if(friend != null) {
contactName.setText(LinphoneUtils.getAddressDisplayName(friend.getAddress()));
} else {
contactName.setText(LinphoneUtils.getAddressDisplayName(address));
//}
}
}
public void changeDisplayedChat(String newSipUri, String displayName, String pictureUri) {
@ -1064,7 +1066,10 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
}
TextView name = (TextView) view.findViewById(R.id.contact_name);
name.setText(LinphoneUtils.getAddressDisplayName(f.getAddress()));
if(f != null) {
name.setText(LinphoneUtils.getAddressDisplayName(f.getAddress()));
}
final TextView address = (TextView) view.findViewById(R.id.contact_address);
address.setText(f.getAddress().asStringUriOnly());

View file

@ -125,7 +125,7 @@ public class ContactDetailsFragment extends Fragment implements OnClickListener
TextView contactName = (TextView) view.findViewById(R.id.contact_name);
contactName.setText(contact.getName());
TableLayout controls = (TableLayout) view.findViewById(R.id.controls);
controls.removeAllViews();
@ -135,6 +135,8 @@ public class ContactDetailsFragment extends Fragment implements OnClickListener
TextView tv = (TextView) v.findViewById(R.id.numeroOrAddress);
tv.setText(contact.getLinphoneAddress());
String displayednumberOrAddress = contact.getLinphoneAddress();
if (!displayChatAddressOnly) {
v.findViewById(R.id.contact_call).setOnClickListener(dialListener);
v.findViewById(R.id.contact_call).setTag(contact.getLinphoneAddress());
@ -186,7 +188,7 @@ public class ContactDetailsFragment extends Fragment implements OnClickListener
} else {
v.findViewById(R.id.contact_chat).setTag(numberOrAddress);
}
final String finalNumberOrAddress = numberOrAddress;
/*ImageView friend = (ImageView) v.findViewById(R.id.addFriend);
if (getResources().getBoolean(R.bool.enable_linphone_friends) && !displayChatAddressOnly) {

View file

@ -145,10 +145,11 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
}
boolean useFirstLoginActivity = getResources().getBoolean(R.bool.display_account_wizard_at_first_start);
if (LinphonePreferences.instance().isProvisioningLoginViewEnabled() && LinphonePreferences.instance().isFirstLaunch() && LinphoneManager.getLc().getDefaultProxyConfig() == null) {
if (LinphonePreferences.instance().isProvisioningLoginViewEnabled() && LinphoneManager.getLc().getDefaultProxyConfig() == null) {
Intent wizard = new Intent();
wizard.setClass(this, RemoteProvisioningLoginActivity.class);
wizard.putExtra("Domain", LinphoneManager.getInstance().wizardLoginViewDomain);
finish();
startActivityForResult(wizard, REMOTE_PROVISIONING_LOGIN_ACTIVITY);
} else if (useFirstLoginActivity && LinphonePreferences.instance().isFirstLaunch()) {
if (LinphonePreferences.instance().getAccountCount() > 0) {
@ -276,6 +277,82 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
updateAnimationsState();
}
public void resetListener(){
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc != null) {
lc.removeListener(mListener);
}
mListener = new LinphoneCoreListenerBase(){
@Override
public void messageReceived(LinphoneCore lc, LinphoneChatRoom cr, LinphoneChatMessage message) {
if(!displayChatMessageNotification(message.getFrom().asStringUriOnly())) {
cr.markAsRead();
}
displayMissedChats(getUnreadMessageCount());
if (messageListFragment != null && messageListFragment.isVisible()) {
((ChatListFragment) messageListFragment).refresh();
}
}
@Override
public void registrationState(LinphoneCore lc, LinphoneProxyConfig proxy, LinphoneCore.RegistrationState state, String smessage) {
if (state.equals(RegistrationState.RegistrationCleared)) {
if (lc != null) {
LinphoneAuthInfo authInfo = lc.findAuthInfo(proxy.getIdentity(), proxy.getRealm(), proxy.getDomain());
if (authInfo != null)
lc.removeAuthInfo(authInfo);
}
}
refreshAccounts();
if(state.equals(RegistrationState.RegistrationFailed) && newProxyConfig) {
newProxyConfig = false;
if (proxy.getError() == Reason.BadCredentials) {
displayCustomToast(getString(R.string.error_bad_credentials), Toast.LENGTH_LONG);
}
if (proxy.getError() == Reason.Unauthorized) {
displayCustomToast(getString(R.string.error_unauthorized), Toast.LENGTH_LONG);
}
if (proxy.getError() == Reason.IOError) {
displayCustomToast(getString(R.string.error_io_error), Toast.LENGTH_LONG);
}
}
}
@Override
public void callState(LinphoneCore lc, LinphoneCall call, LinphoneCall.State state, String message) {
if (state == State.IncomingReceived) {
//finish();
startActivity(new Intent(LinphoneActivity.instance(), CallIncomingActivity.class));
} else if (state == State.OutgoingInit || state == State.OutgoingProgress) {
startActivity(new Intent(LinphoneActivity.instance(), CallOutgoingActivity.class));
} else if (state == State.CallEnd || state == State.Error || state == State.CallReleased) {
// Convert LinphoneCore message for internalization
if (message != null && call.getErrorInfo().getReason() == Reason.Declined) {
displayCustomToast(getString(R.string.error_call_declined), Toast.LENGTH_SHORT);
} else if (message != null && call.getReason() == Reason.NotFound) {
displayCustomToast(getString(R.string.error_user_not_found), Toast.LENGTH_SHORT);
} else if (message != null && call.getReason() == Reason.Media) {
displayCustomToast(getString(R.string.error_incompatible_media), Toast.LENGTH_SHORT);
} else if (message != null && state == State.Error) {
displayCustomToast(getString(R.string.error_unknown) + " - " + message, Toast.LENGTH_SHORT);
}
resetClassicMenuLayoutAndGoBackToCallIfStillRunning();
}
int missedCalls = LinphoneManager.getLc().getMissedCallsCount();
displayMissedCalls(missedCalls);
}
};
lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc != null) {
lc.addListener(mListener);
}
}
private void initButtons() {
mTabBar = (LinearLayout) findViewById(R.id.footer);
//mTopBar = (RelativeLayout) findViewById(R.id.top_bar);
@ -1054,6 +1131,9 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if(resultCode == Activity.RESULT_OK && requestCode == REMOTE_PROVISIONING_LOGIN_ACTIVITY){
resetListener();
}
if (resultCode == Activity.RESULT_FIRST_USER && requestCode == SETTINGS_ACTIVITY) {
if (data.getExtras().getBoolean("Exit", false)) {
quit();
@ -1082,6 +1162,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
@Override
protected void onPause() {
getIntent().putExtra("PreviousActivity", 0);
super.onPause();
}
@ -1095,7 +1176,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
ContactsManager.getInstance().prepareContactsInBackground();
updateMissedChatCount();
refreshAccounts();
displayMissedCalls(LinphoneManager.getLc().getMissedCallsCount());
LinphoneManager.getInstance().changeStatusToOnline();
@ -1244,7 +1325,8 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
public void initSideMenu() {
sideMenu = (DrawerLayout) findViewById(R.id.side_menu);
sideMenuItems = getResources().getStringArray(R.array.side_menu_item);
//sideMenuItems = getResources().getStringArray(R.array.side_menu_item);
sideMenuItems = new String[]{getString(R.string.about)};
sideMenuContent = (RelativeLayout) findViewById(R.id.side_menu_content);
sideMenuItemList = (ListView)findViewById(R.id.item_list);
menu = (ImageView) findViewById(R.id.side_menu_button);
@ -1256,7 +1338,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
if(sideMenuItemList.getAdapter().getItem(i).toString().equals("Settings")){
LinphoneActivity.instance().displaySettings();
}
if(sideMenuItemList.getAdapter().getItem(i).toString().equals("About")){
if(sideMenuItemList.getAdapter().getItem(i).toString().equals(getString(R.string.about))){
LinphoneActivity.instance().displayAbout();
}
if(sideMenuItemList.getAdapter().getItem(i).toString().equals("Assistant")){
@ -1312,9 +1394,8 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
TextView address = (TextView) defaultAccount.findViewById(R.id.main_account_address);
TextView displayName = (TextView) defaultAccount.findViewById(R.id.main_account_display_name);
LinphoneProxyConfig proxy = LinphoneManager.getLc().getDefaultProxyConfig();
if(proxy == null) {
if(proxy == null && LinphoneManager.getLc().getProxyConfigList().length == 0) {
displayName.setText(getString(R.string.no_account));
status.setVisibility(View.GONE);
address.setText("");
@ -1323,11 +1404,12 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
defaultAccount.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
LinphoneActivity.instance().displayAccountSettings(0);
openOrCloseSideMenu(false);
//LinphoneActivity.instance().displayAccountSettings(0);
//openOrCloseSideMenu(false);
}
});
} else {
if(proxy == null) proxy = LinphoneManager.getLc().getProxyConfigList()[0];
address.setText(proxy.getAddress().asStringUriOnly());
displayName.setText(LinphoneUtils.getAddressDisplayName(proxy.getAddress()));
status.setImageResource(getStatusIconResource(proxy.getState()));
@ -1336,8 +1418,8 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
defaultAccount.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
LinphoneActivity.instance().displayAccountSettings(LinphonePreferences.instance().getDefaultAccountIndex());
openOrCloseSideMenu(false);
//LinphoneActivity.instance().displayAccountSettings(LinphonePreferences.instance().getDefaultAccountIndex());
//openOrCloseSideMenu(false);
}
});
}
@ -1358,6 +1440,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
} else {
accountsList.setVisibility(View.GONE);
}
statusFragment.resetAccountStatus();
displayMainAccount();
}