Skip to content
This repository has been archived by the owner on Nov 8, 2023. It is now read-only.

Commit

Permalink
Add offset to round screens when an AlertDialog list item is shown.
Browse files Browse the repository at this point in the history
Bug: 30950051
Change-Id: I4546c2381fef68bc9e2d080c6b50f5df17810044
  • Loading branch information
Michael Kwan committed Aug 18, 2016
1 parent decad17 commit 44f854a
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 1 deletion.
3 changes: 2 additions & 1 deletion core/java/com/android/internal/app/AlertController.java
Expand Up @@ -888,7 +888,8 @@ private void setBackground(TypedArray a, View topPanel, View contentPanel, View
final int checkedItem = mCheckedItem;
if (checkedItem > -1) {
listView.setItemChecked(checkedItem, true);
listView.setSelection(checkedItem);
listView.setSelectionFromTop(checkedItem,
a.getDimensionPixelSize(R.styleable.AlertDialog_selectionScrollOffset, 0));
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions core/res/res/values-round-watch/config_material.xml
Expand Up @@ -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>
2 changes: 2 additions & 0 deletions core/res/res/values/attrs.xml
Expand Up @@ -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 -->
Expand Down
3 changes: 3 additions & 0 deletions core/res/res/values/config_material.xml
Expand Up @@ -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>
1 change: 1 addition & 0 deletions core/res/res/values/styles_material.xml
Expand Up @@ -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" />
Expand Down

0 comments on commit 44f854a

Please sign in to comment.