Add topbar in settings and about menu

add option for portrait orientation only
This commit is contained in:
Margaux Clerc 2015-11-17 10:15:06 +01:00
parent 9b8b32d06f
commit 756a183436
12 changed files with 100 additions and 118 deletions

2
.gitmodules vendored
View file

@ -90,4 +90,4 @@
ignore = dirty ignore = dirty
[submodule "submodules/mscodec2"] [submodule "submodules/mscodec2"]
path = submodules/mscodec2 path = submodules/mscodec2
url = git://git.linphone.org/mscodec2.git url = git://git.linphone.org/mscodec2.git

View file

@ -2,8 +2,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.linphone" package="org.linphone"
android:versionCode="2510" android:installLocation="auto"> android:versionCode="2599" android:installLocation="auto">
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="23"/> <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="23"/>
<!-- Permissions for Push Notification --> <!-- Permissions for Push Notification -->
<permission android:name="org.linphone.permission.C2D_MESSAGE" android:protectionLevel="signature" /> <!-- Change package ! --> <permission android:name="org.linphone.permission.C2D_MESSAGE" android:protectionLevel="signature" /> <!-- Change package ! -->

View file

@ -5,32 +5,6 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"> android:orientation="vertical">
<RelativeLayout
android:id="@+id/top_bar"
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"

View file

@ -22,11 +22,40 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<RelativeLayout
android:id="@+id/top_bar"
android:background="@color/colorF"
android:layout_width="match_parent"
android:layout_height="60dp"
android:visibility="gone"
android:layout_alignParentTop="true">
<TextView
android:id="@+id/menu_name"
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="15dp"
android:layout_centerInParent="true"
android:layout_alignParentRight="true"/>
</RelativeLayout>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical" android:orientation="vertical"
android:layout_above="@id/footer"> android:layout_above="@id/footer"
android:layout_below="@id/top_bar">
<FrameLayout <FrameLayout
android:layout_width="match_parent" android:layout_width="match_parent"

View file

@ -1,9 +1,6 @@
[net] [net]
mtu=1300 mtu=1300
[app]
animations=0
[sip] [sip]
guess_hostname=1 guess_hostname=1
inc_timeout=15 inc_timeout=15

View file

@ -6,6 +6,9 @@
<string name="default_domain">sip.linphone.org</string> <string name="default_domain">sip.linphone.org</string>
<string name="default_stun">stun.linphone.org</string> <string name="default_stun">stun.linphone.org</string>
<bool name="use_linphone_friend">false</bool> <bool name="use_linphone_friend">false</bool>
<bool name="orientation_portrait_only">false</bool>
<bool name="show_statusbar_only_on_dialer">false</bool>
<string name="wizard_url">https://www.linphone.org/wizard.php</string> <string name="wizard_url">https://www.linphone.org/wizard.php</string>

View file

@ -20,6 +20,9 @@
<string name="deny">Deny</string> <string name="deny">Deny</string>
<string name="no_account">No account configured</string> <string name="no_account">No account configured</string>
<string name="search">Search</string> <string name="search">Search</string>
<string name="outgoing">outgoing</string>
<string name="incoming">incoming</string>
<string name="missed">missed</string>
<!-- splashscreen --> <!-- splashscreen -->
<string name="app_description">free SIP VOIP client</string> <string name="app_description">free SIP VOIP client</string>

View file

@ -37,7 +37,6 @@ import android.widget.TextView;
public class AboutFragment extends Fragment implements OnClickListener { public class AboutFragment extends Fragment implements OnClickListener {
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) {
@ -50,9 +49,6 @@ 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(org.linphone.LinphonePreferences.instance().isDebugEnabled() ? View.VISIBLE : View.GONE); sendLogButton.setVisibility(org.linphone.LinphonePreferences.instance().isDebugEnabled() ? View.VISIBLE : View.GONE);
@ -70,9 +66,9 @@ public class AboutFragment extends Fragment implements OnClickListener {
if (org.linphone.LinphoneActivity.isInstanciated()) { if (org.linphone.LinphoneActivity.isInstanciated()) {
LinphoneActivity.instance().hideTabBar(true); LinphoneActivity.instance().hideTabBar(true);
LinphoneActivity.instance().displayTopBar(true,"About");
} }
} }
@Override @Override
public void onClick(View v) { public void onClick(View v) {
@ -86,8 +82,6 @@ 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

@ -240,7 +240,7 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
} }
if (LinphoneActivity.isInstanciated()) { if (LinphoneActivity.isInstanciated()) {
LinphoneActivity.instance().selectMenu(FragmentsAvailable.CHATLIST); LinphoneActivity.instance().selectMenu(FragmentsAvailable.CHAT_LIST);
LinphoneActivity.instance().updateChatListFragment(this); LinphoneActivity.instance().updateChatListFragment(this);
LinphoneActivity.instance().hideTabBar(false); LinphoneActivity.instance().hideTabBar(false);
} }

View file

@ -31,7 +31,7 @@ public enum FragmentsAvailable {
ABOUT, ABOUT,
ACCOUNT_SETTINGS, ACCOUNT_SETTINGS,
SETTINGS, SETTINGS,
CHATLIST, CHAT_LIST,
CHAT; CHAT;
public boolean shouldAnimate() { public boolean shouldAnimate() {
@ -58,18 +58,18 @@ public enum FragmentsAvailable {
case DIALER: case DIALER:
return CONTACT_EDITOR.isRightOf(fragment) || fragment == CONTACT_EDITOR; return CONTACT_EDITOR.isRightOf(fragment) || fragment == CONTACT_EDITOR;
case CHATLIST: case CHAT_LIST:
return DIALER.isRightOf(fragment) || fragment == DIALER; return DIALER.isRightOf(fragment) || fragment == DIALER;
case SETTINGS: case SETTINGS:
return CHATLIST.isRightOf(fragment) || fragment == CHATLIST; return CHAT_LIST.isRightOf(fragment) || fragment == CHAT_LIST;
case ABOUT: case ABOUT:
case ACCOUNT_SETTINGS: case ACCOUNT_SETTINGS:
return SETTINGS.isRightOf(fragment) || fragment == SETTINGS; return SETTINGS.isRightOf(fragment) || fragment == SETTINGS;
case CHAT: case CHAT:
return CHATLIST.isRightOf(fragment) || fragment == CHATLIST; return CHAT_LIST.isRightOf(fragment) || fragment == CHAT_LIST;
default: default:
return false; return false;
@ -88,7 +88,7 @@ public enum FragmentsAvailable {
return fragment == CONTACT_DETAIL || fragment == CONTACTS_LIST; return fragment == CONTACT_DETAIL || fragment == CONTACTS_LIST;
case CHAT: case CHAT:
return fragment == CHATLIST; return fragment == CHAT_LIST;
default: default:
return false; return false;

View file

@ -98,11 +98,11 @@ public class HistoryDetailFragment extends Fragment implements OnClickListener {
contactAddress.setText(sipUri); contactAddress.setText(sipUri);
} }
if (status.equals("Missed")) { if (status.equals(getResources().getString(R.string.missed))) {
callDirection.setImageResource(R.drawable.call_missed); callDirection.setImageResource(R.drawable.call_missed);
} else if (status.equals("Incoming")) { } else if (status.equals(getResources().getString(R.string.incoming))) {
callDirection.setImageResource(R.drawable.call_incoming); callDirection.setImageResource(R.drawable.call_incoming);
} else if (status.equals("Outgoing")) { } else if (status.equals(getResources().getString(R.string.outgoing))) {
callDirection.setImageResource(R.drawable.call_outgoing); callDirection.setImageResource(R.drawable.call_outgoing);
} }

View file

@ -57,7 +57,6 @@ import android.app.FragmentTransaction;
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;
import android.content.res.Configuration;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
@ -101,9 +100,11 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
private TextView missedCalls, missedChats; private TextView missedCalls, missedChats;
private RelativeLayout contacts, history, dialer, chat; private RelativeLayout contacts, history, dialer, chat;
private RelativeLayout contacts_selected, history_selected, dialer_selected, chat_selected; private RelativeLayout contacts_selected, history_selected, dialer_selected, chat_selected;
private RelativeLayout mTopBar;
private ImageView cancel;
private FragmentsAvailable currentFragment, nextFragment; private FragmentsAvailable currentFragment, nextFragment;
private List<FragmentsAvailable> fragmentsHistory; private List<FragmentsAvailable> fragmentsHistory;
private Fragment dialerFragment, messageListFragment, friendStatusListenerFragment; private Fragment dialerFragment, messageListFragment;
private ChatFragment chatFragment; private ChatFragment chatFragment;
private Fragment.SavedState dialerSavedState; private Fragment.SavedState dialerSavedState;
private boolean newProxyConfig; private boolean newProxyConfig;
@ -118,7 +119,6 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
private ListView accountsList, sideMenuItemList; private ListView accountsList, sideMenuItemList;
private ImageView menu; private ImageView menu;
static final boolean isInstanciated() { static final boolean isInstanciated() {
return instance != null; return instance != null;
} }
@ -135,13 +135,12 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
if (isTablet() && getRequestedOrientation() != ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) { if (isTablet() && getRequestedOrientation() != ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
} else if (!isTablet() && getRequestedOrientation() != ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) { } else if (!isTablet() && getResources().getBoolean(R.bool.orientation_portrait_only)) {
//setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
} }
if (!LinphoneManager.isInstanciated()) { if (!LinphoneManager.isInstanciated()) {
Log.e("No service running: avoid crash by starting the launch", this.getClass().getName()); Log.e("No service running: avoid crash by starting the launch", this.getClass().getName());
// super.onCreate called earlier
finish(); finish();
startActivity(getIntent().setClass(this, LinphoneLauncherActivity.class)); startActivity(getIntent().setClass(this, LinphoneLauncherActivity.class));
return; return;
@ -161,6 +160,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
} }
} }
//TODO rework
if (getResources().getBoolean(R.bool.use_linphone_tag)) { if (getResources().getBoolean(R.bool.use_linphone_tag)) {
ContactsManager.getInstance().initializeSyncAccount(getApplicationContext(), getContentResolver()); ContactsManager.getInstance().initializeSyncAccount(getApplicationContext(), getContentResolver());
} else { } else {
@ -172,7 +172,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
fragmentsHistory = new ArrayList<FragmentsAvailable>(); fragmentsHistory = new ArrayList<FragmentsAvailable>();
initButtons(); initButtons();
createSideMenu(); initSideMenu();
currentFragment = nextFragment = FragmentsAvailable.DIALER; currentFragment = nextFragment = FragmentsAvailable.DIALER;
fragmentsHistory.add(currentFragment); fragmentsHistory.add(currentFragment);
@ -226,7 +226,6 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
@Override @Override
public void callState(LinphoneCore lc, LinphoneCall call, LinphoneCall.State state, String message) { public void callState(LinphoneCore lc, LinphoneCall call, LinphoneCall.State state, String message) {
if (state == State.IncomingReceived) { if (state == State.IncomingReceived) {
//finish();
startActivity(new Intent(LinphoneActivity.instance(), CallIncomingActivity.class)); startActivity(new Intent(LinphoneActivity.instance(), CallIncomingActivity.class));
} else if (state == State.OutgoingInit || state == State.OutgoingProgress) { } else if (state == State.OutgoingInit || state == State.OutgoingProgress) {
startActivity(new Intent(LinphoneActivity.instance(), CallOutgoingActivity.class)); startActivity(new Intent(LinphoneActivity.instance(), CallOutgoingActivity.class));
@ -279,24 +278,12 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
updateAnimationsState(); updateAnimationsState();
} }
@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
// Sync the toggle state after onRestoreInstanceState has occurred.
//mDrawerToggle.syncState();
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
// Pass any configuration change to the drawer toggls
//mDrawerToggle.onConfigurationChanged(newConfig);
}
private void initButtons() { private void initButtons() {
mTabBar = (LinearLayout) findViewById(R.id.footer); mTabBar = (LinearLayout) findViewById(R.id.footer);
mTopBar = (RelativeLayout) findViewById(R.id.top_bar);
cancel = (ImageView) findViewById(R.id.cancel);
cancel.setOnClickListener(this);
history = (RelativeLayout) findViewById(R.id.history); history = (RelativeLayout) findViewById(R.id.history);
history.setOnClickListener(this); history.setOnClickListener(this);
@ -335,12 +322,9 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
} }
if (statusFragment != null && !statusFragment.isVisible()) { if (statusFragment != null && !statusFragment.isVisible()) {
// Hack to ensure statusFragment is visible after coming back to
// 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);
} }
public void isNewProxyConfig(){ public void isNewProxyConfig(){
@ -375,7 +359,6 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
break; break;
case CONTACTS_LIST: case CONTACTS_LIST:
newFragment = new ContactsListFragment(); newFragment = new ContactsListFragment();
friendStatusListenerFragment = newFragment;
break; break;
case CONTACT_DETAIL: case CONTACT_DETAIL:
newFragment = new ContactDetailsFragment(); newFragment = new ContactDetailsFragment();
@ -399,7 +382,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
case ABOUT: case ABOUT:
newFragment = new AboutFragment(); newFragment = new AboutFragment();
break; break;
case CHATLIST: case CHAT_LIST:
newFragment = new ChatListFragment(); newFragment = new ChatListFragment();
messageListFragment = newFragment; messageListFragment = newFragment;
break; break;
@ -429,11 +412,6 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
} }
private void changeFragment(Fragment newFragment, FragmentsAvailable newFragmentType, boolean withoutAnimation) { private void changeFragment(Fragment newFragment, FragmentsAvailable newFragmentType, boolean withoutAnimation) {
/*if (statusFragment != null) {
statusFragment.closeStatusBar();
}*/
FragmentTransaction transaction = getFragmentManager().beginTransaction(); FragmentTransaction transaction = getFragmentManager().beginTransaction();
if (!withoutAnimation && !isAnimationDisabled && currentFragment.shouldAnimate()) { if (!withoutAnimation && !isAnimationDisabled && currentFragment.shouldAnimate()) {
@ -452,7 +430,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
if (newFragmentType != FragmentsAvailable.DIALER if (newFragmentType != FragmentsAvailable.DIALER
|| newFragmentType != FragmentsAvailable.CONTACTS_LIST || newFragmentType != FragmentsAvailable.CONTACTS_LIST
|| newFragmentType != FragmentsAvailable.CHATLIST || newFragmentType != FragmentsAvailable.CHAT_LIST
|| newFragmentType != FragmentsAvailable.HISTORY_LIST) { || newFragmentType != FragmentsAvailable.HISTORY_LIST) {
transaction.addToBackStack(newFragmentType.toString()); transaction.addToBackStack(newFragmentType.toString());
} }
@ -464,16 +442,13 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
} }
private void changeFragmentForTablets(Fragment newFragment, FragmentsAvailable newFragmentType, boolean withoutAnimation) { private void changeFragmentForTablets(Fragment newFragment, FragmentsAvailable newFragmentType, boolean withoutAnimation) {
// if (getResources().getBoolean(R.bool.show_statusbar_only_on_dialer)) { if (getResources().getBoolean(R.bool.show_statusbar_only_on_dialer)) {
// if (newFragmentType == FragmentsAvailable.DIALER) { if (newFragmentType == FragmentsAvailable.DIALER) {
// showStatusBar(); showStatusBar();
// } else { } else {
// hideStatusBar(); hideStatusBar();
// } }
// } }
/*if (statusFragment != null) {
statusFragment.closeStatusBar();
}*/
LinearLayout ll = (LinearLayout) findViewById(R.id.fragmentContainer2); LinearLayout ll = (LinearLayout) findViewById(R.id.fragmentContainer2);
@ -500,7 +475,6 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
transaction.setCustomAnimations(R.anim.slide_in_left_to_right, R.anim.slide_out_left_to_right, R.anim.slide_in_right_to_left, R.anim.slide_out_right_to_left); transaction.setCustomAnimations(R.anim.slide_in_left_to_right, R.anim.slide_out_left_to_right, R.anim.slide_in_right_to_left, R.anim.slide_out_right_to_left);
} }
} }
transaction.replace(R.id.fragmentContainer, newFragment); transaction.replace(R.id.fragmentContainer, newFragment);
} }
transaction.commitAllowingStateLoss(); transaction.commitAllowingStateLoss();
@ -510,7 +484,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
if (newFragmentType == FragmentsAvailable.DIALER if (newFragmentType == FragmentsAvailable.DIALER
|| newFragmentType == FragmentsAvailable.SETTINGS || newFragmentType == FragmentsAvailable.SETTINGS
|| newFragmentType == FragmentsAvailable.CONTACTS_LIST || newFragmentType == FragmentsAvailable.CONTACTS_LIST
|| newFragmentType == FragmentsAvailable.CHATLIST || newFragmentType == FragmentsAvailable.CHAT_LIST
|| newFragmentType == FragmentsAvailable.HISTORY_LIST) { || newFragmentType == FragmentsAvailable.HISTORY_LIST) {
try { try {
getFragmentManager().popBackStackImmediate(null, FragmentManager.POP_BACK_STACK_INCLUSIVE); getFragmentManager().popBackStackImmediate(null, FragmentManager.POP_BACK_STACK_INCLUSIVE);
@ -527,6 +501,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
lAddress = LinphoneCoreFactory.instance().createLinphoneAddress(sipUri); lAddress = LinphoneCoreFactory.instance().createLinphoneAddress(sipUri);
} catch (LinphoneCoreException e) { } catch (LinphoneCoreException e) {
Log.e("Cannot display history details",e); Log.e("Cannot display history details",e);
//TODO display error message
return; return;
} }
Contact c = ContactsManager.getInstance().findContactWithAddress(getContentResolver(), lAddress); Contact c = ContactsManager.getInstance().findContactWithAddress(getContentResolver(), lAddress);
@ -536,12 +511,12 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
String status; String status;
if (log.getDirection() == CallDirection.Outgoing) { if (log.getDirection() == CallDirection.Outgoing) {
status = "Outgoing"; status = getString(R.string.outgoing);
} else { } else {
if (log.getStatus() == CallStatus.Missed) { if (log.getStatus() == CallStatus.Missed) {
status = "Missed"; status = getString(R.string.missed);
} else { } else {
status = "Incoming"; status = getString(R.string.incoming);
} }
} }
@ -601,7 +576,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
public void displayChatList() { public void displayChatList() {
Bundle extras = new Bundle(); Bundle extras = new Bundle();
changeCurrentFragment(FragmentsAvailable.CHATLIST, extras); changeCurrentFragment(FragmentsAvailable.CHAT_LIST, extras);
} }
public void displayContactsForEdition(String sipAddress) { public void displayContactsForEdition(String sipAddress) {
@ -613,7 +588,6 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
public void displayAbout() { public void displayAbout() {
changeCurrentFragment(FragmentsAvailable.ABOUT, null); changeCurrentFragment(FragmentsAvailable.ABOUT, null);
//settings.setSelected(true);
} }
public void displayAssistant() { public void displayAssistant() {
@ -649,8 +623,9 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
} else { } else {
LinphoneAddress lAddress; LinphoneAddress lAddress;
try { try {
lAddress = LinphoneCoreFactory.instance().createLinphoneAddress(sipUri); lAddress = LinphoneManager.getLc().interpretUrl(sipUri);
} catch (LinphoneCoreException e) { } catch (LinphoneCoreException e) {
//TODO display error message
Log.e("Cannot display chat",e); Log.e("Cannot display chat",e);
return; return;
} }
@ -664,7 +639,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
thumbnailUri = contact.getThumbnailUri().toString(); thumbnailUri = contact.getThumbnailUri().toString();
} }
if (currentFragment == FragmentsAvailable.CHATLIST || currentFragment == FragmentsAvailable.CHAT) { if (currentFragment == FragmentsAvailable.CHAT_LIST || currentFragment == FragmentsAvailable.CHAT) {
Fragment fragment2 = getFragmentManager().findFragmentById(R.id.fragmentContainer2); Fragment fragment2 = getFragmentManager().findFragmentById(R.id.fragmentContainer2);
if (fragment2 != null && fragment2.isVisible() && currentFragment == FragmentsAvailable.CHAT) { if (fragment2 != null && fragment2.isVisible() && currentFragment == FragmentsAvailable.CHAT) {
ChatFragment chatFragment = (ChatFragment) fragment2; ChatFragment chatFragment = (ChatFragment) fragment2;
@ -717,8 +692,11 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
changeCurrentFragment(FragmentsAvailable.DIALER, null); changeCurrentFragment(FragmentsAvailable.DIALER, null);
dialer_selected.setVisibility(View.VISIBLE); dialer_selected.setVisibility(View.VISIBLE);
} else if (id == R.id.chat) { } else if (id == R.id.chat) {
changeCurrentFragment(FragmentsAvailable.CHATLIST, null); changeCurrentFragment(FragmentsAvailable.CHAT_LIST, null);
chat_selected.setVisibility(View.VISIBLE); chat_selected.setVisibility(View.VISIBLE);
} else if (id == R.id.cancel) {
displayTopBar(false,"");
getFragmentManager().popBackStackImmediate();
} }
} }
@ -737,6 +715,17 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
} }
} }
public void displayTopBar(Boolean display, String name) {
TextView menuName = (TextView) findViewById(R.id.menu_name);
if(display){
menuName.setText(name);
mTopBar.setVisibility(View.VISIBLE);
} else {
menuName.setText("");
mTopBar.setVisibility(View.GONE);
}
}
@SuppressWarnings("incomplete-switch") @SuppressWarnings("incomplete-switch")
public void selectMenu(FragmentsAvailable menuToSelect) { public void selectMenu(FragmentsAvailable menuToSelect) {
currentFragment = menuToSelect; currentFragment = menuToSelect;
@ -757,9 +746,9 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
break; break;
case SETTINGS: case SETTINGS:
case ACCOUNT_SETTINGS: case ACCOUNT_SETTINGS:
//settings.setSelected(true); displayTopBar(true,"settings");
break; break;
case CHATLIST: case CHAT_LIST:
case CHAT: case CHAT:
chat_selected.setVisibility(View.VISIBLE); chat_selected.setVisibility(View.VISIBLE);
break; break;
@ -1213,8 +1202,9 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
if (call != null && call.getState() != LinphoneCall.State.IncomingReceived) { if (call != null && call.getState() != LinphoneCall.State.IncomingReceived) {
if (call.getCurrentParamsCopy().getVideoEnabled()) { if (call.getCurrentParamsCopy().getVideoEnabled()) {
startVideoActivity(call); //startVideoActivity(call);
} else { } else {
Log.w("outgoing call");
//startIncallActivity(call); //startIncallActivity(call);
} }
} }
@ -1239,7 +1229,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
if (currentFragment == FragmentsAvailable.DIALER if (currentFragment == FragmentsAvailable.DIALER
|| currentFragment == FragmentsAvailable.CONTACTS_LIST || currentFragment == FragmentsAvailable.CONTACTS_LIST
|| currentFragment == FragmentsAvailable.HISTORY_LIST || currentFragment == FragmentsAvailable.HISTORY_LIST
|| currentFragment == FragmentsAvailable.CHATLIST) { || currentFragment == FragmentsAvailable.CHAT_LIST) {
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));
@ -1254,16 +1244,11 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
} }
} }
} }
} /*else if (keyCode == KeyEvent.KEYCODE_MENU && statusFragment != null) { }
if (event.getRepeatCount() < 1) {
statusFragment.openOrCloseStatusBar(true);
}
}*/
return super.onKeyDown(keyCode, event); return super.onKeyDown(keyCode, event);
} }
//SIDE MENU //SIDE MENU
public void openOrCloseSideMenu(boolean open) { public void openOrCloseSideMenu(boolean open) {
if(open) { if(open) {
sideMenu.openDrawer(sideMenuContent); sideMenu.openDrawer(sideMenuContent);
@ -1272,7 +1257,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
} }
} }
public void createSideMenu() { public void initSideMenu() {
sideMenu = (DrawerLayout) findViewById(R.id.side_menu); sideMenu = (DrawerLayout) findViewById(R.id.side_menu);
sideMenuItems = getResources().getStringArray(R.array.side_menu_item); sideMenuItems = getResources().getStringArray(R.array.side_menu_item);
sideMenuContent = (RelativeLayout) findViewById(R.id.side_menu_content); sideMenuContent = (RelativeLayout) findViewById(R.id.side_menu_content);
@ -1320,7 +1305,6 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
private int getStatusIconResource(LinphoneCore.RegistrationState state) { private int getStatusIconResource(LinphoneCore.RegistrationState state) {
try { try {
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (state == RegistrationState.RegistrationOk) { if (state == RegistrationState.RegistrationOk) {
return R.drawable.led_connected; return R.drawable.led_connected;
} else if (state == RegistrationState.RegistrationProgress) { } else if (state == RegistrationState.RegistrationProgress) {
@ -1396,8 +1380,6 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
accountsList = (ListView) findViewById(R.id.accounts_list); accountsList = (ListView) findViewById(R.id.accounts_list);
defaultAccount = (RelativeLayout) findViewById(R.id.default_account); defaultAccount = (RelativeLayout) findViewById(R.id.default_account);
displayMainAccount();
refreshAccounts(); refreshAccounts();
} }