summaryrefslogtreecommitdiff
path: root/main
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
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')
-rw-r--r--main/res/layout/sud_glif_illustration_loading_screen.xml56
-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
5 files changed, 90 insertions, 4 deletions
diff --git a/main/res/layout/sud_glif_illustration_loading_screen.xml b/main/res/layout/sud_glif_illustration_loading_screen.xml
new file mode 100644
index 0000000..581d5c6
--- /dev/null
+++ b/main/res/layout/sud_glif_illustration_loading_screen.xml
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (C) 2020 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.GlifLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:id="@+id/setup_wizard_layout"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ tools:ignore="UnusedResources">
+ <!-- Ignore UnusedResources: can be used by clients -->
+
+ <LinearLayout
+ android:id="@+id/default_content_container"
+ style="@style/SudContentFrame"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+
+ <TextView
+ android:id="@+id/sud_layout_description"
+ style="@style/SudDescription.Glif"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:visibility="invisible"/>
+
+ <com.google.android.setupdesign.view.FillContentLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="1">
+
+ <com.google.android.setupdesign.view.IllustrationVideoView
+ android:id="@+id/sud_illustration_video_view"
+ style="@style/SudContentIllustration"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" />
+
+ </com.google.android.setupdesign.view.FillContentLayout>
+
+ </LinearLayout>
+
+</com.google.android.setupdesign.GlifLayout>
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");
}
}