summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaurice Lam <yukl@google.com>2017-12-05 12:36:57 -0800
committerMaurice Lam <yukl@google.com>2017-12-11 14:18:08 -0800
commitceea5ff728985c6a43c7c6de61ed2b7f530db483 (patch)
treee54d32a600c19a28cde1e1bb5185ae5f85ff05fe
parent9c763452d4b9ae8d51268031046179c40b8ca74d (diff)
downloadsetupwizard-ceea5ff728985c6a43c7c6de61ed2b7f530db483.tar.gz
Implement new XL Progress bar
For screens without much content, the new style is to use an extra large progress bar (same size as illustration). Bug: 63074068 Test: ./gradlew test Change-Id: If139e8eeb555cc684ce43a91524ad2da00b7dc93
-rw-r--r--library/gingerbread/res/values/styles.xml7
-rw-r--r--library/main/res/drawable-v21/suw_fourcolor_progress_bar.xml194
-rw-r--r--library/main/res/layout/suw_glif_loading_screen.xml40
-rw-r--r--library/main/res/values-v11/styles.xml22
-rw-r--r--library/main/res/values-v21/styles.xml10
-rw-r--r--library/test/robotest/src/com/android/setupwizardlib/util/GlifStyleTest.java11
6 files changed, 284 insertions, 0 deletions
diff --git a/library/gingerbread/res/values/styles.xml b/library/gingerbread/res/values/styles.xml
index b510f75..1653938 100644
--- a/library/gingerbread/res/values/styles.xml
+++ b/library/gingerbread/res/values/styles.xml
@@ -246,6 +246,13 @@
<item name="android:background">?attr/colorPrimary</item>
</style>
+ <style name="SuwBase.ProgressBarLarge" parent="@android:style/Widget.ProgressBar.Large" />
+
+ <style name="SuwGmIndeterminateProgressBar" parent="SuwBase.ProgressBarLarge">
+ <item name="android:layout_gravity">center</item>
+ <item name="android:indeterminate">true</item>
+ </style>
+
<!-- Navigation bar styles -->
<style name="SuwNavBarButtonStyle" parent="@android:style/Widget.Button">
diff --git a/library/main/res/drawable-v21/suw_fourcolor_progress_bar.xml b/library/main/res/drawable-v21/suw_fourcolor_progress_bar.xml
new file mode 100644
index 0000000..2ac35ee
--- /dev/null
+++ b/library/main/res/drawable-v21/suw_fourcolor_progress_bar.xml
@@ -0,0 +1,194 @@
+<?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.
+-->
+
+
+<!-- Asset for 4 color indeterminate progress bar, which is a ring with 4 shades of blue -->
+<animated-vector xmlns:aapt="http://schemas.android.com/aapt"
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ tools:ignore="MissingPrefix">
+ <!-- Ignore MissingPrefix: aapt:attr tags take the name attribute without "android:" prefix -->
+ <!-- TODO(yukl): Update to a newer version of lint which properly handles this case -->
+ <aapt:attr name="android:drawable">
+ <vector android:width="823dp" android:height="823dp" android:viewportHeight="823"
+ android:viewportWidth="823">
+ <group android:name="blue1" android:translateX="411.5" android:translateY="411.5">
+ <path android:name="blue1_path"
+ android:pathData="M0 -395 C218,-395 395,-218 395,0 C395,218 218,395 0,395 C-218,395 -395,218 -395,0 C-395,-218 -218,-395 0,-395c "
+ android:strokeAlpha="1" android:strokeColor="#4688f1"
+ android:strokeLineCap="round" android:strokeLineJoin="round"
+ android:strokeWidth="27" />
+ </group>
+ <group android:name="blue2" android:translateX="411.5" android:translateY="411.5">
+ <path android:name="blue2_path"
+ android:pathData=" M0 -395 C218,-395 395,-218 395,0 C395,218 218,395 0,395 C-218,395 -395,218 -395,0 C-395,-218 -218,-395 0,-395c "
+ android:strokeAlpha="1" android:strokeColor="#7dacf4"
+ android:strokeLineCap="round" android:strokeLineJoin="round"
+ android:strokeWidth="28" />
+ </group>
+ <group android:name="blue3" android:translateX="411.5" android:translateY="411.5">
+ <path android:name="blue3_path"
+ android:pathData=" M0 -395 C218,-395 395,-218 395,0 C395,218 218,395 0,395 C-218,395 -395,218 -395,0 C-395,-218 -218,-395 0,-395c "
+ android:strokeAlpha="1" android:strokeColor="#c7dbfb"
+ android:strokeLineCap="round" android:strokeLineJoin="round"
+ android:strokeWidth="29" />
+ </group>
+ <group android:name="blue4" android:translateX="411.5" android:translateY="411.5">
+ <path android:name="blue4_path"
+ android:pathData=" M0 -395 C218,-395 395,-218 395,0 C395,218 218,395 0,395 C-218,395 -395,218 -395,0 C-395,-218 -218,-395 0,-395c "
+ android:strokeAlpha="1" android:strokeColor="#e8f0fd"
+ android:strokeLineCap="round" android:strokeLineJoin="round"
+ android:strokeWidth="30" />
+ </group>
+ </vector>
+ </aapt:attr>
+ <target android:name="blue1_path">
+ <aapt:attr name="android:animation">
+ <objectAnimator android:duration="1983" android:propertyName="trimPathStart"
+ android:repeatCount="infinite" android:valueFrom="0" android:valueTo="1"
+ android:valueType="floatType">
+ <aapt:attr name="android:interpolator">
+ <pathInterpolator android:pathData="M0,0 l.21,0 c.571,0 .194,.755 .79,1" />
+ </aapt:attr>
+ </objectAnimator>
+ </aapt:attr>
+ </target>
+ <target android:name="blue1_path">
+ <aapt:attr name="android:animation">
+ <objectAnimator android:duration="1983" android:propertyName="trimPathEnd"
+ android:repeatCount="infinite" android:valueFrom="0" android:valueTo="1"
+ android:valueType="floatType">
+ <aapt:attr name="android:interpolator">
+ <pathInterpolator android:pathData="M0,0 c0.606,0.315 0.2,1 1.0,1.0" />
+ </aapt:attr>
+ </objectAnimator>
+ </aapt:attr>
+ </target>
+ <target android:name="blue1">
+ <aapt:attr name="android:animation">
+ <objectAnimator android:duration="1983" android:propertyName="rotation"
+ android:repeatCount="infinite" android:valueFrom="0" android:valueTo="355"
+ android:valueType="floatType">
+ <aapt:attr name="android:interpolator">
+ <pathInterpolator android:pathData="M0,0 c0.829,0.228 0.2,0.915 1.0,1.0" />
+ </aapt:attr>
+ </objectAnimator>
+ </aapt:attr>
+ </target>
+ <target android:name="blue2_path">
+ <aapt:attr name="android:animation">
+ <objectAnimator android:duration="1983" android:propertyName="trimPathStart"
+ android:repeatCount="infinite" android:valueFrom="0" android:valueTo="1"
+ android:valueType="floatType">
+ <aapt:attr name="android:interpolator">
+ <pathInterpolator android:pathData="M0,0 l.21,0 c.571,0 .145,.831 .79,1" />
+ </aapt:attr>
+ </objectAnimator>
+ </aapt:attr>
+ </target>
+ <target android:name="blue2_path">
+ <aapt:attr name="android:animation">
+ <objectAnimator android:duration="1983" android:propertyName="trimPathEnd"
+ android:repeatCount="infinite" android:valueFrom="0" android:valueTo="1"
+ android:valueType="floatType">
+ <aapt:attr name="android:interpolator">
+ <pathInterpolator android:pathData="M0,0 c0.606,0.315 0.2,1 1.0,1.0" />
+ </aapt:attr>
+ </objectAnimator>
+ </aapt:attr>
+ </target>
+ <target android:name="blue2">
+ <aapt:attr name="android:animation">
+ <objectAnimator android:duration="1983" android:propertyName="rotation"
+ android:repeatCount="infinite" android:valueFrom="0" android:valueTo="355"
+ android:valueType="floatType">
+ <aapt:attr name="android:interpolator">
+ <pathInterpolator android:pathData="M0,0 c0.792,0.233 0.2,0.915 1.0,1.0" />
+ </aapt:attr>
+ </objectAnimator>
+ </aapt:attr>
+ </target>
+ <target android:name="blue3_path">
+ <aapt:attr name="android:animation">
+ <objectAnimator android:duration="1983" android:propertyName="trimPathStart"
+ android:repeatCount="infinite" android:valueFrom="0" android:valueTo="1"
+ android:valueType="floatType">
+ <aapt:attr name="android:interpolator">
+ <pathInterpolator android:pathData="M0,0 l.21,0 c.6138,0 .007,.883 .79,1" />
+ </aapt:attr>
+ </objectAnimator>
+ </aapt:attr>
+ </target>
+ <target android:name="blue3_path">
+ <aapt:attr name="android:animation">
+ <objectAnimator android:duration="1983" android:propertyName="trimPathEnd"
+ android:repeatCount="infinite" android:valueFrom="0" android:valueTo="1"
+ android:valueType="floatType">
+ <aapt:attr name="android:interpolator">
+ <pathInterpolator android:pathData="M0,0 c0.606,0.315 0.2,1 1.0,1.0" />
+ </aapt:attr>
+ </objectAnimator>
+ </aapt:attr>
+ </target>
+ <target android:name="blue3">
+ <aapt:attr name="android:animation">
+ <set android:ordering="together">
+ <objectAnimator android:duration="1983" android:propertyName="rotation"
+ android:repeatCount="infinite" android:valueFrom="0" android:valueTo="355"
+ android:valueType="floatType">
+ <aapt:attr name="android:interpolator">
+ <pathInterpolator
+ android:pathData="M0,0 c0.762,0.225 0.2,0.915 1.0,1.0" />
+ </aapt:attr>
+ </objectAnimator>
+ </set>
+ </aapt:attr>
+ </target>
+ <target android:name="blue4_path">
+ <aapt:attr name="android:animation">
+ <objectAnimator android:duration="1983" android:propertyName="trimPathStart"
+ android:repeatCount="infinite" android:valueFrom="0" android:valueTo="1"
+ android:valueType="floatType">
+ <aapt:attr name="android:interpolator">
+ <pathInterpolator android:pathData="M0,0 l.21,0 c.572,0 0,1 .79,1" />
+ </aapt:attr>
+ </objectAnimator>
+ </aapt:attr>
+ </target>
+ <target android:name="blue4_path">
+ <aapt:attr name="android:animation">
+ <objectAnimator android:duration="1983" android:propertyName="trimPathEnd"
+ android:repeatCount="infinite" android:valueFrom="0" android:valueTo="1"
+ android:valueType="floatType">
+ <aapt:attr name="android:interpolator">
+ <pathInterpolator android:pathData="M0,0 c0.606,0.315 0.2,1 1.0,1.0" />
+ </aapt:attr>
+ </objectAnimator>
+ </aapt:attr>
+ </target>
+ <target android:name="blue4">
+ <aapt:attr name="android:animation">
+ <objectAnimator android:duration="1983" android:propertyName="rotation"
+ android:repeatCount="infinite" android:valueFrom="0" android:valueTo="355"
+ android:valueType="floatType">
+ <aapt:attr name="android:interpolator">
+ <pathInterpolator android:pathData="M0,0 c0.606,0.172 0.2,0.915 1.0,1.0" />
+ </aapt:attr>
+ </objectAnimator>
+ </aapt:attr>
+ </target>
+</animated-vector>
diff --git a/library/main/res/layout/suw_glif_loading_screen.xml b/library/main/res/layout/suw_glif_loading_screen.xml
new file mode 100644
index 0000000..ecf932e
--- /dev/null
+++ b/library/main/res/layout/suw_glif_loading_screen.xml
@@ -0,0 +1,40 @@
+<?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.android.setupwizardlib.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 -->
+
+ <com.android.setupwizardlib.view.FillContentLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="1">
+
+ <ProgressBar
+ android:id="@+id/suw_large_progress_bar"
+ style="@style/SuwGmIndeterminateProgressBar"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent" />
+
+ </com.android.setupwizardlib.view.FillContentLayout>
+
+</com.android.setupwizardlib.GlifLayout>
diff --git a/library/main/res/values-v11/styles.xml b/library/main/res/values-v11/styles.xml
new file mode 100644
index 0000000..6903577
--- /dev/null
+++ b/library/main/res/values-v11/styles.xml
@@ -0,0 +1,22 @@
+<?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.
+-->
+
+<resources>
+
+ <style name="SuwBase.ProgressBarLarge" parent="@android:style/Widget.Holo.ProgressBar.Large" />
+
+</resources>
diff --git a/library/main/res/values-v21/styles.xml b/library/main/res/values-v21/styles.xml
index ab6f887..6e4c0dd 100644
--- a/library/main/res/values-v21/styles.xml
+++ b/library/main/res/values-v21/styles.xml
@@ -42,6 +42,16 @@
<item name="android:fontFamily">sans-serif-medium</item>
</style>
+ <style name="SuwBase.ProgressBarLarge" parent="@android:style/Widget.Material.ProgressBar.Large" />
+
+ <style name="SuwGmIndeterminateProgressBar" parent="SuwBase.ProgressBarLarge">
+ <item name="android:layout_gravity">center</item>
+ <item name="android:indeterminate">true</item>
+ <item name="android:indeterminateDrawable">@drawable/suw_fourcolor_progress_bar</item>
+ <item name="android:indeterminateTint">@null</item>
+ <item name="android:indeterminateTintMode">@null</item>
+ </style>
+
<!-- Items styles -->
<style name="SuwItemContainer">
diff --git a/library/test/robotest/src/com/android/setupwizardlib/util/GlifStyleTest.java b/library/test/robotest/src/com/android/setupwizardlib/util/GlifStyleTest.java
index aea2c03..b6ced57 100644
--- a/library/test/robotest/src/com/android/setupwizardlib/util/GlifStyleTest.java
+++ b/library/test/robotest/src/com/android/setupwizardlib/util/GlifStyleTest.java
@@ -18,6 +18,7 @@ package com.android.setupwizardlib.util;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
import static org.robolectric.RuntimeEnvironment.application;
import android.annotation.TargetApi;
@@ -29,6 +30,7 @@ import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.ContextThemeWrapper;
import android.widget.Button;
+import android.widget.ProgressBar;
import com.android.setupwizardlib.BuildConfig;
import com.android.setupwizardlib.R;
@@ -76,6 +78,15 @@ public class GlifStyleTest {
assertEquals(0x00000000, activity.getWindow().getStatusBarColor());
}
+ @Test
+ public void glifLoadingScreen_shouldHaveProgressBar() {
+ GlifThemeActivity activity = Robolectric.setupActivity(GlifThemeActivity.class);
+ activity.setContentView(R.layout.suw_glif_loading_screen);
+
+ assertTrue("Progress bar should exist",
+ activity.findViewById(R.id.suw_large_progress_bar) instanceof ProgressBar);
+ }
+
private static class GlifThemeActivity extends Activity {
@Override