diff options
8 files changed, 50 insertions, 3 deletions
diff --git a/library/eclair-mr1/res/values/styles.xml b/library/eclair-mr1/res/values/styles.xml index 11059bb..4ff6ffd 100644 --- a/library/eclair-mr1/res/values/styles.xml +++ b/library/eclair-mr1/res/values/styles.xml @@ -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> diff --git a/library/full-support/res/layout/suw_glif_recycler_template_content.xml b/library/full-support/res/layout/suw_glif_recycler_template_content.xml index 13da5db..e8d209b 100644 --- a/library/full-support/res/layout/suw_glif_recycler_template_content.xml +++ b/library/full-support/res/layout/suw_glif_recycler_template_content.xml @@ -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" diff --git a/library/main/res/layout/suw_glif_list_template_content.xml b/library/main/res/layout/suw_glif_list_template_content.xml index 3793aeb..d0c5cc4 100644 --- a/library/main/res/layout/suw_glif_list_template_content.xml +++ b/library/main/res/layout/suw_glif_list_template_content.xml @@ -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" diff --git a/library/main/res/layout/suw_glif_template_content.xml b/library/main/res/layout/suw_glif_template_content.xml index 0eda2ae..f5a32a6 100644 --- a/library/main/res/layout/suw_glif_template_content.xml +++ b/library/main/res/layout/suw_glif_template_content.xml @@ -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" diff --git a/library/main/res/values/attrs.xml b/library/main/res/values/attrs.xml index 0102dc1..42901c7 100644 --- a/library/main/res/values/attrs.xml +++ b/library/main/res/values/attrs.xml @@ -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" /> diff --git a/library/main/res/values/styles.xml b/library/main/res/values/styles.xml index 93720eb..5a42a03 100644 --- a/library/main/res/values/styles.xml +++ b/library/main/res/values/styles.xml @@ -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"> diff --git a/library/platform/res/values-v23/styles.xml b/library/platform/res/values-v23/styles.xml index 7bfc939..1fd55e8 100644 --- a/library/platform/res/values-v23/styles.xml +++ b/library/platform/res/values-v23/styles.xml @@ -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 --> diff --git a/library/test/instrumentation/src/com/android/setupwizardlib/test/GlifLayoutTest.java b/library/test/instrumentation/src/com/android/setupwizardlib/test/GlifLayoutTest.java index ae3a0b9..22c2f1d 100644 --- a/library/test/instrumentation/src/com/android/setupwizardlib/test/GlifLayoutTest.java +++ b/library/test/instrumentation/src/com/android/setupwizardlib/test/GlifLayoutTest.java @@ -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) { |