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

13248 Commits

Author SHA1 Message Date
David Allison
dc6459f84b feat: upgrade from Volume gestures to Bindings
We remove the `VOLUME_UP` and `VOLUME_DOWN` gestures,
and all associated code

This removes the preferences:
"gestureVolumeUp"
"gestureVolumeDown"

Instead, this is passed to a binding, for example:

"binding_EDIT": [keycode 24]

Related: 6502
2021-08-31 13:00:50 -05:00
David Allison
68493a0c63 feat: Add selection screen for key bindings
Fixes 6052
2021-08-31 13:00:50 -05:00
David Allison
2a6560f168 Add version to KeyBinding schema
Allows detection of requirement to upgrade on a per preference basis
2021-08-31 13:00:50 -05:00
David Allison
1e45a4c7c6 Add screen to KeyBindings
Allows extension to other screens without a schema change
2021-08-31 13:00:50 -05:00
David Allison
65ce8b1286 Remove duplicate preferences
COMMAND_ANSWER_FIRST_BUTTON
COMMAND_ANSWER_SECOND_BUTTON
COMMAND_ANSWER_THIRD_BUTTON
COMMAND_ANSWER_FOURTH_BUTTON
COMMAND_ANSWER_RECOMMENDED

We already have "flip and answer".
Now we differentiate between question & answer, these are not necessary
2021-08-31 13:00:50 -05:00
David Allison
8661525d34 Convert PeripheralCommand -> ViewerCommand
This allows a command to have a "default" value which isn't associated
with the preference string, allowing easier upgrades to the data
2021-08-31 13:00:50 -05:00
David Allison
47f421cd05 fix: MappableBinding equality 2021-08-31 13:00:50 -05:00
David Allison
dd4ef154a4 fix: KeyPicker displayed no text when horizontal
Use constraintlayout and have width == height
rather than using onMeasure.

OnMeasure didn't work perfectly as there was an
AT_MOST constraint enforced by the dialog box wrapper
2021-08-31 13:00:50 -05:00
David Allison
c965c7daaf fix: Ignore key presses if answer field focused
This was broken when we moved to onKeyDown, but the test was faulty
so did not pick up on this.

Test will be fixed in a commit in this PR

History: Moved to onKeyDown in
e439280bf3
PR 8507
2021-08-31 13:00:50 -05:00
David Allison
32c3c10af8 addFieldInNewModel: extract to ModelManager
AnkiDroid specific functionality - may not be needed
2021-08-31 12:55:46 -05:00
David Allison
e0538020fd extract getCardIdsForModel to base class
This is extracted logic, and will still be required
2021-08-31 12:55:46 -05:00
David Allison
922611488e fix: error in NoteType.type 2021-08-31 12:55:46 -05:00
David Allison
867dcb2c2d Convert NoteType to Model + extension properties
This allows `NoteType` to be used in the base class with
Kotlin based methods
2021-08-31 12:55:46 -05:00
David Allison
7c3a7a9ed4 add: setChanged to match Java interface 2021-08-31 12:55:46 -05:00
David Allison
997c33385b add: tmplUseCount to match Java interface 2021-08-31 12:55:46 -05:00
David Allison
5fad3373e1 add: getModels to match Java interface 2021-08-31 12:55:46 -05:00
David Allison
3832b3e112 model: nids - match Java/Kotlin interface
* Remove ArrayList reference
* define nids(model), instead of nids(int)
2021-08-31 12:55:46 -05:00
David Allison
35122814f7 storage: fix bug with cloze upgrade
Array was copied rather than obtaining size
2021-08-31 12:55:46 -05:00
David Allison
1c6b2bb257 validateModel: move to base class and deprecate
This is legacy code which no longer exists, validating the JSON
it can likely be replaced by a unit test for the import process

Added in d55c2d9648
2021-08-31 12:55:46 -05:00
David Allison
3c27a11b30 models: useCount(): fix signature and deprecate 2021-08-31 12:55:46 -05:00
David Allison
f1e7f133d1 add method: setSortIdx for java compatibility 2021-08-31 12:55:46 -05:00
David Allison
1670ca2845 models: return list from all()
An arrayList was not necessary
2021-08-31 12:55:46 -05:00
David Allison
c6c7aaa01b add method: newModel
Java could not have a method named 'new'
2021-08-31 12:55:46 -05:00
David Allison
c7fde3fc7b fix method interface: save
Java expects a nullable model, Kotlin should be non-null
A templates parameter was removed
2021-08-31 12:55:46 -05:00
David Allison
7f018aa917 current: add default to forDeck param
used in ModelsV16
Java had same default
2021-08-31 12:55:46 -05:00
David Allison
417701eeff add unused method: beforeUpload()
For compatibility with legacy Java/ModelManager
2021-08-29 15:23:51 -05:00
David Allison
9baade29ef models: add load() method
Not used - required for compatibility with ModelManager (pre-rust)
2021-08-29 15:23:51 -05:00
David Allison
35133d6616 models: ids() - return set
match our current libAnki implementation return
2021-08-29 15:23:51 -05:00
David Allison
97991d7d36 add non libAnki function: count() 2021-08-29 15:23:51 -05:00
David Allison
6401af7eab add ensureNotEmpty:
See:

