-
Notifications
You must be signed in to change notification settings - Fork 527
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG]: Home screen topics Grid view unaligned after coming back from Lesson #5150
Comments
I am new to Oppia-Android project, I would like to work on this issue, could you plz assign it to me? @adhiamboperes @MohitGupta121 |
Could you please give a brief description of how you would go about solving this. |
Thanks @adhiamboperes for tablet investigation. |
Assign#5150 |
Hi, in order to be assigned any issue, please give a brief description of how you would go about solving it. |
This is just a proposal, will brush it up if the proposal is approved
This is just a proposal, will brush it up if the proposal is approved
Hey there! I want to work on this project as well. I tried to understand what's going on here, I failed:). It has to do something with margins (this function). I had some non viable hypothesis. One interesting thing here is that when this bug happens this function I linked first is called for the 5th (last) element and only then for 0th, 1st... Anyway, I came up with this solution. I don't know why it works, but the code becomes simpler and it works - the problem doesn't appear anymore, see the video. I checked it on Pixel 3 and Pixel C. I understand it changes the layout, but I think it's not that noticeable. I also understand it's not a proper solution, but it works:) See the new layout for Pixel 3 and Pixel C attached. WDYT about this approach? |
This is just a proposal, will brush it up if the proposal is approved
Hi @nikitaevg -- thanks for this! Just from the PM side -- in the new layout, I think that the tiles in the right column in the Pixel 3 mocks are too close to the right edge of the screen. The margin should be consistent on the left and on the right. Is that achievable with your approach? Also, I suggest showing what the equivalent mocks are for the current codebase so that the difference between the old/new ones can be seen more easily, @adhiamboperes do you have any thoughts on the technical approach used here? Just as an FYI I found the relevant PR that introduced the changes (using the |
Hey Sean! Thanks for your comment! Yeah, it was my bad they were inconsistent on the left and right. I thought it was like this before. Sure, I don't want to break it:) I found a real problem here. My new proposal is here, will create a proper PR soon. The gist is these cards that become unaligned - they are being reused after returning to the main screen. Their margin is updated in the code, but the RecyclerView is not notified about those updates. Check this video where you can see the bug is gone. |
Hi, |
@nikitaevg proposed calling
We need to test this code to prevent regressions in the UI, and the first step is to set up a test that does something very similar to the bug and see if we can repro the breakage in Robolectric, then we can step-debug to see what is causing the breakage, and set up a proper test for the code.
|
Unable to reproduce the error. Am I doing something wrong? screenrec.mp4 |
Hi @Abinash6000, could you please try to repro this on a tablet device like a nexus 9? |
Still unable to reproduce the error. portrait.mp4landscape.mp4 |
Hii, it would be of great help if anyone let's me know whether this issue has been solved yet or not. I would like to work on it |
@AyeshaLoladia, please try to reproduce this issue on mobile and tablet emulators and then let us know so we can assign it to you! |
@MohitGupta121 It's about a year since this issue was created why has nobody solved this issue, I just saw this bug and wanted to open an issue and found It already exists and it is a terrible sign for any app, |
@Vinay-Khanagavi Thanks for the note! I agree with you that it is medium-impact, and I have updated the label accordingly. |
Hey @adhiamboperes , I’d like to start working on this issue, but I noticed PR #5160 . already seems to address it effectively. |
@TanishMoral11, there were some incomplete tests and the contributor abandoned the PR. The solution is otherwise acceptable |
Thank you for clarifying, @adhiamboperes ! Would it be alright if I submit a new PR with the same changes and ensure that all the tests are completed? |
Assigned this issue to you @TanishMoral11 |
…g from lesson (#5563) ## Explanation Fixes #5150 , where the home screen topic grid becomes misaligned after returning from a lesson. The grid alignment is now maintained upon returning to the home screen, ensuring a consistent layout for topics. ## Issue Description The home screen topics grid view experiences misalignment when navigating back from a lesson. This issue stems from inconsistent layout parameter management within the margin binding adapters, causing unexpected UI disruptions across different screen configurations. ## Changes Made - Refactored `MarginBindingAdapters` to prioritize `setLayoutParams()` over `requestLayout()` - Implemented a more robust approach to setting and preserving layout parameters - Ensured consistent margin application across various screen orientations and device types ## Reasoning The core of the fix lies in how layout parameters are managed: - `View.setLayoutParams()` explicitly sets layout parameters for a view - This method inherently calls `requestLayout()`, guaranteeing the view is redrawn with updated parameters - Direct parameter setting provides more predictable margin management across different screen configurations ## Test Coverage Comprehensive testing was added to `MarginBindingAdaptersTest` to validate: - Margin preservation across multiple screen configurations - Accurate application of start, end, top, and bottom margins - Consistency of layout parameter management - Robust handling of different device orientations (portrait, landscape, tablet) ## Essential Checklist - [x] The PR title and explanation each start with "Fix #5150: ". - [x] Any changes to [scripts/assets](https://github.com/oppia/oppia-android/tree/develop/scripts/assets) files have their rationale included in the PR explanation. - [x] The PR follows the [style guide](https://github.com/oppia/oppia-android/wiki/Coding-style-guide). - [x] The PR does not contain any unnecessary code changes from Android Studio ([reference](https://github.com/oppia/oppia-android/wiki/Guidance-on-submitting-a-PR#undo-unnecessary-changes)). - [x] The PR is made from a branch that's **not** called "develop" and is up-to-date with "develop". - [x] The PR is **assigned** to the appropriate reviewers ([reference](https://github.com/oppia/oppia-android/wiki/Guidance-on-submitting-a-PR#clarification-regarding-assignees-and-reviewers-section)). --------- Co-authored-by: Adhiambo Peres <[email protected]>
Describe the bug
Home screen topics Grid view unaligned after coming back from Lesson
VID_20230912_120527.mp4
Steps To Reproduce
Go to any topic and then any lesson
Go back by (System or Navigation)
See the Topic Grids now
Expected Behavior
Topic Grid should remain aligned.
Screenshots/Videos
No response
What device/emulator are you using?
Poco M2 Pro
Which Android version is your device/emulator running?
Android 11
Which version of the Oppia Android app are you using?
0.11-oppia-f0837d22fe
Additional Context
No response
The text was updated successfully, but these errors were encountered: