Import updated Android Setupdesign Library 248082482
am: 2eb34e37de

Change-Id: Id446c1bc2af0854b4616d818314c8e476d537511
diff --git a/main/src/com/google/android/setupdesign/GlifLayout.java b/main/src/com/google/android/setupdesign/GlifLayout.java
index 26e55d3..67be5d5 100644
--- a/main/src/com/google/android/setupdesign/GlifLayout.java
+++ b/main/src/com/google/android/setupdesign/GlifLayout.java
@@ -161,6 +161,8 @@
         DescriptionStyler.applyPartnerCustomizationStyle(description);
       }
     }
+    getMixin(IconMixin.class).applyPartnerCustomizationStyle();
+    getMixin(HeaderMixin.class).applyPartnerCustomizationStyle();
   }
 
   @Override
diff --git a/main/src/com/google/android/setupdesign/template/HeaderMixin.java b/main/src/com/google/android/setupdesign/template/HeaderMixin.java
index c2ad460..8e573b9 100644
--- a/main/src/com/google/android/setupdesign/template/HeaderMixin.java
+++ b/main/src/com/google/android/setupdesign/template/HeaderMixin.java
@@ -54,7 +54,6 @@
   public HeaderMixin(
       @NonNull TemplateLayout layout, @Nullable AttributeSet attrs, @AttrRes int defStyleAttr) {
     templateLayout = layout;
-    final Context context = layout.getContext();
 
     final TypedArray a =
         layout
@@ -74,55 +73,67 @@
     }
 
     a.recycle();
-
-    TextView header = layout.findManagedViewById(R.id.suc_layout_title);
-    if (header != null
-        && (layout instanceof GlifLayout)
-        && ((GlifLayout) layout).shouldApplyPartnerHeavyThemeResource()) {
-      applyPartnerCustomizationStyle(context, header);
-    }
   }
 
