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

19379 Commits

Author SHA1 Message Date
Brayan Oliveira
1246253596
fix: reviewer fetch and XMLHttpRequest issues (#16457)
* feat: handle audio and videos seeking in ViewerResourceHandler

basically restore what e55cae28 had deleted

* fix: use http base url in card viewers
2024-05-23 09:39:35 -05:00
Mike Hardy
302ffdcfb7
Dependency updates 20240523 (#16464)
* ---
updated-dependencies:
- dependency-name: com.android.application
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: com.android.library
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* ---
updated-dependencies:
- dependency-name: com.android.tools.lint:lint-api
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: com.android.tools.lint:lint
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: com.android.tools.lint:lint-tests
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* build(deps): bump org.robolectric:robolectric from 4.12.1 to 4.12.2

Bumps [org.robolectric:robolectric](https://github.com/robolectric/robolectric) from 4.12.1 to 4.12.2.
- [Release notes](https://github.com/robolectric/robolectric/releases)
- [Commits](https://github.com/robolectric/robolectric/compare/robolectric-4.12.1...robolectric-4.12.2)

---
updated-dependencies:
- dependency-name: org.robolectric:robolectric
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* ---
updated-dependencies:
- dependency-name: org.jetbrains.kotlin:kotlin-reflect
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* ---
updated-dependencies:
- dependency-name: org.jetbrains.kotlin:kotlin-test
  dependency-type: direct:production
  update-type: version-update:semver-major
- dependency-name: org.jetbrains.kotlin:kotlin-test-junit
  dependency-type: direct:production
  update-type: version-update:semver-major
- dependency-name: org.jetbrains.kotlin:kotlin-test-junit5
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* ---
updated-dependencies:
- dependency-name: org.jetbrains.kotlin:kotlin-stdlib
  dependency-type: direct:production
  update-type: version-update:semver-major
- dependency-name: org.jetbrains.kotlin.android
  dependency-type: direct:production
  update-type: version-update:semver-major
- dependency-name: org.jetbrains.kotlin.plugin.parcelize
  dependency-type: direct:production
  update-type: version-update:semver-major
- dependency-name: org.jetbrains.kotlin.jvm
  dependency-type: direct:production
  update-type: version-update:semver-major
- dependency-name: org.jetbrains.kotlin.plugin.serialization
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-23 15:13:58 +01:00
David Allison
4cfb4afbb0 tests: fix for Kotlin 2.0
The generic needs to apply to both `EmptyApplication` and `AnkiDroidApp`

```
    java.lang.ClassCastException: class com.ichi2.anki.AnkiDroidApp cannot be cast to class java.lang.Void (com.ichi2.anki.AnkiDroidApp is in unnamed module of loader org.robolectric.internal.AndroidSandbox$SdkSandboxClassLoader @29f72685; java.lang.Void is in module java.base of loader 'bootstrap')
        at com.ichi2.anki.RobolectricTest.validateRunWithAnnotationPresent(RobolectricTest.kt:439)
        at com.ichi2.anki.RobolectricTest.setUp(RobolectricTest.kt:105)
        at java.base/java.lang.reflect.Method.invoke(Method.java:580)
        at com.ichi2.testutils.FailOnUnhandledExceptionRule$apply$1.evaluate(FailOnUnhandledExceptionRule.kt:57)
        at org.robolectric.RobolectricTestRunner$HelperTestRunner$1.evaluate(RobolectricTestRunner.java:489)
        at org.robolectric.internal.SandboxTestRunner$2.lambda$evaluate$2(SandboxTestRunner.java:291)
        at org.robolectric.internal.bytecode.Sandbox.lambda$runOnMainThread$0(Sandbox.java:104)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
        at java.base/java.lang.Thread.run(Thread.java:1583)
```
2024-05-22 18:11:22 +00:00
David Allison
4f474d1157 refactor(card-browser): extract 'launchOptions'
Final extraction from 14843 before testing
2024-05-22 10:26:16 +00:00
Brayan Oliveira
e77316421d refactor: inline onCreateWebChromeClient
unused
2024-05-22 07:20:03 +00:00
Brayan Oliveira
04dd1e6ec8 refactor: improve logs of AnkiServer 2024-05-22 07:20:03 +00:00
Brayan Oliveira
b9e70b5c47 refactor: move statistics menu to XML 2024-05-22 07:20:03 +00:00
Brayan Oliveira
bcedcd0a22 refactor: remove IO activity 2024-05-22 07:20:03 +00:00
Brayan Oliveira
ce77fc6fcd refactor: use Parcelable for PreviewerIdsFile
Parcelables tend to be faster than Serializables
2024-05-22 06:58:07 +00:00
David Allison
59416f1e72 fix(note-editor): deck for new cards was not saved
If a user went in and out of the 'add note' widget,
the value was not persisted

Fixes 13931
2024-05-21 23:21:43 +00:00
David Allison
ecc777ddbf perf(tags-dialog): use .toSet()
Better optimizations are possible
but I want test coverage first
2024-05-21 23:15:52 +00:00
David Allison
94b07f1a34 feat(tags-dialog): Add Progress Dialog
The operation is really slow

* show (some) feedback to user
* stop log spam, speeding it up
* remove ANR

* adds a `withContext`

Issue 16226
2024-05-21 23:15:52 +00:00
David Allison
98db2bd32c fix(tags-dialog): Out of Memory issue (HACK)
This fixes an OutOfMemoryException on 31479 cards
(AnKing)

It is still exceptionally slow, to the point of being unusable

Issue 16226
2024-05-21 23:15:52 +00:00
David Allison
6b20e5db7e refactor: selectedRowIds -> CardId 2024-05-21 23:15:52 +00:00
David Allison
719bb08ade fix: TagsDialog TransactionTooLargeException
Since the dialog accepts all tags, this can crash
just by having too many tags

fix by using `TagsFile` serialized to disk

Note: using Parcelable due to API 25 issue: 15878

Fixes 16226 - too many cards
Fixes 16351 - too many tags
2024-05-21 23:15:52 +00:00
David Allison
8c89ad22a4 refactor: tagsDialog - nonnull 2024-05-21 23:15:52 +00:00
David Allison
95624d8760 refactor: Kotlin 2.0 prep
## Deprecations

* `@Deprecated`/ `@Suppress("OVERRIDE_DEPRECATION")`

====

This declaration overrides a deprecated member but is not marked as deprecated itself.
Please add the '@Deprecated' annotation or suppress the diagnostic.
See https://youtrack.jetbrains.com/issue/KT-47902 for details

## `LinkedList.first`

* `LinkedList.first` to `LinkedList.first()`

----

'val first' is deprecated. This declaration will be renamed in a future version of Kotlin.
Please consider using the 'first()' stdlib extension if the collection supports fast random access.

## `kotlinOptions`

* `kotlinOptions` -> `compilerOptions`

 'kotlinOptions(KotlinJvmOptionsDeprecated /* = KotlinJvmOptions */.() -> Unit): Unit' is deprecated.
 Please migrate to the compilerOptions DSL. More details are here: https://kotl.in/u1r8ln
2024-05-21 15:28:50 +00:00
lukstbit
eeb9e27ff2 Remove materialdialogs dependency
Some notes:
- added the back arrow from the vector assets IDE library to replace
the one used from the library
- replaced md_title_textsize with title_textsize, they have the same value, see
709cfee9b4/core/src/main/res/values/dimens.xml (L28)
2024-05-21 12:40:36 +00:00
lukstbit
041145f4f0 Remove references to MaterialDialog from DeckPickerTest
The app doesn't have any more MaterialDialogs so checking for them
is useless now.
2024-05-21 12:40:36 +00:00
lukstbit
12775d8d21 Migrate from MaterialDialog toAlertDialog in DeckSelectionDialog
In onResume() there is code added to clear some window flags that
prevented the keyboard to appear when the user would try to filter
the decks' list.
2024-05-21 12:40:36 +00:00
David Allison
b455b7b135 fix(note-editor): display 'home' deck if filtered
If a note is edited from the Reviewer
And the note is in a filtered deck

The 'current deck' should show the home deck
Before this change it showed the first deck

Fixes 15919
2024-05-21 09:39:15 +00:00
Haz3-jolt
887f51bf0a Added test for addNote 2024-05-21 07:48:58 +00:00
Moreno
b7ac28c533 fix stats orientation change 2024-05-20 19:44:45 -03:00
lukstbit
08f92fa2f4 Clarify waitForPositiveButton in AlertDialog.input() documentation
The standard behavior of clicking any of the platform defined buttons
of a dialog is closing the dialog. This doesn't happen for the positive
button when using the extension AlertDialog.input(waitForPositiveButton = true)
as we set a custom OnClickListener on the positive button which disables the
platform behavior.
2024-05-20 14:54:23 +00:00
lukstbit
be01711243 Migrate MaterialDialog to AlertDialog in TagsDialog
Co-authored-by: Neel Doshi <60827173+neeldoshii@users.noreply.github.com>
2024-05-20 14:54:23 +00:00
lukstbit
7b850d20f7 Migrate MaterialDialog to AlertDialog in ModelFieldEditorTest
Note: showing the dialog required an app compat theme so I inserted it
by using one of our themes through a ContextWrapper. The button
declaration also requires either a resource string or a text so the empty
string satisfies this requirement.
2024-05-20 14:29:38 +00:00
David Allison
a51bf63b67 test(ci): fix windows runner hanging
Tracked down to all methods on TagsDialog

Adding `: RobolectricTest()` did not resolves this

So add `@Flaky`

Fixes 16404
2024-05-19 21:58:32 +00:00
David Allison
84730bec3c test: support class-level Flaky annotation 2024-05-19 21:58:32 +00:00
Neel Doshi
62eff67e2f Migrated AndroidPermanentlyRevokedPermissionsDialog to AlertDialog 2024-05-19 18:29:42 +00:00
AnkiDroid Translations
7853f54d4b Updated strings from Crowdin 2024-05-19 13:48:40 +00:00
Sumit Singh
ebbd10dff4 Ankidroid use flag names like anki 2024-05-19 10:53:04 +00:00
AnkiDroid Translations
8aeb8a63d2 Updated strings from Crowdin 2024-05-19 10:32:29 +00:00
Moreno
9a49a9fd97 try catch intent handling 2024-05-19 06:39:07 +00:00
Moreno
555a8e000e add intent url to previewer 2024-05-19 06:39:07 +00:00
Moreno
22efbf316c refactor handleUrl to use when 2024-05-19 06:39:07 +00:00
Moreno
8daede5875 handle android app links in previewer 2024-05-19 06:39:07 +00:00
Brayan Oliveira
59fbe88329 fix: currentCard not initialized 2024-05-19 06:38:17 +00:00
Robozinho
56e9816618 fix manage notetypes menu 2024-05-18 16:30:43 -03:00
Moreno
e2bb9c8d22 fix summary overflow 2024-05-16 21:22:42 +00:00
Mike Hardy
d312629143
Dependency updates 20240516 (#16415)
* build(deps): bump org.jetbrains.kotlinx:kotlinx-coroutines-test

Bumps [org.jetbrains.kotlinx:kotlinx-coroutines-test](https://github.com/Kotlin/kotlinx.coroutines) from 1.8.0 to 1.8.1.
- [Release notes](https://github.com/Kotlin/kotlinx.coroutines/releases)
- [Changelog](https://github.com/Kotlin/kotlinx.coroutines/blob/master/CHANGES.md)
- [Commits](https://github.com/Kotlin/kotlinx.coroutines/compare/1.8.0...1.8.1)

---
updated-dependencies:
- dependency-name: org.jetbrains.kotlinx:kotlinx-coroutines-test
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* build(deps): bump androidx.viewpager2:viewpager2 from 1.0.0 to 1.1.0

Bumps androidx.viewpager2:viewpager2 from 1.0.0 to 1.1.0.

---
updated-dependencies:
- dependency-name: androidx.viewpager2:viewpager2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* build(deps): bump androidx.appcompat:appcompat

Bumps androidx.appcompat:appcompat from 1.7.0-beta01 to 1.7.0-rc01.

---
updated-dependencies:
- dependency-name: androidx.appcompat:appcompat
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* build(deps): bump androidx.annotation:annotation from 1.7.1 to 1.8.0

Bumps androidx.annotation:annotation from 1.7.1 to 1.8.0.

---
updated-dependencies:
- dependency-name: androidx.annotation:annotation
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* build(deps): bump androidxFragmentKtx from 1.6.2 to 1.7.1

Bumps `androidxFragmentKtx` from 1.6.2 to 1.7.1.

Updates `androidx.fragment:fragment-ktx` from 1.6.2 to 1.7.1

Updates `androidx.fragment:fragment-testing` from 1.6.2 to 1.7.1

Updates `androidx.fragment:fragment-testing-manifest` from 1.6.2 to 1.7.1

---
updated-dependencies:
- dependency-name: androidx.fragment:fragment-ktx
  dependency-type: direct:production
  update-type: version-update:semver-minor
- dependency-name: androidx.fragment:fragment-testing
  dependency-type: direct:production
  update-type: version-update:semver-minor
- dependency-name: androidx.fragment:fragment-testing-manifest
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* build(deps): bump io.mockk:mockk from 1.13.10 to 1.13.11

Bumps [io.mockk:mockk](https://github.com/mockk/mockk) from 1.13.10 to 1.13.11.
- [Release notes](https://github.com/mockk/mockk/releases)
- [Commits](https://github.com/mockk/mockk/compare/1.13.10...1.13.11)

---
updated-dependencies:
- dependency-name: io.mockk:mockk
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-16 16:02:53 -05:00
Neel Doshi
65a9ccd760 Redundant MaterialBuilderUtils 2024-05-16 12:58:23 +00:00
Neel Doshi
2bce63ced9 Refactored DatabaseErrorDialog to AlertDialog 2024-05-16 12:58:23 +00:00
Neel Doshi
480e4e8b95 Extension Function For ListItem and Message 2024-05-16 12:58:23 +00:00
Moreno
ee085a6c92 improve optimizing presets message 2024-05-15 21:57:23 +00:00
Moreno
349d4f21cf fix language country with system default 2024-05-15 15:09:12 +00:00
Ashish Yadav
27f5f25b3d chore: extract ActionModeClass from NoteEditor 2024-05-15 12:31:09 +00:00
Brayan Oliveira
0fc602e8b0 Update forums links
There are now subcategories for AnkiDroid
2024-05-15 09:59:02 -03:00
Haz3-jolt
f336065d12 fixes #16389 IO type reappears when card is added. 2024-05-14 22:00:26 +00:00
Haz3-jolt
53609f681d changed from runBlocking -> withBrowser and simplified scope. 2024-05-14 21:26:17 +00:00
Haz3-jolt
1dc17e5a41 Added test for OnDeckSelected. 2024-05-14 21:26:17 +00:00