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

Feature: Allow changing deck name in statistics screen #15648

Merged
merged 1 commit into from
Sep 16, 2024

Conversation

criticalAY
Copy link
Contributor

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

image
test-stats.webm

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

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.

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

@david-allison david-allison added the Needs Author Reply Waiting for a reply from the original author label Feb 25, 2024
@criticalAY
Copy link
Contributor Author

criticalAY commented Feb 25, 2024

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,

  • other reasons action bar spinner has a sublist too, why would we need that here?,
  • note editor spinner doesn't look good in the action bar, I already tried it

@david-allison
Copy link
Member

david-allison commented Feb 25, 2024

I feel this significantly reduces vertical space, which is what people want from this screen

  1. Could we move it into the menu (as the main action)?
  2. Could you send a screenshot of the spinner to see if we can make it work? The inconsistency is unusual

@criticalAY
Copy link
Contributor Author

image-1.png

Updated screenshot

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.

Visually, this looks awesome, thank you!

AnkiDroid/src/main/java/com/ichi2/anki/pages/Statistics.kt Outdated Show resolved Hide resolved
AnkiDroid/src/main/java/com/ichi2/anki/pages/Statistics.kt Outdated Show resolved Hide resolved
AnkiDroid/src/main/res/layout/page_fragment.xml Outdated Show resolved Hide resolved
AnkiDroid/src/main/res/layout/page_fragment.xml Outdated Show resolved Hide resolved
@criticalAY criticalAY force-pushed the stats-deck-change branch 2 times, most recently from efada90 to bde8a9f Compare February 27, 2024 14:28
Comment on lines 99 to 112
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)
Copy link
Member

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

@BrayanDSO
Copy link
Member

This likely will need more feedback rounds than I have availability for. Leaving to the other reviewers

@criticalAY
Copy link
Contributor Author

@BrayanDSO Is this ok? I made some changes

@criticalAY criticalAY force-pushed the stats-deck-change branch 2 times, most recently from 31453a4 to 39f5818 Compare February 28, 2024 11:36
@david-allison david-allison added Needs Review Needs reviewer reply Waiting for a reply from another reviewer and removed Needs Author Reply Waiting for a reply from the original author labels Mar 4, 2024
@david-allison david-allison added Needs Author Reply Waiting for a reply from the original author and removed Needs Review Needs reviewer reply Waiting for a reply from another reviewer labels Apr 16, 2024
@criticalAY criticalAY force-pushed the stats-deck-change branch 2 times, most recently from 9574e50 to 545b02b Compare April 21, 2024 15:34
@david-allison david-allison removed their assignment Aug 19, 2024
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.

Approve after Mike's comment is taken care of

AnkiDroid/src/main/java/com/ichi2/anki/pages/Statistics.kt Outdated Show resolved Hide resolved
@david-allison david-allison added Needs Author Reply Waiting for a reply from the original author Pending Merge Things with approval that are waiting future merge (e.g. targets a future release, CI wait, etc) and removed Needs Second Approval Has one approval, one more approval to merge labels Aug 19, 2024
@mikehardy
Copy link
Member

Note for me mainly as I look to merge all things merge-able and I scan this, only outstanding thread is this, hoping for a PR or issue to mark the code generating the form we twiddle here upstream so we get a note if they modify it: #15648 (comment)

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.
@lukstbit lukstbit removed Needs Author Reply Waiting for a reply from the original author Has Conflicts labels Aug 31, 2024
@mikehardy mikehardy added Anki Ecosystem Compatibility Blocked by dependency Currently blocked by some other dependent / related change and removed Pending Merge Things with approval that are waiting future merge (e.g. targets a future release, CI wait, etc) labels Sep 16, 2024
@mikehardy
Copy link
Member

Current status: I think we're really close here. Only sticking point is cross-repo programmatic usage of the web form and that will resolve but it may take an iteration or so

@user1823
Copy link
Contributor

user1823 commented Sep 16, 2024

I think that this PR can be merged now as it is and the change from "first text box" to ID can be made in a subsequent PR.

Reasoning:
Even if dae merges the linked PR today, we likely won't get the change in AnkiDroid until the next stable release of Anki, which seems to be at least a month away. In my opinion, it isn't wise to block this PR just for that small change, which we can easily make once the backend update is available.

Obviously, this is just my opinion and the maintainers are free to disagree.

@mikehardy
Copy link
Member

That's a reasonable point @user1823
I'll merge this and peel off the cross-repo compatibility thing to a separate issue so the bulk of this (which is good!) is unblocked.

@mikehardy mikehardy added Pending Merge Things with approval that are waiting future merge (e.g. targets a future release, CI wait, etc) and removed Anki Ecosystem Compatibility Blocked by dependency Currently blocked by some other dependent / related change labels Sep 16, 2024
@mikehardy mikehardy added this pull request to the merge queue Sep 16, 2024
Merged via the queue into ankidroid:main with commit c1fbbad Sep 16, 2024
9 checks passed
@github-actions github-actions bot removed the Pending Merge Things with approval that are waiting future merge (e.g. targets a future release, CI wait, etc) label Sep 16, 2024
@github-actions github-actions bot added this to the 2.19 release milestone Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reintroduce Deck Selector to Statistics Page
7 participants