HabitRPG / habitica-android

Native Android app for Habitica
GNU General Public License v3.0
1.47k stars 521 forks source link

Group View Rewards Screen not taking whole screen width #2090

Open ntietje1 opened 1 month ago

ntietje1 commented 1 month ago

Describe the bug The group rewards screen will have an incorrect width when animating in, then correct itself once the animation finishes. However, if the content is reloaded for any reason such as pulling up to refresh or putting the app into the background and reopening, the content displays squished against the left side of the screen.

It seems that the element is wrapping the size of the chest icon rather than filling the available width. However, that's just my assumption.

To Reproduce

  1. Have no items in the group rewards screen
  2. Go to the rewards screen
  3. Reload the content in any way (refresh or minimize app)

Expected behavior The "You don't have any Rewards" component should take up the entire width of the screen.

Screenshots habatica_rewards_bug

Smartphone (please complete the following information):

Additional context N/A

ntietje1 commented 1 month ago

I did some more investigating and it seems that the emptyView for some reason isn't matching its parent's height, despite having match_parent for its width. In the "onCreateViewHolder" function, I explicitly set the width of the emptyView to the width of it's parent, which seems to fix the issue. Is there a better way to do this?

Here's the link to the branch with the fix: Fix Code

Layout Inspector when emptyView is not taking up the whole width: image

Layout Inspector when emptyView is taking up the whole width: image