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

16350 Commits

Author SHA1 Message Date
David Allison
529bc11db7 feat: implement App Introduction System
* Displays the App Introduction System
* Handles only displaying it once
* Handles syncing if the app intro loads an existing AnkiWeb account
* (special case) Handles an upgrade from 2.15 -> 2.16 where
  the preference for the app intro was unset.
2022-08-26 23:39:35 -05:00
David Allison
b3a138035b feat: App Introduction System
A screen which appears on the first run of the application

Displaying:
* Get Started
* Sync from AnkiWeb

This aims to handle the use case of an existing user.
If they do not sync immediately, then they risk creating
two collections, which are incompatible and cause a sync conflict

Based on 9130 by Shridhar Goel
2022-08-26 23:39:35 -05:00
David Allison
fbe16e5df4 refactor: extract method 'wasFreshInstall'
Will be useful to call from 'DeckPicker'
2022-08-26 23:39:35 -05:00
David Allison
36a992cde0 design: backgrounds for 'introduction' activity
The Introduction activity is the first activity that users see
and therefore should be nicely designed.

* intro_gradient.xml
Contains a background gradient for the top of the introduction:
a blue to white/black gradient

* intro_ankidroid_logo:
Contains the AnkiDroid logo, encircled in a semi-transparent colour

* Due to bugs with `<aapt:attr>` in ankidroid_logo, in v21-23 this is
just the AnkiDroid logo with no transparent circle

Designed to go on top of intro_gradient
2022-08-26 23:39:35 -05:00
David Allison
c138dd5b7a feat: Activity to Login + Sync from AnkiWeb
We do not want to encourage a new AnkiDroid user to create an account

So this only allows a login, not a 'create account'
2022-08-26 23:39:35 -05:00
Brayan Oliveira
9f050a6041 Add option to enable the v3 sched 2022-08-26 23:38:09 -05:00
Brayan Oliveira
78f434e304 Add v3Enabled property to Collection
And override it on CollectionV16.kt
2022-08-26 23:38:09 -05:00
Brayan Oliveira
f67bb496cd Add "Allow sync on metered connections" preference
If disabled, auto-sync isn't triggered on metered connections and the user is asked if they want to continue if they trigger a manual sync

If enabled, sync occurs normally
2022-08-26 23:37:32 -05:00
Brayan Oliveira
100781df2f NF: make DeckPicker.automaticSync() more readable 2022-08-26 23:37:32 -05:00
Brayan Oliveira
e15e8191d4 Create an Advanced category under "Sync" preferences
for better organization
2022-08-26 23:37:32 -05:00
Brayan Oliveira
5d2c141ff8 NF: refactor isActiveNetworkMetered() 2022-08-26 23:37:32 -05:00
Brayan Oliveira
123cf288cf Extract isActiveNetworkMetered() 2022-08-26 23:37:32 -05:00
Brayan Oliveira
7bffd55f23 NF: remove more files from the legacy CSV importer implementation
which aren't used/useful anymore
2022-08-26 23:36:38 -05:00
AnkiDroid Translations
732ee4a80a Updated strings from Crowdin 2022-08-26 23:35:34 -05:00
Mike Hardy
40b4b750cc fix: type coercion fix in ContentProviderTest to fix build
this may not be the very best way, but it meets pre-Kotlin contracts,
and fixes the build now
2022-08-26 23:27:24 -05:00
David Allison
fa5c90eb21 refactor: Convert Utils to Kotlin
com.ichi2.libanki.Utils
2022-08-26 18:00:12 -05:00
David Allison
ad79bd7e66 refactor: Rename Utils.java to .kt
com.ichi2.libanki.Utils
2022-08-26 18:00:12 -05:00
David Allison
aec51a6a67 refactor: Convert Sound to Kotlin
com.ichi2.libanki.Sound

This introduced a bug in `removeFormattingFromMathjax`:

