0
0
mirror of https://github.com/ankidroid/Anki-Android.git synced 2024-09-20 03:52:15 +02:00
Commit Graph

16758 Commits

Author SHA1 Message Date
Arthur Milchior
c7376f63b6 NF: remove custom json
it was only required to avoid checked exception. Thanks to Kotlin, it's not a
concern anymore!
2022-10-13 12:23:30 -05:00
Arthur Milchior
e34505b37e NF: extract JSONArray's utils function as extension
This way, next commit can simply delete the class without changing remaining
code.
2022-10-13 12:23:30 -05:00
Arthur Milchior
13087b9659 NF: extract JSON's cloning method as extension
This way, next commit can delete the JSON class without having to change
them. JSONObject and JSONArray will simply refere to different classes.
2022-10-13 12:23:30 -05:00
Arthur Milchior
d64aafa331 NF: remove JSONObject.fromMap It was a duplicate of constructor 2022-10-13 12:23:30 -05:00
Arthur Milchior
f9808124db NF: refactor timber 2022-10-13 11:41:37 -05:00
Arthur Milchior
a5aa1a06ed NF: refactor DeckOption conf change handler 2022-10-13 11:41:37 -05:00
Mike Hardy
afabd93afa fix(test): we need notification permission on tests that measure screen
otherwise the API33 "post notifications" permission dialog pops up and
screen measurements fails
2022-10-13 11:38:24 -05:00
Damien Elmes
1c5bf8e6d6 Probable fix for test flake on Windows 2022-10-13 10:17:40 -05:00
Damien Elmes
356e467684 Use backend for adding notes
- Ensures tags are registered correctly
- Enables undoing of adds
- Also disables automatic backups when testing under robolectric, since
it causes race conditions in the tests.

Closes #12608
2022-10-13 10:17:40 -05:00
snowtimeglass
97fe872676 Change the order of audio-related items
Change the order of audio-related items to group them

