Revert "Revert "Import updated Android Setupdesign Library 230837776""

This reverts commit ccfe71e70678ac6aaa287a25a0d4eef15d565691.

Reason for revert: Roll forward

Change-Id: I825293f47a74a823261415f27260485c6743a973
diff --git a/main/AndroidManifest.xml b/main/AndroidManifest.xml
index 3728a52..73a3a78 100644
--- a/main/AndroidManifest.xml
+++ b/main/AndroidManifest.xml
@@ -18,6 +18,8 @@
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
     package="com.google.android.setupdesign">
 
-  <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="28" />
+    <uses-sdk
+        android:minSdkVersion="14"
+        android:targetSdkVersion="28" />
 
 </manifest>
diff --git a/main/res/layout/sud_glif_footer_button_bar.xml b/main/res/layout/sud_glif_footer_button_bar.xml
deleted file mode 100644
index e0a796d..0000000
--- a/main/res/layout/sud_glif_footer_button_bar.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-    Copyright (C) 2017 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.
--->
-
-<com.google.android.setupdesign.view.ButtonBarLayout
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    android:id="@+id/sud_footer_button_bar"
-    style="@style/SudGlifButtonBar.Stackable"
-    android:layout_width="match_parent"
-    android:layout_height="wrap_content" />
diff --git a/main/res/layout/sud_glif_preference_template_header.xml b/main/res/layout/sud_glif_preference_template_header.xml
deleted file mode 100644
index d736392..0000000
--- a/main/res/layout/sud_glif_preference_template_header.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-    Copyright (C) 2016 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.
--->
-
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:tools="http://schemas.android.com/tools"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:orientation="vertical"
-    tools:ignore="UnusedResources">
-    <!-- Ignore UnusedResources: can be used by clients -->
-
-    <FrameLayout
-        android:id="@+id/sud_layout_content"
-        android:layout_width="match_parent"
-        android:layout_height="0dp"
-        android:layout_weight="1" />
-
-    <com.google.android.setupdesign.view.NavigationBar
-        android:id="@+id/sud_layout_navigation_bar"
-        style="@style/SudNavBarTheme"
-        android:layout_width="match_parent"
-        android:layout_height="@dimen/sud_navbar_height" />
-
-</LinearLayout>
diff --git a/main/res/layout/sud_no_scroll_template_header_collapsed.xml b/main/res/layout/sud_no_scroll_template_header_collapsed.xml
index af50e0a..db78a01 100644
--- a/main/res/layout/sud_no_scroll_template_header_collapsed.xml
+++ b/main/res/layout/sud_no_scroll_template_header_collapsed.xml
@@ -42,7 +42,8 @@
 
     <include layout="@layout/sud_progress_bar_stub" />
 
-    <FrameLayout android:id="@+id/sud_layout_content"
+    <FrameLayout
+        android:id="@+id/sud_layout_content"
         android:layout_width="match_parent"
         android:layout_height="0dp"
         android:layout_weight="1" />
diff --git a/main/res/layout/sud_recycler_template_header_collapsed.xml b/main/res/layout/sud_recycler_template_header_collapsed.xml
index 3aecacb..44432a0 100644
--- a/main/res/layout/sud_recycler_template_header_collapsed.xml
+++ b/main/res/layout/sud_recycler_template_header_collapsed.xml
@@ -50,7 +50,8 @@
             android:layout_height="match_parent"
             android:scrollbars="vertical" />
 
-        <FrameLayout android:id="@+id/sud_layout_content"
+        <FrameLayout
+            android:id="@+id/sud_layout_content"
             android:layout_width="match_parent"
             android:layout_height="match_parent" />
 
diff --git a/main/res/layout/sud_template_card_wide.xml b/main/res/layout/sud_template_card_wide.xml
index 3b57da2..92700cb 100644
--- a/main/res/layout/sud_template_card_wide.xml
+++ b/main/res/layout/sud_template_card_wide.xml
@@ -56,7 +56,8 @@
                     android:layout_height="match_parent"
                     android:fillViewport="true">
 
-                    <FrameLayout android:id="@+id/sud_layout_content"
+                    <FrameLayout
+                        android:id="@+id/sud_layout_content"
                         android:layout_width="match_parent"
                         android:layout_height="wrap_content"
                         android:clipChildren="false" />
diff --git a/main/res/layout/sud_template_header_collapsed.xml b/main/res/layout/sud_template_header_collapsed.xml
index 420df04..edceed1 100644
--- a/main/res/layout/sud_template_header_collapsed.xml
+++ b/main/res/layout/sud_template_header_collapsed.xml
@@ -53,7 +53,8 @@
         android:layout_weight="1"
         android:fillViewport="true">
 
-        <FrameLayout android:id="@+id/sud_layout_content"
+        <FrameLayout
+            android:id="@+id/sud_layout_content"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:clipChildren="false" />
diff --git a/main/res/values/config.xml b/main/res/values/config.xml
index 4847358..daa00d3 100644
--- a/main/res/values/config.xml
+++ b/main/res/values/config.xml
@@ -23,10 +23,6 @@
     <!-- Whether to use tablet layout -->
     <bool name="sudUseTabletLayout">false</bool>
 
-    <!-- ID used with setTag(int, Object) to store the original weight of a view inside
-         ButtonBarLayout -->
-    <item name="sud_original_weight" type="id" />
-
     <!-- Secondary font for use with headings, title, and other non-body text -->
     <string name="sudFontSecondary" translatable="false">google-sans</string>
     <string name="sudFontSecondaryMedium" translatable="false">google-sans-medium</string>
diff --git a/main/res/values/styles.xml b/main/res/values/styles.xml
index 7711dd4..b0a3c0c 100644
--- a/main/res/values/styles.xml
+++ b/main/res/values/styles.xml
@@ -437,6 +437,7 @@
         <item name="android:paddingRight">@dimen/sud_glif_button_padding</item>
         <item name="android:textAllCaps" tools:targetApi="ice_cream_sandwich">?attr/sudButtonAllCaps</item>
         <item name="textAllCaps">?attr/sudButtonAllCaps</item>
+        <item name="android:stateListAnimator">@null</item>
 
         <!-- Values used in themes -->
         <item name="android:buttonCornerRadius" tools:ignore="NewApi">?attr/sudButtonCornerRadius</item>
diff --git a/main/src/com/google/android/setupdesign/SetupWizardLayout.java b/main/src/com/google/android/setupdesign/SetupWizardLayout.java
index 28df4fc..35752cd 100644
--- a/main/src/com/google/android/setupdesign/SetupWizardLayout.java
+++ b/main/src/com/google/android/setupdesign/SetupWizardLayout.java
@@ -38,7 +38,7 @@
 import android.view.ViewGroup;
 import android.widget.ScrollView;
 import android.widget.TextView;
-import com.google.android.setupcompat.TemplateLayout;
+import com.google.android.setupcompat.internal.TemplateLayout;
 import com.google.android.setupcompat.template.HeaderMixin;
 import com.google.android.setupdesign.template.NavigationBarMixin;
 import com.google.android.setupdesign.template.ProgressBarMixin;
diff --git a/main/src/com/google/android/setupdesign/template/ListMixin.java b/main/src/com/google/android/setupdesign/template/ListMixin.java
index 012fb86..6e2cb20 100644
--- a/main/src/com/google/android/setupdesign/template/ListMixin.java
+++ b/main/src/com/google/android/setupdesign/template/ListMixin.java
@@ -29,7 +29,7 @@
 import android.widget.HeaderViewListAdapter;
 import android.widget.ListAdapter;
 import android.widget.ListView;
