Display progress dialog when remote provisioning
+ Go to dialer once registered + Set firstLaunchSuccessful to prevent assistant to show up on next restart
This commit is contained in:
parent
fdd3aa3db3
commit
3400ffd74f
3 changed files with 37 additions and 15 deletions
|
@ -573,7 +573,11 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
||||||
Log.e(e);
|
Log.e(e);
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
mServiceContext.unregisterReceiver(instance.mKeepAliveReceiver);
|
try {
|
||||||
|
mServiceContext.unregisterReceiver(mKeepAliveReceiver);
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.e(e);
|
||||||
|
}
|
||||||
mLc = null;
|
mLc = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -794,7 +798,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
||||||
Log.e(e);
|
Log.e(e);
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
mServiceContext.unregisterReceiver(instance.mKeepAliveReceiver);
|
mServiceContext.unregisterReceiver(mKeepAliveReceiver);
|
||||||
mLc = null;
|
mLc = null;
|
||||||
instance = null;
|
instance = null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@ import org.linphone.core.LinphoneAddress;
|
||||||
import org.linphone.core.LinphoneAddress.TransportType;
|
import org.linphone.core.LinphoneAddress.TransportType;
|
||||||
import org.linphone.core.LinphoneCore;
|
import org.linphone.core.LinphoneCore;
|
||||||
import org.linphone.core.LinphoneCore.RegistrationState;
|
import org.linphone.core.LinphoneCore.RegistrationState;
|
||||||
|
import org.linphone.core.LinphoneCore.RemoteProvisioningState;
|
||||||
import org.linphone.core.LinphoneCoreException;
|
import org.linphone.core.LinphoneCoreException;
|
||||||
import org.linphone.core.LinphoneCoreFactory;
|
import org.linphone.core.LinphoneCoreFactory;
|
||||||
import org.linphone.core.LinphoneCoreListenerBase;
|
import org.linphone.core.LinphoneCoreListenerBase;
|
||||||
|
@ -71,6 +72,7 @@ private static AssistantActivity instance;
|
||||||
private StatusFragment status;
|
private StatusFragment status;
|
||||||
private ProgressDialog progress;
|
private ProgressDialog progress;
|
||||||
private Dialog dialog;
|
private Dialog dialog;
|
||||||
|
private boolean remoteProvisioningInProgress;
|
||||||
private static final int PERMISSIONS_REQUEST_RECORD_AUDIO = 201;
|
private static final int PERMISSIONS_REQUEST_RECORD_AUDIO = 201;
|
||||||
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
@ -96,27 +98,30 @@ private static AssistantActivity instance;
|
||||||
status.enableSideMenu(false);
|
status.enableSideMenu(false);
|
||||||
//}
|
//}
|
||||||
|
|
||||||
mListener = new LinphoneCoreListenerBase(){
|
mListener = new LinphoneCoreListenerBase() {
|
||||||
@Override
|
@Override
|
||||||
public void registrationState(LinphoneCore lc, LinphoneProxyConfig cfg, LinphoneCore.RegistrationState state, String smessage) {
|
public void registrationState(LinphoneCore lc, LinphoneProxyConfig cfg, RegistrationState state, String smessage) {
|
||||||
if(accountCreated && !newAccount){
|
if (remoteProvisioningInProgress) {
|
||||||
if(address != null && address.asString().equals(cfg.getAddress().asString()) ) {
|
if (progress != null) progress.dismiss();
|
||||||
|
if (state == RegistrationState.RegistrationOk) {
|
||||||
|
remoteProvisioningInProgress = false;
|
||||||
|
success();
|
||||||
|
}
|
||||||
|
} else if (accountCreated && !newAccount){
|
||||||
|
if (address != null && address.asString().equals(cfg.getAddress().asString()) ) {
|
||||||
if (state == RegistrationState.RegistrationOk) {
|
if (state == RegistrationState.RegistrationOk) {
|
||||||
if(progress != null)
|
if (progress != null) progress.dismiss();
|
||||||
progress.dismiss();
|
|
||||||
if (LinphoneManager.getLc().getDefaultProxyConfig() != null) {
|
if (LinphoneManager.getLc().getDefaultProxyConfig() != null) {
|
||||||
launchEchoCancellerCalibration(true);
|
launchEchoCancellerCalibration(true);
|
||||||
}
|
}
|
||||||
} else if (state == RegistrationState.RegistrationFailed) {
|
} else if (state == RegistrationState.RegistrationFailed) {
|
||||||
if(progress != null)
|
if (progress != null) progress.dismiss();
|
||||||
progress.dismiss();
|
if (dialog == null || !dialog.isShowing()) {
|
||||||
if(dialog == null || !dialog.isShowing()) {
|
|
||||||
dialog = createErrorDialog(cfg, smessage);
|
dialog = createErrorDialog(cfg, smessage);
|
||||||
dialog.show();
|
dialog.show();
|
||||||
}
|
}
|
||||||
} else if(!(state == RegistrationState.RegistrationProgress)) {
|
} else if(!(state == RegistrationState.RegistrationProgress)) {
|
||||||
if(progress != null)
|
if (progress != null) progress.dismiss();
|
||||||
progress.dismiss();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -436,9 +441,9 @@ private static AssistantActivity instance;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void displayRegistrationInProgressDialog(){
|
public void displayRegistrationInProgressDialog() {
|
||||||
if(LinphoneManager.getLc().isNetworkReachable()) {
|
if(LinphoneManager.getLc().isNetworkReachable()) {
|
||||||
progress = ProgressDialog.show(this,null,null);
|
progress = ProgressDialog.show(this, null, null);
|
||||||
Drawable d = new ColorDrawable(getResources().getColor(R.color.colorE));
|
Drawable d = new ColorDrawable(getResources().getColor(R.color.colorE));
|
||||||
d.setAlpha(200);
|
d.setAlpha(200);
|
||||||
progress.getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT);
|
progress.getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT);
|
||||||
|
@ -448,6 +453,18 @@ private static AssistantActivity instance;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void displayRemoteProvisioningInProgressDialog() {
|
||||||
|
remoteProvisioningInProgress = true;
|
||||||
|
|
||||||
|
progress = ProgressDialog.show(this, null, null);
|
||||||
|
Drawable d = new ColorDrawable(getResources().getColor(R.color.colorE));
|
||||||
|
d.setAlpha(200);
|
||||||
|
progress.getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT);
|
||||||
|
progress.getWindow().setBackgroundDrawable(d);
|
||||||
|
progress.setContentView(R.layout.progress_dialog);
|
||||||
|
progress.show();
|
||||||
|
}
|
||||||
|
|
||||||
public void displayAssistantConfirm(String username, String password) {
|
public void displayAssistantConfirm(String username, String password) {
|
||||||
CreateAccountActivationFragment fragment = new CreateAccountActivationFragment();
|
CreateAccountActivationFragment fragment = new CreateAccountActivationFragment();
|
||||||
newAccount = true;
|
newAccount = true;
|
||||||
|
|
|
@ -58,6 +58,7 @@ public class RemoteProvisioningFragment extends Fragment implements OnClickListe
|
||||||
|
|
||||||
if (id == R.id.assistant_apply) {
|
if (id == R.id.assistant_apply) {
|
||||||
String url = remoteProvisioningUrl.getText().toString();
|
String url = remoteProvisioningUrl.getText().toString();
|
||||||
|
AssistantActivity.instance().displayRemoteProvisioningInProgressDialog();
|
||||||
LinphonePreferences.instance().setRemoteProvisioningUrl(url);
|
LinphonePreferences.instance().setRemoteProvisioningUrl(url);
|
||||||
LinphoneManager.getInstance().restartLinphoneCore();
|
LinphoneManager.getInstance().restartLinphoneCore();
|
||||||
AssistantActivity.instance().setLinphoneCoreListener();
|
AssistantActivity.instance().setLinphoneCoreListener();
|
||||||
|
|
Loading…
Reference in a new issue