Add topbar and hide tabbar in about

This commit is contained in:
Margaux Clerc 2015-10-15 15:00:16 +02:00
parent d7fc044957
commit 237487cb58
3 changed files with 87 additions and 85 deletions

View file

@ -3,18 +3,45 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/colorH" android:background="@color/colorH"
android:orientation="vertical" android:orientation="vertical">
android:gravity="center">
<RelativeLayout
android:id="@+id/topbar"
android:background="@color/colorF"
android:layout_width="match_parent"
android:layout_height="70dp">
<TextView
android:text="@string/about"
style="@style/font1"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:gravity="center_vertical"/>
<ImageView
android:id="@+id/cancel"
android:src="@drawable/dialer_back"
android:contentDescription="@string/content_description_dialer"
android:layout_width="70dp"
android:layout_height="match_parent"
android:padding="20dp"
android:layout_centerInParent="true"
android:layout_alignParentRight="true"/>
</RelativeLayout>
<ImageView <ImageView
android:src="@drawable/linphone_orange" android:src="@drawable/linphone_orange"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center"
android:padding="10dp" /> android:padding="10dp" />
<TextView <TextView
android:text="@string/app_name" android:text="@string/app_name"
style="@style/font5" style="@style/font5"
android:layout_gravity="center"
android:layout_margin="10dp" android:layout_margin="10dp"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content"/> android:layout_height="wrap_content"/>
@ -23,6 +50,7 @@
android:id="@+id/AboutText" android:id="@+id/AboutText"
android:text="@string/about_text" android:text="@string/about_text"
style="@style/font9" style="@style/font9"
android:layout_gravity="center"
android:gravity="center" android:gravity="center"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content"/> android:layout_height="wrap_content"/>
@ -32,6 +60,7 @@
android:text="@string/about_link" android:text="@string/about_link"
android:autoLink="web" android:autoLink="web"
style="@style/font9" style="@style/font9"
android:layout_gravity="center"
android:gravity="center" android:gravity="center"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content"/> android:layout_height="wrap_content"/>
@ -40,7 +69,7 @@
android:orientation="horizontal" android:orientation="horizontal"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center"> android:layout_gravity="center">
<Button <Button
android:id="@+id/send_log" android:id="@+id/send_log"

View file