-import com.google.android.setupcompat.TemplateLayout;
+import com.google.android.setupcompat.internal.TemplateLayout;
 import com.google.android.setupcompat.template.Mixin;
 import com.google.android.setupdesign.R;
 import com.google.android.setupdesign.items.ItemAdapter;
diff --git a/main/src/com/google/android/setupdesign/template/NavigationBarMixin.java b/main/src/com/google/android/setupdesign/template/NavigationBarMixin.java
index 3ef9a34..286ebf1 100644
--- a/main/src/com/google/android/setupdesign/template/NavigationBarMixin.java
+++ b/main/src/com/google/android/setupdesign/template/NavigationBarMixin.java
@@ -17,7 +17,7 @@
 package com.google.android.setupdesign.template;
 
 import android.view.View;
-import com.google.android.setupcompat.TemplateLayout;
+import com.google.android.setupcompat.internal.TemplateLayout;
 import com.google.android.setupcompat.template.Mixin;
 import com.google.android.setupdesign.R;
 import com.google.android.setupdesign.view.NavigationBar;
diff --git a/main/src/com/google/android/setupdesign/template/ProgressBarMixin.java b/main/src/com/google/android/setupdesign/template/ProgressBarMixin.java
index 717fd57..7e55d51 100644
--- a/main/src/com/google/android/setupdesign/template/ProgressBarMixin.java
+++ b/main/src/com/google/android/setupdesign/template/ProgressBarMixin.java
@@ -23,7 +23,7 @@
 import android.view.View;
 import android.view.ViewStub;
 import android.widget.ProgressBar;
-import com.google.android.setupcompat.TemplateLayout;
+import com.google.android.setupcompat.internal.TemplateLayout;
 import com.google.android.setupcompat.template.Mixin;
 import com.google.android.setupdesign.R;
 
diff --git a/main/src/com/google/android/setupdesign/template/RecyclerMixin.java b/main/src/com/google/android/setupdesign/template/RecyclerMixin.java
index e523dbc..1432a44 100644
--- a/main/src/com/google/android/setupdesign/template/RecyclerMixin.java
+++ b/main/src/com/google/android/setupdesign/template/RecyclerMixin.java
@@ -29,7 +29,7 @@
 import androidx.recyclerview.widget.RecyclerView.ViewHolder;
 import android.util.AttributeSet;
 import android.view.View;
-import com.google.android.setupcompat.TemplateLayout;
+import com.google.android.setupcompat.internal.TemplateLayout;
 import com.google.android.setupcompat.template.Mixin;
 import com.google.android.setupdesign.DividerItemDecoration;
 import com.google.android.setupdesign.R;
diff --git a/main/src/com/google/android/setupdesign/template/RequireScrollMixin.java b/main/src/com/google/android/setupdesign/template/RequireScrollMixin.java
index 7b14990..f1c7cbe 100644
--- a/main/src/com/google/android/setupdesign/template/RequireScrollMixin.java
+++ b/main/src/com/google/android/setupdesign/template/RequireScrollMixin.java
@@ -25,7 +25,7 @@
 import android.view.View;
 import android.view.View.OnClickListener;
 import android.widget.Button;
-import com.google.android.setupcompat.TemplateLayout;
+import com.google.android.setupcompat.internal.TemplateLayout;
 import com.google.android.setupcompat.template.FooterButton;
 import com.google.android.setupcompat.template.Mixin;
 import com.google.android.setupdesign.view.NavigationBar;
