SetupWizard: Make sure fragment is attached in callback

Change-Id: Id492defa4c1d9bcad87311250a5f62fa046ee381
This commit is contained in:
cretin45 2015-02-27 17:23:27 -08:00
parent ec7edd5154
commit bce5500e27
2 changed files with 17 additions and 5 deletions

View File

@ -127,9 +127,15 @@ public class CyanogenServicesPage extends SetupPage {
ActivityOptions.makeCustomAnimation(mContext, ActivityOptions.makeCustomAnimation(mContext,
android.R.anim.fade_in, android.R.anim.fade_in,
android.R.anim.fade_out); android.R.anim.fade_out);
if (!mFragment.isDetached()) {
mFragment.startActivityForResult(intent, mFragment.startActivityForResult(intent,
SetupWizardApp.REQUEST_CODE_SETUP_CYANOGEN, SetupWizardApp.REQUEST_CODE_SETUP_CYANOGEN,
options.toBundle()); options.toBundle());
} else {
if (getCallbacks().isCurrentPage(CyanogenServicesPage.this)) {
getCallbacks().onNextPage();
}
}
} catch (OperationCanceledException e) { } catch (OperationCanceledException e) {
} catch (IOException e) { } catch (IOException e) {
} catch (AuthenticatorException e) { } catch (AuthenticatorException e) {

View File

@ -203,8 +203,14 @@ public class GmsAccountPage extends SetupPage {
ActivityOptions.makeCustomAnimation(mContext, ActivityOptions.makeCustomAnimation(mContext,
android.R.anim.fade_in, android.R.anim.fade_in,
android.R.anim.fade_out); android.R.anim.fade_out);
if (!mFragment.isDetached()) {
mFragment.startActivityForResult(intent, mFragment.startActivityForResult(intent,
SetupWizardApp.REQUEST_CODE_SETUP_GMS, options.toBundle()); SetupWizardApp.REQUEST_CODE_SETUP_GMS, options.toBundle());
} else {
if (getCallbacks().isCurrentPage(GmsAccountPage.this)) {
getCallbacks().onNextPage();
}
}
} catch (OperationCanceledException e) { } catch (OperationCanceledException e) {
} catch (IOException e) { } catch (IOException e) {
} catch (AuthenticatorException e) { } catch (AuthenticatorException e) {