Loading core/java/android/widget/FastScroller.java +23 −7 Original line number Diff line number Diff line Loading @@ -79,6 +79,7 @@ class FastScroller { // Positions for preview image and text. private static final int OVERLAY_FLOATING = 0; private static final int OVERLAY_AT_THUMB = 1; private static final int OVERLAY_ABOVE_THUMB = 2; // Indices for mPreviewResId. private static final int PREVIEW_LEFT = 0; Loading Loading @@ -189,8 +190,9 @@ class FastScroller { /** * Position for the preview image and text. One of: * <ul> * <li>{@link #OVERLAY_AT_THUMB} * <li>{@link #OVERLAY_FLOATING} * <li>{@link #OVERLAY_AT_THUMB} * <li>{@link #OVERLAY_ABOVE_THUMB} * </ul> */ private int mOverlayPosition; Loading Loading @@ -310,8 +312,10 @@ class FastScroller { final int textMinSize = Math.max(0, mPreviewMinHeight); mPrimaryText.setMinimumWidth(textMinSize); mPrimaryText.setMinimumHeight(textMinSize); mPrimaryText.setIncludeFontPadding(false); mSecondaryText.setMinimumWidth(textMinSize); mSecondaryText.setMinimumHeight(textMinSize); mSecondaryText.setIncludeFontPadding(false); refreshDrawablePressedState(); } Loading Loading @@ -595,10 +599,10 @@ class FastScroller { margins.right = mPreviewImage.getPaddingRight(); margins.bottom = mPreviewImage.getPaddingBottom(); if (mOverlayPosition == OVERLAY_AT_THUMB) { measureViewToSide(v, mThumbImage, margins, out); } else { if (mOverlayPosition == OVERLAY_FLOATING) { measureFloating(v, margins, out); } else { measureViewToSide(v, mThumbImage, margins, out); } } Loading Loading @@ -1147,11 +1151,23 @@ class FastScroller { final float thumbMiddle = position * range + offset; thumbImage.setTranslationY(thumbMiddle - thumbImage.getHeight() / 2); final float previewPos = mOverlayPosition == OVERLAY_AT_THUMB ? thumbMiddle : 0; // Center the preview on the thumb, constrained to the list bounds. final View previewImage = mPreviewImage; final float previewHalfHeight = previewImage.getHeight() / 2f; final float previewPos; switch (mOverlayPosition) { case OVERLAY_AT_THUMB: previewPos = thumbMiddle; break; case OVERLAY_ABOVE_THUMB: previewPos = thumbMiddle - previewHalfHeight; break; case OVERLAY_FLOATING: default: previewPos = 0; break; } // Center the preview on the thumb, constrained to the list bounds. final float minP = top + previewHalfHeight; final float maxP = bottom - previewHalfHeight; final float previewMiddle = MathUtils.constrain(previewPos, minP, maxP); Loading core/res/res/drawable/fastscroll_label_left_material.xml 0 → 100644 +27 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2014 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. --> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <corners android:topLeftRadius="44dp" android:topRightRadius="44dp" android:bottomRightRadius="44dp" /> <padding android:paddingLeft="22dp" android:paddingRight="22dp" /> <solid android:color="?attr/colorControlActivated" /> </shape> core/res/res/drawable/fastscroll_label_right_material.xml 0 → 100644 +27 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2014 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. --> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <corners android:topLeftRadius="44dp" android:topRightRadius="44dp" android:bottomLeftRadius="44dp" /> <padding android:paddingLeft="22dp" android:paddingRight="22dp" /> <solid android:color="?attr/colorControlActivated" /> </shape> core/res/res/values/attrs.xml +3 −0 Original line number Diff line number Diff line Loading @@ -733,6 +733,7 @@ <attr name="fastScrollOverlayPosition"> <enum name="floating" value="0" /> <enum name="atThumb" value="1" /> <enum name="aboveThumb" value="2" /> </attr> <!-- Text color for the fast scroll index overlay. Make sure it plays nicely with fastScrollPreviewBackground[Left|Right]. --> Loading Loading @@ -3196,6 +3197,8 @@ <enum name="floating" value="0" /> <!-- Pinned alongside the thumb. --> <enum name="atThumb" value="1" /> <!-- Pinned above the thumb. --> <enum name="aboveThumb" value="2" /> </attr> <attr name="textAppearance" /> <attr name="textColor" /> Loading core/res/res/values/styles_material.xml +4 −0 Original line number Diff line number Diff line Loading @@ -866,6 +866,10 @@ please see styles_device_defaults.xml. <style name="Widget.Material.FastScroll" parent="Widget.FastScroll"> <item name="thumbMinWidth">0dp</item> <item name="thumbMinHeight">0dp</item> <item name="minWidth">88dp</item> <item name="minHeight">88dp</item> <item name="padding">0dp</item> <item name="textSize">45sp</item> </style> <style name="Widget.Material.PreferenceFrameLayout"> Loading Loading
core/java/android/widget/FastScroller.java +23 −7 Original line number Diff line number Diff line Loading @@ -79,6 +79,7 @@ class FastScroller { // Positions for preview image and text. private static final int OVERLAY_FLOATING = 0; private static final int OVERLAY_AT_THUMB = 1; private static final int OVERLAY_ABOVE_THUMB = 2; // Indices for mPreviewResId. private static final int PREVIEW_LEFT = 0; Loading Loading @@ -189,8 +190,9 @@ class FastScroller { /** * Position for the preview image and text. One of: * <ul> * <li>{@link #OVERLAY_AT_THUMB} * <li>{@link #OVERLAY_FLOATING} * <li>{@link #OVERLAY_AT_THUMB} * <li>{@link #OVERLAY_ABOVE_THUMB} * </ul> */ private int mOverlayPosition; Loading Loading @@ -310,8 +312,10 @@ class FastScroller { final int textMinSize = Math.max(0, mPreviewMinHeight); mPrimaryText.setMinimumWidth(textMinSize); mPrimaryText.setMinimumHeight(textMinSize); mPrimaryText.setIncludeFontPadding(false); mSecondaryText.setMinimumWidth(textMinSize); mSecondaryText.setMinimumHeight(textMinSize); mSecondaryText.setIncludeFontPadding(false); refreshDrawablePressedState(); } Loading Loading @@ -595,10 +599,10 @@ class FastScroller { margins.right = mPreviewImage.getPaddingRight(); margins.bottom = mPreviewImage.getPaddingBottom(); if (mOverlayPosition == OVERLAY_AT_THUMB) { measureViewToSide(v, mThumbImage, margins, out); } else { if (mOverlayPosition == OVERLAY_FLOATING) { measureFloating(v, margins, out); } else { measureViewToSide(v, mThumbImage, margins, out); } } Loading Loading @@ -1147,11 +1151,23 @@ class FastScroller { final float thumbMiddle = position * range + offset; thumbImage.setTranslationY(thumbMiddle - thumbImage.getHeight() / 2); final float previewPos = mOverlayPosition == OVERLAY_AT_THUMB ? thumbMiddle : 0; // Center the preview on the thumb, constrained to the list bounds. final View previewImage = mPreviewImage; final float previewHalfHeight = previewImage.getHeight() / 2f; final float previewPos; switch (mOverlayPosition) { case OVERLAY_AT_THUMB: previewPos = thumbMiddle; break; case OVERLAY_ABOVE_THUMB: previewPos = thumbMiddle - previewHalfHeight; break; case OVERLAY_FLOATING: default: previewPos = 0; break; } // Center the preview on the thumb, constrained to the list bounds. final float minP = top + previewHalfHeight; final float maxP = bottom - previewHalfHeight; final float previewMiddle = MathUtils.constrain(previewPos, minP, maxP); Loading
core/res/res/drawable/fastscroll_label_left_material.xml 0 → 100644 +27 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2014 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. --> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <corners android:topLeftRadius="44dp" android:topRightRadius="44dp" android:bottomRightRadius="44dp" /> <padding android:paddingLeft="22dp" android:paddingRight="22dp" /> <solid android:color="?attr/colorControlActivated" /> </shape>
core/res/res/drawable/fastscroll_label_right_material.xml 0 → 100644 +27 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2014 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. --> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <corners android:topLeftRadius="44dp" android:topRightRadius="44dp" android:bottomLeftRadius="44dp" /> <padding android:paddingLeft="22dp" android:paddingRight="22dp" /> <solid android:color="?attr/colorControlActivated" /> </shape>
core/res/res/values/attrs.xml +3 −0 Original line number Diff line number Diff line Loading @@ -733,6 +733,7 @@ <attr name="fastScrollOverlayPosition"> <enum name="floating" value="0" /> <enum name="atThumb" value="1" /> <enum name="aboveThumb" value="2" /> </attr> <!-- Text color for the fast scroll index overlay. Make sure it plays nicely with fastScrollPreviewBackground[Left|Right]. --> Loading Loading @@ -3196,6 +3197,8 @@ <enum name="floating" value="0" /> <!-- Pinned alongside the thumb. --> <enum name="atThumb" value="1" /> <!-- Pinned above the thumb. --> <enum name="aboveThumb" value="2" /> </attr> <attr name="textAppearance" /> <attr name="textColor" /> Loading
core/res/res/values/styles_material.xml +4 −0 Original line number Diff line number Diff line Loading @@ -866,6 +866,10 @@ please see styles_device_defaults.xml. <style name="Widget.Material.FastScroll" parent="Widget.FastScroll"> <item name="thumbMinWidth">0dp</item> <item name="thumbMinHeight">0dp</item> <item name="minWidth">88dp</item> <item name="minHeight">88dp</item> <item name="padding">0dp</item> <item name="textSize">45sp</item> </style> <style name="Widget.Material.PreferenceFrameLayout"> Loading