diff --git a/main/src/com/google/android/setupdesign/view/ButtonBarLayout.java b/main/src/com/google/android/setupdesign/view/ButtonBarLayout.java
deleted file mode 100644
index c3188f2..0000000
--- a/main/src/com/google/android/setupdesign/view/ButtonBarLayout.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Copyright (C) 2017 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.setupdesign.view;
-
-import android.content.Context;
-import android.util.AttributeSet;
-import android.view.View;
-import android.widget.LinearLayout;
-import com.google.android.setupdesign.R;
-
-/**
- * An extension of LinearLayout that automatically switches to vertical orientation when it can't
- * fit its child views horizontally.
- *
- * <p>Modified from {@code com.android.internal.widget.ButtonBarLayout}
- */
-public class ButtonBarLayout extends LinearLayout {
-
-  private boolean stacked = false;
-  private int originalPaddingLeft;
-  private int originalPaddingRight;
-
-  public ButtonBarLayout(Context context) {
-    super(context);
-  }
-
-  public ButtonBarLayout(Context context, AttributeSet attrs) {
-    super(context, attrs);
-  }
-
-  @Override
-  protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
-    final int widthSize = MeasureSpec.getSize(widthMeasureSpec);
-
-    setStacked(false);
-
-    boolean needsRemeasure = false;
-
-    int initialWidthMeasureSpec = widthMeasureSpec;
-    if (MeasureSpec.getMode(widthMeasureSpec) == MeasureSpec.EXACTLY) {
-      // Measure with WRAP_CONTENT, so that we can compare the measured size with the
-      // available size to see if we need to stack.
-      initialWidthMeasureSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
-
-      // We'll need to remeasure again to fill excess space.
-      needsRemeasure = true;
-    }
-
-    super.onMeasure(initialWidthMeasureSpec, heightMeasureSpec);
-
-    if (getMeasuredWidth() > widthSize) {
-      setStacked(true);
-
-      // Measure again in the new orientation.
-      needsRemeasure = true;
-    }
-
-    if (needsRemeasure) {
-      super.onMeasure(widthMeasureSpec, heightMeasureSpec);
-    }
-  }
-
-  private void setStacked(boolean stacked) {
-    if (this.stacked == stacked) {
-      return;
-    }
-    this.stacked = stacked;
-    int childCount = getChildCount();
-    for (int i = 0; i < childCount; i++) {
-      View child = getChildAt(i);
-      LayoutParams childParams = (LayoutParams) child.getLayoutParams();
-      if (stacked) {
-        child.setTag(R.id.sud_original_weight, childParams.weight);
-        childParams.weight = 0;
-      } else {
-        Float weight = (Float) child.getTag(R.id.sud_original_weight);
-        if (weight != null) {
-          childParams.weight = weight;
-        }
-      }
-      child.setLayoutParams(childParams);
-    }
-
-    setOrientation(stacked ? LinearLayout.VERTICAL : LinearLayout.HORIZONTAL);
-
-    // Reverse the child order, so that the primary button is towards the top when vertical
-    for (int i = childCount - 1; i >= 0; i--) {
-      bringChildToFront(getChildAt(i));
-    }
-
-    if (stacked) {
-      // HACK: In the default button bar style, the left and right paddings are not
-      // balanced to compensate for different alignment for borderless (left) button and
-      // the raised (right) button. When it's stacked, we want the buttons to be centered,
-      // so we balance out the paddings here.
-      originalPaddingLeft = getPaddingLeft();
-      originalPaddingRight = getPaddingRight();
-      int paddingHorizontal = Math.max(originalPaddingLeft, originalPaddingRight);
-      setPadding(paddingHorizontal, getPaddingTop(), paddingHorizontal, getPaddingBottom());
-    } else {
-      setPadding(originalPaddingLeft, getPaddingTop(), originalPaddingRight, getPaddingBottom());
-    }
-  }
-}
diff --git a/strings/AndroidManifest.xml b/strings/AndroidManifest.xml
index f278f6c..e8316f3 100644
--- a/strings/AndroidManifest.xml
+++ b/strings/AndroidManifest.xml
@@ -18,6 +18,8 @@
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
     package="com.google.android.setupdesign.strings">
 
-  <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="28" />
+    <uses-sdk
+        android:minSdkVersion="14"
+        android:targetSdkVersion="28" />
 
 </manifest>