dae/anki@8497da27cf

Does not exist in V16, likely in the Rust implementation
2021-08-29 15:23:51 -05:00
David Allison
a48b6661ec lint: fix error
Cause: conflict between 9343 and 8812

ref: 9286
2021-08-27 13:26:24 -05:00
mikunimaru
5b9dab096f
feat: New JavaScript api for TTS (#8812)
* New JavaScript api for TTS

Since it is unlikely that a beginner will handle this api,
I moved the functions on the android side to
JavaScript with as little modification as possible.

Since the function conversion rules have been simplified,
 the api can be extended with consistent rules even
 if other TTS functions are needed on the JavaScript side in the future.

* Create LanguageUtils class

Moved the localeFromStringIgnoringScriptAndExtensions function
to the LanguageUtils class.

* Improved JavaScript TTS initialization process

Fixed a problem that null may be passed
as an argument when initializing JavaScriptTTS.
Changed to refer to context from within the class
instead of the argument when initializing JavaScriptTTS.
2021-08-27 12:00:32 -05:00
Nicola Dardanis
c6f5d3f3ea lint: Use isEmpty instead of comparing size to zero 2021-08-27 08:19:38 -05:00
Nicola Dardanis
e546c9ac7b nf: Use isEmpty in place of checking size to be zero when possible 2021-08-27 08:19:38 -05:00
Nicola Dardanis
51ac9055db lint: Avoid use of field prefixes for variable names 2021-08-27 08:15:20 -05:00
Nicola Dardanis
250097f54e nf: Avoid use of field prefixes for variable names 2021-08-27 08:15:20 -05:00
Mike Hardy
c110ca9556 Bumped version to 2.16alpha12
@branch-specific
2021-08-27 03:44:22 +00:00
AnkiDroid Translations
656c315d32 Updated strings from Crowdin 2021-08-26 22:32:56 -05:00
Shridhar Goel
a36418fceb Fix crash when AudioFocusRequest is null 2021-08-26 20:58:05 -05:00
Akshay
4587fedabe Added drawing button in BasicImageFieldController 2021-08-25 08:52:08 -05:00
Akshay
0a905d6800 Created drawing activity 2021-08-25 08:52:08 -05:00
Akshay
840dbe4dca Changed WeakReference to AnkiActivity in whiteboard to let other activities use whiteboard view 2021-08-25 08:52:08 -05:00
Akshay
8d7a6813c8 Extracted createInstance in a method of whiteboard 2021-08-25 08:52:08 -05:00
Farjad Ilyas
5884664995 fix[Deck Import]: Check if storage is accessible
- If AnkiDroid is using a non-app-specific directory to store user data
  and storage permission hasn't been granted, the Deck Import dialog
  appears over the DeckPicker startup dialog if an import is requested
  via an Intent. This allows the user to attempt to import the Deck when
  AnkiDroid can't access user data in the non-app-specific directory,
  resulting in a crash.

- Require that data is either stored in an app-specific directory, or
  storage permission has been granted if user data is stored in a
  non-app-specific directory, before allowing a deck to be imported via
  an Intent.
2021-08-25 08:49:30 -05:00
Mike Hardy
048c24bb66 Bumped version to 2.16alpha11
@branch-specific
2021-08-24 23:06:03 +00:00
AnkiDroid Translations
2c3de9ebd9 Updated strings from Crowdin 2021-08-24 17:51:45 -05:00
David Allison
ec8d716c6e nf: TextImporter - add EncodingException
Allows users to handle this exception separately

Since we use streams, this exception can be thrown later
2021-08-24 16:53:36 -05:00
David Allison
dfc4e43bd8 nf: TextImporter - add UnknownDelimiterException
Allows users to handle this exception separately
2021-08-24 16:53:36 -05:00
David Allison
cab199935a feat: expose field count publicly 2021-08-24 16:53:36 -05:00
David Allison
df011a9531 feat: csv mapping class
Allows mapping from a collection of CSV columns to notes
(fields and tags)

Also includes Parcelize to allow for simple serialisation
of objects to bundles

For use in the CSV Import (issue 6772)
2021-08-24 16:53:36 -05:00