Skip to content

Commit

Permalink
[NavigationView] Fix subheader and divider insets and use relative li…
Browse files Browse the repository at this point in the history
…stPreferredItemPaddings.

Resolves #4122
Resolves #4123

GIT_ORIGIN_REV_ID=911d1af88c0d10c6894bf38546b870430e86b6f9
PiperOrigin-RevId: 634517597
  • Loading branch information
pubiqq authored and leticiarossi committed May 16, 2024
1 parent 9a39e22 commit 26bfdd2
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
NavigationMenuTextItem item = (NavigationMenuTextItem) items.get(position);
subHeader.setText(item.getMenuItem().getTitle());
TextViewCompat.setTextAppearance(subHeader, subheaderTextAppearance);
subHeader.setPadding(
subHeader.setPaddingRelative(
subheaderInsetStart,
subHeader.getPaddingTop(),
subheaderInsetEnd,
Expand All @@ -634,7 +634,7 @@ public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
case VIEW_TYPE_SEPARATOR:
{
NavigationMenuSeparatorItem item = (NavigationMenuSeparatorItem) items.get(position);
holder.itemView.setPadding(
holder.itemView.setPaddingRelative(
dividerInsetStart,
item.getPaddingTop(),
dividerInsetEnd,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/listPreferredItemHeightSmall"
android:paddingLeft="?attr/listPreferredItemPaddingLeft"
android:paddingRight="?attr/listPreferredItemPaddingRight"
android:paddingStart="?attr/listPreferredItemPaddingStart"
android:paddingEnd="?attr/listPreferredItemPaddingEnd"
android:focusable="true"
android:foreground="?attr/selectableItemBackground"
android:defaultFocusHighlightEnabled="false"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="?attr/listPreferredItemHeightSmall"
android:paddingLeft="?attr/listPreferredItemPaddingLeft"
android:paddingRight="?attr/listPreferredItemPaddingRight"
android:paddingStart="?attr/listPreferredItemPaddingStart"
android:paddingEnd="?attr/listPreferredItemPaddingEnd"
android:gravity="center_vertical|start"
android:maxLines="1"
android:textAppearance="@style/TextAppearance.AppCompat.Body2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
<item name="android:background">?android:attr/windowBackground</item>
<item name="android:fitsSystemWindows">true</item>
<item name="android:maxWidth">@dimen/design_navigation_max_width</item>
<item name="subheaderInsetStart">?attr/listPreferredItemPaddingLeft</item>
<item name="subheaderInsetEnd">?attr/listPreferredItemPaddingRight</item>
<item name="subheaderInsetStart">?attr/listPreferredItemPaddingStart</item>
<item name="subheaderInsetEnd">?attr/listPreferredItemPaddingEnd</item>
<item name="drawerLayoutCornerSize">0dp</item>
</style>

Expand Down

0 comments on commit 26bfdd2

Please sign in to comment.