diff --git a/res/drawable-xhdpi/topbar_call_notification.png b/res/drawable-xhdpi/topbar_call_notification.png
new file mode 100644
index 000000000..2f0b96fea
Binary files /dev/null and b/res/drawable-xhdpi/topbar_call_notification.png differ
diff --git a/res/drawable-xhdpi/topbar_chat_notification.png b/res/drawable-xhdpi/topbar_chat_notification.png
new file mode 100644
index 000000000..4f35ff4e6
Binary files /dev/null and b/res/drawable-xhdpi/topbar_chat_notification.png differ
diff --git a/res/drawable-xhdpi/topbar_videocall_notification.png b/res/drawable-xhdpi/topbar_videocall_notification.png
new file mode 100644
index 000000000..e91df1885
Binary files /dev/null and b/res/drawable-xhdpi/topbar_videocall_notification.png differ
diff --git a/res/drawable-xhdpi/waiting_time.png b/res/drawable-xhdpi/waiting_time.png
new file mode 100644
index 000000000..cd949a26f
Binary files /dev/null and b/res/drawable-xhdpi/waiting_time.png differ
diff --git a/res/drawable/quit.xml b/res/drawable/quit.xml
new file mode 100644
index 000000000..f85f9638b
--- /dev/null
+++ b/res/drawable/quit.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
diff --git a/res/drawable/security_ko.png b/res/drawable/security_ko.png
deleted file mode 100644
index bf75d1b27..000000000
Binary files a/res/drawable/security_ko.png and /dev/null differ
diff --git a/res/drawable/security_ok.png b/res/drawable/security_ok.png
deleted file mode 100644
index 0a48c7d14..000000000
Binary files a/res/drawable/security_ok.png and /dev/null differ
diff --git a/res/drawable/security_pending.png b/res/drawable/security_pending.png
deleted file mode 100644
index 1f68accf2..000000000
Binary files a/res/drawable/security_pending.png and /dev/null differ
diff --git a/res/layout/about.xml b/res/layout/about.xml
index e0a3b1b6a..58d6f6a1f 100644
--- a/res/layout/about.xml
+++ b/res/layout/about.xml
@@ -3,31 +3,25 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
+ android:layout_margin="10dp"
android:background="@color/colorH"
android:gravity="center">
-
-
-
-
+ android:padding="10dp"
+ android:src="@drawable/linphone_orange" />
+ android:textSize="30dp" />
-
-
-
-
-
-
-
-
-
-
diff --git a/res/layout/accounts.xml b/res/layout/accounts.xml
index 554d2099a..a9d27bb05 100644
--- a/res/layout/accounts.xml
+++ b/res/layout/accounts.xml
@@ -2,30 +2,22 @@
-
-
+ android:layout_height="30dp"
+ android:gravity="center">
-
-
-
+
+
+
-
-
diff --git a/res/layout/dialer.xml b/res/layout/dialer.xml
index 2d86770ed..0e42ae587 100644
--- a/res/layout/dialer.xml
+++ b/res/layout/dialer.xml
@@ -14,12 +14,12 @@
+ android:src="@drawable/contact_add_button"
+ android:layout_alignParentBottom="true"/>
-
\ No newline at end of file
diff --git a/res/layout/edit_list.xml b/res/layout/edit_list.xml
new file mode 100644
index 000000000..08d995487
--- /dev/null
+++ b/res/layout/edit_list.xml
@@ -0,0 +1,50 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/res/layout/incall_stats.xml b/res/layout/incall_stats.xml
new file mode 100644
index 000000000..4dce83347
--- /dev/null
+++ b/res/layout/incall_stats.xml
@@ -0,0 +1,155 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/res/layout/launch_screen.xml b/res/layout/launch_screen.xml
index f946c5c53..fb691d241 100644
--- a/res/layout/launch_screen.xml
+++ b/res/layout/launch_screen.xml
@@ -12,8 +12,9 @@
+ android:layout_width="200dp"
+ android:layout_height="200dp"
+ android:layout_gravity="center"/>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ android:layout_below="@id/status">
-
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ android:layout_above="@id/footer">
-
+
+
+
+
+
+
+
+ android:orientation="horizontal">
-
+
-
+
-
+
-
+
-
-
+
+
+
+
+
+
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
-
-
-
-
-
-
-
-
+
-
+
+
-
-
-
-
-
-
-
-
+ android:orientation="vertical">
+
-
+
+ android:layout_height="match_parent"
+ android:id="@+id/side_menu_content"
+ android:layout_gravity="left">
-
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/res/layout/menu_chat_button.xml b/res/layout/menu_chat_button.xml
deleted file mode 100644
index a2254c5ed..000000000
--- a/res/layout/menu_chat_button.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/res/layout/menu_contact_button.xml b/res/layout/menu_contact_button.xml
deleted file mode 100644
index 1df5ddb39..000000000
--- a/res/layout/menu_contact_button.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/res/layout/menu_history_button.xml b/res/layout/menu_history_button.xml
deleted file mode 100644
index b9338fff6..000000000
--- a/res/layout/menu_history_button.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/res/layout/numpad.xml b/res/layout/numpad.xml
index 93f4d1342..ee9b946be 100644
--- a/res/layout/numpad.xml
+++ b/res/layout/numpad.xml
@@ -1,7 +1,7 @@
+ android:layout_width="match_parent" android:layout_height="match_parent" >
@@ -10,7 +10,7 @@
-
+
diff --git a/res/layout/side_menu_default_account.xml b/res/layout/side_menu_default_account.xml
new file mode 100644
index 000000000..14d3dce79
--- /dev/null
+++ b/res/layout/side_menu_default_account.xml
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/res/layout/side_menu_item.xml b/res/layout/side_menu_item.xml
new file mode 100644
index 000000000..8ff9cbe10
--- /dev/null
+++ b/res/layout/side_menu_item.xml
@@ -0,0 +1,9 @@
+
+
\ No newline at end of file
diff --git a/res/layout/status.xml b/res/layout/status.xml
index ce237baf1..f6bcc9450 100644
--- a/res/layout/status.xml
+++ b/res/layout/status.xml
@@ -1,263 +1,88 @@
-
-
-
-
-
-
-
-
-
-
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
+
-
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/res/values/color.xml b/res/values/color.xml
index 5a3a49cab..6486e2d39 100644
--- a/res/values/color.xml
+++ b/res/values/color.xml
@@ -13,6 +13,9 @@
#ffa645
#3eb5c0
#96c11f
+ #ffeee5
+
+
diff --git a/res/values/digit_style.xml b/res/values/digit_style.xml
index 61f6a8f6c..1fb8cd745 100644
--- a/res/values/digit_style.xml
+++ b/res/values/digit_style.xml
@@ -1,13 +1,11 @@
diff --git a/res/values/non_localizable_custom.xml b/res/values/non_localizable_custom.xml
index 0047642e9..06bd9b33b 100644
--- a/res/values/non_localizable_custom.xml
+++ b/res/values/non_localizable_custom.xml
@@ -21,10 +21,6 @@
https://www.linphone.org/wizard.php
- false
- false
- true
- false
false
false
@@ -50,7 +46,6 @@
false
true
- false
true
true
false
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 0705ddf88..13b1764ff 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -37,20 +37,22 @@
Confirm password
- Enter a number or an address
+ Enter a number or an address
-
-
+
+
- Settings
- Assistant
- About
+ Quit
+
incoming call
outgoing call
@@ -258,7 +260,6 @@
Send log
Reset log
Audio
- Exit
Prefix
Advanced
Settings
diff --git a/res/values/styles.xml b/res/values/styles.xml
index ef2a3845b..a80c6bf00 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -9,12 +9,12 @@
- @color/colorA
- true
- bold
- - 30sp
+ - 28sp
+
+
+
+
\ No newline at end of file
diff --git a/src/org/linphone/AboutFragment.java b/src/org/linphone/AboutFragment.java
index 1e9d70fd6..934f869db 100644
--- a/src/org/linphone/AboutFragment.java
+++ b/src/org/linphone/AboutFragment.java
@@ -62,10 +62,6 @@ public class AboutFragment extends Fragment implements OnClickListener {
resetLogButton.setOnClickListener(this);
resetLogButton.setVisibility(LinphonePreferences.instance().isDebugEnabled() ? View.VISIBLE : View.GONE);
- exitButton = view.findViewById(R.id.exit);
- exitButton.setOnClickListener(this);
- exitButton.setVisibility(View.VISIBLE);
-
return view;
}
@@ -88,7 +84,6 @@ public class AboutFragment extends Fragment implements OnClickListener {
if (LinphoneActivity.isInstanciated()) {
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (v == sendLogButton) {
- //LinphoneUtils.collectLogs(LinphoneActivity.instance(), getString(R.string.about_bugreport_email));
if (lc != null) {
lc.uploadLogCollection();
}
@@ -96,8 +91,6 @@ public class AboutFragment extends Fragment implements OnClickListener {
if (lc != null) {
lc.resetLogCollection();
}
- } else {
- LinphoneActivity.instance().exit();
}
}
}
diff --git a/src/org/linphone/ChatActivity.java b/src/org/linphone/ChatActivity.java
deleted file mode 100644
index a3114f654..000000000
--- a/src/org/linphone/ChatActivity.java
+++ /dev/null
@@ -1,68 +0,0 @@
-package org.linphone;
-/*
-ChatActivity.java
-Copyright (C) 2015 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.
-*/
-
-import android.app.Activity;
-import android.app.FragmentManager;
-import android.os.Bundle;
-
-/**
- * @author Margaux Clerc
- */
-public class ChatActivity extends Activity {
- private static final String CHAT_FRAGMENT = "chatFragment";
- private ChatFragment chatFragment;
- private StatusFragment status;
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.chat_activity);
-
- Bundle extras = new Bundle();
- if( getIntent().getExtras() != null) {
- extras.putString("SipUri", getIntent().getExtras().getString("SipUri"));
- extras.putString("DisplayName", getIntent().getExtras().getString("DisplayName"));
- extras.putString("PictureUri", getIntent().getExtras().getString("PictureUri"));
- extras.putString("ThumbnailUri", getIntent().getExtras().getString("ThumbnailUri"));
- }
-
- ChatFragment fragment = new ChatFragment();
- fragment.setArguments(extras);
- getFragmentManager().beginTransaction().add(R.id.fragmentContainer, fragment, "ChatFragment").commit();
-
- FragmentManager fm = getFragmentManager();
- chatFragment = (ChatFragment) fm.findFragmentByTag(CHAT_FRAGMENT);
-
- // If the Fragment is non-null, then it is currently being
- // retained across a configuration change.
- if (chatFragment == null) {
- chatFragment = new ChatFragment();
- chatFragment.setArguments(extras);
- fm.beginTransaction().add(R.id.fragmentContainer, chatFragment, CHAT_FRAGMENT).commit();
- }
-
- }
-
- public void updateStatusFragment(StatusFragment fragment) {
- status = fragment;
- }
-
-}
-
diff --git a/src/org/linphone/LinphoneActivity.java b/src/org/linphone/LinphoneActivity.java
index cd187f0c1..63bdc255d 100644
--- a/src/org/linphone/LinphoneActivity.java
+++ b/src/org/linphone/LinphoneActivity.java
@@ -22,7 +22,6 @@ import static android.content.Intent.ACTION_MAIN;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Calendar;
import java.util.Collection;
import java.util.List;
@@ -44,17 +43,15 @@ import org.linphone.core.LinphoneCore.RegistrationState;
import org.linphone.core.LinphoneCoreException;
import org.linphone.core.LinphoneCoreFactory;
import org.linphone.core.LinphoneCoreListenerBase;
+import org.linphone.core.LinphonePlayer;
import org.linphone.core.LinphoneProxyConfig;
import org.linphone.core.Reason;
import org.linphone.mediastream.Log;
import org.linphone.assistant.RemoteProvisioningLoginActivity;
import org.linphone.ui.AddressText;
-import org.linphone.ui.LedPreference;
import android.annotation.SuppressLint;
-import android.app.ActionBar;
import android.app.Activity;
-import android.app.AlertDialog;
import android.app.Dialog;
import android.app.Fragment;
import android.app.FragmentManager;
@@ -65,12 +62,11 @@ import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.res.Configuration;
import android.graphics.Bitmap;
-import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Bundle;
-import android.text.Layout;
+import android.support.v4.widget.DrawerLayout;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.LayoutInflater;
@@ -85,16 +81,12 @@ import android.view.animation.AnimationUtils;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.BaseAdapter;
-import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.RelativeLayout;
-import android.widget.TableLayout;
import android.widget.TextView;
import android.widget.Toast;
-import android.support.v4.widget.DrawerLayout;
-import android.support.v4.app.ActionBarDrawerToggle;
/**
* @author Sylvain Berfini
@@ -111,7 +103,6 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
private StatusFragment statusFragment;
private TextView missedCalls, missedChats;
- private LinearLayout menu, mark;
private RelativeLayout contacts, history, dialer, chat;
private RelativeLayout contacts_selected, history_selected, dialer_selected, chat_selected;
private FragmentsAvailable currentFragment, nextFragment;
@@ -123,12 +114,14 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
private boolean isAnimationDisabled = false, preferLinphoneContacts = false;
private OrientationEventListener mOrientationHelper;
private LinphoneCoreListenerBase mListener;
- private String[] mParams;
+
+ private DrawerLayout sideMenu;
+ private String[] sideMenuItems;
private String mTitle;
- private RelativeLayout mDrawerList, exitLayout, headerLayout;
- private DrawerLayout mDrawerLayout;
- private ActionBarDrawerToggle mDrawerToggle;
- ListView mDrawerListB;
+ private RelativeLayout sideMenuContent, quitLayout, defaultAccount;
+ private ListView accountsList, sideMenuItemList;
+ private ImageView menu;
+
static final boolean isInstanciated() {
return instance != null;
@@ -151,7 +144,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
}
if (!LinphoneManager.isInstanciated()) {
- Log.e("No service running: avoid crash by starting the launcher", this.getClass().getName());
+ Log.e("No service running: avoid crash by starting the launch", this.getClass().getName());
// super.onCreate called earlier
finish();
startActivity(getIntent().setClass(this, LinphoneLauncherActivity.class));
@@ -175,16 +168,15 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
if (getResources().getBoolean(R.bool.use_linphone_tag)) {
ContactsManager.getInstance().initializeSyncAccount(getApplicationContext(), getContentResolver());
} else {
- ContactsManager.getInstance().initializeContactManager(getApplicationContext(), getContentResolver());
+ ContactsManager.getInstance().initializeContactManager(getApplicationContext(), getContentResolver());
}
setContentView(R.layout.main);
instance = this;
fragmentsHistory = new ArrayList();
-
- createDrawer();
initButtons();
+ createSideMenu();
currentFragment = nextFragment = FragmentsAvailable.DIALER;
fragmentsHistory.add(currentFragment);
@@ -231,13 +223,13 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
displayCustomToast(getString(R.string.error_io_error), Toast.LENGTH_LONG);
}
}
-
- //initAccounts();
+ initAccounts();
}
@Override
public void callState(LinphoneCore lc, LinphoneCall call, LinphoneCall.State state, String message) {
if (state == State.IncomingReceived) {
+ //finish();
startActivity(new Intent(LinphoneActivity.instance(), IncomingCallActivity.class));
} else if (state == State.OutgoingInit || state == State.OutgoingProgress) {
startActivity(new Intent(LinphoneActivity.instance(), OutgoingCallActivity.class));
@@ -290,212 +282,6 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
updateAnimationsState();
}
- public void createDrawer() {
- mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
- mParams = getResources().getStringArray(R.array.menu_entry);
- mDrawerList = (RelativeLayout) findViewById(R.id.left_drawer);
- mDrawerListB = (ListView) findViewById(R.id.list_drawer);
- List dataList = new ArrayList();
- mDrawerListB.setAdapter(new ArrayAdapter(this,R.layout.drawer_list_item, mParams));
- mDrawerListB.setOnItemClickListener(new DrawerItemClickListener());
-
- initAccounts();
-
- ImageView menubar = (ImageView) findViewById(R.id.menu_icon);
- menubar.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View view) {
- if(mDrawerLayout.isDrawerVisible(Gravity.LEFT)){
- mDrawerLayout.closeDrawer(mDrawerList);
- } else {
- mDrawerLayout.openDrawer(mDrawerList);
- }
- }
- });
-
- exitLayout = (RelativeLayout) findViewById(R.id.exitLayout);
- exitLayout.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View view) {
- exit();
- }
- });
-
-
-
- }
-
- public void initAccounts() {
- ListView accounts = (ListView) findViewById(R.id.accounts_list);
- //accounts.setVisibility(View.VISIBLE);
-
- accounts.setAdapter(new AccountsListAdapter());
- accounts.setOnItemClickListener(new AdapterView.OnItemClickListener() {
- @Override
- public void onItemClick(AdapterView> adapterView, View view, int i, long l) {
- Log.w("Tag " + i);
- int position = (int) view.getTag();
- displayAccountSettings(position);
- mDrawerLayout.closeDrawer(mDrawerList);
- }
- });
-
- }
-
- private int getStatusIconResource(LinphoneCore.RegistrationState state, boolean isDefaultAccount) {
- try {
- LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
- boolean defaultAccountConnected = (isDefaultAccount && lc != null && lc.getDefaultProxyConfig() != null && lc.getDefaultProxyConfig().isRegistered()) || !isDefaultAccount;
- if (state == RegistrationState.RegistrationOk && defaultAccountConnected) {
- return R.drawable.led_connected;
- } else if (state == RegistrationState.RegistrationProgress) {
- return R.drawable.led_inprogress;
- } else if (state == RegistrationState.RegistrationFailed) {
- return R.drawable.led_error;
- } else {
- return R.drawable.led_disconnected;
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- return R.drawable.led_disconnected;
- }
-
- class AccountsListAdapter extends BaseAdapter {
- List proxy_list;
-
- AccountsListAdapter() {
- proxy_list = new ArrayList();
- refresh();
-
- }
-
- public void refresh(){
- proxy_list = new ArrayList();
-
- proxy_list.add(LinphoneManager.getLc().getDefaultProxyConfig());
- for(LinphoneProxyConfig proxyConfig : LinphoneManager.getLc().getProxyConfigList()){
- if(proxyConfig != LinphoneManager.getLc().getDefaultProxyConfig()){
- proxy_list.add(proxyConfig);
- }
- }
- }
-
- public int getCount() {
- LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
- if (proxy_list != null) {
- return proxy_list.size();
- } else {
- return 0;
- }
- }
-
- public Object getItem(int position) {
- return proxy_list.get(position);
- }
-
- public long getItemId(int position) {
- return position;
- }
-
- public View getView(final int position, View convertView, ViewGroup parent) {
- refresh();
- boolean isDefaultAccount = false;
- View view = null;
- Log.w(position);
- LinphoneProxyConfig lpc = (LinphoneProxyConfig) getItem(position);
- //if (convertView != null) {
- // view = convertView;
- //} else {
- if(lpc == LinphoneManager.getLc().getDefaultProxyConfig()) {
- isDefaultAccount = true;
- view = getLayoutInflater().inflate(R.layout.main_account, parent, false);
- Log.w("Default account");
-
- } else {
- view = getLayoutInflater().inflate(R.layout.accounts, parent, false);
- }
- //}
-
- ImageView status = (ImageView) view.findViewById(R.id.statusLed);
-
- TextView address = (TextView) view.findViewById(R.id.address);
- String sipAddress = (lpc.getIdentity() != null && lpc.getIdentity().startsWith("sip:")) ? lpc.getIdentity().split("sip:")[1] : lpc.getIdentity();
- //identity.setText(sipAddress);
-
- try {
- LinphoneAddress identity = LinphoneCoreFactory.instance().createLinphoneAddress(lpc.getIdentity());
- address.setText(identity.asStringUriOnly());
- if(isDefaultAccount) {
- TextView displayName = (TextView) findViewById(R.id.display_name);
- if (identity.getDisplayName() != null)
- displayName.setText(identity.getDisplayName());
- else
- displayName.setText(identity.getUserName());
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- int nbAccounts = LinphonePreferences.instance().getAccountCount();
- int accountIndex = 0;
-
- for (int i = 0; i < nbAccounts; i++) {
- String username = LinphonePreferences.instance().getAccountUsername(i);
- String domain = LinphonePreferences.instance().getAccountDomain(i);
- String id = username + "@" + domain;
- if (id.equals(address)) {
- accountIndex = i;
- view.setTag(accountIndex);
-
- break;
- }
- }
-
- status.setImageResource(getStatusIconResource(lpc.getState(),isDefaultAccount));
-
- view.setTag(accountIndex);
-
- return view;
- }
- }
-
- private class DrawerItemClickListener implements ListView.OnItemClickListener {
- @Override
- public void onItemClick(AdapterView> parent, View view, int position, long id) {
- selectItem(view,position);
- }
- }
-
- private void selectItem(View view,int position) {
-
- Log.w(mDrawerListB.getAdapter().getItem(position).toString());
- mDrawerListB.setItemChecked(position, true);
-
- if(mDrawerListB.getAdapter().getItem(position).toString().equals("Settings")){
- displaySettings();
- }
- if(mDrawerListB.getAdapter().getItem(position).toString().equals("About")){
- displayAbout();
- }
-
- if(mDrawerListB.getAdapter().getItem(position).toString().equals("Assistant")){
- displayAssistant();
- }
- mDrawerLayout.closeDrawer(mDrawerList);
- }
-
- @Override
- public void setTitle(CharSequence title) {
- mTitle = (String) title;
- //getActionBar().setTitle(mTitle);
- }
-
- /**
- * When using the ActionBarDrawerToggle, you must call it during
- * onPostCreate() and onConfigurationChanged()...
- */
@Override
protected void onPostCreate(Bundle savedInstanceState) {
@@ -513,8 +299,6 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
private void initButtons() {
- menu = (LinearLayout) findViewById(R.id.menu);
-
history = (RelativeLayout) findViewById(R.id.history);
history.setOnClickListener(this);
contacts = (RelativeLayout) findViewById(R.id.contacts);
@@ -863,11 +647,13 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
return;
}
+ Log.w("Display chat sipuri" + sipUri);
+
if(sipUri == null) {
- Intent intent = new Intent(this, ChatActivity.class);
- startOrientationSensor();
- startActivityForResult(intent, CHAT_ACTIVITY);
+ Bundle extras = new Bundle();
+ changeCurrentFragment(FragmentsAvailable.CHAT, extras);
} else {
+ Log.w("Display chat");
LinphoneAddress lAddress;
try {
lAddress = LinphoneCoreFactory.instance().createLinphoneAddress(sipUri);
@@ -885,38 +671,38 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
thumbnailUri = contact.getThumbnailUri().toString();
}
-
- if (currentFragment == FragmentsAvailable.CHATLIST || currentFragment == FragmentsAvailable.CHAT){
- if (isTablet()){
- Fragment fragment2 = getFragmentManager().findFragmentById(R.id.fragmentContainer2);
- if (fragment2 != null && fragment2.isVisible() && currentFragment == FragmentsAvailable.CHAT) {
- ChatFragment chatFragment = (ChatFragment) fragment2;
- chatFragment.changeDisplayedChat(sipUri, displayName, pictureUri);
- } else {
- Bundle extras = new Bundle();
- extras.putString("SipUri", sipUri);
- if (contact != null) {
- extras.putString("DisplayName", displayName);
- extras.putString("PictureUri", pictureUri);
- extras.putString("ThumbnailUri", thumbnailUri);
- }
- changeCurrentFragment(FragmentsAvailable.CHAT, extras);
- }
+ if (currentFragment == FragmentsAvailable.CHATLIST || currentFragment == FragmentsAvailable.CHAT) {
+ Fragment fragment2 = getFragmentManager().findFragmentById(R.id.fragmentContainer2);
+ if (fragment2 != null && fragment2.isVisible() && currentFragment == FragmentsAvailable.CHAT) {
+ ChatFragment chatFragment = (ChatFragment) fragment2;
+ chatFragment.changeDisplayedChat(sipUri, displayName, pictureUri);
} else {
Bundle extras = new Bundle();
extras.putString("SipUri", sipUri);
if (lAddress.getDisplayName() != null) {
- extras.putString("DisplayName", contact.getName());
+ extras.putString("DisplayName", displayName);
extras.putString("PictureUri", pictureUri);
extras.putString("ThumbnailUri", thumbnailUri);
}
changeCurrentFragment(FragmentsAvailable.CHAT, extras);
}
- if (messageListFragment != null && messageListFragment.isVisible()) {
- ((ChatListFragment) messageListFragment).refresh();
+ } else {
+ Bundle extras = new Bundle();
+ extras.putString("SipUri", sipUri);
+ if (lAddress.getDisplayName() != null) {
+ extras.putString("DisplayName", displayName);
+ extras.putString("PictureUri", pictureUri);
+ extras.putString("ThumbnailUri", thumbnailUri);
}
+ changeCurrentFragment(FragmentsAvailable.CHAT, extras);
}
+
+ if (messageListFragment != null && messageListFragment.isVisible()) {
+ ((ChatListFragment) messageListFragment).refresh();
+ }
+
+
LinphoneService.instance().resetMessageNotifCount();
LinphoneService.instance().removeMessageNotification();
displayMissedChats(getChatStorage().getUnreadMessageCount());
@@ -999,11 +785,6 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
messageListFragment = fragment;
}
- public void hideMenu(boolean hide) {
- menu.setVisibility(hide ? View.GONE : View.VISIBLE);
- mark.setVisibility(hide ? View.GONE : View.VISIBLE);
- }
-
public void updateStatusFragment(StatusFragment fragment) {
statusFragment = fragment;
}
@@ -1094,11 +875,6 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
private void displayMissedChats(final int missedChatCount) {
if (missedChatCount > 0) {
missedChats.setText(missedChatCount + "");
- if (missedChatCount > 99) {
- missedChats.setTextSize(12);
- } else {
- missedChats.setTextSize(20);
- }
missedChats.setVisibility(View.VISIBLE);
if (!isAnimationDisabled) {
missedChats.startAnimation(AnimationUtils.loadAnimation(LinphoneActivity.this, R.anim.bounce));
@@ -1311,7 +1087,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
}
}
- public void exit() {
+ public void quit() {
finish();
stopService(new Intent(ACTION_MAIN).setClass(this, LinphoneService.class));
}
@@ -1320,7 +1096,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == Activity.RESULT_FIRST_USER && requestCode == SETTINGS_ACTIVITY) {
if (data.getExtras().getBoolean("Exit", false)) {
- exit();
+ quit();
} else {
FragmentsAvailable newFragment = (FragmentsAvailable) data.getExtras().getSerializable("FragmentToDisplay");
changeCurrentFragment(newFragment, null, true);
@@ -1498,6 +1274,206 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
}*/
return super.onKeyDown(keyCode, event);
}
+
+ //SIDE MENU
+
+ public void openOrCloseSideMenu(boolean open) {
+ if(open) {
+ sideMenu.openDrawer(sideMenuContent);
+ } else {
+ sideMenu.closeDrawer(sideMenuContent);
+ }
+ }
+
+ public void createSideMenu() {
+ sideMenu = (DrawerLayout) findViewById(R.id.side_menu);
+ sideMenuItems = getResources().getStringArray(R.array.side_menu_item);
+ sideMenuContent = (RelativeLayout) findViewById(R.id.side_menu_content);
+ sideMenuItemList = (ListView)findViewById(R.id.item_list);
+ menu = (ImageView) findViewById(R.id.side_menu_button);
+
+ sideMenuItemList.setAdapter(new ArrayAdapter(this, R.layout.side_menu_item, sideMenuItems));
+ sideMenuItemList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
+ @Override
+ public void onItemClick(AdapterView> adapterView, View view, int i, long l) {
+ if(sideMenuItemList.getAdapter().getItem(i).toString().equals("Settings")){
+ LinphoneActivity.instance().displaySettings();
+ }
+ if(sideMenuItemList.getAdapter().getItem(i).toString().equals("About")){
+ LinphoneActivity.instance().displayAbout();
+ }
+ if(sideMenuItemList.getAdapter().getItem(i).toString().equals("Assistant")){
+ LinphoneActivity.instance().displayAssistant();
+ }
+ openOrCloseSideMenu(false);
+ }
+ });
+
+ initAccounts();
+
+ menu.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ if(sideMenu.isDrawerVisible(Gravity.LEFT)){
+ sideMenu.closeDrawer(sideMenuContent);
+ } else {
+ sideMenu.openDrawer(sideMenuContent);
+ }
+ }
+ });
+
+ quitLayout = (RelativeLayout) findViewById(R.id.side_menu_quit);
+ quitLayout.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ LinphoneActivity.instance().quit();
+ }
+ });
+ }
+
+ private void initAccounts() {
+ accountsList = (ListView) findViewById(R.id.accounts_list);
+ defaultAccount = (RelativeLayout) findViewById(R.id.default_account);
+
+ if (LinphoneManager.getLc().getDefaultProxyConfig() != null) {
+ defaultAccount.setVisibility(View.VISIBLE);
+ ImageView status = (ImageView)findViewById(R.id.status_led);
+ TextView address = (TextView) findViewById(R.id.address);
+ TextView displayName = (TextView) findViewById(R.id.display_name);
+
+ try {
+ LinphoneAddress identity = LinphoneCoreFactory.instance().createLinphoneAddress((LinphoneManager.getLc().getDefaultProxyConfig().getIdentity()));
+ address.setText(identity.asStringUriOnly());
+ if (identity.getDisplayName() != null) {
+ displayName.setText(identity.getDisplayName());
+ } else if (identity.getUserName() != null) {
+ displayName.setText(identity.getUserName());
+ } else {
+ displayName.setText("");
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ status.setImageResource(getStatusIconResource(LinphoneManager.getLc().getDefaultProxyConfig().getState()));
+
+ defaultAccount.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ LinphoneActivity.instance().displayAccountSettings(LinphonePreferences.instance().getDefaultAccountIndex());
+ openOrCloseSideMenu(false);
+ }
+ });
+
+ } else {
+ defaultAccount.setVisibility(View.GONE);
+ }
+
+ if(LinphoneManager.getLc().getProxyConfigList().length > 1) {
+ accountsList.setVisibility(View.VISIBLE);
+ accountsList.setAdapter(new AccountsListAdapter());
+ accountsList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
+ @Override
+ public void onItemClick(AdapterView> adapterView, View view, int i, long l) {
+ int position = Integer.parseInt(view.getTag().toString());
+ LinphoneActivity.instance().displayAccountSettings(position);
+ openOrCloseSideMenu(false);
+ }
+ });
+ } else {
+ accountsList.setVisibility(View.GONE);
+ }
+ }
+
+ private int getStatusIconResource(LinphoneCore.RegistrationState state) {
+ try {
+ LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
+ if (state == RegistrationState.RegistrationOk) {
+ return R.drawable.led_connected;
+ } else if (state == RegistrationState.RegistrationProgress) {
+ return R.drawable.led_inprogress;
+ } else if (state == RegistrationState.RegistrationFailed) {
+ return R.drawable.led_error;
+ } else {
+ return R.drawable.led_disconnected;
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ return R.drawable.led_disconnected;
+ }
+
+ class AccountsListAdapter extends BaseAdapter {
+ List proxy_list;
+
+ AccountsListAdapter() {
+ proxy_list = new ArrayList();
+ refresh();
+ }
+
+ public void refresh(){
+ proxy_list = new ArrayList();
+ for(LinphoneProxyConfig proxyConfig : LinphoneManager.getLc().getProxyConfigList()){
+ if(proxyConfig != LinphoneManager.getLc().getDefaultProxyConfig()){
+ proxy_list.add(proxyConfig);
+ }
+ }
+ }
+
+ public int getCount() {
+ if (proxy_list != null) {
+ return proxy_list.size();
+ } else {
+ return 0;
+ }
+ }
+
+ public Object getItem(int position) {
+ return proxy_list.get(position);
+ }
+
+ public long getItemId(int position) {
+ return position;
+ }
+
+ public View getView(final int position, View convertView, ViewGroup parent) {
+ View view = null;
+ LinphoneProxyConfig lpc = (LinphoneProxyConfig) getItem(position);
+ if (convertView != null) {
+ view = convertView;
+ } else {
+ view = getLayoutInflater().inflate(R.layout.accounts, parent, false);
+ }
+
+ ImageView status = (ImageView) view.findViewById(R.id.statusLed);
+ TextView address = (TextView) view.findViewById(R.id.address);
+ String sipAddress = (lpc.getIdentity() != null && lpc.getIdentity().startsWith("sip:")) ? lpc.getIdentity().split("sip:")[1] : lpc.getIdentity();
+
+ try {
+ LinphoneAddress identity = LinphoneCoreFactory.instance().createLinphoneAddress(lpc.getIdentity());
+ address.setText(identity.asStringUriOnly());
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ int nbAccounts = LinphonePreferences.instance().getAccountCount();
+ int accountIndex = 0;
+
+ for (int i = 0; i < nbAccounts; i++) {
+ String username = LinphonePreferences.instance().getAccountUsername(i);
+ String domain = LinphonePreferences.instance().getAccountDomain(i);
+ String id = username + "@" + domain;
+ if (id.equals(sipAddress)) {
+ accountIndex = i;
+ view.setTag(accountIndex);
+ break;
+ }
+ }
+ status.setImageResource(getStatusIconResource(lpc.getState()));
+ return view;
+ }
+ }
}
interface ContactPicked {
diff --git a/src/org/linphone/LinphoneService.java b/src/org/linphone/LinphoneService.java
index 5c829cec3..088dc80df 100644
--- a/src/org/linphone/LinphoneService.java
+++ b/src/org/linphone/LinphoneService.java
@@ -297,7 +297,7 @@ public final class LinphoneService extends Service {
notificationTextId = R.string.incall_notif_paused;
break;
case VIDEO:
- inconId = R.drawable.conf_video;
+ inconId = R.drawable.topbar_videocall_notification;
notificationTextId = R.string.incall_notif_video;
break;
default:
@@ -405,10 +405,10 @@ public final class LinphoneService extends Service {
try {
bm = MediaStore.Images.Media.getBitmap(getContentResolver(), pictureUri);
} catch (Exception e) {
- bm = BitmapFactory.decodeResource(getResources(), R.drawable.unknown_small);
+ bm = BitmapFactory.decodeResource(getResources(), R.drawable.avatar);
}
} else {
- bm = BitmapFactory.decodeResource(getResources(), R.drawable.unknown_small);
+ bm = BitmapFactory.decodeResource(getResources(), R.drawable.avatar);
}
mMsgNotif = Compatibility.createMessageNotification(getApplicationContext(), mMsgNotifCount, fromName, message, bm, notifContentIntent);
diff --git a/src/org/linphone/assistant/AssistantActivity.java b/src/org/linphone/assistant/AssistantActivity.java
index 84cf1ad6b..bf8b69516 100644
--- a/src/org/linphone/assistant/AssistantActivity.java
+++ b/src/org/linphone/assistant/AssistantActivity.java
@@ -138,7 +138,7 @@ public class AssistantActivity extends Activity implements OnClickListener {
back.setOnClickListener(this);
cancel = (ImageView) findViewById(R.id.cancel);
cancel.setOnClickListener(this);
- status.enableLeftMenu(false);
+ status.enableSideMenu(false);
}
private void changeFragment(Fragment newFragment) {
diff --git a/src/org/linphone/assistant/RemoteProvisioningFragment.java b/src/org/linphone/assistant/RemoteProvisioningFragment.java
index 6fd08962e..eb257431c 100644
--- a/src/org/linphone/assistant/RemoteProvisioningFragment.java
+++ b/src/org/linphone/assistant/RemoteProvisioningFragment.java
@@ -62,7 +62,7 @@ public class RemoteProvisioningFragment extends Fragment implements OnClickListe
Intent intent = new Intent();
intent.setClass(getActivity(), LinphoneLauncherActivity.class);
getActivity().finish();
- LinphoneActivity.instance().exit();
+ LinphoneActivity.instance().quit();
startActivity(intent);
}
}
diff --git a/src/org/linphone/ui/AddressText.java b/src/org/linphone/ui/AddressText.java
index 3b6677578..6b754ba91 100644
--- a/src/org/linphone/ui/AddressText.java
+++ b/src/org/linphone/ui/AddressText.java
@@ -73,7 +73,7 @@ public class AddressText extends EditText implements AddressType {
}
private String getHintText() {
- String resizedText = getContext().getString(R.string.addressHint);
+ String resizedText = getContext().getString(R.string.address_bar_hint);
if (getHint() != null) {
resizedText = getHint().toString();
}