summaryrefslogtreecommitdiff
path: root/main/src
diff options
context:
space:
mode:
authorSetup Wizard Team <android-setup-team-eng@google.com>2020-05-05 10:02:57 +0800
committerCating Lin <catinglin@google.com>2020-05-07 03:26:45 +0000
commitd520f469f449f64cab202d160fd3c35d6c8f54f7 (patch)
tree7569d0e863d201856867b4943d5a3d87b036db2e /main/src
parent0564078669999e2e240c9a5ca55e7cd5c28a7e04 (diff)
downloadsetupdesign-d520f469f449f64cab202d160fd3c35d6c8f54f7.tar.gz
Import updated Android Setupdesign Library 309863724
Copied from google3/third_party/java_src/android_libs/setupdesign Test: mm Bug: 155846468 Included changes: - 309863724 Fine tuning the progress illustration for better ux exper... - 308970672 Add description field for illustration_loading_screen lay... - 306581820 Support PartnerResource to customize packages to recipien... - 306566965 New progress illustration layout and related partner conf... - 305382237 Lower log level to prevent crash PiperOrigin-RevId: 309863724 Change-Id: I1820bd33788ab637f974ba7350d5d389271abcf8
Diffstat (limited to 'main/src')
-rw-r--r--main/src/com/google/android/setupdesign/template/HeaderMixin.java8
-rw-r--r--main/src/com/google/android/setupdesign/template/IconMixin.java8
-rw-r--r--main/src/com/google/android/setupdesign/util/Partner.java18
-rw-r--r--main/src/com/google/android/setupdesign/view/IllustrationVideoView.java4
4 files changed, 34 insertions, 4 deletions
diff --git a/main/src/com/google/android/setupdesign/template/HeaderMixin.java b/main/src/com/google/android/setupdesign/template/HeaderMixin.java
index ef14d29..0a6eb9e 100644
--- a/main/src/com/google/android/setupdesign/template/HeaderMixin.java
+++ b/main/src/com/google/android/setupdesign/template/HeaderMixin.java
@@ -121,6 +121,14 @@ public class HeaderMixin implements Mixin {
return titleView != null ? titleView.getText() : null;
}
+ /** Sets the visibility of header text */
+ public void setVisibility(int visibility) {
+ final TextView titleView = getTextView();
+ if (titleView != null) {
+ titleView.setVisibility(visibility);
+ }
+ }
+
/**
* Sets the color of the header text. This can also be set via XML using {@code
* app:sucHeaderTextColor}.
diff --git a/main/src/com/google/android/setupdesign/template/IconMixin.java b/main/src/com/google/android/setupdesign/template/IconMixin.java
index f74f87a..dca934f 100644
--- a/main/src/com/google/android/setupdesign/template/IconMixin.java
+++ b/main/src/com/google/android/setupdesign/template/IconMixin.java
@@ -172,6 +172,14 @@ public class IconMixin implements Mixin {
return iconView != null ? iconView.getContentDescription() : null;
}
+ /** Sets the visibiltiy of the icon view */
+ public void setVisibility(int visibility) {
+ final ImageView iconView = getView();
+ if (iconView != null) {
+ iconView.setVisibility(visibility);
+ }
+ }
+
/** @return The ImageView responsible for displaying the icon. */
protected ImageView getView() {
return (ImageView) templateLayout.findManagedViewById(R.id.sud_layout_icon);
diff --git a/main/src/com/google/android/setupdesign/util/Partner.java b/main/src/com/google/android/setupdesign/util/Partner.java
index 6b97bf6..aee5070 100644
--- a/main/src/com/google/android/setupdesign/util/Partner.java
+++ b/main/src/com/google/android/setupdesign/util/Partner.java
@@ -27,13 +27,17 @@ import android.graphics.drawable.Drawable;
import android.os.Build.VERSION;
import android.os.Build.VERSION_CODES;
import androidx.annotation.AnyRes;
+import androidx.annotation.ArrayRes;
import androidx.annotation.ColorRes;
import androidx.annotation.DrawableRes;
import androidx.annotation.Nullable;
import androidx.annotation.StringRes;
import androidx.annotation.VisibleForTesting;
import android.util.Log;
+import java.util.Arrays;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
/**
* Utilities to discover and interact with partner customizations. An overlay package is one that
@@ -55,10 +59,20 @@ public class Partner {
@Nullable private static Partner partner;
/**
+ * Gets the string-array from partner overlay. If not available, an empty array will be returned.
+ *
+ * @see #getResourceEntry(Context, int)
+ */
+ public static Set<String> getStringArray(Context context, @ArrayRes int res) {
+ ResourceEntry resourceEntry = Partner.getResourceEntry(context, res);
+ return new HashSet<>(Arrays.asList(resourceEntry.resources.getStringArray(resourceEntry.id)));
+ }
+
+ /**
* Gets a drawable from partner overlay, or if not available, the drawable from the original
* context.
*
- * @see #getResourceEntry(android.content.Context, int)
+ * @see #getResourceEntry(Context, int)
*/
public static Drawable getDrawable(Context context, @DrawableRes int id) {
final ResourceEntry entry = getResourceEntry(context, id);
@@ -68,7 +82,7 @@ public class Partner {
/**
* Gets a string from partner overlay, or if not available, the string from the original context.
*
- * @see #getResourceEntry(android.content.Context, int)
+ * @see #getResourceEntry(Context, int)
*/
public static String getString(Context context, @StringRes int id) {
final ResourceEntry entry = getResourceEntry(context, id);
diff --git a/main/src/com/google/android/setupdesign/view/IllustrationVideoView.java b/main/src/com/google/android/setupdesign/view/IllustrationVideoView.java
index 939b8de..0654b02 100644
--- a/main/src/com/google/android/setupdesign/view/IllustrationVideoView.java
+++ b/main/src/com/google/android/setupdesign/view/IllustrationVideoView.java
@@ -188,7 +188,7 @@ public class IllustrationVideoView extends TextureView
mediaPlayer.setDataSource(getContext(), uri, null);
mediaPlayer.prepareAsync();
} catch (IOException e) {
- Log.wtf(TAG, "Unable to set data source", e);
+ Log.e(TAG, "Unable to set video data source: " + videoRes, e);
}
}
@@ -350,7 +350,7 @@ public class IllustrationVideoView extends TextureView
if (isPrepared()) {
mp.start();
} else {
- Log.wtf(TAG, "Seek complete but media player not prepared");
+ Log.e(TAG, "Seek complete but media player not prepared");
}
}