- Move "Set TTS language" above "Deck options" (Move "Deck options" to the bottom of the menu)
- Move "Replay audio" and "Check pronunciation" above "Set TTS language"
2022-10-13 10:14:56 -05:00
Pratyaksh Khurana
373e4ea3fb
Added snackbar instead of toast and format code (#12607)
* added snackbar instead of toast and format code
* fix nits
2022-10-13 10:13:17 -05:00
lukstbit
a858c9dafd Make DeckPicker to use MaterialDialog
The deprecation for the neutral button will be handled with other deprecations of that type in a future PR.
2022-10-13 09:57:09 -05:00
lukstbit
a5f47984c6 Make CustomSyncServerSettingsFragment to use MaterialDialog 2022-10-13 09:57:09 -05:00
lukstbit
dae964af4d Make CoroutineHelpers to use MaterialDialog
This commit also adds for userAcceptsSchemaChange(Collection) handling for canceling the dialog in other ways(like
tapping outside or using the back button). Without onCancel the function will never resume in the situations mentioned
above.
2022-10-13 09:57:09 -05:00
Brayan
0e7868886f Remove "Show " from show hint string 2022-10-13 09:49:41 -05:00
Brayan
7158e623a4 NF: Remove runHint
unused
2022-10-13 09:49:41 -05:00
lukstbit
8e13995d7a Fix 0 bytes file output when exporting collection
To fix the bug this commit introduces a split between saving and sharing the collection exported file.
2022-10-13 09:47:32 -05:00
David Allison
eb49979e9b chore: remove 'welcome dialog'
Due to Scoped Storage, we will no longer need this dialog
It was added because people were complaining about the storage
permission prompt, and this will no longer be shown

We remove this now to remove the burden on translators and a step
for developers to test a new version of the app.

Later, we'll remove this function entirely.

See: issue 5304 - scoped storage
2022-10-13 09:23:39 -05:00
AnkiDroid Translations
b046356264 Updated strings from Crowdin 2022-10-13 09:23:18 -05:00
David Allison
bd4b810102 fix: 'RescheduleDialog' memory leak
* Open Reviewer
* Select "Reschedule - Reschedule in X Days"
* Close the dialog
* Close the reviewer
* Memory leak
2022-10-13 07:59:27 -05:00
Mike Hardy
2f76748a97 fix(acra): use correct BuildConfig so we get correct version number
This should solve the problem of ACRA / Acrarium showing the library version number
in the UI vs the app version number
2022-10-13 07:54:01 -05:00
Mike Hardy
19a9fb0d6e fix(acra, limiter): limiter timestamps are now public
we can get our most recent exception of a specific type without reflection now
2022-10-13 07:54:01 -05:00
Mike Hardy
bca194d236 fix(acra, dialog): override language in crash dialog context
This is the equivalent method from AnkiDroidApp and AnkiActivity,
but this dialog does not inherit from them, so it has to override
the language in it's own implementation
2022-10-13 07:54:01 -05:00
Mike Hardy
c80840426f build(deps): forward port to ACRA 5.9.x config style
- note using "acra" as prefs prefix so this works with current version
  (which needs "" for prefs to work) and next version (which needs null)
  just specifying a custom file works around the existing bug and new fixed style
  see https://github.com/ACRA/acra/issues/1113 and related commit
2022-10-13 07:54:01 -05:00
Mike Hardy
e0f4d25324 refactor: centralize init of ACRA next to config 2022-10-13 07:54:01 -05:00
Mike Hardy
1dda5853e2 refactor: KotlinCleanup of ACRA config member
Only ACRATest is using the property now, rest of config is internal+dynamic
2022-10-13 07:54:01 -05:00
Mike Hardy
bd16defa83 refactor: store ACRA params as local state, always rebuild
instead of modifying the existing builder to change config, rebuild
each time by storing the modifications locally and then
re-doing the config completely using our local state
2022-10-13 07:54:01 -05:00
Mike Hardy
4048569cb8 refactor: extract ACRA config builder default configuration 2022-10-13 07:54:01 -05:00
Mike Hardy
2bd8374bed refactor: set crash alert dialog UI elements from primary sources
No need to entangle with ACRA stuff here
2022-10-13 07:54:01 -05:00
Mike Hardy
3c3d868cff refactor: remove reference to ACRA internal class, use standard Map 2022-10-13 07:54:01 -05:00
Mike Hardy
89fd6d4049 refactor: use new location for ACRA convenience method 2022-10-13 07:54:01 -05:00
David Allison
983fd6c8d2 lint: fix lint warnings
These were flagged by Android Studio on the previous commit
2022-10-13 07:52:10 -05:00
David Allison
a586b14dd6 fix: don't show crash report dialog on first run
`getColSafe()` showed a crash report dialog on the first run of the app

We add an override in a path where this is expected to fail
2022-10-13 07:52:10 -05:00
Arthur Milchior
bd818a03bb NF: refactor syncFunction 2022-10-13 11:15:56 +03:00
Divyansh Kushwaha
74626669bb Fix: getAllModelsAndNotesCount is now cancelled co-operatively 2022-10-13 10:33:12 +03:00
curche
c8ea3766b0 Refactor LintUtils.isAnAllowedClass to not use var 2022-10-12 20:15:53 +03:00
Prince kushwaha
4782cc3c8e Kotlin CleanUp of ImportTest.kt 2022-10-11 18:04:42 -03:00
Divyansh Kushwaha
2bdc97ffc4
[GSoC] Coroutines migration SuspendCardMulti (#12585)
* Extracted SuspendCardMulti to suspendCardMulti

* SuspendCardMulti now extends TaskDelegate

* Moved exception handling to suspendCardMulti function

* Migrated SuspendCardMulti to Coroutines

* Exceptions are now handled by launchCatchingTask

* Extracted long condition out of `if()` to a variable
2022-10-11 18:35:33 +03:00
Nishant Bhandari
0a91bcbf71
[KotlinCleanup] DeckOptions (#12619)
* Replaced java methods with kotlin

* Removed all java.lang.* methods.

* Removed `val r`

* Removed `val s`

* Simplified assignment in if else.

* Replaced for loop with forEachIndexed.

* Removed unused if else statement.

Co-authored-by: Nishant <nishantbhandari0019@gmail.com>
2022-10-11 13:55:37 +05:30
Divyansh Kushwaha
762db37a9f
[GSoC] Coroutines migration RebuildCram (#12584)
* DeckPicker: Migrated usage of CollectionTask.RebuildCram to Coroutines

* StudyOptionsFragment: Migrated usage of RebuildCram to Coroutines

* Migrated RebuildCram to Coroutines

* KotlinCleanup, removed unused getCollectionTaskListener
2022-10-11 00:59:36 +05:30
Arthur Milchior
622061e850 NF: replace in by source for Parceleable
this even follow the parameter name of the class it extends
2022-10-09 17:17:06 -03:00
Divyansh Kushwaha
632a83277b
[GSoC] Coroutines migration DeleteNoteMulti (#12577)
* DeleteNoteHandler now extends TaskListenerWithContext

Copied the logic from previous parent: ListenerWithProgressBarCloseOnFalse

* DeleteNoteMulti now extends TaskDelegate not DismissNotes

DismissNotes is a wrapper that just executes the original task in db-transaction. This behaviour is now directly implemented in DeleteNoteMulti

* Extracted DeleteNoteMulti::task to deleteNoteMulti

* deleteNoteMulti: result is returned finally instead of publishing as progress

In previous implementation, result was being published using doProgress and just after function returns. So basically is is equivalent to finally returning the result.

Also notes are removed from view only if the operation results in success

* Migrated DeleteNoteMulti to Coroutines

pre and post delete behaviour has be imported from Cardbrowser.mDeleteNoteHandler.

* KotlinCleanup: CardBrowser

* Exceptions are now handled by launchCatchingTask

* Changes to UI is now done behind a progress dialog

* renamed variables to more descriptive ones

result to deleteCard
deleteNoteMulti to deleteMultipleNotes
2022-10-10 01:02:14 +05:30
nicki
c1dfa70659
Cleanup: Refactor Finder.kt and define preds as a val instead of var (#12593)
* Refactor `preds` to define it as a `val` instead of `var`

* move initialization to when declaration happens

auto suggestion by Android Studio

* remove redundant curly braces
2022-10-09 10:46:43 -03:00
Divyansh Kushwaha
d9b4ea9d86
[GSoC] Coroutines migration RenderBrowserQA (#12571)
* Extracted out RenderBrowserQA::task to renderBrowserQA

* Extracted out onPostExecuteRenderBrowserQA function

* KotlonCleanup: CardBrowser

* Coroutines migration RenderBrowserQA

Replaced cancellation check of CollectionTask with coroutineScope.ensureActive()
2022-10-09 11:17:12 +03:00
Divyansh Kushwaha
d3a1ab4766
[GSoC] Coroutines migration ConfSetSubdecks (#12592)
* Extracted out ConfSetSubdecks::task to confSetSubdecks

* Migrated ConfSetSubdecks to Coroutines

Since the launch is taking place from inside a AppCompatPreferenceActivity which is not a lifecycleOwner. And launchCatchingTask can only happen from a lifecycleOwner, so a custom CoroutineScope implementation is required which cancels any job (launched from this activity) when the activity gets destroyed and that is achieved by extending 'AppCompatPreferenceActivity: CoroutineScope by MainScope' and calling cancel in onDestroy.

MainScope delegates the CoroutineScope implementation with having Main dispatcher as default for launch{} calls. This is the reason why coroutine is launched using launch{} instead of launchCatchingTask{}

* Exceptions are now handled by CoroutineExceptionHandler

* Moved confSetSubdecks to DeckOptions
2022-10-09 10:23:12 +03:00
Mike Hardy
b8eccc1ab7 Bumped version to 2.16alpha86 2022-10-09 00:00:33 +00:00
Mike Hardy
5bf2a71dfc fix(release): fail release process if gradle targets fail
Fixes #12594
2022-10-08 18:57:20 -05:00
Mike Hardy
d26a90cac2 fix(release): workaround gradle OOM by killing daemon after most activities
Fixes #12594
2022-10-08 18:57:20 -05:00
Mike Hardy
4348e998dc release(docs): add documentation of each important release step
should  help diagnose problems more quickly in future
2022-10-08 18:57:20 -05:00
Mike Hardy
0486f9348a chore(card-template-editor): quiet log warning by specifying compatible gravity_start
If you use TabLayout, and
if that tabMode is "scrollable" (which we want, vs auto or fixed), and
if you do not specify a non-default gravity,
then you get a TabLayout set for mode scrollable + gravity fill, which is not compatible

In this commit I switch to gravity start, which simply matches the behavior the TabLayout falls back to

- I considered tabMode:auto, then that puts the tabs in the center which looks bad, unless,
- I considered tabMode:auto with gravity start, now tabs are in right spot, but there is no change in behavior vs
- I consdiered tabMode:scrollable with gravity start - which is the fallback behavior and
  works best while representing the minimal change

This is the warning:
W/TabLayout: MODE_SCROLLABLE + GRAVITY_FILL is not supported, GRAVITY_START will be used instead
2022-10-08 18:57:20 -05:00