summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaurice Lam <yukl@google.com>2019-02-14 22:01:25 +0000
committerMaurice Lam <yukl@google.com>2019-02-14 22:01:25 +0000
commit232a2831bdbc44a82d27dfa66a01fc05830f4fa3 (patch)
tree6ad7dd8708899e6c1b6ae79cb4ed693cdd93c393
parente272b169dcf5224b205919b8263a2371e1f74092 (diff)
downloadsetupcompat-232a2831bdbc44a82d27dfa66a01fc05830f4fa3.tar.gz
Revert "Import updated Android SetupCompat Library 231343431"
This reverts commit e272b169dcf5224b205919b8263a2371e1f74092. Reason for revert: b/124450605 Change-Id: Ib125444854026cfa6f5319ad4954d2dd1f35d6f1
-rw-r--r--main/java/com/google/android/setupcompat/PartnerCustomizationLayout.java13
-rw-r--r--main/java/com/google/android/setupcompat/TemplateLayout.java (renamed from main/java/com/google/android/setupcompat/internal/TemplateLayout.java)5
-rw-r--r--main/java/com/google/android/setupcompat/internal/ClockProvider.java23
-rw-r--r--main/java/com/google/android/setupcompat/internal/PersistableBundles.java4
-rw-r--r--main/java/com/google/android/setupcompat/internal/Preconditions.java52
-rw-r--r--main/java/com/google/android/setupcompat/internal/SetupCompatServiceProvider.java1
-rw-r--r--main/java/com/google/android/setupcompat/internal/Ticker.java29
-rw-r--r--main/java/com/google/android/setupcompat/internal/Validations.java9
-rw-r--r--main/java/com/google/android/setupcompat/logging/CustomEvent.java19
-rw-r--r--main/java/com/google/android/setupcompat/logging/MetricKey.java2
-rw-r--r--main/java/com/google/android/setupcompat/logging/SetupMetricsLogger.java2
-rw-r--r--main/java/com/google/android/setupcompat/logging/Timer.java2
-rw-r--r--main/java/com/google/android/setupcompat/template/FooterBarMixin.java20
-rw-r--r--main/java/com/google/android/setupcompat/template/HeaderMixin.java2
-rw-r--r--main/java/com/google/android/setupcompat/template/IconMixin.java2
-rw-r--r--main/java/com/google/android/setupcompat/template/Mixin.java4
-rw-r--r--main/res/color-v23/suc_customization_button_highlight_ripple.xml4
-rw-r--r--main/res/layout-sw600dp/partner_customization_layout.xml19
-rw-r--r--main/res/layout/partner_customization_layout.xml55
-rw-r--r--main/res/values/attrs.xml146
-rw-r--r--main/res/values/colors.xml8
-rw-r--r--main/res/values/config.xml4
-rw-r--r--main/res/values/dimens.xml15
-rw-r--r--main/res/values/styles.xml99
24 files changed, 224 insertions, 315 deletions
diff --git a/main/java/com/google/android/setupcompat/PartnerCustomizationLayout.java b/main/java/com/google/android/setupcompat/PartnerCustomizationLayout.java
index cef0aee..2b04e93 100644
--- a/main/java/com/google/android/setupcompat/PartnerCustomizationLayout.java
+++ b/main/java/com/google/android/setupcompat/PartnerCustomizationLayout.java
@@ -33,7 +33,6 @@ import android.view.ViewGroup;
import android.view.ViewStub;
import android.view.WindowManager;
import com.google.android.setupcompat.internal.PersistableBundles;
-import com.google.android.setupcompat.internal.TemplateLayout;
import com.google.android.setupcompat.lifecycle.LifecycleFragment;
import com.google.android.setupcompat.logging.CustomEvent;
import com.google.android.setupcompat.logging.MetricKey;
@@ -86,6 +85,11 @@ public class PartnerCustomizationLayout extends TemplateLayout {
.obtainStyledAttributes(
attrs, R.styleable.SucPartnerCustomizationLayout, defStyleAttr, 0);
+ final int footer = a.getResourceId(R.styleable.SucPartnerCustomizationLayout_sucFooter, 0);
+ if (footer != 0) {
+ inflateFooter(footer);
+ }
+
boolean layoutFullscreen =
a.getBoolean(R.styleable.SucPartnerCustomizationLayout_sucLayoutFullscreen, true);
@@ -99,9 +103,7 @@ public class PartnerCustomizationLayout extends TemplateLayout {
Log.i(
TAG,
- "activity="
- + activity.getClass().getSimpleName()
- + ", isSetupFlow="
+ "isSetupFlow="
+ isSetupFlow
+ ", applyPartnerResource="
+ applyPartnerResource()
@@ -163,8 +165,7 @@ public class PartnerCustomizationLayout extends TemplateLayout {
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
- if (suwVersionSupportPartnerResource
- && WizardManagerHelper.isAnySetupWizard(activity.getIntent())) {
+ if (WizardManagerHelper.isAnySetupWizard(activity.getIntent())) {
FooterBarMixin footerBarMixin = getMixin(FooterBarMixin.class);
footerBarMixin.onDetachedFromWindow();
FooterButton primaryButton = footerBarMixin.getPrimaryButton();
diff --git a/main/java/com/google/android/setupcompat/internal/TemplateLayout.java b/main/java/com/google/android/setupcompat/TemplateLayout.java
index 222d482..644ab78 100644
--- a/main/java/com/google/android/setupcompat/internal/TemplateLayout.java
+++ b/main/java/com/google/android/setupcompat/TemplateLayout.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.google.android.setupcompat.internal;
+package com.google.android.setupcompat;
import android.annotation.TargetApi;
import android.content.Context;
@@ -29,7 +29,6 @@ import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.widget.FrameLayout;
-import com.google.android.setupcompat.R;
import com.google.android.setupcompat.template.Mixin;
import com.google.android.setupcompat.util.FallbackThemeWrapper;
import java.util.HashMap;
@@ -40,8 +39,6 @@ import java.util.Map;
* android:layout} through XML, and adds its children to a "container" in the template. When
* inflating this layout from XML, the {@code android:layout} and {@code suwContainer} attributes
* are required.
- *
- * <p>This class is designed to use inside the library; it is not suitable for external use.
*/
public class TemplateLayout extends FrameLayout {
diff --git a/main/java/com/google/android/setupcompat/internal/ClockProvider.java b/main/java/com/google/android/setupcompat/internal/ClockProvider.java
index f35a289..c54ac2e 100644
--- a/main/java/com/google/android/setupcompat/internal/ClockProvider.java
+++ b/main/java/com/google/android/setupcompat/internal/ClockProvider.java
@@ -17,10 +17,12 @@
package com.google.android.setupcompat.internal;
import androidx.annotation.VisibleForTesting;
+import com.google.common.base.Supplier;
+import com.google.common.base.Ticker;
import java.util.concurrent.TimeUnit;
/** Provider for time in nanos and millis. Allows overriding time during tests. */
-public class ClockProvider {
+public class ClockProvider extends Ticker {
public static long timeInNanos() {
return ticker.read();
@@ -32,23 +34,24 @@ public class ClockProvider {
@VisibleForTesting
public static void resetInstance() {
- ticker = SYSTEM_TICKER;
+ ticker = Ticker.systemTicker();
}
@VisibleForTesting
public static void setInstance(Supplier<Long> nanoSecondSupplier) {
- ticker = () -> nanoSecondSupplier.get();
+ ticker =
+ new Ticker() {
+ @Override
+ public long read() {
+ return nanoSecondSupplier.get();
+ }
+ };
}
+ @Override
public long read() {
return ticker.read();
}
- private static final Ticker SYSTEM_TICKER = () -> System.nanoTime();
- private static Ticker ticker = SYSTEM_TICKER;
-
- @VisibleForTesting
- public interface Supplier<T> {
- T get();
- }
+ private static Ticker ticker = Ticker.systemTicker();
}
diff --git a/main/java/com/google/android/setupcompat/internal/PersistableBundles.java b/main/java/com/google/android/setupcompat/internal/PersistableBundles.java
index 4d6c1f5..64951d6 100644
--- a/main/java/com/google/android/setupcompat/internal/PersistableBundles.java
+++ b/main/java/com/google/android/setupcompat/internal/PersistableBundles.java
@@ -17,6 +17,7 @@
package com.google.android.setupcompat.internal;
import android.os.PersistableBundle;
+import com.google.common.base.Preconditions;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@@ -43,7 +44,8 @@ public final class PersistableBundles {
for (String key : bundle.keySet()) {
Preconditions.checkArgument(
!result.containsKey(key),
- String.format("Found duplicate key [%s] while attempting to merge bundles.", key));
+ "Found duplicate key [%s] while attempting to merge bundles.",
+ key);
}
result.putAll(bundle);
}
diff --git a/main/java/com/google/android/setupcompat/internal/Preconditions.java b/main/java/com/google/android/setupcompat/internal/Preconditions.java
deleted file mode 100644
index b433808..0000000
--- a/main/java/com/google/android/setupcompat/internal/Preconditions.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2019 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.google.android.setupcompat.internal;
-
-/**
- * Static convenience methods that help a method or constructor check whether it was invoked
- * correctly (that is, whether its <i>preconditions</i> were met).
- *
- * <p>If the precondition is not met, the {@code Preconditions} method throws an unchecked exception
- * of a specified type, which helps the method in which the exception was thrown communicate that
- * its caller has made a mistake.
- */
-public final class Preconditions {
-
- /** Ensures the truth of an expression involving one or more parameters to the calling method. */
- public static void checkArgument(boolean expression, String errorMessage) {
- if (!expression) {
- throw new IllegalArgumentException(errorMessage);
- }
- }
-
- /**
- * Ensures the truth of an expression involving the state of the calling instance, but not
- * involving any parameters to the calling method.
- */
- public static void checkState(boolean expression, String errorMessage) {
- if (!expression) {
- throw new IllegalStateException(errorMessage);
- }
- }
-
- /** Ensures that an object reference passed as a parameter to the calling method is not null. */
- public static <T> T checkNotNull(T reference, String errorMessage) {
- if (reference == null) {
- throw new NullPointerException(errorMessage);
- }
- return reference;
- }
-}
diff --git a/main/java/com/google/android/setupcompat/internal/SetupCompatServiceProvider.java b/main/java/com/google/android/setupcompat/internal/SetupCompatServiceProvider.java
index 507177f..e16dda9 100644
--- a/main/java/com/google/android/setupcompat/internal/SetupCompatServiceProvider.java
+++ b/main/java/com/google/android/setupcompat/internal/SetupCompatServiceProvider.java
@@ -27,6 +27,7 @@ import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import android.util.Log;
import com.google.android.setupcompat.ISetupCompatService;
+import com.google.common.base.Preconditions;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
diff --git a/main/java/com/google/android/setupcompat/internal/Ticker.java b/main/java/com/google/android/setupcompat/internal/Ticker.java
deleted file mode 100644
index f521625..0000000
--- a/main/java/com/google/android/setupcompat/internal/Ticker.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (C) 2019 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.google.android.setupcompat.internal;
-
-/**
- * A time source; returns a time value representing the number of nanoseconds elapsed since some
- * fixed but arbitrary point in time.
- *
- * <p><b>Warning:</b> this interface can only be used to measure elapsed time, not wall time.
- */
-public interface Ticker {
-
- /** Returns the number of nanoseconds elapsed since this ticker's fixed point of reference. */
- long read();
-}
diff --git a/main/java/com/google/android/setupcompat/internal/Validations.java b/main/java/com/google/android/setupcompat/internal/Validations.java
index 333c134..584cad9 100644
--- a/main/java/com/google/android/setupcompat/internal/Validations.java
+++ b/main/java/com/google/android/setupcompat/internal/Validations.java
@@ -16,6 +16,8 @@
package com.google.android.setupcompat.internal;
+import com.google.common.base.Preconditions;
+
/** Commonly used validations and preconditions. */
public final class Validations {
@@ -28,7 +30,10 @@ public final class Validations {
public static void assertLengthInRange(int length, String name, int minLength, int maxLength) {
Preconditions.checkArgument(
length <= maxLength && length >= minLength,
- String.format("Length of %s should be in the range [%s-%s]", name, minLength, maxLength));
+ "Length of %s should be in the range [%s-%s]",
+ name,
+ minLength,
+ maxLength);
}
/**
@@ -39,7 +44,7 @@ public final class Validations {
* greather than {@code maxLength}.
*/
public static void assertLengthInRange(String input, String name, int minLength, int maxLength) {
- Preconditions.checkNotNull(input, String.format("%s cannot be null.", name));
+ Preconditions.checkNotNull(input, "%s cannot be null.", name);
assertLengthInRange(input.length(), name, minLength, maxLength);
}
diff --git a/main/java/com/google/android/setupcompat/logging/CustomEvent.java b/main/java/com/google/android/setupcompat/logging/CustomEvent.java
index 98f8d91..f9aa3b9 100644
--- a/main/java/com/google/android/setupcompat/logging/CustomEvent.java
+++ b/main/java/com/google/android/setupcompat/logging/CustomEvent.java
@@ -23,7 +23,7 @@ import android.os.Parcelable;
import android.os.PersistableBundle;
import androidx.annotation.VisibleForTesting;
import com.google.android.setupcompat.internal.ClockProvider;
-import com.google.android.setupcompat.internal.Preconditions;
+import com.google.common.base.Preconditions;
import java.util.Objects;
/**
@@ -131,8 +131,8 @@ public final class CustomEvent implements Parcelable {
assertPersistableBundleIsValid(bundle);
this.timestampMillis = timestampMillis;
this.metricKey = metricKey;
- this.persistableBundle = new PersistableBundle(bundle);
- this.piiValues = new PersistableBundle(piiValues);
+ this.persistableBundle = bundle.deepCopy();
+ this.piiValues = piiValues.deepCopy();
}
private final long timestampMillis;
@@ -153,16 +153,17 @@ public final class CustomEvent implements Parcelable {
}
Preconditions.checkArgument(
valid,
- String.format(
- "Invalid data type for key='%s'. Expected values of type %s, but found [%s].",
- key, CUSTOM_EVENT_ALLOWED_DATA_TYPES, value));
+ "Invalid data type for key='%s'. Expected values of type %s, but found [%s].",
+ key,
+ CUSTOM_EVENT_ALLOWED_DATA_TYPES,
+ value);
if (value instanceof String) {
Preconditions.checkArgument(
((String) value).length() <= MAX_STR_LENGTH,
- String.format(
- "Maximum length of string value for key='%s' cannot exceed %s.",
- key, MAX_STR_LENGTH));
+ "Maximum length of string value for key='%s' cannot exceed %s.",
+ key,
+ MAX_STR_LENGTH);
}
}
}
diff --git a/main/java/com/google/android/setupcompat/logging/MetricKey.java b/main/java/com/google/android/setupcompat/logging/MetricKey.java
index 7df4a71..fe310f2 100644
--- a/main/java/com/google/android/setupcompat/logging/MetricKey.java
+++ b/main/java/com/google/android/setupcompat/logging/MetricKey.java
@@ -21,7 +21,7 @@ import static com.google.android.setupcompat.internal.Validations.assertLengthIn
import android.os.Parcel;
import android.os.Parcelable;
import androidx.annotation.NonNull;
-import com.google.android.setupcompat.internal.Preconditions;
+import com.google.common.base.Preconditions;
import java.util.Objects;
import java.util.regex.Pattern;
diff --git a/main/java/com/google/android/setupcompat/logging/SetupMetricsLogger.java b/main/java/com/google/android/setupcompat/logging/SetupMetricsLogger.java
index 2869c65..adfcd81 100644
--- a/main/java/com/google/android/setupcompat/logging/SetupMetricsLogger.java
+++ b/main/java/com/google/android/setupcompat/logging/SetupMetricsLogger.java
@@ -19,10 +19,10 @@ package com.google.android.setupcompat.logging;
import android.content.Context;
import android.os.Bundle;
import androidx.annotation.NonNull;
-import com.google.android.setupcompat.internal.Preconditions;
import com.google.android.setupcompat.internal.SetupCompatServiceInvoker;
import com.google.android.setupcompat.logging.internal.SetupMetricsLoggingConstants.MetricBundleKeys;
import com.google.android.setupcompat.logging.internal.SetupMetricsLoggingConstants.MetricType;
+import com.google.common.base.Preconditions;
import java.util.concurrent.TimeUnit;
/** SetupMetricsLogger provides an easy way to log custom metrics to SetupWizard. */
diff --git a/main/java/com/google/android/setupcompat/logging/Timer.java b/main/java/com/google/android/setupcompat/logging/Timer.java
index ec4b9e0..7d2a2c9 100644
--- a/main/java/com/google/android/setupcompat/logging/Timer.java
+++ b/main/java/com/google/android/setupcompat/logging/Timer.java
@@ -18,7 +18,7 @@ package com.google.android.setupcompat.logging;
import android.util.Log;
import com.google.android.setupcompat.internal.ClockProvider;
-import com.google.android.setupcompat.internal.Preconditions;
+import com.google.common.base.Preconditions;
/** Convenience utility to log duration events. Please note that this class is not thread-safe. */
public final class Timer {
diff --git a/main/java/com/google/android/setupcompat/template/FooterBarMixin.java b/main/java/com/google/android/setupcompat/template/FooterBarMixin.java
index 25fe418..813868f 100644
--- a/main/java/com/google/android/setupcompat/template/FooterBarMixin.java
+++ b/main/java/com/google/android/setupcompat/template/FooterBarMixin.java
@@ -50,7 +50,7 @@ import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
import com.google.android.setupcompat.R;
-import com.google.android.setupcompat.internal.TemplateLayout;
+import com.google.android.setupcompat.TemplateLayout;
import com.google.android.setupcompat.logging.internal.FooterBarMixinMetrics;
import com.google.android.setupcompat.template.FooterButton.ButtonType;
import java.util.concurrent.atomic.AtomicInteger;
@@ -79,7 +79,6 @@ public class FooterBarMixin implements Mixin {
@VisibleForTesting int defaultPadding;
@ColorInt private final int footerBarPrimaryBackgroundColor;
@ColorInt private final int footerBarSecondaryBackgroundColor;
- private boolean removeFooterBarWhenEmpty = true;
private static final AtomicInteger nextGeneratedId = new AtomicInteger(1);
@@ -335,16 +334,6 @@ public class FooterBarMixin implements Mixin {
}
/**
- * Sets whether the footer bar should be removed when there are no footer buttons in the bar.
- *
- * @param value True if footer bar is gone, false otherwise.
- */
- public void setRemoveFooterBarWhenEmpty(boolean value) {
- removeFooterBarWhenEmpty = value;
- autoSetButtonBarVisibility();
- }
-
- /**
* Checks the visibility state of footer buttons to set the visibility state of this footer bar
* automatically.
*/
@@ -355,12 +344,7 @@ public class FooterBarMixin implements Mixin {
boolean secondaryVisible =
secondaryButton != null && secondaryButton.getVisibility() == View.VISIBLE;
- if (buttonContainer != null) {
- buttonContainer.setVisibility(
- primaryVisible || secondaryVisible
- ? View.VISIBLE
- : removeFooterBarWhenEmpty ? View.GONE : View.INVISIBLE);
- }
+ buttonContainer.setVisibility(primaryVisible || secondaryVisible ? View.VISIBLE : View.GONE);
}
/** Returns the visibility status for this footer bar. */
diff --git a/main/java/com/google/android/setupcompat/template/HeaderMixin.java b/main/java/com/google/android/setupcompat/template/HeaderMixin.java
index f6ae697..f4f0573 100644
--- a/main/java/com/google/android/setupcompat/template/HeaderMixin.java
+++ b/main/java/com/google/android/setupcompat/template/HeaderMixin.java
@@ -24,7 +24,7 @@ import androidx.annotation.Nullable;
import android.util.AttributeSet;
import android.widget.TextView;
import com.google.android.setupcompat.R;
-import com.google.android.setupcompat.internal.TemplateLayout;
+import com.google.android.setupcompat.TemplateLayout;
/**
* A {@link com.google.android.setupcompat.template.Mixin} for setting and getting the header text.
diff --git a/main/java/com/google/android/setupcompat/template/IconMixin.java b/main/java/com/google/android/setupcompat/template/IconMixin.java
index c2002e2..c319277 100644
--- a/main/java/com/google/android/setupcompat/template/IconMixin.java
+++ b/main/java/com/google/android/setupcompat/template/IconMixin.java
@@ -24,7 +24,7 @@ import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageView;
import com.google.android.setupcompat.R;
-import com.google.android.setupcompat.internal.TemplateLayout;
+import com.google.android.setupcompat.TemplateLayout;
/**
* A {@link com.google.android.setupcompat.template.Mixin} for setting an icon on the template
diff --git a/main/java/com/google/android/setupcompat/template/Mixin.java b/main/java/com/google/android/setupcompat/template/Mixin.java
index 2db118e..473ba6f 100644
--- a/main/java/com/google/android/setupcompat/template/Mixin.java
+++ b/main/java/com/google/android/setupcompat/template/Mixin.java
@@ -19,7 +19,7 @@ package com.google.android.setupcompat.template;
/**
* Marker interface to indicate Mixin classes.
*
- * @see com.google.android.setupcompat.internal.TemplateLayout#registerMixin(Class, Mixin)
- * @see com.google.android.setupcompat.internal.TemplateLayout#getMixin(Class)
+ * @see com.google.android.setupcompat.TemplateLayout#registerMixin(Class, Mixin)
+ * @see com.google.android.setupcompat.TemplateLayout#getMixin(Class)
*/
public interface Mixin {}
diff --git a/main/res/color-v23/suc_customization_button_highlight_ripple.xml b/main/res/color-v23/suc_customization_button_highlight_ripple.xml
index ccc28f7..e827a6d 100644
--- a/main/res/color-v23/suc_customization_button_highlight_ripple.xml
+++ b/main/res/color-v23/suc_customization_button_highlight_ripple.xml
@@ -16,6 +16,6 @@
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:alpha="?attr/sucFooterBarButtonHighlightAlpha"
- android:color="?attr/sucFooterBarButtonColorControlHighlightRipple" />
+ <item android:color="?attr/sucFooterBarButtonColorControlHighlightRipple"
+ android:alpha="?attr/sucFooterBarButtonHighlightAlpha" />
</selector>
diff --git a/main/res/layout-sw600dp/partner_customization_layout.xml b/main/res/layout-sw600dp/partner_customization_layout.xml
index 882f661..56a9aa6 100644
--- a/main/res/layout-sw600dp/partner_customization_layout.xml
+++ b/main/res/layout-sw600dp/partner_customization_layout.xml
@@ -21,15 +21,14 @@
android:layout_height="match_parent"
android:orientation="vertical">
- <FrameLayout
- android:id="@+id/suc_layout_content"
- android:layout_width="match_parent"
- android:layout_height="0dp"
- android:layout_weight="1" />
-
- <ViewStub
- android:id="@+id/suc_layout_footer"
- android:layout_width="match_parent"
- android:layout_height="wrap_content" />
+ <FrameLayout
+ android:id="@+id/suc_layout_content"
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="1" />
+ <ViewStub
+ android:id="@+id/suc_layout_footer"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" />
</LinearLayout>
diff --git a/main/res/layout/partner_customization_layout.xml b/main/res/layout/partner_customization_layout.xml
index 09ee7f1..32d5356 100644
--- a/main/res/layout/partner_customization_layout.xml
+++ b/main/res/layout/partner_customization_layout.xml
@@ -21,34 +21,33 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
- <LinearLayout
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+
+ <ImageView
+ android:id="@+id/suc_layout_icon"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:contentDescription="@null"
+ android:visibility="gone" />
+
+ <TextView
+ android:id="@+id/suc_layout_title"
android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical">
-
- <ImageView
- android:id="@+id/suc_layout_icon"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:contentDescription="@null"
- android:visibility="gone" />
-
- <TextView
- android:id="@+id/suc_layout_title"
- android:layout_width="match_parent"
- android:layout_height="wrap_content" />
-
- <FrameLayout
- android:id="@+id/suc_layout_content"
- android:layout_width="match_parent"
- android:layout_height="0dp"
- android:layout_weight="1" />
-
- <ViewStub
- android:id="@+id/suc_layout_footer"
- android:layout_width="match_parent"
- android:layout_height="wrap_content" />
-
- </LinearLayout>
+ android:layout_height="wrap_content" />
+ <FrameLayout
+ android:id="@+id/suc_layout_content"
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="1" />
+
+ <ViewStub
+ android:id="@+id/suc_layout_footer"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" />
+
+ </LinearLayout>
</com.google.android.setupcompat.view.StatusBarBackgroundLayout>
diff --git a/main/res/values/attrs.xml b/main/res/values/attrs.xml
index 3ad87e5..6f2d979 100644
--- a/main/res/values/attrs.xml
+++ b/main/res/values/attrs.xml
@@ -16,86 +16,86 @@
-->
<resources>
+ <!-- Theme attributes -->
+ <attr name="sucLayoutTheme" format="reference" />
- <!-- Theme attributes -->
- <attr name="sucLayoutTheme" format="reference" />
+ <declare-styleable name="SucTemplateLayout">
+ <attr name="android:layout" />
+ <attr name="sucContainer" format="reference" />
+ </declare-styleable>
- <declare-styleable name="SucTemplateLayout">
- <attr name="android:layout" />
- <attr name="sucContainer" format="reference" />
- </declare-styleable>
+ <declare-styleable name="SucPartnerCustomizationLayout">
+ <attr name="sucFooter" format="reference" />
+ <attr name="sucLayoutFullscreen" format="boolean" />
+ <!-- When set to false, prevents the layout applying partner resource. This attribute is
+ particularly useful when the layout would like to apply their customized attributes.
+ This attribute will be ignored and use partner resource when inside setup wizard flow.
+ The default value is true. -->
+ <attr name="sucUsePartnerResource" format="boolean" />
+ </declare-styleable>
- <declare-styleable name="SucPartnerCustomizationLayout">
- <attr name="sucLayoutFullscreen" format="boolean" />
- <!-- When set to false, prevents the layout applying partner resource. This attribute is
- particularly useful when the layout would like to apply their customized attributes.
- This attribute will be ignored and use partner resource when inside setup wizard flow.
- The default value is true. -->
- <attr name="sucUsePartnerResource" format="boolean" />
- </declare-styleable>
+ <!-- Status bar attributes -->
+ <declare-styleable name="SucStatusBarMixin">
+ <!-- The color for the status bar. For this to take effect,
+ "android:windowDrawsSystemBarBackgrounds" should be set to true and
+ "android:windowTranslucentStatus" should be set to false. Also,
+ View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN should be set to true and
+ android:statusBarColor should be transparent. -->
+ <attr name="sucStatusBarBackground" format="color|reference" />
+ <attr name="sucLightStatusBar" format="boolean" />
+ </declare-styleable>
- <!-- Status bar attributes -->
- <declare-styleable name="SucStatusBarMixin">
- <!-- The color for the status bar. For this to take effect,
- "android:windowDrawsSystemBarBackgrounds" should be set to true and
- "android:windowTranslucentStatus" should be set to false. Also,
- View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN should be set to true and
- android:statusBarColor should be transparent. -->
- <attr name="sucStatusBarBackground" format="color|reference" />
- <attr name="sucLightStatusBar" format="boolean" />
- </declare-styleable>
+ <!-- System navigation bar attributes -->
+ <declare-styleable name="SucSystemNavBarMixin">
+ <!-- The color for the system navigation bar. For this to take effect,
+ "android:windowDrawsSystemBarBackgrounds" should be set to true and
+ "android:windowTranslucentNavigation" should be set to false. -->
+ <attr name="sucSystemNavBarBackgroundColor" format="color" />
+ <attr name="sucLightSystemNavBar" format="boolean" />
+ </declare-styleable>
- <!-- System navigation bar attributes -->
- <declare-styleable name="SucSystemNavBarMixin">
- <!-- The color for the system navigation bar. For this to take effect,
- "android:windowDrawsSystemBarBackgrounds" should be set to true and
- "android:windowTranslucentNavigation" should be set to false. -->
- <attr name="sucSystemNavBarBackgroundColor" format="color" />
- <attr name="sucLightSystemNavBar" format="boolean" />
- </declare-styleable>
+ <!-- FooterButton attributes -->
+ <declare-styleable name="SucFooterButton">
+ <attr name="android:text" />
+ <attr name="android:theme" />
+ <!-- Next value: 9 -->
+ <attr name="sucButtonType">
+ <enum name="other" value="0" />
+ <enum name="add_another" value="1" />
+ <enum name="cancel" value="2" />
+ <enum name="clear" value="3" />
+ <enum name="done" value="4" />
+ <enum name="next" value="5" />
+ <enum name="opt_in" value="6" />
+ <enum name="skip" value="7" />
+ <enum name="stop" value="8" />
+ </attr>
+ </declare-styleable>
- <!-- FooterButton attributes -->
- <declare-styleable name="SucFooterButton">
- <attr name="android:text" />
- <attr name="android:theme" />
- <!-- Next value: 9 -->
- <attr name="sucButtonType">
- <enum name="other" value="0" />
- <enum name="add_another" value="1" />
- <enum name="cancel" value="2" />
- <enum name="clear" value="3" />
- <enum name="done" value="4" />
- <enum name="next" value="5" />
- <enum name="opt_in" value="6" />
- <enum name="skip" value="7" />
- <enum name="stop" value="8" />
- </attr>
- </declare-styleable>
+ <!-- Button of footer attributes -->
+ <declare-styleable name="SucFooterBarMixin">
+ <attr name="sucFooterBarButtonAllCaps" format="boolean" />
+ <attr name="sucFooterBarButtonCornerRadius" format="dimension" />
+ <attr name="sucFooterBarButtonFontFamily" format="string|reference" />
+ <attr name="sucFooterBarPaddingTop" format="dimension" />
+ <attr name="sucFooterBarPaddingBottom" format="dimension" />
+ <attr name="sucFooterBarPrimaryFooterBackground" format="color" />
+ <attr name="sucFooterBarPrimaryFooterButton" format="reference" />
+ <attr name="sucFooterBarSecondaryFooterBackground" format="color" />
+ <attr name="sucFooterBarSecondaryFooterButton" format="reference" />
+ <attr name="sucFooterBarButtonHighlightAlpha" format="float" />
+ <attr name="sucFooterBarButtonColorControlHighlight" format="color" />
+ <attr name="sucFooterBarButtonColorControlHighlightRipple" format="color" />
+ <attr name="sucFooterBarPaddingVertical" format="dimension" />
+ </declare-styleable>
- <!-- Button of footer attributes -->
- <declare-styleable name="SucFooterBarMixin">
- <attr name="sucFooterBarButtonAllCaps" format="boolean" />
- <attr name="sucFooterBarButtonCornerRadius" format="dimension" />
- <attr name="sucFooterBarButtonFontFamily" format="string|reference" />
- <attr name="sucFooterBarPaddingTop" format="dimension" />
- <attr name="sucFooterBarPaddingBottom" format="dimension" />
- <attr name="sucFooterBarPrimaryFooterBackground" format="color" />
- <attr name="sucFooterBarPrimaryFooterButton" format="reference" />
- <attr name="sucFooterBarSecondaryFooterBackground" format="color" />
- <attr name="sucFooterBarSecondaryFooterButton" format="reference" />
- <attr name="sucFooterBarButtonHighlightAlpha" format="float" />
- <attr name="sucFooterBarButtonColorControlHighlight" format="color" />
- <attr name="sucFooterBarButtonColorControlHighlightRipple" format="color" />
- <attr name="sucFooterBarPaddingVertical" format="dimension" />
- </declare-styleable>
+ <declare-styleable name="SucIconMixin">
+ <attr name="android:icon" />
+ </declare-styleable>
- <declare-styleable name="SucIconMixin">
- <attr name="android:icon" />
- </declare-styleable>
-
- <declare-styleable name="SucHeaderMixin">
- <attr name="sucHeaderText" format="string" localization="suggested" />
- <attr name="sucHeaderTextColor" format="reference|color" />
- </declare-styleable>
+ <declare-styleable name="SucHeaderMixin">
+ <attr name="sucHeaderText" format="string" localization="suggested" />
+ <attr name="sucHeaderTextColor" format="reference|color" />
+ </declare-styleable>
</resources>
diff --git a/main/res/values/colors.xml b/main/res/values/colors.xml
index f472b35..db4a877 100644
--- a/main/res/values/colors.xml
+++ b/main/res/values/colors.xml
@@ -17,10 +17,10 @@
<resources>
- <!-- On versions < 23, we cannot reference other theme values in a color resource. Default to
- the framework default of 12% black -->
- <color name="suc_customization_button_highlight_ripple">#1f000000</color>
+ <!-- On versions < 23, we cannot reference other theme values in a color resource. Default to
+ the framework default of 12% black -->
+ <color name="suc_customization_button_highlight_ripple">#1f000000</color>
- <color name="suc_customization_button_highlight_default">#ff1a73e8</color>
+ <color name="suc_customization_button_highlight_default">#ff1a73e8</color>
</resources> \ No newline at end of file
diff --git a/main/res/values/config.xml b/main/res/values/config.xml
index 99bad1c..d5f5aea 100644
--- a/main/res/values/config.xml
+++ b/main/res/values/config.xml
@@ -17,7 +17,7 @@
<resources>
- <!-- ID used with View#setTag to store the original weight on a ButtonBar -->
- <item name="suc_customization_original_weight" type="id" />
+ <!-- ID used with View#setTag to store the original weight on a ButtonBar -->
+ <item name="suc_customization_original_weight" type="id" />
</resources>
diff --git a/main/res/values/dimens.xml b/main/res/values/dimens.xml
index eaffda9..bb860de 100644
--- a/main/res/values/dimens.xml
+++ b/main/res/values/dimens.xml
@@ -17,13 +17,12 @@
<resources>
- <!-- TODO(b/121025996): Remove default values from setup compat, use from theme -->
- <!-- Footer button bar style padding attributes-->
- <dimen name="suc_customization_footer_min_height">72dp</dimen>
- <dimen name="suc_customization_button_margin_start">8dp</dimen>
- <dimen name="suc_customization_button_margin_end">20dp</dimen>
-
- <!-- Footer button style padding attributes -->
- <dimen name="suc_customization_button_padding">16dp</dimen>
+ <!-- TODO(b/121025996): Remove default values from setup compat, use from theme -->
+ <!-- Footer button bar style padding attributes-->
+ <dimen name="suc_customization_footer_min_height">72dp</dimen>
+ <dimen name="suc_customization_button_margin_start">8dp</dimen>
+ <dimen name="suc_customization_button_margin_end">20dp</dimen>
+ <!-- Footer button style padding attributes -->
+ <dimen name="suc_customization_button_padding">16dp</dimen>
</resources>
diff --git a/main/res/values/styles.xml b/main/res/values/styles.xml
index 48fcddf..7d84c55 100644
--- a/main/res/values/styles.xml
+++ b/main/res/values/styles.xml
@@ -17,62 +17,61 @@
<resources xmlns:tools="http://schemas.android.com/tools">
- <!-- Customization footer styles -->
- <style name="SucPartnerCustomizationButtonBar.Stackable" parent="SucPartnerCustomizationButtonBar">
- <item name="android:gravity">center</item>
- </style>
+ <!-- Customization footer styles -->
+ <style name="SucPartnerCustomizationButtonBar.Stackable" parent="SucPartnerCustomizationButtonBar">
+ <item name="android:gravity">center</item>
+ </style>
- <style name="SucPartnerCustomizationButtonBar">
- <item name="android:baselineAligned">false</item>
- <item name="android:clipChildren">false</item>
- <item name="android:clipToPadding">false</item>
- <item name="android:gravity">center_vertical</item>
- <item name="android:minHeight">@dimen/suc_customization_footer_min_height</item>
- <item name="android:orientation">horizontal</item>
- <item name="android:paddingTop">?attr/sucFooterBarPaddingVertical</item>
- <item name="android:paddingBottom">?attr/sucFooterBarPaddingVertical</item>
- <item name="android:paddingEnd" tools:ignore="NewApi">@dimen/suc_customization_button_margin_end</item>
- <item name="android:paddingLeft">@dimen/suc_customization_button_margin_start</item>
- <item name="android:paddingRight">@dimen/suc_customization_button_margin_end</item>
- <item name="android:paddingStart" tools:ignore="NewApi">@dimen/suc_customization_button_margin_start</item>
- </style>
+ <style name="SucPartnerCustomizationButtonBar">
+ <item name="android:baselineAligned">false</item>
+ <item name="android:clipChildren">false</item>
+ <item name="android:clipToPadding">false</item>
+ <item name="android:gravity">center_vertical</item>
+ <item name="android:minHeight">@dimen/suc_customization_footer_min_height</item>
+ <item name="android:orientation">horizontal</item>
+ <item name="android:paddingTop">?attr/sucFooterBarPaddingVertical</item>
+ <item name="android:paddingBottom">?attr/sucFooterBarPaddingVertical</item>
+ <item name="android:paddingEnd" tools:ignore="NewApi">@dimen/suc_customization_button_margin_end</item>
+ <item name="android:paddingLeft">@dimen/suc_customization_button_margin_start</item>
+ <item name="android:paddingRight">@dimen/suc_customization_button_margin_end</item>
+ <item name="android:paddingStart" tools:ignore="NewApi">@dimen/suc_customization_button_margin_start</item>
+ </style>
- <style name="SucPartnerCustomizationButton.Primary" parent="android:Widget.Material.Button.Colored">
- <!-- This style can be applied to a button either as a "style" in XML, or as a theme in
- ContextThemeWrapper. These self-referencing attributes make sure this is applied as
- both to the button. -->
- <item name="android:buttonStyle">@style/SucPartnerCustomizationButton.Primary</item>
- <item name="android:theme">@style/SucPartnerCustomizationButton.Primary</item>
+ <style name="SucPartnerCustomizationButton.Primary" parent="android:Widget.Material.Button.Colored">
+ <!-- This style can be applied to a button either as a "style" in XML, or as a theme in
+ ContextThemeWrapper. These self-referencing attributes make sure this is applied as
+ both to the button. -->
+ <item name="android:buttonStyle">@style/SucPartnerCustomizationButton.Primary</item>
+ <item name="android:theme">@style/SucPartnerCustomizationButton.Primary</item>
- <!-- Values used in styles -->
- <item name="android:fontFamily">?attr/sucFooterBarButtonFontFamily</item>
- <item name="android:paddingLeft">@dimen/suc_customization_button_padding</item>
- <item name="android:paddingRight">@dimen/suc_customization_button_padding</item>
- <item name="android:textAllCaps">?attr/sucFooterBarButtonAllCaps</item>
- <item name="android:stateListAnimator">@null</item>
+ <!-- Values used in styles -->
+ <item name="android:fontFamily">?attr/sucFooterBarButtonFontFamily</item>
+ <item name="android:paddingLeft">@dimen/suc_customization_button_padding</item>
+ <item name="android:paddingRight">@dimen/suc_customization_button_padding</item>
+ <item name="android:textAllCaps">?attr/sucFooterBarButtonAllCaps</item>
- <!-- Values used in themes -->
- <item name="android:buttonCornerRadius" tools:ignore="NewApi">?attr/sucFooterBarButtonCornerRadius</item>
- </style>
+ <!-- Values used in themes -->
+ <item name="android:buttonCornerRadius" tools:ignore="NewApi">?attr/sucFooterBarButtonCornerRadius</item>
+ </style>
- <style name="SucPartnerCustomizationButton.Secondary" parent="android:Widget.Material.Button.Borderless.Colored">
- <!-- This style can be applied to a button either as a "style" in XML, or as a theme in
- ContextThemeWrapper. These self-referencing attributes make sure this is applied as
- both to the button. -->
- <item name="android:buttonStyle">@style/SucPartnerCustomizationButton.Secondary</item>
- <item name="android:theme">@style/SucPartnerCustomizationButton.Secondary</item>
+ <style name="SucPartnerCustomizationButton.Secondary" parent="android:Widget.Material.Button.Borderless.Colored">
+ <!-- This style can be applied to a button either as a "style" in XML, or as a theme in
+ ContextThemeWrapper. These self-referencing attributes make sure this is applied as
+ both to the button. -->
+ <item name="android:buttonStyle">@style/SucPartnerCustomizationButton.Secondary</item>
+ <item name="android:theme">@style/SucPartnerCustomizationButton.Secondary</item>
- <!-- Values used in styles -->
- <item name="android:fontFamily">?attr/sucFooterBarButtonFontFamily</item>
- <item name="android:minWidth">0dp</item>
- <item name="android:paddingLeft">@dimen/suc_customization_button_padding</item>
- <item name="android:paddingRight">@dimen/suc_customization_button_padding</item>
- <item name="android:textAllCaps">?attr/sucFooterBarButtonAllCaps</item>
+ <!-- Values used in styles -->
+ <item name="android:fontFamily">?attr/sucFooterBarButtonFontFamily</item>
+ <item name="android:minWidth">0dp</item>
+ <item name="android:paddingLeft">@dimen/suc_customization_button_padding</item>
+ <item name="android:paddingRight">@dimen/suc_customization_button_padding</item>
+ <item name="android:textAllCaps">?attr/sucFooterBarButtonAllCaps</item>
- <!-- Values used in themes -->
- <item name="android:buttonCornerRadius" tools:ignore="NewApi">?attr/sucFooterBarButtonCornerRadius</item>
- <item name="android:colorControlHighlight" tools:targetApi="lollipop">@color/suc_customization_button_highlight_ripple</item>
- <item name="sucFooterBarButtonColorControlHighlight">@color/suc_customization_button_highlight_ripple</item>
- </style>
+ <!-- Values used in themes -->
+ <item name="android:buttonCornerRadius" tools:ignore="NewApi">?attr/sucFooterBarButtonCornerRadius</item>
+ <item name="android:colorControlHighlight" tools:targetApi="lollipop">@color/suc_customization_button_highlight_ripple</item>
+ <item name="sucFooterBarButtonColorControlHighlight">@color/suc_customization_button_highlight_ripple</item>
+ </style>
</resources>