summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2024-02-02 23:56:53 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2024-02-02 23:56:53 +0000
commit1a707c68aea816f12b3e1cde886ceb6a1f6f758b (patch)
treee465a2eb9fa131221638ce7dd7633329089e526b
parent029871f890f9468e0c95845c48d1c84d8fa53381 (diff)
parentb07899ff0ae407963d9c745cf97c994ca06f8c29 (diff)
downloadsetupdesign-simpleperf-release.tar.gz
Snap for 11400057 from b07899ff0ae407963d9c745cf97c994ca06f8c29 to simpleperf-releasesimpleperf-release
Change-Id: I12272e2efe15d83fb3da65ca1519d63ae284a224
-rw-r--r--Android.bp14
-rw-r--r--lottie_loading_layout/Android.bp2
-rw-r--r--lottie_loading_layout/AndroidManifest.xml4
-rw-r--r--main/src/com/google/android/setupdesign/util/ContentStyler.java16
-rw-r--r--main/src/com/google/android/setupdesign/util/DescriptionStyler.java20
-rw-r--r--main/src/com/google/android/setupdesign/util/HeaderAreaStyler.java6
-rw-r--r--main/src/com/google/android/setupdesign/util/ItemStyler.java20
-rw-r--r--main/src/com/google/android/setupdesign/util/TextViewPartnerStyler.java39
8 files changed, 84 insertions, 37 deletions
diff --git a/Android.bp b/Android.bp
index 3653d5f..6b6bf56 100644
--- a/Android.bp
+++ b/Android.bp
@@ -47,10 +47,13 @@ android_library {
srcs: [
"main/src/**/*.java",
],
- min_sdk_version: "14",
+ min_sdk_version: "19",
optimize: {
proguard_flags_files: ["proguard.flags"],
- }
+ },
+ lint: {
+ baseline_filename: "lint-baseline.xml",
+ },
}
//
@@ -64,6 +67,9 @@ android_library {
resource_dirs: [
"strings/res",
],
- min_sdk_version: "14",
- sdk_version: "current"
+ min_sdk_version: "19",
+ sdk_version: "current",
+ lint: {
+ baseline_filename: "lint-baseline.xml",
+ },
}
diff --git a/lottie_loading_layout/Android.bp b/lottie_loading_layout/Android.bp
index 6d41812..24f2e7e 100644
--- a/lottie_loading_layout/Android.bp
+++ b/lottie_loading_layout/Android.bp
@@ -26,6 +26,6 @@ android_library {
resource_dirs: [
"res",
],
- min_sdk_version: "16",
+ min_sdk_version: "19",
sdk_version: "current"
}
diff --git a/lottie_loading_layout/AndroidManifest.xml b/lottie_loading_layout/AndroidManifest.xml
index 3053930..1b0b77e 100644
--- a/lottie_loading_layout/AndroidManifest.xml
+++ b/lottie_loading_layout/AndroidManifest.xml
@@ -19,7 +19,7 @@
package="com.google.android.setupdesign.lottieloadinglayout">
<uses-sdk
- android:minSdkVersion="14"
- android:targetSdkVersion="32" />
+ android:minSdkVersion="23"
+ android:targetSdkVersion="34" />
</manifest>
diff --git a/main/src/com/google/android/setupdesign/util/ContentStyler.java b/main/src/com/google/android/setupdesign/util/ContentStyler.java
index 5fc1d1c..45d89ec 100644
--- a/main/src/com/google/android/setupdesign/util/ContentStyler.java
+++ b/main/src/com/google/android/setupdesign/util/ContentStyler.java
@@ -53,9 +53,10 @@ public final class ContentStyler {
PartnerConfig.CONFIG_CONTENT_LINK_TEXT_COLOR,
PartnerConfig.CONFIG_CONTENT_TEXT_SIZE,
PartnerConfig.CONFIG_CONTENT_FONT_FAMILY,
+ /* textFontWeightConfig= */ null,
PartnerConfig.CONFIG_DESCRIPTION_LINK_FONT_FAMILY,
- null,
- null,
+ /* textMarginTopConfig= */ null,
+ /* textMarginBottomConfig= */ null,
ContentStyler.getPartnerContentTextGravity(contentText.getContext())));
}
@@ -90,16 +91,17 @@ public final class ContentStyler {
TextViewPartnerStyler.applyPartnerCustomizationStyle(
infoText,
new TextPartnerConfigs(
- null,
- null,
+ /* textColorConfig= */ null,
+ /* textLinkedColorConfig= */ null,
textSizeConfigAvailable ? PartnerConfig.CONFIG_CONTENT_INFO_TEXT_SIZE : null,
fontFamilyConfigAvailable ? PartnerConfig.CONFIG_CONTENT_INFO_FONT_FAMILY : null,
+ /* textFontWeightConfig= */ null,
linkFontFamilyConfigAvailable
? PartnerConfig.CONFIG_DESCRIPTION_LINK_FONT_FAMILY
: null,
- null,
- null,
- 0));
+ /* textMarginTopConfig= */ null,
+ /* textMarginBottomConfig= */ null,
+ /* textGravity= */ 0));
// TODO: Move CONFIG_CONTENT_INFO_LINE_SPACING_EXTRA to TextPartnerConfigs for
// customize
diff --git a/main/src/com/google/android/setupdesign/util/DescriptionStyler.java b/main/src/com/google/android/setupdesign/util/DescriptionStyler.java
index b779bc6..52a2e10 100644
--- a/main/src/com/google/android/setupdesign/util/DescriptionStyler.java
+++ b/main/src/com/google/android/setupdesign/util/DescriptionStyler.java
@@ -41,9 +41,10 @@ public final class DescriptionStyler {
PartnerConfig.CONFIG_DESCRIPTION_LINK_TEXT_COLOR,
PartnerConfig.CONFIG_DESCRIPTION_TEXT_SIZE,
PartnerConfig.CONFIG_DESCRIPTION_FONT_FAMILY,
+ PartnerConfig.CONFIG_DESCRIPTION_FONT_WEIGHT,
PartnerConfig.CONFIG_DESCRIPTION_LINK_FONT_FAMILY,
- null,
- null,
+ /* textMarginTopConfig= */ null,
+ /* textMarginBottomConfig= */ null,
PartnerStyleHelper.getLayoutGravity(description.getContext())));
}
@@ -57,13 +58,14 @@ public final class DescriptionStyler {
TextViewPartnerStyler.applyPartnerCustomizationLightStyle(
description,
new TextPartnerConfigs(
- null,
- null,
- null,
- null,
- null,
- null,
- null,
+ /* textColorConfig= */ null,
+ /* textLinkedColorConfig= */ null,
+ /* textSizeConfig= */ null,
+ /* textFontFamilyConfig= */ null,
+ /* textFontWeightConfig= */ null,
+ /* textLinkFontFamilyConfig= */ null,
+ /* textMarginTopConfig= */ null,
+ /* textMarginBottomConfig= */ null,
PartnerStyleHelper.getLayoutGravity(description.getContext())));
}
diff --git a/main/src/com/google/android/setupdesign/util/HeaderAreaStyler.java b/main/src/com/google/android/setupdesign/util/HeaderAreaStyler.java
index bb1c667..a52101d 100644
--- a/main/src/com/google/android/setupdesign/util/HeaderAreaStyler.java
+++ b/main/src/com/google/android/setupdesign/util/HeaderAreaStyler.java
@@ -70,10 +70,11 @@ public final class HeaderAreaStyler {
header,
new TextPartnerConfigs(
PartnerConfig.CONFIG_HEADER_TEXT_COLOR,
- null,
+ /* textLinkedColorConfig= */ null,
PartnerConfig.CONFIG_HEADER_TEXT_SIZE,
PartnerConfig.CONFIG_HEADER_FONT_FAMILY,
- null,
+ PartnerConfig.CONFIG_HEADER_FONT_WEIGHT,
+ /* textLinkFontFamilyConfig= */ null,
PartnerConfig.CONFIG_HEADER_TEXT_MARGIN_TOP,
PartnerConfig.CONFIG_HEADER_TEXT_MARGIN_BOTTOM,
PartnerStyleHelper.getLayoutGravity(header.getContext())));
@@ -97,6 +98,7 @@ public final class HeaderAreaStyler {
PartnerConfig.CONFIG_DESCRIPTION_LINK_TEXT_COLOR,
PartnerConfig.CONFIG_DESCRIPTION_TEXT_SIZE,
PartnerConfig.CONFIG_DESCRIPTION_FONT_FAMILY,
+ PartnerConfig.CONFIG_DESCRIPTION_FONT_WEIGHT,
PartnerConfig.CONFIG_DESCRIPTION_LINK_FONT_FAMILY,
PartnerConfig.CONFIG_DESCRIPTION_TEXT_MARGIN_TOP,
PartnerConfig.CONFIG_DESCRIPTION_TEXT_MARGIN_BOTTOM,
diff --git a/main/src/com/google/android/setupdesign/util/ItemStyler.java b/main/src/com/google/android/setupdesign/util/ItemStyler.java
index 5dbf0a4..e6d0131 100644
--- a/main/src/com/google/android/setupdesign/util/ItemStyler.java
+++ b/main/src/com/google/android/setupdesign/util/ItemStyler.java
@@ -89,13 +89,14 @@ public final class ItemStyler {
TextViewPartnerStyler.applyPartnerCustomizationStyle(
titleTextView,
new TextPartnerConfigs(
- null,
- null,
+ /* textColorConfig= */ null,
+ /* textLinkedColorConfig= */ null,
PartnerConfig.CONFIG_ITEMS_TITLE_TEXT_SIZE,
PartnerConfig.CONFIG_ITEMS_TITLE_FONT_FAMILY,
- null,
- null,
- null,
+ /* textFontWeightConfig= */ null,
+ /* textLinkFontFamilyConfig= */ null,
+ /* textMarginTopConfig= */ null,
+ /* textMarginBottomConfig= */ null,
PartnerStyleHelper.getLayoutGravity(titleTextView.getContext())));
}
@@ -113,13 +114,14 @@ public final class ItemStyler {
TextViewPartnerStyler.applyPartnerCustomizationStyle(
summaryTextView,
new TextPartnerConfigs(
- null,
- null,
+ /* textColorConfig= */ null,
+ /* textLinkedColorConfig= */ null,
PartnerConfig.CONFIG_ITEMS_SUMMARY_TEXT_SIZE,
PartnerConfig.CONFIG_ITEMS_SUMMARY_FONT_FAMILY,
- null,
+ /* textFontWeightConfig= */ null,
+ /* textLinkFontFamilyConfig= */ null,
PartnerConfig.CONFIG_ITEMS_SUMMARY_MARGIN_TOP,
- null,
+ /* textMarginBottomConfig= */ null,
PartnerStyleHelper.getLayoutGravity(summaryTextView.getContext())));
}
diff --git a/main/src/com/google/android/setupdesign/util/TextViewPartnerStyler.java b/main/src/com/google/android/setupdesign/util/TextViewPartnerStyler.java
index b56d09a..ced6fd4 100644
--- a/main/src/com/google/android/setupdesign/util/TextViewPartnerStyler.java
+++ b/main/src/com/google/android/setupdesign/util/TextViewPartnerStyler.java
@@ -16,6 +16,9 @@
package com.google.android.setupdesign.util;
+import static com.google.android.setupcompat.partnerconfig.PartnerConfigHelper.isFontWeightEnabled;
+
+import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Typeface;
import android.util.TypedValue;
@@ -31,7 +34,11 @@ import com.google.android.setupdesign.view.RichTextView;
/** Helper class to apply partner configurations to a textView. */
final class TextViewPartnerStyler {
+ /** Normal font weight. */
+ private static final int FONT_WEIGHT_NORMAL = 400;
+
/** Applies given partner configurations {@code textPartnerConfigs} to the {@code textView}. */
+ @SuppressLint("NewApi") // Applying partner config should be guarded before Android S
public static void applyPartnerCustomizationStyle(
@NonNull TextView textView, @NonNull TextPartnerConfigs textPartnerConfigs) {
@@ -74,16 +81,35 @@ final class TextViewPartnerStyler {
}
}
+ Typeface fontFamily = null;
if (textPartnerConfigs.getTextFontFamilyConfig() != null
&& PartnerConfigHelper.get(context)
.isPartnerConfigAvailable(textPartnerConfigs.getTextFontFamilyConfig())) {
String fontFamilyName =
PartnerConfigHelper.get(context)
.getString(context, textPartnerConfigs.getTextFontFamilyConfig());
- Typeface font = Typeface.create(fontFamilyName, Typeface.NORMAL);
- if (font != null) {
- textView.setTypeface(font);
+ fontFamily = Typeface.create(fontFamilyName, Typeface.NORMAL);
+ }
+
+ Typeface font;
+ if (isFontWeightEnabled(context)
+ && textPartnerConfigs.getTextFontWeightConfig() != null
+ && PartnerConfigHelper.get(context)
+ .isPartnerConfigAvailable(textPartnerConfigs.getTextFontWeightConfig())) {
+ int weight =
+ PartnerConfigHelper.get(context)
+ .getInteger(
+ context, textPartnerConfigs.getTextFontWeightConfig(), FONT_WEIGHT_NORMAL);
+ if (fontFamily == null) {
+ fontFamily = textView.getTypeface();
}
+ font = Typeface.create(fontFamily, weight, /* italic= */ false);
+ } else {
+ font = fontFamily;
+ }
+
+ if (font != null) {
+ textView.setTypeface(font);
}
if (textView instanceof RichTextView && textPartnerConfigs.getLinkTextFontFamilyConfig() != null
@@ -162,6 +188,7 @@ final class TextViewPartnerStyler {
private final PartnerConfig textLinkedColorConfig;
private final PartnerConfig textSizeConfig;
private final PartnerConfig textFontFamilyConfig;
+ private final PartnerConfig textFontWeightConfig;
private final PartnerConfig textLinkFontFamilyConfig;
private final PartnerConfig textMarginTopConfig;
private final PartnerConfig textMarginBottomConfig;
@@ -172,6 +199,7 @@ final class TextViewPartnerStyler {
@Nullable PartnerConfig textLinkedColorConfig,
@Nullable PartnerConfig textSizeConfig,
@Nullable PartnerConfig textFontFamilyConfig,
+ @Nullable PartnerConfig textFontWeightConfig,
@Nullable PartnerConfig textLinkFontFamilyConfig,
@Nullable PartnerConfig textMarginTopConfig,
@Nullable PartnerConfig textMarginBottomConfig,
@@ -180,6 +208,7 @@ final class TextViewPartnerStyler {
this.textLinkedColorConfig = textLinkedColorConfig;
this.textSizeConfig = textSizeConfig;
this.textFontFamilyConfig = textFontFamilyConfig;
+ this.textFontWeightConfig = textFontWeightConfig;
this.textLinkFontFamilyConfig = textLinkFontFamilyConfig;
this.textMarginTopConfig = textMarginTopConfig;
this.textMarginBottomConfig = textMarginBottomConfig;
@@ -202,6 +231,10 @@ final class TextViewPartnerStyler {
return textFontFamilyConfig;
}
+ public PartnerConfig getTextFontWeightConfig() {
+ return textFontWeightConfig;
+ }
+
public PartnerConfig getLinkTextFontFamilyConfig() {
return textLinkFontFamilyConfig;
}