Add offset to round screens when an AlertDialog list item is shown.

am: 44f854acd7

Change-Id: Ibfaa7c431c4bacf31d217850749c8df5a8660c6e
This commit is contained in:
Michael Kwan
2016-08-25 06:12:02 +00:00
committed by android-build-merger
5 changed files with 11 additions and 1 deletions

View File

@@ -888,7 +888,8 @@ public class AlertController {
final int checkedItem = mCheckedItem;
if (checkedItem > -1) {
listView.setItemChecked(checkedItem, true);
listView.setSelection(checkedItem);
listView.setSelectionFromTop(checkedItem,
a.getDimensionPixelSize(R.styleable.AlertDialog_selectionScrollOffset, 0));
}
}
}

View File

@@ -22,4 +22,7 @@
<!-- Gravity that should be used for dialog text styles. Equivalent to: Gravity.CENTER_HORIZONTAL | Gravity.TOP -->
<integer name="config_dialogTextGravity">0x00000031</integer>
<!-- The amount to offset when scrolling to a selection in an AlertDialog -->
<dimen name="config_alertDialogSelectionScrollOffset">@dimen/screen_percentage_15</dimen>
</resources>

View File

@@ -2057,6 +2057,8 @@ i
<!-- Controller for micro specific layout. -->
<enum name="micro" value="1" />
</attr>
<!-- @hide Offset when scrolling to a selection. -->
<attr name="selectionScrollOffset" format="dimension" />
</declare-styleable>
<!-- @hide -->

View File

@@ -34,4 +34,7 @@
<!-- True if preference fragment should clip to padding. -->
<bool name="config_preferenceFragmentClipToPadding">true</bool>
<!-- The amount to offset when scrolling to a selection in an AlertDialog -->
<dimen name="config_alertDialogSelectionScrollOffset">0dp</dimen>
</resources>

View File

@@ -1213,6 +1213,7 @@ please see styles_device_defaults.xml.
<item name="multiChoiceItemLayout">@layout/select_dialog_multichoice_material</item>
<item name="singleChoiceItemLayout">@layout/select_dialog_singlechoice_material</item>
<item name="controllerType">@integer/config_alertDialogController</item>
<item name="selectionScrollOffset">@dimen/config_alertDialogSelectionScrollOffset</item>
</style>
<style name="AlertDialog.Material.Light" />