-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Keep image file names #10329
Keep image file names #10329
Conversation
First PR! 🚀 We sincerely appreciate that you have taken the time to propose a change to AnkiDroid! Please have patience with us as we are all volunteers - we will get to this as soon as possible. |
A bigger issue this solves is don't making copies when someone reattachs the same image later in another note with the attach button. So, less storage and performance is wasted with time with copies of the same files |
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.
Since it's a change to libAnki
, requesting a couple of tests
One of our "big" problems which the filename solved was Google Images: It download/replaces the same filename on phones in many cases, and users were getting frustrated that their images were being replaced/not uploaded as Anki assumed same filename == same content
.
Your comment on "reattaches the same image" flags a concern, as we may be re-introducing this bug.
Made one, let me know if more is needed. I fixed another one related to
I don't know if I understood you correctly. This is I got:
If this is what you meant, this now isn't a problem. Tecnically, before my PR, Ankidroid TL;DR |
A demo: Screen_Recording_20220217-071849_AnkiDroid.mp4 |
40cee0a
to
f90bb3f
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.
I like this and it's a great improvement. Thanks!
All my comments are nitpicks.
AnkiDroid/src/main/java/com/ichi2/anki/multimediacard/fields/BasicImageFieldController.java
Outdated
Show resolved
Hide resolved
AnkiDroid/src/test/java/com/ichi2/anki/services/NoteServiceTest.java
Outdated
Show resolved
Hide resolved
AnkiDroid/src/test/java/com/ichi2/anki/services/NoteServiceTest.java
Outdated
Show resolved
Hide resolved
AnkiDroid/src/test/java/com/ichi2/anki/services/NoteServiceTest.java
Outdated
Show resolved
Hide resolved
Append checksum instead in filename of index as Anki Desktop does
Do not create temp names
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.
Nice! Looks like a solid test by my read as well, this will be a nice user improvement, quite a few complaints came in about current behavior
Purpose / Description
Keep the selected images original file names or appends its checksum in it if not unique, like Anki desktop does.
Fixes
Fixes #9116
Approach
<img>
tag I just put the field media import before text formatting, so it's possible to update theImagePath
at importMediaToDirectory() if changed.How Has This Been Tested?
Couldn't run the automated tests or build new ones because of #8482
Tested it manually with Android Studio Emulator (API 32, Pixel 2) and on my android phone (Samsung Galaxy Note 10 Lite SM-N770F/DS)
Procedure:
Checklist
Please, go through these checks before submitting the PR.
if
statements)Personal considerations
imgRandomNumberSequence.extension
tounixtimestamp.extension
doesn't matter much IMO, I kept it to keep things simple