-  public void applyPartnerCustomizationStyle(Context context, TextView header) {
+  /** See {@link #applyPartnerCustomizationStyle(Context, TextView)}. */
+  public void applyPartnerCustomizationStyle() {
+    final Context context = templateLayout.getContext();
+    TextView header = templateLayout.findManagedViewById(R.id.suc_layout_title);
+    applyPartnerCustomizationStyle(context, header);
+  }
 
-    int textColor =
-        PartnerConfigHelper.get(context).getColor(context, PartnerConfig.CONFIG_HEADER_TEXT_COLOR);
-    if (textColor != 0) {
-      setTextColor(valueOf(textColor));
-    }
-
-    float textSize =
-        PartnerConfigHelper.get(context)
-            .getDimension(context, PartnerConfig.CONFIG_HEADER_TEXT_SIZE);
-    if (textSize != 0) {
-      setTextSize(textSize);
-    }
-
-    String fontFamily =
-        PartnerConfigHelper.get(context)
-            .getString(context, PartnerConfig.CONFIG_HEADER_FONT_FAMILY);
-    if (fontFamily != null) {
-      setFontFamily(Typeface.create(fontFamily, Typeface.NORMAL));
-    }
-
-    String gravity =
-        PartnerConfigHelper.get(context).getString(context, PartnerConfig.CONFIG_LAYOUT_GRAVITY);
-    if (gravity != null) {
-      switch (gravity.toLowerCase(Locale.ROOT)) {
-        case "center":
-          setGravity(header, Gravity.CENTER);
-          break;
-        case "start":
-          setGravity(header, Gravity.START);
-          break;
-        default: // fall out
+  /**
+   * Use the given {@code header} to apply heavy theme. If {@link
+   * com.google.android.setupdesign.GlifLayout#shouldApplyPartnerHeavyThemeResource()} is true,
+   * {@code header} can be customized style from partner configuration.
+   *
+   * @param context The context of client activity.
+   * @param header The icon image to use for apply heavy theme.
+   */
+  private void applyPartnerCustomizationStyle(Context context, @Nullable TextView header) {
+    if (header != null
+        && (templateLayout instanceof GlifLayout)
+        && ((GlifLayout) templateLayout).shouldApplyPartnerHeavyThemeResource()) {
+      int textColor =
+          PartnerConfigHelper.get(context)
+              .getColor(context, PartnerConfig.CONFIG_HEADER_TEXT_COLOR);
+      if (textColor != 0) {
+        setTextColor(valueOf(textColor));
       }
-    }
 
-    int color =
-        PartnerConfigHelper.get(context)
-            .getColor(context, PartnerConfig.CONFIG_HEADER_AREA_BACKGROUND_COLOR);
-    setBackgroundColor(color);
+      float textSize =
+          PartnerConfigHelper.get(context)
+              .getDimension(context, PartnerConfig.CONFIG_HEADER_TEXT_SIZE);
+      if (textSize != 0) {
+        setTextSize(textSize);
+      }
+
+      String fontFamily =
+          PartnerConfigHelper.get(context)
+              .getString(context, PartnerConfig.CONFIG_HEADER_FONT_FAMILY);
+      if (fontFamily != null) {
+        setFontFamily(Typeface.create(fontFamily, Typeface.NORMAL));
+      }
+
+      String gravity =
+          PartnerConfigHelper.get(context).getString(context, PartnerConfig.CONFIG_LAYOUT_GRAVITY);
+      if (gravity != null) {
+        switch (gravity.toLowerCase(Locale.ROOT)) {
+          case "center":
+            setGravity(header, Gravity.CENTER);
+            break;
+          case "start":
+            setGravity(header, Gravity.START);
+            break;
+          default: // fall out
+        }
+      }
+
+      int color =
+          PartnerConfigHelper.get(context)
+              .getColor(context, PartnerConfig.CONFIG_HEADER_AREA_BACKGROUND_COLOR);
+      setBackgroundColor(color);
+    }
   }
 
   /** @return The TextView displaying the header. */
diff --git a/main/src/com/google/android/setupdesign/template/IconMixin.java b/main/src/com/google/android/setupdesign/template/IconMixin.java
index 334d473..cfc498d 100644
--- a/main/src/com/google/android/setupdesign/template/IconMixin.java
+++ b/main/src/com/google/android/setupdesign/template/IconMixin.java
@@ -24,6 +24,7 @@
 import android.os.Build.VERSION_CODES;
 import androidx.annotation.ColorInt;
 import androidx.annotation.DrawableRes;
+import androidx.annotation.Nullable;
 import android.util.AttributeSet;
 import android.view.View;
 import android.view.ViewGroup.LayoutParams;
@@ -83,19 +84,31 @@
     }
 
     a.recycle();
-
-    ImageView iconImage = layout.findManagedViewById(R.id.sud_layout_icon);
-    if (iconImage != null
-        && (layout instanceof GlifLayout)
-        && ((GlifLayout) layout).shouldApplyPartnerHeavyThemeResource()) {
-      applyPartnerCustomizationStyle(context, iconImage);
-    }
   }
 
-  public void applyPartnerCustomizationStyle(Context context, ImageView iconImage) {
-    int gravity = PartnerStyleHelper.getLayoutGravity(context);
-    if (gravity != 0) {
-      setGravity(iconImage, gravity);
+  /** See {@link #applyPartnerCustomizationStyle(Context, ImageView)}. */
+  public void applyPartnerCustomizationStyle() {
+    final Context context = templateLayout.getContext();
+    final ImageView iconImage = templateLayout.findManagedViewById(R.id.sud_layout_icon);
+    applyPartnerCustomizationStyle(context, iconImage);
+  }
+
+  /**
+   * Use the given {@code iconImage} to apply heavy theme. If {@link
+   * com.google.android.setupdesign.GlifLayout#shouldApplyPartnerHeavyThemeResource()} is true,
+   * {@code iconImage} can be customized style from partner configuration.
+   *
+   * @param context The context of client activity.
+   * @param iconImage The icon image to use for apply heavy theme.
+   */
+  private void applyPartnerCustomizationStyle(Context context, @Nullable ImageView iconImage) {
+    if (iconImage != null
+        && (templateLayout instanceof GlifLayout)
+        && ((GlifLayout) templateLayout).shouldApplyPartnerHeavyThemeResource()) {
+      int gravity = PartnerStyleHelper.getLayoutGravity(context);
+      if (gravity != 0) {
+        setGravity(iconImage, gravity);
+      }
     }
   }