SetupWizard: Refactor page completed to hidden

Change-Id: Ia5e84c52a711767e539adcc3b1a2fdc5d5a27b13
This commit is contained in:
cretin45 2015-01-28 21:32:50 -08:00
parent c3d44b4b83
commit f76ee499de
5 changed files with 15 additions and 15 deletions

View File

@ -84,7 +84,7 @@ public abstract class AbstractSetupData implements SetupDataCallbacks {
@Override
public void onNextPage() {
if (getCurrentPage().doNextAction() == false) {
if (advanceToNextUncompleted()) {
if (advanceToNextUnhidden()) {
for (int i = 0; i < mListeners.size(); i++) {
mListeners.get(i).onNextPage();
}
@ -95,7 +95,7 @@ public abstract class AbstractSetupData implements SetupDataCallbacks {
@Override
public void onPreviousPage() {
if (getCurrentPage().doPreviousAction() == false) {
if (advanceToPreviousUncompleted()) {
if (advanceToPreviousUnhidden()) {
for (int i = 0; i < mListeners.size(); i++) {
mListeners.get(i).onPreviousPage();
}
@ -103,20 +103,20 @@ public abstract class AbstractSetupData implements SetupDataCallbacks {
}
}
private boolean advanceToNextUncompleted() {
private boolean advanceToNextUnhidden() {
while (mCurrentPageIndex < mPageList.size()) {
mCurrentPageIndex++;
if (!getCurrentPage().isCompleted()) {
if (!getCurrentPage().isHidden()) {
return true;
}
}
return false;
}
private boolean advanceToPreviousUncompleted() {
private boolean advanceToPreviousUnhidden() {
while (mCurrentPageIndex > 0) {
mCurrentPageIndex--;
if (!getCurrentPage().isCompleted()) {
if (!getCurrentPage().isHidden()) {
return true;
}
}

View File

@ -92,7 +92,7 @@ public class CyanogenServicesPage extends SetupPage {
if (requestCode == SetupWizardApp.REQUEST_CODE_SETUP_CYANOGEN) {
if (resultCode == Activity.RESULT_OK || resultCode == Activity.RESULT_FIRST_USER) {
if (SetupWizardUtils.accountExists(mContext, mContext.getString(R.string.cm_account_type))) {
setCompleted(true);
setHidden(true);
}
getCallbacks().onNextPage();
} else if (resultCode == Activity.RESULT_CANCELED) {

View File

@ -87,7 +87,7 @@ public class GmsAccountPage extends SetupPage {
if (requestCode == SetupWizardApp.REQUEST_CODE_SETUP_GMS) {
if (resultCode == Activity.RESULT_OK || resultCode == Activity.RESULT_FIRST_USER) {
if (SetupWizardUtils.accountExists(mContext, SetupWizardApp.ACCOUNT_TYPE_GMS)) {
setCompleted(true);
setHidden(true);
}
getCallbacks().onNextPage();
} else if (resultCode == Activity.RESULT_CANCELED) {

View File

@ -39,8 +39,8 @@ public interface Page {
public void resetData(Bundle data);
public boolean isRequired();
public Page setRequired(boolean required);
public boolean isCompleted();
public void setCompleted(boolean completed);
public boolean isHidden();
public void setHidden(boolean hidden);
public boolean doPreviousAction();
public boolean doNextAction();
public void doLoadAction(Activity context, int action);

View File

@ -35,7 +35,7 @@ public abstract class SetupPage implements Page {
private Bundle mData = new Bundle();
private boolean mRequired = false;
private boolean mCompleted = false;
private boolean mHidden = false;
protected final Context mContext;
@ -106,13 +106,13 @@ public abstract class SetupPage implements Page {
}
@Override
public boolean isCompleted() {
return mCompleted;
public boolean isHidden() {
return mHidden;
}
@Override
public void setCompleted(boolean completed) {
mCompleted = completed;
public void setHidden(boolean hidden) {
mHidden = hidden;
}
@Override