-
-
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
AnkiDroid to use flag names like anki #16242
Conversation
Message to maintainers, this PR contains strings changes.
Read more about updating strings on the wiki, |
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.
Looks great! Needs to handle errors, other than that, the other comment is a nitpick and this is good to go
|
@david-allison, Unit tests are failing again. What should be done? |
@Giyutomioka-SS Remove the code or resource which are not in use. |
Already did |
Ping me in 24h, feel free to pick up another issue in the meantime |
|
@Giyutomioka-SS with apologies, my laptop died today. Try our Discord for now, I'll be a while to get back to normal |
@david-allison please don’t apologize, machines can give up anytime, and i always keep a tab on anki discord just don’t talk much😅 |
Feel free to ping the channel for help/a review, it's what we're here for! |
Not sure why, but the backend is not being found?
I looked at the commit history - it should be squashed - no reason for 5 commits - so I recommend learning how If it is not solved by that, then I would also do a |
1e62485
to
256426d
Compare
@david-allison @Giyutomioka-SS It is blocked until I come up with the right code to handle the flag names, as the previous commit I made related to flag names was reverted |
I don't see a reason for blocking this one. It doesn't matter which PR goes first, as long as is works and doesn't break CI |
This PR uses a method which was reverted to fix the CI failure and that is the reason for the conflicts, but if you intend to replace strings only then go ahead, @Giyutomioka-SS remember to find and replace the strings at all places now |
256426d
to
b311439
Compare
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 |
@BrayanDSO @david-allison @criticalAY Could you please review this once? |
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.
This is no longer using the backend
displayName should be a method
On my phone but there should be a better way than the current code to achieve the same result @Giyutomioka-SS instead of overriding it for all the strings |
Unit tests are failing if I am using TR this way in Flag.kt should I revert this to the previous commit it works fine. |
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.
Will approve after the blue flag name is corrected
The unit test fail as the col is not open I think |
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.
Cheers
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.
Tests are failing
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 believe:
Subject: [PATCH] feat: Toggle Bury
Issue 14163
---
Index: AnkiDroid/src/main/java/com/ichi2/anki/Reviewer.kt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/Reviewer.kt b/AnkiDroid/src/main/java/com/ichi2/anki/Reviewer.kt
--- a/AnkiDroid/src/main/java/com/ichi2/anki/Reviewer.kt (revision 9fb827d72dcbb33cfc10761fbed02216a09f0181)
+++ b/AnkiDroid/src/main/java/com/ichi2/anki/Reviewer.kt (date 1715982065094)
@@ -851,14 +851,14 @@
}
private fun setFlagTitles(menu: Menu) {
- menu.findItem(R.id.action_flag_zero).title = Flag.NONE.displayName
- menu.findItem(R.id.action_flag_one).title = Flag.RED.displayName
- menu.findItem(R.id.action_flag_two).title = Flag.ORANGE.displayName
- menu.findItem(R.id.action_flag_three).title = Flag.GREEN.displayName
- menu.findItem(R.id.action_flag_four).title = Flag.BLUE.displayName
- menu.findItem(R.id.action_flag_five).title = Flag.PINK.displayName
- menu.findItem(R.id.action_flag_six).title = Flag.TURQUOISE.displayName
- menu.findItem(R.id.action_flag_seven).title = Flag.PURPLE.displayName
+ menu.findItem(R.id.action_flag_zero).title = Flag.NONE.displayName()
+ menu.findItem(R.id.action_flag_one).title = Flag.RED.displayName()
+ menu.findItem(R.id.action_flag_two).title = Flag.ORANGE.displayName()
+ menu.findItem(R.id.action_flag_three).title = Flag.GREEN.displayName()
+ menu.findItem(R.id.action_flag_four).title = Flag.BLUE.displayName()
+ menu.findItem(R.id.action_flag_five).title = Flag.PINK.displayName()
+ menu.findItem(R.id.action_flag_six).title = Flag.TURQUOISE.displayName()
+ menu.findItem(R.id.action_flag_seven).title = Flag.PURPLE.displayName()
}
@SuppressLint("RestrictedApi")
Index: AnkiDroid/src/main/java/com/ichi2/anki/previewer/PreviewerFragment.kt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/previewer/PreviewerFragment.kt b/AnkiDroid/src/main/java/com/ichi2/anki/previewer/PreviewerFragment.kt
--- a/AnkiDroid/src/main/java/com/ichi2/anki/previewer/PreviewerFragment.kt (revision 9fb827d72dcbb33cfc10761fbed02216a09f0181)
+++ b/AnkiDroid/src/main/java/com/ichi2/anki/previewer/PreviewerFragment.kt (date 1715982065097)
@@ -206,14 +206,14 @@
}
private fun setFlagTitles(menu: Menu) {
- menu.findItem(R.id.action_flag_zero).title = Flag.NONE.displayName
- menu.findItem(R.id.action_flag_one).title = Flag.RED.displayName
- menu.findItem(R.id.action_flag_two).title = Flag.ORANGE.displayName
- menu.findItem(R.id.action_flag_three).title = Flag.GREEN.displayName
- menu.findItem(R.id.action_flag_four).title = Flag.BLUE.displayName
- menu.findItem(R.id.action_flag_five).title = Flag.PINK.displayName
- menu.findItem(R.id.action_flag_six).title = Flag.TURQUOISE.displayName
- menu.findItem(R.id.action_flag_seven).title = Flag.PURPLE.displayName
+ menu.findItem(R.id.action_flag_zero).title = Flag.NONE.displayName()
+ menu.findItem(R.id.action_flag_one).title = Flag.RED.displayName()
+ menu.findItem(R.id.action_flag_two).title = Flag.ORANGE.displayName()
+ menu.findItem(R.id.action_flag_three).title = Flag.GREEN.displayName()
+ menu.findItem(R.id.action_flag_four).title = Flag.BLUE.displayName()
+ menu.findItem(R.id.action_flag_five).title = Flag.PINK.displayName()
+ menu.findItem(R.id.action_flag_six).title = Flag.TURQUOISE.displayName()
+ menu.findItem(R.id.action_flag_seven).title = Flag.PURPLE.displayName()
}
private fun setBackSideOnlyButtonIcon(menu: Menu, isBackSideOnly: Boolean) {
Index: AnkiDroid/src/main/java/com/ichi2/anki/Flag.kt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/Flag.kt b/AnkiDroid/src/main/java/com/ichi2/anki/Flag.kt
--- a/AnkiDroid/src/main/java/com/ichi2/anki/Flag.kt (revision 9fb827d72dcbb33cfc10761fbed02216a09f0181)
+++ b/AnkiDroid/src/main/java/com/ichi2/anki/Flag.kt (date 1715982602616)
@@ -18,19 +18,31 @@
import androidx.annotation.ColorRes
import androidx.annotation.DrawableRes
import com.ichi2.anki.CollectionManager.TR
+import com.ichi2.anki.CollectionManager.withCol
import com.ichi2.libanki.Card
import com.ichi2.libanki.CardId
import com.ichi2.libanki.Collection
-enum class Flag(val code: Int, @DrawableRes val drawableRes: Int, @ColorRes val browserColorRes: Int?, val displayName: String) {
- NONE(0, R.drawable.ic_flag_transparent, null, TR.browsingNoFlag()),
- RED(1, R.drawable.ic_flag_red, R.color.flag_red, TR.actionsFlagRed()),
- ORANGE(2, R.drawable.ic_flag_orange, R.color.flag_orange, TR.actionsFlagOrange()),
- GREEN(3, R.drawable.ic_flag_green, R.color.flag_green, TR.actionsFlagGreen()),
- BLUE(4, R.drawable.ic_flag_blue, R.color.flag_blue, TR.actionsFlagBlue()),
- PINK(5, R.drawable.ic_flag_pink, R.color.flag_pink, TR.actionsFlagPink()),
- TURQUOISE(6, R.drawable.ic_flag_turquoise, R.color.flag_turquoise, TR.actionsFlagTurquoise()),
- PURPLE(7, R.drawable.ic_flag_purple, R.color.flag_purple, TR.actionsFlagPurple());
+enum class Flag(val code: Int, @DrawableRes val drawableRes: Int, @ColorRes val browserColorRes: Int?) {
+ NONE(0, R.drawable.ic_flag_transparent, null),
+ RED(1, R.drawable.ic_flag_red, R.color.flag_red),
+ ORANGE(2, R.drawable.ic_flag_orange, R.color.flag_orange),
+ GREEN(3, R.drawable.ic_flag_green, R.color.flag_green),
+ BLUE(4, R.drawable.ic_flag_blue, R.color.flag_blue),
+ PINK(5, R.drawable.ic_flag_pink, R.color.flag_pink),
+ TURQUOISE(6, R.drawable.ic_flag_turquoise, R.color.flag_turquoise),
+ PURPLE(7, R.drawable.ic_flag_purple, R.color.flag_purple);
+
+ fun displayName() : String = when (this) {
+ NONE -> TR.browsingNoFlag()
+ RED -> TR.actionsFlagRed()
+ ORANGE -> TR.actionsFlagOrange()
+ GREEN -> TR.actionsFlagGreen()
+ BLUE -> TR.actionsFlagBlue()
+ PINK -> TR.actionsFlagPink()
+ TURQUOISE -> TR.actionsFlagTurquoise()
+ PURPLE -> TR.actionsFlagPurple()
+ }
companion object {
fun fromCode(code: Int): Flag {
Index: AnkiDroid/src/main/java/com/ichi2/anki/CardBrowser.kt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/CardBrowser.kt b/AnkiDroid/src/main/java/com/ichi2/anki/CardBrowser.kt
--- a/AnkiDroid/src/main/java/com/ichi2/anki/CardBrowser.kt (revision 9fb827d72dcbb33cfc10761fbed02216a09f0181)
+++ b/AnkiDroid/src/main/java/com/ichi2/anki/CardBrowser.kt (date 1715982065104)
@@ -822,25 +822,25 @@
}
private fun setFlagTitles(menu: Menu) {
- menu.findItem(R.id.action_select_flag_zero).title = Flag.NONE.displayName
- menu.findItem(R.id.action_select_flag_one).title = Flag.RED.displayName
- menu.findItem(R.id.action_select_flag_two).title = Flag.ORANGE.displayName
- menu.findItem(R.id.action_select_flag_three).title = Flag.GREEN.displayName
- menu.findItem(R.id.action_select_flag_four).title = Flag.BLUE.displayName
- menu.findItem(R.id.action_select_flag_five).title = Flag.PINK.displayName
- menu.findItem(R.id.action_select_flag_six).title = Flag.TURQUOISE.displayName
- menu.findItem(R.id.action_select_flag_seven).title = Flag.PURPLE.displayName
+ menu.findItem(R.id.action_select_flag_zero).title = Flag.NONE.displayName()
+ menu.findItem(R.id.action_select_flag_one).title = Flag.RED.displayName()
+ menu.findItem(R.id.action_select_flag_two).title = Flag.ORANGE.displayName()
+ menu.findItem(R.id.action_select_flag_three).title = Flag.GREEN.displayName()
+ menu.findItem(R.id.action_select_flag_four).title = Flag.BLUE.displayName()
+ menu.findItem(R.id.action_select_flag_five).title = Flag.PINK.displayName()
+ menu.findItem(R.id.action_select_flag_six).title = Flag.TURQUOISE.displayName()
+ menu.findItem(R.id.action_select_flag_seven).title = Flag.PURPLE.displayName()
}
private fun setMultiSelectFlagTitles(menu: Menu) {
- menu.findItem(R.id.action_flag_zero).title = Flag.NONE.displayName
- menu.findItem(R.id.action_flag_one).title = Flag.RED.displayName
- menu.findItem(R.id.action_flag_two).title = Flag.ORANGE.displayName
- menu.findItem(R.id.action_flag_three).title = Flag.GREEN.displayName
- menu.findItem(R.id.action_flag_four).title = Flag.BLUE.displayName
- menu.findItem(R.id.action_flag_five).title = Flag.PINK.displayName
- menu.findItem(R.id.action_flag_six).title = Flag.TURQUOISE.displayName
- menu.findItem(R.id.action_flag_seven).title = Flag.PURPLE.displayName
+ menu.findItem(R.id.action_flag_zero).title = Flag.NONE.displayName()
+ menu.findItem(R.id.action_flag_one).title = Flag.RED.displayName()
+ menu.findItem(R.id.action_flag_two).title = Flag.ORANGE.displayName()
+ menu.findItem(R.id.action_flag_three).title = Flag.GREEN.displayName()
+ menu.findItem(R.id.action_flag_four).title = Flag.BLUE.displayName()
+ menu.findItem(R.id.action_flag_five).title = Flag.PINK.displayName()
+ menu.findItem(R.id.action_flag_six).title = Flag.TURQUOISE.displayName()
+ menu.findItem(R.id.action_flag_seven).title = Flag.PURPLE.displayName()
}
private fun updatePreviewMenuItem() {
CI is happy now |
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.
Cheers!
0adf4f7
to
34ec637
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.
Thanks!
Going in after #16427(with which I'm almost done) |
Maintainers: Please Sync Translations to produce a commit with only the automated changes from this PR. Read more about updating strings on the wiki, |
Hi there @Giyutomioka-SS! This is the OpenCollective Notice for PRs merged from 2024-05-01 through 2024-05-31 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! |
Purpose / Description
AnkiDroid to use Flag names like Anki
Fixes
How Has This Been Tested?
On Realme 6 & Emulator
Screen Recording
video_2024-04-22_01-29-40.mp4
Checklist
Please, go through these checks before submitting the PR.