From 59b79eb7c10f7ad72c1d746428904f4af11d9837 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Tue, 18 Sep 2012 16:40:52 +0200 Subject: [PATCH] Updated default and wizard settings --- res/layout/chat.xml | 8 ++++---- res/layout/contact.xml | 1 + res/xml/preferences.xml | 3 ++- src/org/linphone/ContactFragment.java | 3 +++ src/org/linphone/PreferencesFragment.java | 19 ++++++++++++++++--- src/org/linphone/setup/SetupActivity.java | 15 +++++++++++++++ 6 files changed, 41 insertions(+), 8 deletions(-) diff --git a/res/layout/chat.xml b/res/layout/chat.xml index a9bcf69c0..f8ee9610e 100644 --- a/res/layout/chat.xml +++ b/res/layout/chat.xml @@ -57,15 +57,15 @@ android:background="@drawable/chat_field_background"> + android:contentDescription="@string/content_description_send_message" + android:paddingLeft="8dp" + android:src="@drawable/chat_send_picture" /> @@ -246,7 +247,7 @@ + android:defaultValue="false"/> diff --git a/src/org/linphone/ContactFragment.java b/src/org/linphone/ContactFragment.java index 515522ba8..166fde34e 100644 --- a/src/org/linphone/ContactFragment.java +++ b/src/org/linphone/ContactFragment.java @@ -95,6 +95,9 @@ public class ContactFragment extends Fragment implements OnClickListener { for (String numberOrAddress : contact.getNumerosOrAddresses()) { View v = inflater.inflate(R.layout.contact_control_row, null); + if (numberOrAddress.startsWith("sip:")) { + numberOrAddress = numberOrAddress.substring(4); + } ((TextView) v.findViewById(R.id.numeroOrAddress)).setText(numberOrAddress); v.findViewById(R.id.dial).setOnClickListener(dialListener); diff --git a/src/org/linphone/PreferencesFragment.java b/src/org/linphone/PreferencesFragment.java index d2ace91f6..e70ecff76 100644 --- a/src/org/linphone/PreferencesFragment.java +++ b/src/org/linphone/PreferencesFragment.java @@ -47,6 +47,7 @@ import org.linphone.setup.SetupActivity; import org.linphone.ui.LedPreference; import org.linphone.ui.PreferencesListFragment; +import android.app.Activity; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; @@ -73,6 +74,7 @@ public class PreferencesFragment extends PreferencesListFragment implements EcCa private static final int ACCOUNTS_SETTINGS_ID = 0; private static final int WIZARD_SETTINGS_ID = 1; private static final int CAMERA_SETTINGS_ID = 5; + private static final int WIZARD_INTENT = 1; public PreferencesFragment() { super(R.xml.preferences); @@ -131,8 +133,10 @@ public class PreferencesFragment extends PreferencesListFragment implements EcCa // No video if (!Version.isVideoCapable()) { uncheckAndDisableCheckbox(pref_video_enable_key); - } else if (!AndroidCameraConfiguration.hasFrontCamera()) { - uncheckDisableAndHideCheckbox(R.string.pref_video_use_front_camera_key); + } else { + if (!AndroidCameraConfiguration.hasFrontCamera()) { + uncheckDisableAndHideCheckbox(R.string.pref_video_use_front_camera_key); + } } if (prefs().getBoolean(LinphoneActivity.PREF_FIRST_LAUNCH,true)) { @@ -413,11 +417,20 @@ public class PreferencesFragment extends PreferencesListFragment implements EcCa wizard.setOnPreferenceClickListener(new OnPreferenceClickListener() { public boolean onPreferenceClick(Preference preference) { Intent intent = new Intent(mContext, SetupActivity.class); - startActivity(intent); + startActivityForResult(intent, WIZARD_INTENT); return true; } }); } + + @Override + public void onActivityResult(int requestCode, int resultCode, Intent data) { + if (requestCode == WIZARD_INTENT && resultCode == Activity.RESULT_OK) { + if (LinphoneActivity.isInstanciated()) { + LinphoneActivity.instance().goToDialer(); + } + } + } private void initializeMediaEncryptionPreferences() { LinphoneCore lc=LinphoneManager.getLc(); diff --git a/src/org/linphone/setup/SetupActivity.java b/src/org/linphone/setup/SetupActivity.java index 12a707060..ad3bdbc7a 100644 --- a/src/org/linphone/setup/SetupActivity.java +++ b/src/org/linphone/setup/SetupActivity.java @@ -21,6 +21,7 @@ import org.linphone.LinphoneManager; import org.linphone.R; import org.linphone.core.Log; +import android.app.Activity; import android.content.Context; import android.content.SharedPreferences; import android.os.Bundle; @@ -143,6 +144,7 @@ public class SetupActivity extends FragmentActivity implements OnClickListener { if (LinphoneManager.getLc().getDefaultProxyConfig() != null) { writePreference(R.string.first_launch_suceeded_once_key, true); + setResult(Activity.RESULT_OK); finish(); } } @@ -189,6 +191,19 @@ public class SetupActivity extends FragmentActivity implements OnClickListener { writePreference(R.string.pref_username_key, username); writePreference(R.string.pref_passwd_key, password); writePreference(R.string.pref_domain_key, domain); + + boolean isMainAccountLinphoneDotOrg = domain.equals(getString(R.string.default_domain)); + if (isMainAccountLinphoneDotOrg) { + writePreference(R.string.pref_proxy_key, domain + ":5223"); + writePreference(R.string.pref_enable_outbound_proxy_key, true); + writePreference(R.string.pref_stun_server_key, "stun.linphone.org"); + + writePreference(R.string.pref_ice_enable_key, true); + writePreference(R.string.pref_push_notification_key, true); + writePreference(R.string.pref_transport_tls_key, true); + writePreference(R.string.pref_transport_tcp_key, false); + writePreference(R.string.pref_transport_udp_key, false); + } } else { writePreference(getString(R.string.pref_username_key) + newAccountId, username); writePreference(getString(R.string.pref_passwd_key) + newAccountId, password);