@ -28,23 +28,19 @@ import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
/** /**
* @author Sylvain Berfini * @author Sylvain Berfini
*/ */
public class AboutFragment extends Fragment implements OnClickListener { public class AboutFragment extends Fragment implements OnClickListener {
private FragmentsAvailable about = FragmentsAvailable.ABOUT_INSTEAD_OF_CHAT;
View exitButton = null;
View sendLogButton = null; View sendLogButton = null;
View resetLogButton = null; View resetLogButton = null;
private ImageView cancel;
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
if (getArguments() != null && getArguments().getSerializable("About") != null) {
about = (FragmentsAvailable) getArguments().getSerializable("About");
}
View view = inflater.inflate(R.layout.about, container, false); View view = inflater.inflate(R.layout.about, container, false);
TextView aboutText = (TextView) view.findViewById(R.id.AboutText); TextView aboutText = (TextView) view.findViewById(R.id.AboutText);
@ -54,13 +50,16 @@ public class AboutFragment extends Fragment implements OnClickListener {
Log.e(e, "cannot get version name"); Log.e(e, "cannot get version name");
} }
cancel = (ImageView) view.findViewById(R.id.cancel);
cancel.setOnClickListener(this);
sendLogButton = view.findViewById(R.id.send_log); sendLogButton = view.findViewById(R.id.send_log);
sendLogButton.setOnClickListener(this); sendLogButton.setOnClickListener(this);
sendLogButton.setVisibility(LinphonePreferences.instance().isDebugEnabled() ? View.VISIBLE : View.GONE); sendLogButton.setVisibility(org.linphone.LinphonePreferences.instance().isDebugEnabled() ? View.VISIBLE : View.GONE);
resetLogButton = view.findViewById(R.id.reset_log); resetLogButton = view.findViewById(R.id.reset_log);
resetLogButton.setOnClickListener(this); resetLogButton.setOnClickListener(this);
resetLogButton.setVisibility(LinphonePreferences.instance().isDebugEnabled() ? View.VISIBLE : View.GONE); resetLogButton.setVisibility(org.linphone.LinphonePreferences.instance().isDebugEnabled() ? View.VISIBLE : View.GONE);
return view; return view;
} }
@ -69,20 +68,16 @@ public class AboutFragment extends Fragment implements OnClickListener {
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
if (LinphoneActivity.isInstanciated()) { if (org.linphone.LinphoneActivity.isInstanciated()) {
LinphoneActivity.instance().selectMenu(about); LinphoneActivity.instance().hideTabBar(true);
if (getResources().getBoolean(R.bool.show_statusbar_only_on_dialer)) {
LinphoneActivity.instance().hideStatusBar();
}
} }
} }
@Override @Override
public void onClick(View v) { public void onClick(View v) {
if (LinphoneActivity.isInstanciated()) { if (org.linphone.LinphoneActivity.isInstanciated()) {
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); LinphoneCore lc = org.linphone.LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (v == sendLogButton) { if (v == sendLogButton) {
if (lc != null) { if (lc != null) {
lc.uploadLogCollection(); lc.uploadLogCollection();
@ -91,6 +86,8 @@ public class AboutFragment extends Fragment implements OnClickListener {
if (lc != null) { if (lc != null) {
lc.resetLogCollection(); lc.resetLogCollection();
} }
} else if (v == cancel) {
getFragmentManager().popBackStackImmediate();
} }
} }
} }

View file

@ -28,7 +28,6 @@ import java.util.List;
import org.linphone.LinphoneManager.AddressType; import org.linphone.LinphoneManager.AddressType;
import org.linphone.assistant.AssistantActivity; import org.linphone.assistant.AssistantActivity;
import org.linphone.compatibility.Compatibility;
import org.linphone.core.CallDirection; import org.linphone.core.CallDirection;
import org.linphone.core.LinphoneAddress; import org.linphone.core.LinphoneAddress;
import org.linphone.core.LinphoneAuthInfo; import org.linphone.core.LinphoneAuthInfo;
@ -43,7 +42,6 @@ import org.linphone.core.LinphoneCore.RegistrationState;
import org.linphone.core.LinphoneCoreException; import org.linphone.core.LinphoneCoreException;
import org.linphone.core.LinphoneCoreFactory; import org.linphone.core.LinphoneCoreFactory;
import org.linphone.core.LinphoneCoreListenerBase; import org.linphone.core.LinphoneCoreListenerBase;
import org.linphone.core.LinphonePlayer;
import org.linphone.core.LinphoneProxyConfig; import org.linphone.core.LinphoneProxyConfig;
import org.linphone.core.Reason; import org.linphone.core.Reason;
import org.linphone.mediastream.Log; import org.linphone.mediastream.Log;
@ -56,7 +54,6 @@ import android.app.Dialog;
import android.app.Fragment; import android.app.Fragment;
import android.app.FragmentManager; import android.app.FragmentManager;
import android.app.FragmentTransaction; import android.app.FragmentTransaction;
import android.content.ComponentName;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.pm.ActivityInfo; import android.content.pm.ActivityInfo;
@ -97,7 +94,6 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
private static final int FIRST_LOGIN_ACTIVITY = 101; private static final int FIRST_LOGIN_ACTIVITY = 101;
private static final int REMOTE_PROVISIONING_LOGIN_ACTIVITY = 102; private static final int REMOTE_PROVISIONING_LOGIN_ACTIVITY = 102;
private static final int CALL_ACTIVITY = 19; private static final int CALL_ACTIVITY = 19;
private static final int CHAT_ACTIVITY = 21;
private static LinphoneActivity instance; private static LinphoneActivity instance;
@ -114,10 +110,10 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
private boolean isAnimationDisabled = false, preferLinphoneContacts = false; private boolean isAnimationDisabled = false, preferLinphoneContacts = false;
private OrientationEventListener mOrientationHelper; private OrientationEventListener mOrientationHelper;
private LinphoneCoreListenerBase mListener; private LinphoneCoreListenerBase mListener;
private LinearLayout mTabBar;
private DrawerLayout sideMenu; private DrawerLayout sideMenu;
private String[] sideMenuItems; private String[] sideMenuItems;
private String mTitle;
private RelativeLayout sideMenuContent, quitLayout, defaultAccount; private RelativeLayout sideMenuContent, quitLayout, defaultAccount;
private ListView accountsList, sideMenuItemList; private ListView accountsList, sideMenuItemList;
private ImageView menu; private ImageView menu;
@ -195,7 +191,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
if(!displayChatMessageNotification(message.getFrom().asStringUriOnly())) { if(!displayChatMessageNotification(message.getFrom().asStringUriOnly())) {
cr.markAsRead(); cr.markAsRead();
} }
displayMissedChats(getChatStorage().getUnreadMessageCount()); displayMissedChats(getUnreadMessageCount());
if (messageListFragment != null && messageListFragment.isVisible()) { if (messageListFragment != null && messageListFragment.isVisible()) {
((ChatListFragment) messageListFragment).refresh(); ((ChatListFragment) messageListFragment).refresh();
} }
@ -299,6 +295,8 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
private void initButtons() { private void initButtons() {
mTabBar = (LinearLayout) findViewById(R.id.footer);
history = (RelativeLayout) findViewById(R.id.history); history = (RelativeLayout) findViewById(R.id.history);
history.setOnClickListener(this); history.setOnClickListener(this);
contacts = (RelativeLayout) findViewById(R.id.contacts); contacts = (RelativeLayout) findViewById(R.id.contacts);
@ -326,8 +324,8 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
return; return;
} }
//findViewById(R.id.status).setVisibility(View.GONE); findViewById(R.id.status).setVisibility(View.GONE);
//findViewById(R.id.fragmentContainer).setPadding(0, 0, 0, 0); findViewById(R.id.fragmentContainer).setPadding(0, 0, 0, 0);
} }
public void showStatusBar() { public void showStatusBar() {
@ -335,12 +333,12 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
return; return;
} }
/*if (statusFragment != null && !statusFragment.isVisible()) { if (statusFragment != null && !statusFragment.isVisible()) {
// Hack to ensure statusFragment is visible after coming back to // Hack to ensure statusFragment is visible after coming back to
// dialer from chat // dialer from chat
statusFragment.getView().setVisibility(View.VISIBLE); statusFragment.getView().setVisibility(View.VISIBLE);
}*/ }
//findViewById(R.id.status).setVisibility(View.VISIBLE); findViewById(R.id.status).setVisibility(View.VISIBLE);
//findViewById(R.id.fragmentContainer).setPadding(0, LinphoneUtils.pixelsToDpi(getResources(), 40), 0, 0); //findViewById(R.id.fragmentContainer).setPadding(0, LinphoneUtils.pixelsToDpi(getResources(), 40), 0, 0);
} }
@ -375,17 +373,8 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
newFragment = new HistoryDetailFragment(); newFragment = new HistoryDetailFragment();
break; break;
case CONTACTS: case CONTACTS:
if (getResources().getBoolean(R.bool.use_android_native_contact_edit_interface)) { newFragment = new ContactsFragment();
Intent i = new Intent(); friendStatusListenerFragment = newFragment;
i.setComponent(new ComponentName("com.android.contacts", "com.android.contacts.DialtactsContactsEntryActivity"));
i.setAction("android.intent.action.MAIN");
i.addCategory("android.intent.category.LAUNCHER");
i.addCategory("android.intent.category.DEFAULT");
startActivity(i);
} else {
newFragment = new ContactsFragment();
friendStatusListenerFragment = newFragment;
}
break; break;
case CONTACT: case CONTACT:
newFragment = new ContactFragment(); newFragment = new ContactFragment();
@ -407,8 +396,6 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
newFragment = new AccountPreferencesFragment(); newFragment = new AccountPreferencesFragment();
break; break;
case ABOUT: case ABOUT:
case ABOUT_INSTEAD_OF_CHAT:
case ABOUT_INSTEAD_OF_SETTINGS:
newFragment = new AboutFragment(); newFragment = new AboutFragment();
break; break;
case CHATLIST: case CHATLIST:
@ -463,8 +450,6 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
} }
if (newFragmentType != FragmentsAvailable.DIALER if (newFragmentType != FragmentsAvailable.DIALER
|| newFragmentType != FragmentsAvailable.ABOUT_INSTEAD_OF_CHAT
|| newFragmentType != FragmentsAvailable.ABOUT_INSTEAD_OF_SETTINGS
|| newFragmentType != FragmentsAvailable.CONTACTS || newFragmentType != FragmentsAvailable.CONTACTS
|| newFragmentType != FragmentsAvailable.CHATLIST || newFragmentType != FragmentsAvailable.CHATLIST
|| newFragmentType != FragmentsAvailable.HISTORY) { || newFragmentType != FragmentsAvailable.HISTORY) {
@ -500,8 +485,6 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
} else { } else {
if (newFragmentType == FragmentsAvailable.DIALER if (newFragmentType == FragmentsAvailable.DIALER
|| newFragmentType == FragmentsAvailable.ABOUT || newFragmentType == FragmentsAvailable.ABOUT
|| newFragmentType == FragmentsAvailable.ABOUT_INSTEAD_OF_CHAT
|| newFragmentType == FragmentsAvailable.ABOUT_INSTEAD_OF_SETTINGS
|| newFragmentType == FragmentsAvailable.SETTINGS || newFragmentType == FragmentsAvailable.SETTINGS
|| newFragmentType == FragmentsAvailable.ACCOUNT_SETTINGS) { || newFragmentType == FragmentsAvailable.ACCOUNT_SETTINGS) {
ll.setVisibility(View.GONE); ll.setVisibility(View.GONE);
@ -524,8 +507,6 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
currentFragment = newFragmentType; currentFragment = newFragmentType;
if (newFragmentType == FragmentsAvailable.DIALER if (newFragmentType == FragmentsAvailable.DIALER
|| newFragmentType == FragmentsAvailable.ABOUT_INSTEAD_OF_CHAT
|| newFragmentType == FragmentsAvailable.ABOUT_INSTEAD_OF_SETTINGS
|| newFragmentType == FragmentsAvailable.SETTINGS || newFragmentType == FragmentsAvailable.SETTINGS
|| newFragmentType == FragmentsAvailable.CONTACTS || newFragmentType == FragmentsAvailable.CONTACTS
|| newFragmentType == FragmentsAvailable.CHATLIST || newFragmentType == FragmentsAvailable.CHATLIST
@ -642,18 +623,24 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
return true; return true;
} }
public int getUnreadMessageCount() {
int count = 0;
LinphoneChatRoom[] chats = LinphoneManager.getLc().getChatRooms();
for (LinphoneChatRoom chatroom : chats) {
count += chatroom.getUnreadMessagesCount();
}
return count;
}
public void displayChat(String sipUri) { public void displayChat(String sipUri) {
if (getResources().getBoolean(R.bool.disable_chat)) { if (getResources().getBoolean(R.bool.disable_chat)) {
return; return;
} }
Log.w("Display chat sipuri" + sipUri);
if(sipUri == null) { if(sipUri == null) {
Bundle extras = new Bundle(); Bundle extras = new Bundle();
changeCurrentFragment(FragmentsAvailable.CHAT, extras); changeCurrentFragment(FragmentsAvailable.CHAT, extras);
} else { } else {
Log.w("Display chat");
LinphoneAddress lAddress; LinphoneAddress lAddress;
try { try {
lAddress = LinphoneCoreFactory.instance().createLinphoneAddress(sipUri); lAddress = LinphoneCoreFactory.instance().createLinphoneAddress(sipUri);
@ -697,15 +684,13 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
changeCurrentFragment(FragmentsAvailable.CHAT, extras); changeCurrentFragment(FragmentsAvailable.CHAT, extras);
} }
if (messageListFragment != null && messageListFragment.isVisible()) { if (messageListFragment != null && messageListFragment.isVisible()) {
((ChatListFragment) messageListFragment).refresh(); ((ChatListFragment) messageListFragment).refresh();
} }
LinphoneService.instance().resetMessageNotifCount(); LinphoneService.instance().resetMessageNotifCount();
LinphoneService.instance().removeMessageNotification(); LinphoneService.instance().removeMessageNotification();
displayMissedChats(getChatStorage().getUnreadMessageCount()); displayMissedChats(getUnreadMessageCount());
} }
} }
@ -738,6 +723,14 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
chat_selected.setVisibility(View.GONE); chat_selected.setVisibility(View.GONE);
} }
public void hideTabBar(Boolean hide) {
if(hide){
mTabBar.setVisibility(View.GONE);
} else {
mTabBar.setVisibility(View.VISIBLE);
}
}
@SuppressWarnings("incomplete-switch") @SuppressWarnings("incomplete-switch")
public void selectMenu(FragmentsAvailable menuToSelect) { public void selectMenu(FragmentsAvailable menuToSelect) {
currentFragment = menuToSelect; currentFragment = menuToSelect;
@ -760,10 +753,6 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
case ACCOUNT_SETTINGS: case ACCOUNT_SETTINGS:
//settings.setSelected(true); //settings.setSelected(true);
break; break;
case ABOUT_INSTEAD_OF_CHAT:
break;
case ABOUT_INSTEAD_OF_SETTINGS:
break;
case CHATLIST: case CHATLIST:
case CHAT: case CHAT:
chat_selected.setVisibility(View.VISIBLE); chat_selected.setVisibility(View.VISIBLE);
@ -833,7 +822,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
public void updateMissedChatCount() { public void updateMissedChatCount() {
displayMissedChats(getChatStorage().getUnreadMessageCount()); displayMissedChats(getUnreadMessageCount());
} }
public int onMessageSent(String to, String message) { public int onMessageSent(String to, String message) {
@ -871,13 +860,16 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
} }
} }
private void displayMissedChats(final int missedChatCount) { private void displayMissedChats(final int missedChatCount) {;
if (missedChatCount > 0) { if (missedChatCount > 0) {
missedChats.setText(missedChatCount + ""); missedChats.setText(missedChatCount + "");
missedChats.setVisibility(View.VISIBLE); missedChats.setVisibility(View.VISIBLE);
if (!isAnimationDisabled) { if (!isAnimationDisabled) {
missedChats.startAnimation(AnimationUtils.loadAnimation(LinphoneActivity.this, R.anim.bounce)); missedChats.startAnimation(AnimationUtils.loadAnimation(LinphoneActivity.this, R.anim.bounce));
} }
if(missedChatCount > 99){
//TODO
}
} else { } else {
missedChats.clearAnimation(); missedChats.clearAnimation();
missedChats.setVisibility(View.GONE); missedChats.setVisibility(View.GONE);
@ -901,7 +893,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
public Dialog displayDialog(String text){ public Dialog displayDialog(String text){
Dialog dialog = new Dialog(this); Dialog dialog = new Dialog(this);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
Drawable d = new ColorDrawable(R.color.colorC); Drawable d = new ColorDrawable(getResources().getColor(R.color.colorC));
d.setAlpha(200); d.setAlpha(200);
dialog.setContentView(R.layout.dialog); dialog.setContentView(R.layout.dialog);
dialog.getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT,WindowManager.LayoutParams.MATCH_PARENT); dialog.getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT,WindowManager.LayoutParams.MATCH_PARENT);
@ -1050,40 +1042,26 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
public void addContact(String displayName, String sipUri) public void addContact(String displayName, String sipUri)
{ {
if (getResources().getBoolean(R.bool.use_android_native_contact_edit_interface)) { Bundle extras = new Bundle();
Intent intent = Compatibility.prepareAddContactIntent(displayName, sipUri); extras.putSerializable("NewSipAdress", sipUri);
startActivity(intent); changeCurrentFragment(FragmentsAvailable.EDIT_CONTACT, extras);
} else {
Bundle extras = new Bundle();
extras.putSerializable("NewSipAdress", sipUri);
changeCurrentFragment(FragmentsAvailable.EDIT_CONTACT, extras);
}
} }
public void editContact(Contact contact) public void editContact(Contact contact)
{ {
if (getResources().getBoolean(R.bool.use_android_native_contact_edit_interface)) {
Intent intent = Compatibility.prepareEditContactIntent(Integer.parseInt(contact.getID()));
startActivity(intent);
} else {
Bundle extras = new Bundle(); Bundle extras = new Bundle();
extras.putSerializable("Contact", contact); extras.putSerializable("Contact", contact);
changeCurrentFragment(FragmentsAvailable.EDIT_CONTACT, extras); changeCurrentFragment(FragmentsAvailable.EDIT_CONTACT, extras);
}
} }
public void editContact(Contact contact, String sipAddress) public void editContact(Contact contact, String sipAddress)
{ {
if (getResources().getBoolean(R.bool.use_android_native_contact_edit_interface)) {
Intent intent = Compatibility.prepareEditContactIntentWithSipAddress(Integer.parseInt(contact.getID()), sipAddress);
startActivity(intent);
} else {
Bundle extras = new Bundle(); Bundle extras = new Bundle();
extras.putSerializable("Contact", contact); extras.putSerializable("Contact", contact);
extras.putSerializable("NewSipAdress", sipAddress); extras.putSerializable("NewSipAdress", sipAddress);
changeCurrentFragment(FragmentsAvailable.EDIT_CONTACT, extras); changeCurrentFragment(FragmentsAvailable.EDIT_CONTACT, extras);
}
} }
public void quit() { public void quit() {
@ -1249,9 +1227,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
if (currentFragment == FragmentsAvailable.DIALER if (currentFragment == FragmentsAvailable.DIALER
|| currentFragment == FragmentsAvailable.CONTACTS || currentFragment == FragmentsAvailable.CONTACTS
|| currentFragment == FragmentsAvailable.HISTORY || currentFragment == FragmentsAvailable.HISTORY
|| currentFragment == FragmentsAvailable.CHATLIST || currentFragment == FragmentsAvailable.CHATLIST) {
|| currentFragment == FragmentsAvailable.ABOUT_INSTEAD_OF_CHAT
|| currentFragment == FragmentsAvailable.ABOUT_INSTEAD_OF_SETTINGS) {
boolean isBackgroundModeActive = LinphonePreferences.instance().isBackgroundModeEnabled(); boolean isBackgroundModeActive = LinphonePreferences.instance().isBackgroundModeEnabled();
if (!isBackgroundModeActive) { if (!isBackgroundModeActive) {
stopService(new Intent(Intent.ACTION_MAIN).setClass(this, LinphoneService.class)); stopService(new Intent(Intent.ACTION_MAIN).setClass(this, LinphoneService.class));
@ -1447,7 +1423,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
ImageView status = (ImageView) view.findViewById(R.id.statusLed); ImageView status = (ImageView) view.findViewById(R.id.statusLed);
TextView address = (TextView) view.findViewById(R.id.address); TextView address = (TextView) view.findViewById(R.id.address);
String sipAddress = (lpc.getIdentity() != null && lpc.getIdentity().startsWith("sip:")) ? lpc.getIdentity().split("sip:")[1] : lpc.getIdentity(); String sipAddress = lpc.getAddress().asStringUriOnly();
try { try {
LinphoneAddress identity = LinphoneCoreFactory.instance().createLinphoneAddress(lpc.getIdentity()); LinphoneAddress identity = LinphoneCoreFactory.instance().createLinphoneAddress(lpc.getIdentity());
@ -1462,7 +1438,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
for (int i = 0; i < nbAccounts; i++) { for (int i = 0; i < nbAccounts; i++) {
String username = LinphonePreferences.instance().getAccountUsername(i); String username = LinphonePreferences.instance().getAccountUsername(i);
String domain = LinphonePreferences.instance().getAccountDomain(i); String domain = LinphonePreferences.instance().getAccountDomain(i);
String id = username + "@" + domain; String id = "sip:" + username + "@" + domain;
if (id.equals(sipAddress)) { if (id.equals(sipAddress)) {
accountIndex = i; accountIndex = i;
view.setTag(accountIndex); view.setTag(accountIndex);