diff --git a/res/values/strings.xml b/res/values/strings.xml index 6f9dad17d..81ad41cf6 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -61,7 +61,7 @@ pref_codecs_key Place a call Debug -Linphone %s SIP (rfc 3261) compatible phone under GNU Public License V2\n http://www.linphone.org\n© 2010 Belledonne Communications +Linphone %s SIP (rfc 3261) compatible phone under GNU Public License V2\n http://www.linphone.org\n\nInstructions\nhttp://www.linphone.org/m/help\n\n© 2011 Belledonne Communications About Audio Exit @@ -84,9 +84,11 @@ Cannot call %s Yes No +Dismiss Never remind me %s, do you want to go to the settings page ? <P ALIGN=CENTER>No SIP account has been configured yet, do you want to go to the settings page ?<br/><br/> Need help ?<br/> "http://www.linphone.org/m/help"</p> +<P ALIGN=CENTER>Welcome to Linphone SIP phone<br/><br/> If you are new to SIP, have a look at<br/> "http://www.linphone.org/m/help"</p> Cannot initiate a new call because a call is already engaged History Cannot build destination address from [%s] diff --git a/src/org/linphone/DialerActivity.java b/src/org/linphone/DialerActivity.java index bed54dcdb..5c6e5a2ca 100644 --- a/src/org/linphone/DialerActivity.java +++ b/src/org/linphone/DialerActivity.java @@ -109,6 +109,7 @@ public class DialerActivity extends Activity implements LinphoneCoreListener { MediaPlayer mRingerPlayer; Vibrator mVibrator; + private static boolean accountCheckingDone; /** * @@ -332,7 +333,80 @@ public class DialerActivity extends Activity implements LinphoneCoreListener { finish(); } + + if (!accountCheckingDone) checkAccountsSettings(); } + + private boolean checkDefined(int ... keys) { + for (int key : keys) { + String conf = mPref.getString(getString(key), null); + if (conf == null || "".equals(conf)) + return false; + } + return true; + } + + + private void checkAccountsSettings() { + if (mPref.getBoolean(PREF_FIRST_LAUNCH, true)) { + // First launch + AlertDialog.Builder builder = new AlertDialog.Builder(this); + TextView lDialogTextView = new TextView(this); + lDialogTextView.setAutoLinkMask(0x0f/*all*/); + lDialogTextView.setPadding(10, 10, 10, 10); + + lDialogTextView.setText(Html.fromHtml(getString(R.string.first_launch_message))); + + builder.setCustomTitle(lDialogTextView) + .setCancelable(false) + .setPositiveButton(getString(R.string.dismiss), new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + LinphoneActivity.instance().startprefActivity(); + mPref.edit().putBoolean(PREF_FIRST_LAUNCH, false).commit(); + accountCheckingDone = true; + } + }); + + builder.create().show(); + + + } else if (!mPref.getBoolean(PREF_CHECK_CONFIG, false) + && !checkDefined(R.string.pref_username_key, R.string.pref_passwd_key, R.string.pref_domain_key)) { + // Account not set + + AlertDialog.Builder builder = new AlertDialog.Builder(this); + TextView lDialogTextView = new TextView(this); + lDialogTextView.setAutoLinkMask(0x0f/*all*/); + lDialogTextView.setPadding(10, 10, 10, 10); + + lDialogTextView.setText(Html.fromHtml(getString(R.string.initial_config_error))); + + builder.setCustomTitle(lDialogTextView) + .setCancelable(false) + .setPositiveButton(getString(R.string.yes), new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + LinphoneActivity.instance().startprefActivity(); + accountCheckingDone = true; + } + }).setNeutralButton(getString(R.string.no), new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + dialog.cancel(); + accountCheckingDone = true; + } + }).setNegativeButton(getString(R.string.never_remind), new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + mPref.edit().putBoolean(PREF_CHECK_CONFIG, true).commit(); + dialog.cancel(); + accountCheckingDone = true; + } + }); + + builder.create().show(); + } else { + accountCheckingDone = true; + } + } + private void updateIncallVideoCallButton() { boolean prefVideoEnabled = mPref.getBoolean(getString(R.string.pref_video_enable_key), false); if (prefVideoEnabled && !mCall.isEnabled()) { @@ -397,40 +471,7 @@ public class DialerActivity extends Activity implements LinphoneCoreListener { updateIncallVideoCallButton(); try{ LinphoneService.instance().initFromConf(); - } catch (LinphoneConfigException ec) { - if (mPref.getBoolean(PREF_FIRST_LAUNCH, true)) { - Log.w(LinphoneService.TAG,"no valid settings found - first launch",ec); - LinphoneActivity.instance().startprefActivity(); - mPref.edit().putBoolean(PREF_FIRST_LAUNCH, false).commit(); - } else { - Log.w(LinphoneService.TAG,"no valid settings found", ec); - AlertDialog.Builder builder = new AlertDialog.Builder(this); - TextView lDialogTextView = new TextView(this); - lDialogTextView.setAutoLinkMask(0x0f/*all*/); - lDialogTextView.setPadding(10, 10, 10, 10); - lDialogTextView.setText(Html.fromHtml(getString(R.string.initial_config_error))); - builder.setCustomTitle(lDialogTextView) - .setCancelable(false) - .setPositiveButton(getString(R.string.yes), new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int id) { - LinphoneActivity.instance().startprefActivity(); - } - }).setNeutralButton(getString(R.string.no), new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int id) { - dialog.cancel(); - - } - }).setNegativeButton(getString(R.string.never_remind), new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int id) { - mPref.edit().putBoolean(PREF_CHECK_CONFIG, true).commit(); - dialog.cancel(); - } - }); - if (mPref.getBoolean(PREF_CHECK_CONFIG, false) == false) { - builder.create().show(); - } - } - } catch (Exception e ) { + } catch (Exception e) { Log.e(LinphoneService.TAG,"Cannot get initial config", e); } if (getIntent().getData() != null) { diff --git a/src/org/linphone/LinphoneService.java b/src/org/linphone/LinphoneService.java index dc938c184..3d26ab177 100644 --- a/src/org/linphone/LinphoneService.java +++ b/src/org/linphone/LinphoneService.java @@ -321,7 +321,7 @@ public class LinphoneService extends Service implements LinphoneCoreListener { LinphoneCoreFactory.instance().setDebugMode(lIsDebug); try { - //codec config + // Configure audio codecs enableDisableAudioCodec("speex", 32000, R.string.pref_codec_speex32_key); enableDisableAudioCodec("speex", 16000, R.string.pref_codec_speex16_key); enableDisableAudioCodec("speex", 8000, R.string.pref_codec_speex8_key); @@ -330,6 +330,7 @@ public class LinphoneService extends Service implements LinphoneCoreListener { enableDisableAudioCodec("PCMU", 8000, R.string.pref_codec_pcmu_key); enableDisableAudioCodec("PCMA", 8000, R.string.pref_codec_pcma_key); + // Configure video codecs for (PayloadType videoCodec : mLinphoneCore.listVideoCodecs()) { enableDisableVideoCodecs(videoCodec); } diff --git a/submodules/linphone b/submodules/linphone index fa1e4658b..703e455e3 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit fa1e4658bde1b9b3f7abc8745db71d15287694e3 +Subproject commit 703e455e34e4dc4d05dd0c5bf72166cee23a1dc1