SetupWizard: Refactor page completed to hidden
Change-Id: Ia5e84c52a711767e539adcc3b1a2fdc5d5a27b13
This commit is contained in:
parent
c3d44b4b83
commit
f76ee499de
|
@ -84,7 +84,7 @@ public abstract class AbstractSetupData implements SetupDataCallbacks {
|
||||||
@Override
|
@Override
|
||||||
public void onNextPage() {
|
public void onNextPage() {
|
||||||
if (getCurrentPage().doNextAction() == false) {
|
if (getCurrentPage().doNextAction() == false) {
|
||||||
if (advanceToNextUncompleted()) {
|
if (advanceToNextUnhidden()) {
|
||||||
for (int i = 0; i < mListeners.size(); i++) {
|
for (int i = 0; i < mListeners.size(); i++) {
|
||||||
mListeners.get(i).onNextPage();
|
mListeners.get(i).onNextPage();
|
||||||
}
|
}
|
||||||
|
@ -95,7 +95,7 @@ public abstract class AbstractSetupData implements SetupDataCallbacks {
|
||||||
@Override
|
@Override
|
||||||
public void onPreviousPage() {
|
public void onPreviousPage() {
|
||||||
if (getCurrentPage().doPreviousAction() == false) {
|
if (getCurrentPage().doPreviousAction() == false) {
|
||||||
if (advanceToPreviousUncompleted()) {
|
if (advanceToPreviousUnhidden()) {
|
||||||
for (int i = 0; i < mListeners.size(); i++) {
|
for (int i = 0; i < mListeners.size(); i++) {
|
||||||
mListeners.get(i).onPreviousPage();
|
mListeners.get(i).onPreviousPage();
|
||||||
}
|
}
|
||||||
|
@ -103,20 +103,20 @@ public abstract class AbstractSetupData implements SetupDataCallbacks {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean advanceToNextUncompleted() {
|
private boolean advanceToNextUnhidden() {
|
||||||
while (mCurrentPageIndex < mPageList.size()) {
|
while (mCurrentPageIndex < mPageList.size()) {
|
||||||
mCurrentPageIndex++;
|
mCurrentPageIndex++;
|
||||||
if (!getCurrentPage().isCompleted()) {
|
if (!getCurrentPage().isHidden()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean advanceToPreviousUncompleted() {
|
private boolean advanceToPreviousUnhidden() {
|
||||||
while (mCurrentPageIndex > 0) {
|
while (mCurrentPageIndex > 0) {
|
||||||
mCurrentPageIndex--;
|
mCurrentPageIndex--;
|
||||||
if (!getCurrentPage().isCompleted()) {
|
if (!getCurrentPage().isHidden()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,7 +92,7 @@ public class CyanogenServicesPage extends SetupPage {
|
||||||
if (requestCode == SetupWizardApp.REQUEST_CODE_SETUP_CYANOGEN) {
|
if (requestCode == SetupWizardApp.REQUEST_CODE_SETUP_CYANOGEN) {
|
||||||
if (resultCode == Activity.RESULT_OK || resultCode == Activity.RESULT_FIRST_USER) {
|
if (resultCode == Activity.RESULT_OK || resultCode == Activity.RESULT_FIRST_USER) {
|
||||||
if (SetupWizardUtils.accountExists(mContext, mContext.getString(R.string.cm_account_type))) {
|
if (SetupWizardUtils.accountExists(mContext, mContext.getString(R.string.cm_account_type))) {
|
||||||
setCompleted(true);
|
setHidden(true);
|
||||||
}
|
}
|
||||||
getCallbacks().onNextPage();
|
getCallbacks().onNextPage();
|
||||||
} else if (resultCode == Activity.RESULT_CANCELED) {
|
} else if (resultCode == Activity.RESULT_CANCELED) {
|
||||||
|
|
|
@ -87,7 +87,7 @@ public class GmsAccountPage extends SetupPage {
|
||||||
if (requestCode == SetupWizardApp.REQUEST_CODE_SETUP_GMS) {
|
if (requestCode == SetupWizardApp.REQUEST_CODE_SETUP_GMS) {
|
||||||
if (resultCode == Activity.RESULT_OK || resultCode == Activity.RESULT_FIRST_USER) {
|
if (resultCode == Activity.RESULT_OK || resultCode == Activity.RESULT_FIRST_USER) {
|
||||||
if (SetupWizardUtils.accountExists(mContext, SetupWizardApp.ACCOUNT_TYPE_GMS)) {
|
if (SetupWizardUtils.accountExists(mContext, SetupWizardApp.ACCOUNT_TYPE_GMS)) {
|
||||||
setCompleted(true);
|
setHidden(true);
|
||||||
}
|
}
|
||||||
getCallbacks().onNextPage();
|
getCallbacks().onNextPage();
|
||||||
} else if (resultCode == Activity.RESULT_CANCELED) {
|
} else if (resultCode == Activity.RESULT_CANCELED) {
|
||||||
|
|
|
@ -39,8 +39,8 @@ public interface Page {
|
||||||
public void resetData(Bundle data);
|
public void resetData(Bundle data);
|
||||||
public boolean isRequired();
|
public boolean isRequired();
|
||||||
public Page setRequired(boolean required);
|
public Page setRequired(boolean required);
|
||||||
public boolean isCompleted();
|
public boolean isHidden();
|
||||||
public void setCompleted(boolean completed);
|
public void setHidden(boolean hidden);
|
||||||
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);
|
||||||
|
|
|
@ -35,7 +35,7 @@ public abstract class SetupPage implements Page {
|
||||||
|
|
||||||
private Bundle mData = new Bundle();
|
private Bundle mData = new Bundle();
|
||||||
private boolean mRequired = false;
|
private boolean mRequired = false;
|
||||||
private boolean mCompleted = false;
|
private boolean mHidden = false;
|
||||||
|
|
||||||
protected final Context mContext;
|
protected final Context mContext;
|
||||||
|
|
||||||
|
@ -106,13 +106,13 @@ public abstract class SetupPage implements Page {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isCompleted() {
|
public boolean isHidden() {
|
||||||
return mCompleted;
|
return mHidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setCompleted(boolean completed) {
|
public void setHidden(boolean hidden) {
|
||||||
mCompleted = completed;
|
mHidden = hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue