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);
|
||||
}
|
||||
finally {
|
||||
mServiceContext.unregisterReceiver(instance.mKeepAliveReceiver);
|
||||
try {
|
||||
mServiceContext.unregisterReceiver(mKeepAliveReceiver);
|
||||
} catch (Exception e) {
|
||||
Log.e(e);
|
||||
}
|
||||
mLc = null;
|
||||
}
|
||||
}
|
||||
|
@ -794,7 +798,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
|||
Log.e(e);
|
||||
}
|
||||
finally {
|
||||
mServiceContext.unregisterReceiver(instance.mKeepAliveReceiver);
|
||||
mServiceContext.unregisterReceiver(mKeepAliveReceiver);
|
||||
mLc = null;
|
||||
instance = null;
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ import org.linphone.core.LinphoneAddress;
|
|||
import org.linphone.core.LinphoneAddress.TransportType;
|
||||
import org.linphone.core.LinphoneCore;
|
||||
import org.linphone.core.LinphoneCore.RegistrationState;
|
||||
import org.linphone.core.LinphoneCore.RemoteProvisioningState;
|
||||
import org.linphone.core.LinphoneCoreException;
|
||||
import org.linphone.core.LinphoneCoreFactory;
|
||||
import org.linphone.core.LinphoneCoreListenerBase;
|
||||
|
@ -71,6 +72,7 @@ private static AssistantActivity instance;
|
|||
private StatusFragment status;
|
||||
private ProgressDialog progress;
|
||||
private Dialog dialog;
|
||||
private boolean remoteProvisioningInProgress;
|
||||
private static final int PERMISSIONS_REQUEST_RECORD_AUDIO = 201;
|
||||
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -96,27 +98,30 @@ private static AssistantActivity instance;
|
|||
status.enableSideMenu(false);
|
||||
//}
|
||||
|
||||
mListener = new LinphoneCoreListenerBase(){
|
||||
mListener = new LinphoneCoreListenerBase() {
|
||||
@Override
|
||||
public void registrationState(LinphoneCore lc, LinphoneProxyConfig cfg, LinphoneCore.RegistrationState state, String smessage) {
|
||||
if(accountCreated && !newAccount){
|
||||
if(address != null && address.asString().equals(cfg.getAddress().asString()) ) {
|
||||
public void registrationState(LinphoneCore lc, LinphoneProxyConfig cfg, RegistrationState state, String smessage) {
|
||||
if (remoteProvisioningInProgress) {
|
||||
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(progress != null)
|
||||
progress.dismiss();
|
||||
if (progress != null) progress.dismiss();
|
||||
if (LinphoneManager.getLc().getDefaultProxyConfig() != null) {
|
||||
launchEchoCancellerCalibration(true);
|
||||
}
|
||||
} else if (state == RegistrationState.RegistrationFailed) {
|
||||
if(progress != null)
|
||||
progress.dismiss();
|
||||
if(dialog == null || !dialog.isShowing()) {
|
||||
if (progress != null) progress.dismiss();
|
||||
if (dialog == null || !dialog.isShowing()) {
|
||||
dialog = createErrorDialog(cfg, smessage);
|
||||
dialog.show();
|
||||
}
|
||||
} else if(!(state == RegistrationState.RegistrationProgress)) {
|
||||
if(progress != null)
|
||||
progress.dismiss();
|
||||
if (progress != null) progress.dismiss();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -436,9 +441,9 @@ private static AssistantActivity instance;
|
|||
}
|
||||
}
|
||||
|
||||
public void displayRegistrationInProgressDialog(){
|
||||
public void displayRegistrationInProgressDialog() {
|
||||
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));
|
||||
d.setAlpha(200);
|
||||
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) {
|
||||
CreateAccountActivationFragment fragment = new CreateAccountActivationFragment();
|
||||
newAccount = true;
|
||||
|
|
|
@ -58,6 +58,7 @@ public class RemoteProvisioningFragment extends Fragment implements OnClickListe
|
|||
|
||||
if (id == R.id.assistant_apply) {
|
||||
String url = remoteProvisioningUrl.getText().toString();
|
||||
AssistantActivity.instance().displayRemoteProvisioningInProgressDialog();
|
||||
LinphonePreferences.instance().setRemoteProvisioningUrl(url);
|
||||
LinphoneManager.getInstance().restartLinphoneCore();
|
||||
AssistantActivity.instance().setLinphoneCoreListener();
|
||||
|
|
Loading…
Reference in a new issue