Reworked lifecycle to not fully start LinphoneActivity at first start before the wizard
This commit is contained in:
parent
bb070b3665
commit
bffe9c9537
2 changed files with 17 additions and 11 deletions
|
@ -100,8 +100,6 @@ import android.widget.Toast;
|
|||
public class LinphoneActivity extends Activity implements OnClickListener, ContactPicked, ActivityCompat.OnRequestPermissionsResultCallback {
|
||||
public static final String PREF_FIRST_LAUNCH = "pref_first_launch";
|
||||
private static final int SETTINGS_ACTIVITY = 123;
|
||||
private static final int FIRST_LOGIN_ACTIVITY = 101;
|
||||
private static final int REMOTE_PROVISIONING_LOGIN_ACTIVITY = 102;
|
||||
private static final int CALL_ACTIVITY = 19;
|
||||
private static final int PERMISSIONS_REQUEST_OVERLAY = 206;
|
||||
private static final int PERMISSIONS_REQUEST_SYNC = 207;
|
||||
|
@ -161,14 +159,22 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
|
|||
Intent wizard = new Intent();
|
||||
wizard.setClass(this, RemoteProvisioningLoginActivity.class);
|
||||
wizard.putExtra("Domain", LinphoneManager.getInstance().wizardLoginViewDomain);
|
||||
startActivityForResult(wizard, REMOTE_PROVISIONING_LOGIN_ACTIVITY);
|
||||
} else if (savedInstanceState == null && (useFirstLoginActivity && LinphonePreferences.instance().isFirstLaunch() || LinphoneManager.getLc().getProxyConfigList().length == 0)) {
|
||||
startActivity(wizard);
|
||||
finish();
|
||||
return;
|
||||
} else if (savedInstanceState == null && (useFirstLoginActivity && LinphonePreferences.instance().isFirstLaunch())) {
|
||||
if (LinphonePreferences.instance().getAccountCount() > 0) {
|
||||
LinphonePreferences.instance().firstLaunchSuccessful();
|
||||
} else {
|
||||
startActivityForResult(new Intent().setClass(this, AssistantActivity.class), FIRST_LOGIN_ACTIVITY);
|
||||
startActivity(new Intent().setClass(this, AssistantActivity.class));
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (getIntent() != null && getIntent().getExtras() != null) {
|
||||
newProxyConfig = getIntent().getExtras().getBoolean("isNewProxyConfig");
|
||||
}
|
||||
|
||||
if (getResources().getBoolean(R.bool.use_linphone_tag)) {
|
||||
if (getPackageManager().checkPermission(Manifest.permission.WRITE_SYNC_SETTINGS, getPackageName()) != PackageManager.PERMISSION_GRANTED) {
|
||||
|
|
|
@ -42,6 +42,7 @@ import android.app.FragmentTransaction;
|
|||
import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
|
@ -187,7 +188,8 @@ private static AssistantActivity instance;
|
|||
if (getResources().getBoolean(R.bool.setup_cancel_move_to_back)) {
|
||||
moveTaskToBack(true);
|
||||
} else {
|
||||
setResult(Activity.RESULT_CANCELED);
|
||||
LinphonePreferences.instance().firstLaunchSuccessful();
|
||||
startActivity(new Intent().setClass(this, LinphoneActivity.class));
|
||||
finish();
|
||||
}
|
||||
} else if (id == R.id.back) {
|
||||
|
@ -203,7 +205,8 @@ private static AssistantActivity instance;
|
|||
if (getResources().getBoolean(R.bool.setup_cancel_move_to_back)) {
|
||||
moveTaskToBack(true);
|
||||
} else {
|
||||
setResult(Activity.RESULT_CANCELED);
|
||||
LinphonePreferences.instance().firstLaunchSuccessful();
|
||||
startActivity(new Intent().setClass(this, LinphoneActivity.class));
|
||||
finish();
|
||||
}
|
||||
} else if (currentFragment == AssistantFragmentsEnum.LOGIN
|
||||
|
@ -519,10 +522,7 @@ private static AssistantActivity instance;
|
|||
|
||||
public void success() {
|
||||
mPrefs.firstLaunchSuccessful();
|
||||
if(LinphoneActivity.instance() != null) {
|
||||
LinphoneActivity.instance().isNewProxyConfig();
|
||||
setResult(Activity.RESULT_OK);
|
||||
}
|
||||
startActivity(new Intent().setClass(this, LinphoneActivity.class).putExtra("isNewProxyConfig", true));
|
||||
finish();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue