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

12046 Commits

Author SHA1 Message Date
Arthur Milchior
4699dbcb97 NF: Uses specific server type when the type is known 2020-12-13 08:09:49 -05:00
Arthur Milchior
b24b370558 NF: add typing for updatedecklistlistener 2020-12-13 08:06:34 -05:00
Arthur Milchior
3696153741 NF: add type parameter to card queue
Remove a warning about unchecked type
2020-12-13 08:05:56 -05:00
Arthur Milchior
da44e472f0 NF: return pair in correct order 2020-12-13 08:05:27 -05:00
Arthur Milchior
9e34babb11 NF: add brackets to pairs
There remain two pairs without bracket, but it's because there are wrong
2020-12-13 08:05:27 -05:00
Arthur Milchior
ab2c2425d4 NF: remove unused parameter in initFieldEditText 2020-12-13 08:03:39 -05:00
Arthur Milchior
4bedb0f502 NF: showImportDialog takes no useless parameters 2020-12-13 08:03:39 -05:00
Arthur Milchior
9692a2e4c7 NF: remove unused variable context in getTimeTaken 2020-12-13 08:03:39 -05:00
Arthur Milchior
61c5e5b0f5 NF: set some variable to final
I only changed the variables that I know. There are a lot other that can be made final, that gives warning in android
studio, but I don't know
2020-12-13 08:41:31 +00:00
Arthur Milchior
d64d77550f NF: remove m starting a method parameter 2020-12-13 07:45:20 +00:00
Mike Hardy
a55bcd502c Bumped version to 2.15alpha14
@branch-specific
2020-12-12 22:25:40 +00:00
Manav Sehgal
8311d47fc2
Remove legacy Whiteboard settings (#7858)
* Remove legacy whiteboard settings from prefs
* Remove black strokes setting from UI
* Remove monochrome refs
* Hide pen color based on night mode
* Fix typo
* Update Whiteboard Foreground test
* Add missing annotation import

Co-authored-by: Mike Hardy <github@mikehardy.net>
2020-12-12 17:14:13 -05:00
Arthur Milchior
c3587daefc NF: download return ConnectionResultType instead of pair
The pair was useless as second element was always null
2020-12-12 16:45:35 -05:00
Arthur Milchior
1a63ff82c8 NF: remove a method that is never used 2020-12-12 16:37:13 -05:00
Arthur Milchior
df252c1eb5 Equality check the correct value
I don't know why this is the only if case that was not properly changed in 38ab1ea7ad
In this case, it would mean the media db corruption was not catched
2020-12-12 16:35:53 -05:00
Arthur Milchior
dc528a6c1f MediaSyncer's sync second element is a string
It was never anything else, so no need to use type `Object`
2020-12-12 16:35:53 -05:00
Arthur Milchior
43cab6d355 NF: indicate that payload's data is NonNull 2020-12-12 16:34:05 -05:00
Arthur Milchior
ce53a4b8db Add a method returnGenericError to factorize code
Each time in Connection a generic error is returned, it is quite similar.
Furthermore, 38ab1ea7ad moved result to resultType, which was mostly correct. However, for
the sake of consistency, it should have left a 0-length array in result. This repair it
2020-12-12 16:19:09 -05:00
Arthur Milchior
1e4840929d NF: Add good type parameter to AbstractDeckTreeNode 2020-12-12 16:17:14 -05:00
Arthur Milchior
5d5a25740c DeckPicker's sync listener's onPostExecute uses resultType
It was correctly done in f8512af52fcae210a92f34c360f9ecb4db33c8ac, however rebasing over
47dd6596f3 seems to have fail. This is regretful because using sync actually helped made
the change simpler.
2020-12-12 15:45:25 -05:00
Arthur Milchior
4946fc7912 NF: remove a always true condition 2020-12-12 15:45:25 -05:00
Arthur Milchior
eeac3cff18 NF: remove useless cast 2020-12-12 15:45:25 -05:00
Arthur Milchior
d9d30432fb Adding empty array in result 2020-12-12 15:45:25 -05:00
Arthur Milchior
447a07d855 Adding back test for null array
In 38ab1ea7ad the test for null was removed. It should be useless normally, but it does
not hurt to add it back either
2020-12-12 15:45:25 -05:00
Arthur Milchior
33e5688ec5 Correct custom_sync_server_url
I do not know why this was added in 38ab1ea7ad. Even looking at history, it does not seems
like something that was recently removed.
2020-12-12 15:45:25 -05:00
Arthur Milchior
930bd70272 NF: correct typing of tasks
The very wrong line was
```java
private static class UpdateCardHandler<Result extends BooleanGetter> extends
ListenerWithProgressBarCloseOnFalse<Pair<Card, String>, Result> {
```

`UpdateCardHandler` should not have taken a parameter, and especially, no variable of this type should have been
declared without parameters. This stopped typechecking to work, and lead to #7862.

The remaining changes are the one detected by the correction of this first line.

The irony is that the whole point of using Task was to ensure type safety
2020-12-12 14:14:20 +01:00
Mike Hardy
09e622693e Bumped version to 2.15alpha13
@branch-specific
2020-12-10 22:22:03 +00:00
Arthur Milchior
3e79836703 NF: Add Type Task, type CollectionTask and TaskListener 2020-12-10 14:22:22 -05:00
Arthur Milchior
266cb892e4 NF: uses col variable in CollectionTask 2020-12-10 14:22:22 -05:00
Arthur Milchior
7a722e2c82 NF: replace getCol by its definition 2020-12-10 14:22:22 -05:00
Arthur Milchior
fd90cf9152 NF: remove hasValidCol 2020-12-10 14:22:22 -05:00
Arthur Milchior
980cafa3e7 NF: Split actualDoInBackground 2020-12-10 14:22:22 -05:00
Arthur Milchior
27bcbd1e85 NF: more specific type for mDueTree 2020-12-10 14:22:22 -05:00
David Allison
c7e588c331 Reviewer: Increase Left/Right Padding for Top Bar
Material design states we should have 16dp padding to the sides if in full screen.

OnePlus 7 Pro phones truncated the "new count", so this fixes the issue

Fixes 7854
2020-12-10 08:41:14 -05:00
Arthur Milchior
4205d1d3cd NF: correct automated google test creating deck adapter too soon
According to Mike:
> lots of devices crashing in the automated robotest from google on the alpha release

> > FATAL EXCEPTION: Thread-6
> > Process: com.ichi2.anki, PID: 9642
> > java.lang.NullPointerException: Attempt to invoke virtual method 'com.ichi2.libanki.Decks com.ichi2.libanki.Collection.getDecks()' on a null object reference
> >     at com.ichi2.anki.widgets.DeckAdapter$DeckFilter.<init>(DeckAdapter.java:4)
> >     at com.ichi2.anki.widgets.DeckAdapter$DeckFilter.<init>(DeckAdapter.java:1)
> >     at com.ichi2.anki.widgets.DeckAdapter.getFilter(DeckAdapter.java:1)
> >     at com.ichi2.anki.DeckPicker.__renderPage(DeckPicker.java:21)
> >     at com.ichi2.anki.DeckPicker$UpdateDeckListListener.actualOnPostExecute(DeckPicker.java:9)
> >     at com.ichi2.anki.DeckPicker$UpdateDeckListListener.actualOnPostExecute(DeckPicker.java:1)
> >     at com.ichi2.async.TaskListenerWithContext.onPostExecute(TaskListenerWithContext.java:2)
> >     at com.ichi2.async.CollectionTask.onPostExecute(CollectionTask.java:4)
> >     at com.ichi2.async.CollectionTask.onPostExecute(CollectionTask.java:1)
> >     at android.os.AsyncTask.finish(AsyncTask.java:695)
> >     at android.os.AsyncTask.-wrap1(Unknown Source:0)
> >     at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:712)
> >     at android.os.Handler.dispatchMessage(Handler.java:105)

