Skip to content

Commit

Permalink
Adjust badge positioning for spotlight and mark items
Browse files Browse the repository at this point in the history
  • Loading branch information
therealsujitk committed Oct 12, 2023
1 parent 096c6a2 commit 83c75cd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ public void setMarksItem(Mark.AllData marksItem) {
@OptIn(markerClass = ExperimentalBadgeUtils.class)
@Override
public void onLayoutChange(View view, int i, int i1, int i2, int i3, int i4, int i5, int i6, int i7) {
markBadge.setHorizontalOffset(-(((View) markTitle.getParent()).getPaddingStart() - markBadge.getIntrinsicWidth()) / 2);
markBadge.setVerticalOffset((markTitle.getMeasuredHeight() - markBadge.getIntrinsicHeight()) / 2);
markBadge.setHorizontalOffset(10 - ((View) markTitle.getParent()).getPaddingStart() / 2);
markBadge.setVerticalOffset(10 + markTitle.getMeasuredHeight() / 2);

BadgeUtils.attachBadgeDrawable(markBadge, markTitle);
markTitle.removeOnLayoutChangeListener(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ public void onPageFinished(WebView view, String url) {
float pixelDensity = announcementType.getContext().getResources().getDisplayMetrics().density;
BadgeDrawable announcementBadge = BadgeDrawable.create(announcementType.getContext());
announcementBadge.setBadgeGravity(BadgeDrawable.TOP_END);
announcementBadge.setHorizontalOffset((int) (6.5 * pixelDensity));
announcementBadge.setVerticalOffset((int) (6.5 * pixelDensity));
announcementBadge.setHorizontalOffset((int) (10 * pixelDensity));
announcementBadge.setVerticalOffset((int) (10 * pixelDensity));

announcementType.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
@OptIn(markerClass = ExperimentalBadgeUtils.class)
Expand Down

0 comments on commit 83c75cd

Please sign in to comment.