-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Feature: Allow changing deck name in statistics screen #15648
base: main
Are you sure you want to change the base?
Conversation
34f2925
to
9d2531b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason you didn't go with the spinner in the ActionBar
? I'd expect this UI to be at the top of the screen
Ohh that's because the deck name is already shown in the page why to have it at top would that be a good ui ? I did mention that in my pr template,
|
I feel this significantly reduces vertical space, which is what people want from this screen
|
9d2531b
to
555c1ea
Compare
AnkiDroid/src/main/java/com/ichi2/anki/widgets/DeckDropDownAdapter.kt
Outdated
Show resolved
Hide resolved
555c1ea
to
f996aaf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Visually, this looks awesome, thank you!
AnkiDroid/src/main/java/com/ichi2/anki/widgets/DeckDropDownAdapter.kt
Outdated
Show resolved
Hide resolved
f996aaf
to
1ece7f9
Compare
efada90
to
bde8a9f
Compare
private fun changeDeck(selectedDeck: String) { | ||
val javascriptCode = """ | ||
var textBox = [].slice.call(document.getElementsByTagName('input'), 0).filter(x => x.type == "text")[0]; | ||
textBox.value = "deck:$selectedDeck"; | ||
textBox.dispatchEvent(new Event("input", { bubbles: true })); | ||
textBox.dispatchEvent(new Event("change")); | ||
""".trimIndent() | ||
webView.evaluateJavascript(javascriptCode, null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if possible, add an AndroidTest to get any backend breakages
This likely will need more feedback rounds than I have availability for. Leaving to the other reviewers |
@BrayanDSO Is this ok? I made some changes |
31453a4
to
39f5818
Compare
39f5818
to
1821224
Compare
9574e50
to
545b02b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The control in the action bar needs a "down caret" so it appears selectable
It is there but I suspect not visible due to the toolbar color will override it |
Hello 👋, this PR has had no activity for more than 2 weeks and needs a reply from the author. If you think this is a mistake please comment and ping a maintainer to get this merged ASAP! Thanks for contributing! You have 7 days until this gets closed automatically |
3a1aecf
to
d8106cb
Compare
I've fixed the conflicts and made some changes to implement the feature(basically, just change the current selected deck and reload the embedded WebView). The new behavior follows the desktop behavior where selecting a deck in the statistics screen doesn't change the html input at the top. Some images(note that I added a background for the decks spinner area to differentiate it a bit from the rest of the content, I think it looks better): |
I feel I'm missing something Where do you select a deck in the screenshots? I'd have expected it in the app bar |
It's the Spinner at the bottom(in the picture there was a deck B selected). Besides the desktop UI that places the deck selector at the bottom it was much easier to implement this way(I would prefer to keep the title as it is). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like it design wise, but it's better than it was. Let's do it
But, does it mean that changing the deck in the Stats page changes the current deck? If so, it will affect the reviewer if the user goes to the Stats page and changes the deck there in the middle of doing reviews. From the issue description, I quote:
In #15197 (comment), David wrote:
(Here, "decks in the reviewer" should be read as "decks in the Stats page" IMO.) In this Anki forums post, Damien wrote:
So, Damien seems to support the idea of updating the search when selecting a deck. Also, design-wise, I liked the design by criticalAY. |
My quick test just now showed the same behavior on desktop. Do you see a different behavior? |
Well, what you are suggesting here is exactly what I suggested in #15197 (comment). If we go that route, we will also need to add code for refreshing the reviewer when the user returns to the reviewer, though (see the linked comment). However, I later got convinced by David's comment that users won't want their reviews to be affected by changing the deck in Stats page. Also, see that Damien also supports changing the search query and is welcoming a PR to do that in Anki. |
A Spinner was introduced in the statistics screen top bar which can be used by the user to change the current selected deck and update the WebView with the statistics for the new selected deck. Note: the deck selection mechanism is decoupled from the general DeckSpinnerSelection/DeckSelectionDialog system so changing the deck in the statistics screen doesn't modify the selected deck for other parts of the app.
d8106cb
to
65c9a35
Compare
Purpose / Description
Reintroduce Deck Selector to the Statistics Page
Fixes
Approach
Use M3 button to allow user to change deck, not using the spinner here as the deck name is already displayed in the text field
How Has This Been Tested?
Google emulator API 34
Tested the orientation change too
test-stats.webm
Checklist
Please, go through these checks before submitting the PR.