SetupWizard. Let each page optionally handle deferred actions on finish

Change-Id: I040d8dd472cc73ee034b3dbe8177a5b2e3314918
This commit is contained in:
cretin45 2015-01-30 10:52:47 -08:00
parent 645354b463
commit e39d98bdb3
3 changed files with 10 additions and 0 deletions

View File

@ -133,6 +133,12 @@ public abstract class AbstractSetupData extends BroadcastReceiver implements Set
} }
} }
public void finishPages() {
for (Page page : mPageList.values()) {
page.onFinishSetup();
}
}
public Bundle save() { public Bundle save() {
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
for (Page page : mPageList.values()) { for (Page page : mPageList.values()) {

View File

@ -44,6 +44,7 @@ public interface Page {
public boolean doPreviousAction(); public boolean doPreviousAction();
public boolean doNextAction(); public boolean doNextAction();
public void doLoadAction(Activity context, int action); public void doLoadAction(Activity context, int action);
public void onFinishSetup();
public boolean onActivityResult(int requestCode, int resultCode, Intent data); public boolean onActivityResult(int requestCode, int resultCode, Intent data);
public SetupDataCallbacks getCallbacks(); public SetupDataCallbacks getCallbacks();
} }

View File

@ -69,6 +69,9 @@ public abstract class SetupPage implements Page {
return false; return false;
} }
@Override
public void onFinishSetup() {}
@Override @Override
public void doLoadAction(Activity context, int action) { public void doLoadAction(Activity context, int action) {
if (context == null || context.isFinishing()) { return; } if (context == null || context.isFinishing()) { return; }