```
INSTANCE
java.lang.NoSuchFieldError: INSTANCE
	at com.ichi2.libanki.MathJaxClozeTest.removeFormattingFromMathjax(MathJaxClozeTest.kt:22)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.robolectric.RobolectricTestRunner$HelperTestRunner$1.evaluate(RobolectricTestRunner.java:591)
	at org.robolectric.internal.SandboxTestRunner$2.lambda$evaluate$0(SandboxTestRunner.java:274)
	at org.robolectric.internal.bytecode.Sandbox.lambda$runOnMainThread$0(Sandbox.java:88)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:829)
	Suppressed: org.robolectric.android.internal.AndroidTestEnvironment$UnExecutedRunnablesException: Main looper has queued unexecuted runnables. This might be the cause of the test failure. You might need a shadowOf(Looper.getMainLooper()).idle() call.
```

Importing the method fixed this
2022-08-26 18:29:00 -03:00
David Allison
2c7832f4af refactor: Rename Sound.java to .kt
com.ichi2.libanki.Sound
2022-08-26 18:29:00 -03:00
David Allison
78ecb433cb refactor: Convert SchedTest to Kotlin
com.ichi2.libanki.sched.SchedTest
2022-08-26 13:01:34 -03:00
David Allison
8d8eeef893 refactor: Rename SchedTest.java to .kt
com.ichi2.libanki.sched.SchedTest
2022-08-26 13:01:34 -03:00
David Allison
236a0d63ab refactor: Convert ContentProviderTest to Kotlin
com.ichi2.anki.tests.ContentProviderTest
2022-08-26 12:56:14 -03:00
David Allison
b74b4a0fd0 refactor: Rename ContentProviderTest.java to .kt
com.ichi2.anki.tests.ContentProviderTest
2022-08-26 12:56:14 -03:00
David Allison
fab95690f2 refactor: Convert AnkiDroidApp to Kotlin
com.ichi2.anki.AnkiDroidApp
2022-08-26 17:28:25 +03:00
David Allison
2aab716452 refactor: Rename AnkiDroidApp.java to .kt
com.ichi2.anki.AnkiDroidApp
2022-08-26 17:28:25 +03:00
Arthur Milchior
26ae93b87b NF: factorize DeckPreferenceHack 2022-08-26 07:24:30 -05:00
David Allison
f1cc51008a refactor: Convert Models to Kotlin
com.ichi2.libanki.Models
2022-08-26 07:05:47 -05:00
David Allison
fa6ccb303d refactor: Rename Models.java to .kt
com.ichi2.libanki.Models
2022-08-26 07:05:47 -05:00
David Allison
456bad7d83 cleanup: make param non-null 2022-08-26 07:05:47 -05:00
lukstbit
f5a634ffbb Migrate CollectionTest.java to kotlin 2022-08-26 07:10:48 -03:00
lukstbit
0d66ebd9a5 Rename CollectionTest.java to .kt 2022-08-26 07:10:48 -03:00
lukstbit
9a3a89f3f5 Migrate Shared.java to kotlin 2022-08-26 06:03:46 -03:00
lukstbit
4abd985be7 Rename Shared.java to .kt 2022-08-26 06:03:46 -03:00
David Allison
d330cf39d9 refactor: KotlinCleanup - HandleEmptyCardListener 2022-08-26 08:55:47 +03:00
David Allison
5df3cc8fef refactor: KotlinCleanup - DeckPicker 2022-08-26 08:55:47 +03:00
Divyansh Kushwaha
632fa40a6b Early return in UpdateCardHandler 2022-08-26 04:39:18 +02:00
Divyansh Kushwaha
ee6908ae97 Simplified asynctask callbacks
When updating a single card, it is not required to show continuous progress since it a short task and user can be notified after the task has been finished. So instead of using onProgressUpdate callback, it is good to use onPostExecute for UI updates after the card has been updated.
2022-08-26 04:39:18 +02:00
AnkiDroid Translations
d3940212ad Updated strings from Crowdin 2022-08-25 20:31:06 -05:00
Brayan Oliveira
267255b3f2 Disable Statistics preferences if the new backend is enabled
They don't have an effect on the new Statistics page
2022-08-25 18:57:12 -05:00
Brayan Oliveira
11cfb9c9fc Add rust cleanups to remove Statistics and CardInfo 2022-08-25 18:57:12 -05:00
Brayan Oliveira
f4f042e046 Add Anki's new Statistics page 2022-08-25 18:57:12 -05:00
Brayan Oliveira
04276c956f
[GSoC] NF: Remove the old CSV importer implementation (#12171)
* Remove the old WIP CSV importer implementation

https://github.com/ankidroid/Anki-Android/pull/6773 started to implement a CSV importer, but now all that code/strings is unnecessary as we get the implementation from the new backend

* Remove unused strings from all l10n files

The app compiles without this change. But CI fails on :AnkiDroid:lintPlayRelease
2022-08-25 17:16:26 -05:00
Brayan Oliveira
832b5d8c79 Make the CSV importer accept .csv and .tsv extensions
to do it, an "extraMimes" param is added to openImportFilePicker, which can be passed to the intent wish a "EXTRA_MIME_TYPES" as extra.

ref: https://stackoverflow.com/questions/27367272/how-can-i-setup-an-android-intent-for-multiple-types-of-files-pdf-office-imag
2022-08-25 14:08:45 -05:00
Brayan Oliveira
71967feff3 Add Anki's new CardInfo page 2022-08-25 13:49:01 -05:00
Mike Hardy
835cba9f20 Bumped version to 2.16alpha81 2022-08-25 16:07:32 +00:00
Mike Hardy
67533b62bc
Dependency updates 20220825 (#12170)
* build(deps): bump robolectric from 4.8.1 to 4.8.2

Bumps [robolectric](https://github.com/robolectric/robolectric) from 4.8.1 to 4.8.2.
- [Release notes](https://github.com/robolectric/robolectric/releases)
- [Commits](https://github.com/robolectric/robolectric/compare/robolectric-4.8.1...robolectric-4.8.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>

* build(deps): bump mockk from 1.12.5 to 1.12.7

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

---
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>

* build(deps): bump ktlint-gradle from 10.3.0 to 11.0.0

Bumps ktlint-gradle from 10.3.0 to 11.0.0.

---
updated-dependencies:
- dependency-name: org.jlleitschuh.gradle:ktlint-gradle
  dependency-type: direct:production
  update-type: version-update:semver-major
...

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

* build(deps): bump jsoup from 1.15.2 to 1.15.3

Bumps [jsoup](https://github.com/jhy/jsoup) from 1.15.2 to 1.15.3.
- [Release notes](https://github.com/jhy/jsoup/releases)
- [Changelog](https://github.com/jhy/jsoup/blob/master/CHANGES)
- [Commits](https://github.com/jhy/jsoup/compare/jsoup-1.15.2...jsoup-1.15.3)

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

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

* build(deps): bump webkit from 1.4.0 to 1.5.0

Bumps webkit from 1.4.0 to 1.5.0.

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

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>
2022-08-25 11:06:33 -05:00
Brayan Oliveira
ea20f01f3b Change AnkiServer's hostname to localhost
So it's compatible with ipv6 too
2022-08-25 10:28:55 -05:00
Brayan Oliveira
c69218e6ad NF: cleanup on CoroutineHelpers.kt
- Remove `withContextCatching` (unused)
- Improve `runBlockingCatching` javadoc
2022-08-25 10:28:55 -05:00
Brayan Oliveira
9d053c0b05 Make PagesActivity.importCsvRaw return its result and be undoable 2022-08-25 10:28:55 -05:00
Brayan Oliveira
a6e39379a7 Add new catching coroutine helpers
- Extract the try/catch logic from launchCatchingTask to `runCatchingTask`
- Create `withContextCatching` and `runBlockingCatching` methods
2022-08-25 10:28:55 -05:00