summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSetup Wizard Team <android-setup-team-eng@google.com>2022-05-23 12:38:26 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2022-05-23 12:38:26 +0000
commit1bbb24c5c08ce4067b4c2c4ff3a8103a7c865fe5 (patch)
treee94f2f0f46cd6d06fc62643eaf5c64bbb8a7cea7
parent41058490e00b6eaf70fc4ddbb0e8217f5ac5ae30 (diff)
parentff7d0e40d00ad15f6015105274dd9d186a3a4ed8 (diff)
downloadsetupcompat-1bbb24c5c08ce4067b4c2c4ff3a8103a7c865fe5.tar.gz
Import updated Android SetupCompat Library 447928644 am: 3c778d5d37 am: ff7d0e40d0
Original change: https://googleplex-android-review.googlesource.com/c/platform/external/setupcompat/+/17956849 Change-Id: I009feda57884818a5ed3952d70b11944fb722b0e Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--main/java/com/google/android/setupcompat/template/FooterBarMixin.java29
-rw-r--r--main/java/com/google/android/setupcompat/util/BuildCompatUtils.java4
2 files changed, 26 insertions, 7 deletions
diff --git a/main/java/com/google/android/setupcompat/template/FooterBarMixin.java b/main/java/com/google/android/setupcompat/template/FooterBarMixin.java
index 4d78955..4d2a0c9 100644
--- a/main/java/com/google/android/setupcompat/template/FooterBarMixin.java
+++ b/main/java/com/google/android/setupcompat/template/FooterBarMixin.java
@@ -33,6 +33,7 @@ import android.view.ContextThemeWrapper;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
+import android.view.ViewGroup;
import android.view.ViewStub;
import android.widget.Button;
import android.widget.LinearLayout;
@@ -536,13 +537,12 @@ public class FooterBarMixin implements Mixin {
buttonContainer.addView(tempPrimaryButton);
}
- if (isEvenlyWeightedButtons) {
- setEvenlyWeightedButtons(tempPrimaryButton, tempSecondaryButton);
- }
+ setEvenlyWeightedButtons(tempPrimaryButton, tempSecondaryButton, isEvenlyWeightedButtons);
}
- private void setEvenlyWeightedButtons(Button primaryButton, Button secondaryButton) {
- if (primaryButton != null && secondaryButton != null) {
+ private void setEvenlyWeightedButtons(
+ Button primaryButton, Button secondaryButton, boolean isEvenlyWeighted) {
+ if (primaryButton != null && secondaryButton != null && isEvenlyWeighted) {
primaryButton.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
int primaryButtonMeasuredWidth = primaryButton.getMeasuredWidth();
secondaryButton.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
@@ -552,6 +552,25 @@ public class FooterBarMixin implements Mixin {
primaryButton.getLayoutParams().width = maxButtonMeasureWidth;
secondaryButton.getLayoutParams().width = maxButtonMeasureWidth;
+ } else {
+ if (primaryButton != null) {
+ LinearLayout.LayoutParams primaryLayoutParams =
+ (LinearLayout.LayoutParams) primaryButton.getLayoutParams();
+ if (null != primaryLayoutParams) {
+ primaryLayoutParams.width = ViewGroup.LayoutParams.WRAP_CONTENT;
+ primaryLayoutParams.weight = 0;
+ primaryButton.setLayoutParams(primaryLayoutParams);
+ }
+ }
+ if (secondaryButton != null) {
+ LinearLayout.LayoutParams secondaryLayoutParams =
+ (LinearLayout.LayoutParams) secondaryButton.getLayoutParams();
+ if (null != secondaryLayoutParams) {
+ secondaryLayoutParams.width = ViewGroup.LayoutParams.WRAP_CONTENT;
+ secondaryLayoutParams.weight = 0;
+ secondaryButton.setLayoutParams(secondaryLayoutParams);
+ }
+ }
}
}
diff --git a/main/java/com/google/android/setupcompat/util/BuildCompatUtils.java b/main/java/com/google/android/setupcompat/util/BuildCompatUtils.java
index 8fa862f..3c4e2a2 100644
--- a/main/java/com/google/android/setupcompat/util/BuildCompatUtils.java
+++ b/main/java/com/google/android/setupcompat/util/BuildCompatUtils.java
@@ -72,8 +72,8 @@ public final class BuildCompatUtils {
* @return Whether the current OS version is higher or equal to T.
*/
public static boolean isAtLeastT() {
- if (!isAtLeastS()) {
- return false;
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
+ return true;
}
return (Build.VERSION.CODENAME.equals("REL") && Build.VERSION.SDK_INT >= 33)
|| (Build.VERSION.CODENAME.length() == 1