Link to instructions on linphone website in about activity.
Fix account error dialog not recreated on orientation change.
This commit is contained in:
parent
259fc8f5e1
commit
bdaa7ceecb
4 changed files with 81 additions and 37 deletions
|
@ -61,7 +61,7 @@
|
||||||
<string name="pref_codecs_key">pref_codecs_key</string>
|
<string name="pref_codecs_key">pref_codecs_key</string>
|
||||||
<string name="place_call_chooser">Place a call</string>
|
<string name="place_call_chooser">Place a call</string>
|
||||||
<string name="pref_debug">Debug</string>
|
<string name="pref_debug">Debug</string>
|
||||||
<string name="about_text">Linphone %s SIP (rfc 3261) compatible phone under GNU Public License V2\n http://www.linphone.org\n© 2010 Belledonne Communications</string>
|
<string name="about_text">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</string>
|
||||||
<string name="menu_about">About</string>
|
<string name="menu_about">About</string>
|
||||||
<string name="pref_audio">Audio</string>
|
<string name="pref_audio">Audio</string>
|
||||||
<string name="menu_exit">Exit</string>
|
<string name="menu_exit">Exit</string>
|
||||||
|
@ -84,9 +84,11 @@
|
||||||
<string name="call_error">Cannot call %s</string>
|
<string name="call_error">Cannot call %s</string>
|
||||||
<string name="yes">Yes</string>
|
<string name="yes">Yes</string>
|
||||||
<string name="no">No</string>
|
<string name="no">No</string>
|
||||||
|
<string name="dismiss">Dismiss</string>
|
||||||
<string name="never_remind">Never remind me</string>
|
<string name="never_remind">Never remind me</string>
|
||||||
<string name="config_error">%s, do you want to go to the settings page ?</string>
|
<string name="config_error">%s, do you want to go to the settings page ?</string>
|
||||||
<string name="initial_config_error"><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></string>
|
<string name="initial_config_error"><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></string>
|
||||||
|
<string name="first_launch_message"><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></string>
|
||||||
<string name="warning_already_incall">Cannot initiate a new call because a call is already engaged</string>
|
<string name="warning_already_incall">Cannot initiate a new call because a call is already engaged</string>
|
||||||
<string name="tab_history">History</string>
|
<string name="tab_history">History</string>
|
||||||
<string name="warning_wrong_destination_address">Cannot build destination address from [%s]</string>
|
<string name="warning_wrong_destination_address">Cannot build destination address from [%s]</string>
|
||||||
|
|
|
@ -109,6 +109,7 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
|
||||||
MediaPlayer mRingerPlayer;
|
MediaPlayer mRingerPlayer;
|
||||||
|
|
||||||
Vibrator mVibrator;
|
Vibrator mVibrator;
|
||||||
|
private static boolean accountCheckingDone;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -332,7 +333,80 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
|
||||||
finish();
|
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() {
|
private void updateIncallVideoCallButton() {
|
||||||
boolean prefVideoEnabled = mPref.getBoolean(getString(R.string.pref_video_enable_key), false);
|
boolean prefVideoEnabled = mPref.getBoolean(getString(R.string.pref_video_enable_key), false);
|
||||||
if (prefVideoEnabled && !mCall.isEnabled()) {
|
if (prefVideoEnabled && !mCall.isEnabled()) {
|
||||||
|
@ -397,40 +471,7 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
|
||||||
updateIncallVideoCallButton();
|
updateIncallVideoCallButton();
|
||||||
try{
|
try{
|
||||||
LinphoneService.instance().initFromConf();
|
LinphoneService.instance().initFromConf();
|
||||||
} catch (LinphoneConfigException ec) {
|
} catch (Exception e) {
|
||||||
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 ) {
|
|
||||||
Log.e(LinphoneService.TAG,"Cannot get initial config", e);
|
Log.e(LinphoneService.TAG,"Cannot get initial config", e);
|
||||||
}
|
}
|
||||||
if (getIntent().getData() != null) {
|
if (getIntent().getData() != null) {
|
||||||
|
|
|
@ -321,7 +321,7 @@ public class LinphoneService extends Service implements LinphoneCoreListener {
|
||||||
LinphoneCoreFactory.instance().setDebugMode(lIsDebug);
|
LinphoneCoreFactory.instance().setDebugMode(lIsDebug);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
//codec config
|
// Configure audio codecs
|
||||||
enableDisableAudioCodec("speex", 32000, R.string.pref_codec_speex32_key);
|
enableDisableAudioCodec("speex", 32000, R.string.pref_codec_speex32_key);
|
||||||
enableDisableAudioCodec("speex", 16000, R.string.pref_codec_speex16_key);
|
enableDisableAudioCodec("speex", 16000, R.string.pref_codec_speex16_key);
|
||||||
enableDisableAudioCodec("speex", 8000, R.string.pref_codec_speex8_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("PCMU", 8000, R.string.pref_codec_pcmu_key);
|
||||||
enableDisableAudioCodec("PCMA", 8000, R.string.pref_codec_pcma_key);
|
enableDisableAudioCodec("PCMA", 8000, R.string.pref_codec_pcma_key);
|
||||||
|
|
||||||
|
// Configure video codecs
|
||||||
for (PayloadType videoCodec : mLinphoneCore.listVideoCodecs()) {
|
for (PayloadType videoCodec : mLinphoneCore.listVideoCodecs()) {
|
||||||
enableDisableVideoCodecs(videoCodec);
|
enableDisableVideoCodecs(videoCodec);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit fa1e4658bde1b9b3f7abc8745db71d15287694e3
|
Subproject commit 703e455e34e4dc4d05dd0c5bf72166cee23a1dc1
|
Loading…
Reference in a new issue