This seems to be caused by access to collection before it's loaded. It seems impossible in real use, even when there is
no permission to read data. Moving capacity after constructor is not ideal, but ensure that no resizing copy data and
that it is only done when collection is loaded
2020-12-10 06:28:27 -05:00
Mike Hardy
b1def328b1 Bumped version to 2.15alpha12
@branch-specific
2020-12-09 19:11:04 +00:00
Arthur Milchior
cafaf0fe04 NF: Capacity inialized with database 2020-12-09 14:01:15 -05:00
Mike Hardy
24443a327e Bump minSdkVersion to 21, purge related lower-API workarounds
Fixes #7843
2020-12-09 13:40:58 -05:00
Arthur Milchior
640a7b710e NF: Remove enum Previewing 2020-12-09 12:44:31 -05:00
Arthur Milchior
887d27986e NF: Remove method previewCards(Note, Previewing, int) 2020-12-09 12:44:31 -05:00
Arthur Milchior
e859dc5753 NF: remove method `previewCards(Note, Previewing) 2020-12-09 12:44:31 -05:00
Arthur Milchior
ca7b365987 NF: Remove previewCards(Note) that was never used
It was introduced in 2012 in 2f3ea8868c and does not seems to have ever been used since.
I believe it is safe to delete it
2020-12-09 12:44:31 -05:00
Arthur Milchior
7a31ed7521 NF: progressCallback gets a function as constructor 2020-12-09 12:17:48 -05:00
Arthur Milchior
d4b3f57e74 NF: Move static part of CollectionTask to other class
I kept the static part which are related to some specific task and not managing tasks
2020-12-09 12:17:48 -05:00
Arthur Milchior
23158d37a7 NF: avoid useless type conversion list to array 2020-12-09 11:44:05 -05:00
Arthur Milchior
ec80d4eb9f NF: Dismiss_multi first argument is List<Long> 2020-12-09 11:44:05 -05:00
Arthur Milchior
5128cc2c75 NF: init capacity of list, map and set 2020-12-09 11:27:39 -05:00
Arthur Milchior
aebb6b34b2 NF: using isInDynamicDeck when possible for readability 2020-12-09 10:12:30 -05:00
Arthur Milchior
c797e0e1b5 Correct #7846: deck picker don't crash with no folder access
It remains to add a regression test, but I don't know how to create a DeckPicker and get a menu
2020-12-09 13:06:20 +00:00
Mike Hardy
e70f17175d Bumped version to 2.15alpha11
@branch-specific
2020-12-08 19:39:28 +00:00