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
This commit is contained in:
Maurice Lam 2017-12-05 12:36:57 -08:00
parent 9c763452d4
commit ceea5ff728
6 changed files with 284 additions and 0 deletions

View file

@ -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">

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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">

View file

@ -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