diff options
author | Erin Yan <yiranyan@google.com> | 2021-07-13 22:35:27 +0000 |
---|---|---|
committer | Erin Yan <yiranyan@google.com> | 2021-07-21 22:44:17 +0000 |
commit | 5ec41c2976c5bd9f750f7982fdd515eec4e1c19a (patch) | |
tree | 5f2689a8bc67bf6a40257c558af07c89eea1cc5b | |
parent | 0695ada180d638d7bf55dc4df38fde60a46073e6 (diff) | |
download | setupwizard-5ec41c2976c5bd9f750f7982fdd515eec4e1c19a.tar.gz |
Add SummaryActionState for WAITING_TO_RESOLVE complete state
Bug: 187868931
Test: built with Soong successfully, CarSetupWizardLibRoboTests passed. Built with Gradle successfully, tests passed with Gradle.
Change-Id: I13613fd478a5e76ee96e008709158a54a40f6f04
3 files changed, 35 insertions, 4 deletions
diff --git a/library/main/src/com/android/car/setupwizardlib/summary/PartnerSummaryActionsCollector.java b/library/main/src/com/android/car/setupwizardlib/summary/PartnerSummaryActionsCollector.java index 2dfb04b..9b89308 100644 --- a/library/main/src/com/android/car/setupwizardlib/summary/PartnerSummaryActionsCollector.java +++ b/library/main/src/com/android/car/setupwizardlib/summary/PartnerSummaryActionsCollector.java @@ -151,11 +151,13 @@ public class PartnerSummaryActionsCollector { String completedDescription = summaryStateBundle.getString(EXTRA_SUMMARY_COMPLETED_DESCRIPTION, description); + SummaryActionState completeState = completed + ? SummaryActionState.COMPLETED : SummaryActionState.NOT_COMPLETED; return new SummaryAction( title, description, requiresNetwork, - completed, + completeState, priority, scriptUri, hasUnfinishedDependency, diff --git a/library/main/src/com/android/car/setupwizardlib/summary/SummaryAction.java b/library/main/src/com/android/car/setupwizardlib/summary/SummaryAction.java index 6f9e626..55d71d7 100644 --- a/library/main/src/com/android/car/setupwizardlib/summary/SummaryAction.java +++ b/library/main/src/com/android/car/setupwizardlib/summary/SummaryAction.java @@ -28,7 +28,7 @@ public class SummaryAction implements Comparable<SummaryAction> { public final int priority; public final boolean hasUnfinishedDependency; public final String dependencyDescription; - public final boolean completed; + public final SummaryActionState completeState; public final String iconResourceName; public final String completedDescription; @@ -36,7 +36,7 @@ public class SummaryAction implements Comparable<SummaryAction> { String actionTitle, String actionDescription, boolean requiresNetwork, - boolean completed, + SummaryActionState completeState, int priority, String scriptUri, boolean hasUnfinishedDependency, @@ -46,7 +46,7 @@ public class SummaryAction implements Comparable<SummaryAction> { this.actionTitle = actionTitle; this.actionDescription = actionDescription; this.requiresNetwork = requiresNetwork; - this.completed = completed; + this.completeState = completeState; this.priority = priority; this.scriptUri = scriptUri; this.hasUnfinishedDependency = hasUnfinishedDependency; @@ -55,6 +55,11 @@ public class SummaryAction implements Comparable<SummaryAction> { this.completedDescription = completedDescription; } + /** Returns {@code true} if the action is completed. */ + public boolean isCompleted() { + return completeState == SummaryActionState.COMPLETED; + } + @Override public int compareTo(@NonNull SummaryAction o) { if (o == null) { diff --git a/library/main/src/com/android/car/setupwizardlib/summary/SummaryActionState.java b/library/main/src/com/android/car/setupwizardlib/summary/SummaryActionState.java new file mode 100644 index 0000000..2b7daf2 --- /dev/null +++ b/library/main/src/com/android/car/setupwizardlib/summary/SummaryActionState.java @@ -0,0 +1,24 @@ +/* + * Copyright (C) 2021 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.car.setupwizardlib.summary; + +/** Complete state of the action. */ +public enum SummaryActionState { + COMPLETED, + NOT_COMPLETED, + WAITING_TO_RESOLVE +} |