Skip to content
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

remove back button if fragmented #16582

Merged
merged 1 commit into from
Jun 17, 2024

Conversation

SanjaySargam
Copy link
Contributor

@SanjaySargam SanjaySargam commented Jun 10, 2024

Purpose / Description

Hide the back button in StudyOptionsFragment when fragmented

Approach

set toolbar navigation icon to null

How Has This Been Tested?

Physical Device ( ChromeBook )
Screenshot 2024-06-11 11 49 03 AM

Checklist

Please, go through these checks before submitting the PR.

  • You have a descriptive commit message with a short title (first line, max 50 chars).
  • You have commented your code, particularly in hard-to-understand areas
  • You have performed a self-review of your own code
  • UI changes: include screenshots of all affected screens (in particular showing any new or changed strings)
  • UI Changes: You have tested your change using the Google Accessibility Scanner

@david-allison
Copy link
Member

Could you provide a screenshot comparison?

Copy link
Member

@Arthur-Milchior Arthur-Milchior left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with the code.
As David noted, screenshot would be helpful.
But I'd go further, and really request you to rewrite your commit message. This commit seems a great writing exercice.

There are two kind of readers you want to have in mind when writing your commit message. The reviewers, and some other dev that try to understand why the code is the way it is years later. (Probably to fix a bug)

So, when this future reader will see the one line description, they should know as much as possible.
You can state that it's for large screen only. That the button had no side effect.

Then, with more details, you can state that it was a bug that existed for a long time, unnoticed.
That the button is useful on small screen when the fragment appears on a separate screen, and is not useful when the fragment appears near the deck-picker, where there is nowhere to go back to, so we could remove the button.

In particular, you wrote

This commit hides back button if it is fragmented

It seems that the button is fragmented. This is not the case. Please state explicitly that you consider the case where the deck picker view is fragmented, i.e. big screen. Explain also which "back button" is hidden. The one that appeared without purpose.

Instead of "hidden", you may state that you remove it. From the point of view of the user, the button just does not appear. It does not exists anymore. There is no sense in stating that it's hidden, which would imply it's still here.

Finally, "fragmented" may not be the best word here. This word is specific to our codebase. From the user point of view, what matter is that the fragment appears simultaneously with the deck picker. So we can't go "back" to the deck picker.

If you stated this in your commit message, it would be quite simpler to see the commit makes total sense and should be accepted. And the future reader could understand whether this line is related or not to a potential bug they have with some back issue years later

@@ -363,6 +363,8 @@ class StudyOptionsFragment : Fragment(), ChangeManager.Subscriber, Toolbar.OnMen
icon!!.isAutoMirrored = true
toolbar!!.navigationIcon = icon
toolbar!!.setNavigationOnClickListener { (activity as AnkiActivity).finish() }
} else {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd consider inversing if and else. So that the sentence can be read as "if it is fragmented" instead of the longer "if it is not fragmented".

@@ -363,6 +363,8 @@ class StudyOptionsFragment : Fragment(), ChangeManager.Subscriber, Toolbar.OnMen
icon!!.isAutoMirrored = true
toolbar!!.navigationIcon = icon
toolbar!!.setNavigationOnClickListener { (activity as AnkiActivity).finish() }
} else {
toolbar!!.navigationIcon = null
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a comment explaining why it is done.
I don't expect it's clear to most reader of the codebase that there is no reason for the back button.

So, please explain that, when the fragment appear near the deck picker, the "back" button had no purpose, so should be removed

This bug existed for a long time which was unnoticed. Back button is useful on small screen when the fragment appears on a separate screen, and is not useful when the fragment appears near the deck-picker, where there is nowhere to go back to, so we could remove the button
Copy link
Member

@david-allison david-allison left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@david-allison david-allison added the Needs Second Approval Has one approval, one more approval to merge label Jun 11, 2024
@lukstbit lukstbit added the GSoC Pull requests authored by a Google Summer of Code participant [Candidate/Selected], for GSoC mentors label Jun 12, 2024
@Arthur-Milchior Arthur-Milchior added this pull request to the merge queue Jun 17, 2024
Merged via the queue into ankidroid:main with commit 13189e0 Jun 17, 2024
8 checks passed
@github-actions github-actions bot removed the Needs Second Approval Has one approval, one more approval to merge label Jun 17, 2024
@github-actions github-actions bot added this to the 2.19 release milestone Jun 17, 2024
Copy link
Contributor

Hi there @SanjaySargam! This is the OpenCollective Notice for PRs merged from 2024-06-01 through 2024-06-30

If you are interested in compensation for this work, the process with details is here:

https://github.com/ankidroid/Anki-Android/wiki/OpenCollective-Payment-Process#how-to-get-paid

Important

PLEASE NOTE: The process was updated in August 2024. Re-read the Payment Process page if you have not already.

We only post one comment per person per month to avoid spamming you, regardless of the number of PRs merged, but this note applies to all PRs merged for this month

Please understand that our monthly budget is never guaranteed to cover all claims - the cap on payments-per-person may be lower, but we try to make our process as fair and transparent as possible, we just need your understanding.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GSoC Pull requests authored by a Google Summer of Code participant [Candidate/Selected], for GSoC mentors
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants