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

9197 Commits

Author SHA1 Message Date
Joshua Ford
5c6d293ebf CI: Use emulator acceleration
To take advantage of some of the new nested virtualization capabilities
of some of the images in Travis, you must be using the newest LTS
release of Ubuntu, 18.04 Bionic Beaver.

However, the Travis image of Bionic does not include support for JDK 8,
which we need to utilize the Android SDK manager. To circumvent this
issue, we change from the "android" language type to "generic", and take
care of both the JDK and the Android SDK ourselves.

As such, this commit makes the following changes:
* Switch `dist` from `trusty` to `bionic`
* Switch `language` from `android` to `generic`
* Enable the use of `sudo`
* Install libpulse0 for emulator audio
* Set up KVM inside the allocated Travis image
* Use Gravis repository to download and install Java
* Version android-wait-for-emulator in our repo
* Download and install the Android SDK ourselves
* Switch to `emulator-headless` for the x86 emulators

Since we're free to switch Java versions as we please, we can finally
support JDK 11 by switching to it after starting our emulator.
2019-11-01 12:01:22 -05:00
Timothy Rae
726a9b2e9a Bumped version to 2.10alpha12
@branch-specific
2019-10-30 14:57:19 +09:00
Arthur Milchior
9dfcc03785 Correcting #5515 hopefully
The error was sent in this line:
7235a5bc66/AnkiDroid/src/main/java/com/ichi2/async/DeckTask.java (L857)
where searchResult is null.
It's value is the result of col.findCardsForCardBrowser
this method simply returns the  value returned by the Finder#findCardsForCardBrowser

The value returned by the finder itself findCardsForCardBrowser sends
null if the task was cancelled. However, the value returned is still
used by findCardsForCardBrowser. So I ensure that it's not null, but
an empty list.
2019-10-30 14:54:38 +09:00
Timothy Rae
b8696208c1 Bumped version to 2.10alpha11
@branch-specific
2019-10-30 14:18:21 +09:00
Arthur Milchior
dbf3c09d5b Decks#checkIntegrity
As in anki. Moved to deck instead of in Sched
2019-10-30 14:16:38 +09:00
Arthur Milchior
f609f42481 Adding method Parent from Anki
For the sake of readability, I added in Ankidroid Anki's method called
Parent. I added it in Deck instead of sched, because first it makes
more sens. And in python it was a nested function, which is not proper
in java.
2019-10-30 14:16:38 +09:00
Timothy Rae
0d0fc4711a Bumped version to 2.10alpha10
@branch-specific
2019-10-30 12:38:02 +09:00
Arthur Milchior
7235a5bc66 Getting due correct when generating cards with no new siblings
Here is a silly problem with porting Python code to Java. Sometimes,
it does not work the same way at all. When I committed
504d96a99d I didn't pay attention to was
the value of dues.get(nid) when nid is not in dues. And actually, the
value is None. Which means that it can't be converted to a long. And
thus raised an exception.

