Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -83,19 +83,17 @@ public class FirstRunWizardActivity extends AppCompatActivity implements


public void onCreate(Bundle savedInstanceState) {
// we need to construct the wizard model before we call super.onCreate, because it's used in
// onGetPage (which is indirectly called through super.onCreate if savedInstanceState is not
// null)
mWizardModel = createWizardModel(savedInstanceState);

super.onCreate(savedInstanceState);
setContentView(R.layout.activity_first_run_wizard);
ButterKnife.bind(this);

setTitle(getString(R.string.title_setup_gnucash));

mWizardModel = new FirstRunWizardModel(this);
if (savedInstanceState != null) {
mWizardModel.load(savedInstanceState.getBundle("model"));
}

mWizardModel.registerListener(this);

mPagerAdapter = new MyPagerAdapter(getSupportFragmentManager());
mPager.setAdapter(mPagerAdapter);
mStepPagerStrip
Expand Down Expand Up @@ -197,6 +195,24 @@ public void onClick(View view) {
updateBottomBar();
}

/**
* Create the wizard model for the activity, taking into accoun the savedInstanceState if it
* exists (and if it contains a "model" key that we can use).
* @param savedInstanceState the instance state available in {{@link #onCreate(Bundle)}}
* @return an appropriate wizard model for this activity
*/
private AbstractWizardModel createWizardModel(Bundle savedInstanceState) {
AbstractWizardModel model = new FirstRunWizardModel(this);
if (savedInstanceState != null) {
Bundle wizardModel = savedInstanceState.getBundle("model");
if (wizardModel != null) {
model.load(wizardModel);
}
}
model.registerListener(this);
return model;
}

/**
* Create accounts depending on the user preference (import or default set) and finish this activity
* <p>This method also removes the first run flag from the application</p>
Expand Down