Merge "Add scroll indicators to GLIF Pixel theme"

This commit is contained in:
Maurice Lam 2017-03-03 23:02:00 +00:00 committed by Android (Google) Code Review
commit eb7c2d1e90
8 changed files with 50 additions and 3 deletions

View file

@ -92,6 +92,7 @@
<item name="suwItemDescriptionStyle">@style/SuwItemContainer.Description.Glif</item>
<item name="suwListItemIconColor">@color/suw_list_item_icon_color_dark</item>
<item name="suwMarginSides">@dimen/suw_glif_margin_sides</item>
<item name="suwScrollIndicators">none</item>
<item name="textAppearanceListItem">@style/TextAppearance.SuwGlifItemTitle</item>
<item name="textAppearanceListItemSmall">@style/TextAppearance.SuwGlifItemSummary</item>
</style>
@ -121,6 +122,7 @@
<item name="suwItemDescriptionStyle">@style/SuwItemContainer.Description.Glif</item>
<item name="suwListItemIconColor">@color/suw_list_item_icon_color_light</item>
<item name="suwMarginSides">@dimen/suw_glif_margin_sides</item>
<item name="suwScrollIndicators">none</item>
<item name="textAppearanceListItem">@style/TextAppearance.SuwGlifItemTitle</item>
<item name="textAppearanceListItemSmall">@style/TextAppearance.SuwGlifItemSummary</item>
</style>

View file

@ -18,17 +18,22 @@
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<!-- Ignore UnusedAttribute: scrollIndicators is new in M. Default to no indicators in older
versions. -->
<com.android.setupwizardlib.view.HeaderRecyclerView
android:id="@+id/suw_recycler_view"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:scrollbars="vertical"
app:suwHeader="@layout/suw_glif_header" />
android:scrollIndicators="?attr/suwScrollIndicators"
app:suwHeader="@layout/suw_glif_header"
tools:ignore="UnusedAttribute" />
<ViewStub
android:id="@+id/suw_layout_footer"

View file

@ -17,17 +17,22 @@
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<!-- Ignore UnusedAttribute: scrollIndicators is new in M. Default to no indicators in older
versions. -->
<com.android.setupwizardlib.view.StickyHeaderListView
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
app:suwHeader="@layout/suw_glif_header" />
android:scrollIndicators="?attr/suwScrollIndicators"
app:suwHeader="@layout/suw_glif_header"
tools:ignore="UnusedAttribute" />
<ViewStub
android:id="@+id/suw_layout_footer"

View file

@ -17,16 +17,21 @@
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<!-- Ignore UnusedAttribute: scrollIndicators is new in M. Default to no indicators in older
versions. -->
<ScrollView
android:id="@+id/suw_scroll_view"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:fillViewport="true">
android:fillViewport="true"
android:scrollIndicators="?attr/suwScrollIndicators"
tools:ignore="UnusedAttribute">
<LinearLayout
android:layout_width="match_parent"

View file

@ -49,6 +49,26 @@
<attr name="suwNavBarTextColor" format="color" />
<attr name="suwNavBarTheme" format="reference" />
<!-- Values copied from frameworks/base/core/res/res/values/attrs.xml -->
<attr name="suwScrollIndicators">
<!-- No scroll indicators are displayed. -->
<flag name="none" value="0x00" />
<!-- Displays top scroll indicator when view can be scrolled up. -->
<flag name="top" value="0x01" />
<!-- Displays bottom scroll indicator when vew can be scrolled down. -->
<flag name="bottom" value="0x02" />
<!-- Displays left scroll indicator when vew can be scrolled left. -->
<flag name="left" value="0x04" />
<!-- Displays right scroll indicator when vew can be scrolled right. -->
<flag name="right" value="0x08" />
<!-- Displays right scroll indicator when vew can be scrolled in the
start direction. -->
<flag name="start" value="0x10" />
<!-- Displays right scroll indicator when vew can be scrolled in the
end direction. -->
<flag name="end" value="0x20" />
</attr>
<!-- Custom view attributes -->
<attr name="suwColorPrimary" format="color" />
<attr name="suwHeader" format="reference" />

View file

@ -25,6 +25,7 @@
<item name="suwBackgroundBaseColor">?android:attr/colorBackground</item>
<item name="suwBackgroundPatterned">false</item>
<item name="suwGlifHeaderGravity">center_horizontal</item>
<item name="suwScrollIndicators">top|bottom</item>
</style>
<style name="SuwThemeGlifPixel.Light" parent="SuwThemeGlif.Light">
@ -33,6 +34,7 @@
<item name="suwBackgroundBaseColor">?android:attr/colorBackground</item>
<item name="suwBackgroundPatterned">false</item>
<item name="suwGlifHeaderGravity">center_horizontal</item>
<item name="suwScrollIndicators">top|bottom</item>
</style>
<style name="Animation.SuwWindowAnimation" parent="@android:style/Animation.Activity">

View file

@ -95,6 +95,7 @@
<item name="suwItemDescriptionStyle">@style/SuwItemContainer.Description.Glif</item>
<item name="suwListItemIconColor">@color/suw_list_item_icon_color_dark</item>
<item name="suwMarginSides">@dimen/suw_glif_margin_sides</item>
<item name="suwScrollIndicators">none</item>
</style>
<style name="SuwThemeGlif.Light" parent="android:Theme.Material.Light.NoActionBar">
@ -121,6 +122,7 @@
<item name="suwItemDescriptionStyle">@style/SuwItemContainer.Description.Glif</item>
<item name="suwListItemIconColor">@color/suw_list_item_icon_color_light</item>
<item name="suwMarginSides">@dimen/suw_glif_margin_sides</item>
<item name="suwScrollIndicators">none</item>
</style>
<!-- Button styles -->

View file

@ -106,6 +106,12 @@ public class GlifLayoutTest {
Integer.toHexString(glifLayout.getBackgroundBaseColor().getDefaultColor()));
assertFalse("GLIF Pixel theme shuold not have patterned background",
glifLayout.isBackgroundPatterned());
if (VERSION.SDK_INT >= VERSION_CODES.M) {
// Scroll indicators are only available on versions >= M
assertEquals(View.SCROLL_INDICATOR_TOP | View.SCROLL_INDICATOR_BOTTOM,
glifLayout.getScrollView().getScrollIndicators());
}
}
private void assertDefaultTemplateInflated(GlifLayout layout) {