I also realized that the line `due = dues.get(nid);` was present twice
in the code, which makes no sens in the first place. So this second
occurrence is now removed.
2019-10-28 23:44:33 +09:00
Mike Hardy
ff14b3d375 wait in testAnswerCard for just a moment before assertion 2019-10-28 08:35:01 -05:00
Mike Hardy
26163e7585 Setup/teardown resources properly in tests 2019-10-28 08:35:01 -05:00
Mike Hardy
0572353d1b use stable channel emulator now that 29.x is out 2019-10-28 08:35:01 -05:00
Timothy Rae
605bad8187 Bumped version to 2.10alpha9
@branch-specific
2019-10-27 18:11:46 +09:00
danosl
0c18472767 Fix sched v2 overflow bug (#5574)
Fixes #5558
2019-10-27 17:44:00 +09:00
Timothy Rae
00b67f5b67 Bumped version to 2.10alpha8
@branch-specific
2019-10-26 14:18:37 +09:00
Timothy Rae
c1e98478d1 Bumped version to 2.10alpha7
@branch-specific
2019-10-26 14:15:25 +09:00
Arthur Milchior
9208ccec33 New cards of existing note take due value of NEW siblings
This commit port to Ankidroid a PR I just did on anki's
library. arthurmilchior/anki@3f45de87b3.

https://github.com/dae/anki/pull/339

Once again, I tested this by trying to reproduce the bug with this new
version of ankidroid and checking that the bug does not exists
in this version; and that all due numbers were correctly generated.
2019-10-25 19:25:58 +09:00
Arthur Milchior
504d96a99d Correct due of generated siblings.
This commit port current Anki code to Ankidroid. It ensures that when
a note is edited, and the edit generate new card, those new cards
obtain the same due value as their siblings.

The bug was reported (by me) as #5456. And I tested this correction
simply by trying to reproduce the bug with this new code, and checking
that it does not occur anymore.
2019-10-25 19:25:58 +09:00
Arthur Milchior
e845325c08 New model: more simple and more unique
This commit simultaneously corrects two problems, in which Ankidroid
differs from Anki.

When a standard model is constructed, Anki add random symbols only if
the model's name is already used in the collection. This is now the
case in Ankidroid too.

When a model of name m is cloned, if "m - copy" already exists, then a
random string is appended. This is now the case in Ankidroid too.
2019-10-25 19:23:16 +09:00
Arthur Milchior
1193ecfaf7 Using localization of name of note type 2019-10-25 19:19:04 +09:00
Arthur Milchior
9224ff005b Use resources instead of string in standard templates.
In Anki, standard models are localized. More precisely, there are
translations of field names, card name and model names. I ported this
to ankidroid.
2019-10-25 19:19:04 +09:00
Stephan
daa8b7f612 catch and report TTS errors (#5561)
* catch and report TTS errors

implement onError() to report a Toast with some hints to the user
in case the TTS engine returns an error.

From API 21 upwards we would also have the error code available
for further details on what happened.

* Display Snackbar for failing TTS

In case TTS output fails display a Snackbar with an error
message and a help link pointing to the FAQ with recovery
instructions.
2019-10-23 21:31:35 +09:00
Arthur Milchior
01292d7965 Factorize standard model creation
dae/anki@fed2f2fa3d
2019-10-22 15:11:42 +09:00
Arthur Milchior
21c1838bb1 Adding missing Throw
I don't intend to test this commit
2019-10-22 13:38:16 +09:00
Mike Hardy
7e1fd5129d bump jacoco version, handle new failure mode
jacoco 0.8.4 -> 0.8.5 started failing fast for all errors, but
it turns out that there were certain configurations (present in
typical android instrumented test situations) where certain failures
(like inability to write /jacoco.exec) had no consequence because actual
output went to a different directory (like /data/data/<package>/**/*.ec)

solution is to package a properties file that instructs the jacoco-agent
used to boot the app to not attempt it's normal output
2019-10-21 22:19:51 -05:00
Mike Hardy
ac94ae3571 fix gradle coverage entropy - classes and output moved 2019-10-21 22:19:51 -05:00
Mike Hardy
31b5008177 lint gradle file 2019-10-21 22:19:51 -05:00
Timothy Rae
54390166eb Bumped version to 2.10alpha6
@branch-specific
2019-10-22 11:31:22 +09:00
Timothy Rae
e0d3b19224 Updated strings from Crowdin 2019-10-22 11:26:58 +09:00
Arthur Milchior
559caa6a41 Remove useless exception
Both as comment and as try/catch
2019-10-22 11:21:25 +09:00
Arthur Milchior
36b4f1dd7d ensure the list of note types is not empty
dae/anki@8497da27cf
2019-10-22 11:21:25 +09:00
Arthur Milchior
cc769fd5f4 Replace addField and addTemplate
Instead used specialized function, avoiding try/catch when useless
2019-10-22 11:21:25 +09:00
Arthur Milchior
5b5ed9d3a3 Similar to last commit, but for templates 2019-10-22 11:21:25 +09:00
Arthur Milchior
0829284084 Separate addField to avoid exceptions
Before this commit, in ModelManager, the addField method's type
contained `throws ConfirmModSchemaException`.

This method add variants not sending exception:
* for new models,
* when mod is already changed.

I added a private method, so that the actual work can be factorized.
2019-10-22 11:21:25 +09:00
Arthur Milchior
29d95d409b Add a class for assertion
Assert are not usually present in android program. See discussion
here.
https://github.com/ankidroid/Anki-Android/pull/5475#discussion_r336821445
2019-10-22 11:21:25 +09:00
Arthur Milchior
906f185d1a Allow to create a basic model without adding it.
This way, we can add more complex standard model without having to
uselessly trigger a new change of mod.

dae/anki@c14b9e2077 and dae/anki@db4edf62eb
2019-10-22 11:21:25 +09:00
Arthur Milchior
3bcb332229 Add isModelNew in ModelManager
It's here to factorize a method which is trivial in anki, and may
throws an exception here, hence is longer.
2019-10-22 11:21:25 +09:00
Timothy Rae
26c0aca338 Updated strings from Crowdin 2019-10-22 10:45:58 +09:00
Timothy Rae
4424b7a3d7 Bumped version to 2.10alpha5
@branch-specific
2019-10-22 07:58:32 +09:00
Timothy Rae
aa94e209f2 Don't run gitflow-integrate script unless we're on correct branch 2019-10-22 07:11:56 +09:00
Adam Wolf
037219dc89 Fix Mathjax Cloze duplication issue. 2019-10-22 06:39:56 +09:00
Piotr Kubowicz
66494bb5da Use inflexion form in 'studied x cards in y minutes' (#5529)
The main application screen was using generic 'y minutes'
translation string. Some languages use a different form
for 'y minutes' and 'in y minutes'.
2019-10-21 19:18:55 +09:00
Timothy Rae
2747182b79 Bumped version to 2.10alpha4
@branch-specific
2019-10-21 14:53:31 +09:00
Scott Noyes
c4865da41a Cloze menu (#5536)
* Fix #5532

* Fix #5532

* Adjust variable declaration style.

* Be less oblivious about declaring variables in scope.

* Consistent indentation
2019-10-21 14:51:40 +09:00
Timothy Rae
81515b3a97 Bumped version to 2.10alpha3
@branch-specific
2019-10-21 14:49:07 +09:00
Arthur Milchior
7d69986664 Add interval as a potential second column in the browser (#5549)
Answer feature request #5542

This has been tested by starting Ankidroid, openining the Browser with
a real collection, and checking that I can select interval and see
their values correctly.

Tested-by: Arthur Milchior <Arthur@Milchior.fr>
2019-10-21 14:44:37 +09:00
Timothy Rae
23f9769d54 Bumped version to 2.10alpha2
@branch-specific
2019-10-21 07:39:38 +09:00
Arthur Milchior
a1b55d3bef Allow for a deck parameter when previewing a card.
This is to follow anki's code.

dae/anki@b3de44129b
2019-10-21 07:31:10 +09:00
Arthur Milchior
9f2f50ead0 Allow for a deck parameter when creating a card
This is to follow anki's code. Originally, it allows to correct a bug
when previewing new cards.

dae/anki@20ff61e59e
2019-10-21 07:31:10 +09:00
Arthur Milchior
ece0b5d33a escape backslash in find&replace
https://anki.tenderapp.com/discussions/ankidesktop/35903-bug-find-and-replace-breaks-when-replacing-with-latexmathjax-commands
dae/anki@6b784ae42e
2019-10-21 07:10:05 +09:00
Arthur Milchior
be935e55cb use a constant for the starting factor
dae/anki@227ca090db
2019-10-21 06:45:35 +09:00