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

12659 Commits

Author SHA1 Message Date
Mrudul Tora
6d68424cd4
Fixes #8151 Build flavors for Amazon Appstore and Google Playstore (#8427)
Fixes #8151 Build flavors for Amazon Appstore and Google Playstore
2021-04-19 22:39:06 -05:00
Đặng Đoàn Đức Trung
8c6b2fc9cc
Fixing gestures with answer buttons not working (#8579)
* Refactor performClickWithAction to answerCard

* Remove all mentions of performClickWithVisual

* Add visual feedback to gestures and touch events

* Add back overridden method and some code formatting

* Cherry pick from revert-touch

* Replace touch handler with a class encompassing both click and touch handlers

* Fixing logic

* Fix lint

* Logic documentation

* Add documentation to click threshold constant

Co-authored-by: Mike Hardy <github@mikehardy.net>

* Test optimization

Co-authored-by: David Allison <62114487+david-allison-1@users.noreply.github.com>
Co-authored-by: Mike Hardy <github@mikehardy.net>
2021-04-18 15:20:57 -05:00
Tarekk Mohamed Abdalla
5394865cbe NF: embed progress bar in the layout 2021-04-18 13:08:01 -05:00
David Allison
143d7bbf7c Fix: Duplicate cards shown in Card Browser
Main issue: we use the same list reference, leading to prefetched
cards bring added twice

The other issue was an off-by-one error in the count of cards to pre
render. This didn't matter too much, but we returned one more than was
requested

Fixes 8547
2021-04-18 12:28:39 -05:00
Nicola Dardanis
d63f8ebaa7 refactor: Open Previewer from CardBrowser using new Activity APIs 2021-04-16 10:43:24 -05:00
Mike Hardy
74c34cc0d6 Bumped version to 2.15alpha43
@branch-specific
2021-04-16 04:44:49 +00:00
Mike Hardy
213dd10094 remove jcenter maven repository
this is important because it is about to sunset, and if we do not
peel this off before we cut the release-2.15 branch, that branch
will no longer build without backporting
2021-04-15 23:21:34 -05:00
Mike Hardy
60f0e1f8fc NF: remove unused espresso / androidTest view watcher
this allows us to purge our last jcenter dependency
2021-04-15 23:21:34 -05:00
Mike Hardy
b50866e13d Use jitpack to reference sqlite-android artifact
requery / sqlite-android was still using jcenter, which is going away

This is tracked upstream:
https://github.com/requery/sqlite-android/issues/140
https://github.com/requery/sqlite-android/pull/145
2021-04-15 23:21:34 -05:00
Mike Hardy
61cb6c3f05 Update to gradle 7.0
- API publishing needed a complete overhaul, tested locally, works
- JCenter is still needed for AnkiDroid as noted unfortunately...couple months to go
- Some artifact resolution performance complaints but local testing shows every single thing works
2021-04-15 23:21:34 -05:00
Arthur Milchior
5f709dfe16 NF: BuryCard undo's affect the Card
There was no reason to affect the whole note while only a card was changed. However, it was not a bug, even if it was
reverting siblings. Indeed, if this undo is executed, all changes made too siblings would have been undone previously
2021-04-15 23:18:03 -05:00
Arthur Milchior
64c9d8f9d6 NF: add revertCardToProvidedState
Similar to the note one
2021-04-15 23:18:03 -05:00
Arthur Milchior
95a71b7788 NF: split revertNoteToProvidedState 2021-04-15 23:18:03 -05:00
Arthur Milchior
30e3529f31 NF: rename revertToProvidedState to revertNoteToProvidedState
That makes more clear that all siblings are reverted too
2021-04-15 23:18:03 -05:00
Mike Hardy
f3a53cf5be
stale bot exempt properties are plural now 2021-04-15 23:07:31 -05:00
Arthur Milchior
6b0117bb3e ensure that mTextView is not null
After installing a new version of ankidroid from master and syncing, I got the message

```
    java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object java.lang.ref.WeakReference.get()' on a null object reference
        at com.ichi2.anki.stats.AnkiStatsTaskHandler$DeckPreviewStatistics.onPostExecute(AnkiStatsTaskHandler.java:275)
        at com.ichi2.anki.stats.AnkiStatsTaskHandler$DeckPreviewStatistics.onPostExecute(AnkiStatsTaskHandler.java:220)
        at android.os.AsyncTask.finish(AsyncTask.java:755)
        at android.os.AsyncTask.access$900(AsyncTask.java:192)
        at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:772)
        at android.os.Handler.dispatchMessage(Handler.java:107)
        at android.os.Looper.loop(Looper.java:237)
        at android.app.ActivityThread.main(ActivityThread.java:8107)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100)
```

I suspect that it is because collection or the db is empty (normal after a sync. )
2021-04-15 22:54:22 -05:00
Arthur Milchior
e2936c33e5 NF: remove useless initialization 2021-04-15 22:54:22 -05:00
Tarekk Mohamed Abdalla
8228f60070 lint: enable rtl lint rules
RtlSymmetry is disabled because we already have RtlHardcoded rule enabled
2021-04-15 22:47:24 -05:00
Tarekk Mohamed Abdalla
1721460286 NF: Fix RtlHardcoded lint issues 2021-04-15 22:47:24 -05:00
Mrudul Tora
557eff4dc8
Lint: Lint rule for use of UIUtils.showSnackbar instead of Snackbar.make (#8625)
* Added lint rule for use of UIUtils.showSnackbar instead of Snackbar.make
* Fixed the lint errors related to Snackbar.make
* Fixed inconsistent spacing

Co-authored-by: David Allison <62114487+david-allison-1@users.noreply.github.com>
2021-04-15 22:44:46 -05:00
Mike Hardy
43c5eeedb2 Clear ACRA on cancel, use ACRA data for rate limit
- if the user canceled, they should not be limited in the future
- the limiter should have the best source of info for rate limiting

Fixes #8379
2021-04-15 22:11:33 -05:00
Mike Hardy
b0efa29f7a chore: bump workflow dependencies
- java needs a distribution now, "adopt" is best in my opinion
- cancel-workflow-action can kill all_but_latest now (I helped on that one, nice)
- nothing else that was breaking or worth using feature-wise
2021-04-15 20:58:01 -05:00
Mike Hardy
6578a72b6c chore: bump acra from 5.5.x to 5.7.x
tested locally and inspected debug acralyzer instance, worked fine
2021-04-15 20:58:01 -05:00
dependabot-preview[bot]
b79a238c60 Bump protobuf-java from 3.15.7 to 3.15.8 (#316)
Bumps [protobuf-java](https://github.com/protocolbuffers/protobuf) from 3.15.7 to 3.15.8.
- [Release notes](https://github.com/protocolbuffers/protobuf/releases)
- [Changelog](https://github.com/protocolbuffers/protobuf/blob/master/generate_changelog.py)
- [Commits](https://github.com/protocolbuffers/protobuf/compare/v3.15.7...v3.15.8)

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

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2021-04-15 20:58:01 -05:00
Mike Hardy
a1ebaa0066 Bumped version to 2.15alpha42
@branch-specific
2021-04-14 22:46:15 +00:00
David Allison
3dafbb2953 NF: Refactor Finder
The start of decoupling abstractions from libAnki
2021-04-14 17:30:26 -05:00
Tarekk Mohamed Abdalla
30c8593f8f
feat: Enable jacoco reports to be opened (#8617)
* feat: enable jacoco reports to be opened
* fix jacocoTestReport to run independently from other jacoco tasks

Co-authored-by: Mike Hardy <github@mikehardy.net>
2021-04-14 17:29:48 -05:00
David Allison
fe5f91b3dd nf: remove mOnStatisticsActivityResult
The request code was unused, the base class uses a different value

setFragmentContentView is now unused, not deleted as it's tested
good code

Fixes 8616
2021-04-14 17:01:55 -05:00
David Allison
992716d11f nf: rename variable
mOnRequestPreviewActivityResult -> mOnRequestReviewActivityResult
2021-04-14 17:01:55 -05:00
David Allison
4c68867daa fix: Crash showing analytics opt-in
We need to call onCreate before we show the fragment

Fixes 8610
2021-04-14 16:16:24 -05:00
David Allison
c9cb04ce0d Add test: ensure Analytics opt in succeeds
This currently fails due to Issue 8610
2021-04-14 16:16:24 -05:00
David Allison
55ae42c103 lint: fix errors
Cause: Merge of 8370
2021-04-14 13:57:02 -05:00
Arthur Milchior
ccf2211ee6 Ensures forbidden symbols are removed from new field names
Fixes #8388.

The same string `fieldName` should be used independently of whether there is an exception thrown
2021-04-14 13:19:26 -05:00
Arthur Milchior
694e8dcade NF: NonNull on task 2021-04-14 13:13:15 -05:00
David Allison
39cacd6717 fix: Open DeckPicker if collection path changes
Before this change, we performed this check on `onActivityResult`.

This was bad, as we had :
* onCreate -> startCollectionLoading -> onCollectionLoaded
* onActivityResult -> closeCollection -> crash

Now, by moving to the Preferences, we avoid this issue

There was also a bug that `mOldColPath` was not saved via
`onSaveInstanceState`, this meant "Don't Keep Activities" would cause
accessing the preferences to always reopen the collection

Fixes 8422
2021-04-14 13:09:10 -05:00
David Allison
73fc183172
Decks: refactor restoreToDefault for Rust (#8582)
* NF: refactor variable usage

Removes usage of 'conf' allowing further refactor

* extract update_config and new_deck_config_legacy

004cc2b5f8

diff shows the extraction, method are renamed in the latest Rust
2021-04-14 13:04:17 -05:00
David Allison
00abc059f6 NF: Convert Deck methods to return List
We shouldn't be enforcing an implementation unless we need it
2021-04-14 13:00:45 -05:00
David Allison
8cf130621b NF: Extract helper method from Decks
Only used once
2021-04-14 12:58:05 -05:00
David Allison
b042b87853 confForDid: use default on invalid configuration
From Anki commit 94d369db18c2a6ac3b0614498d8abcc7db538633
2021-04-14 12:56:49 -05:00
David Allison
873521ae15 Deprecate getCol().getDecks().getDecks()
Its usage is discouraged in the Python, and we save a lot of
effort by not converting legacy code

We only had one usage. This code no longer exists in Anki's pylib

1cc63f9267/pylib/anki/decks.py (L51)
2021-04-14 12:55:46 -05:00
David Allison
3541c210d8 Add lint rule to enforce constant field naming
For: `public static final` variables

Lint Id: ConstantFieldName

Automation: Means that we don't need to enforce this in code reviews

Constant (final variables) names must be all uppercase using underscore
 to separate words.

https://github.com/ankidroid/Anki-Android/wiki/Code-style#constant-final-variables-names-must-be-all-uppercase-using-underscore-to-separate-words

Note: The wording is imprecise: so only flag public constants
2021-04-14 12:43:52 -05:00
David Allison
f1e37dc557 Add lint rule to enforce 'm' variable prefix
For: Non-Static, Non-Public variables

Lint Id: NonPublicNonStaticFieldName

Automation: Means that we don't need to enforce this in code reviews

https://github.com/ankidroid/Anki-Android/wiki/Code-style#non-public-non-static-field-names-should-start-with-m
2021-04-14 12:43:52 -05:00
David Allison
58c0a410a7 Rename lint: FieldNamingPatternDetector
To NonPublicNonStaticFieldName

A more specific code, so we can apply others
2021-04-14 12:43:52 -05:00
David Allison
717417950c Project Formatting: default to 'm' prefix
https://github.com/ankidroid/Anki-Android/wiki/Code-style#non-public-non-static-field-names-should-start-with-m
2021-04-14 12:43:52 -05:00
Mike Hardy
f9925c9443 Remove Travis CI config, we are 100% GitHub Actions now 2021-04-14 12:20:33 -05:00
Mike Hardy
bce4afee5f Bump recyclerview to 1.2.0, forward-port deprecated APIs
Previous `getAdapterPosition()` API was split to be non-ambiguous,
and `getBindingAdapterPosition()` seems like the correct option to use between
the two new APIs, as the listener appears to be viewed from the adapter context,
not the RecyclerView context (where `getAbsoluteAdapterPosition()` would be correct)

Additionally, `setHasFixed(true)` must not be used in layouts with wrap_content, as that implies
that the content is not fixed - this is a new lint check. Uses of `setHasFixedSize(true)` have been
removed in these contexts, with the downside being that RecyclerView cannot do some layout performance
optimizations, as it needs to check adapter size now during layout.
2021-04-14 12:17:14 -05:00
Mike Hardy
af92f54832 Bumped version to 2.15alpha41
@branch-specific
2021-04-14 16:57:50 +00:00
David Allison
ddc07dd12e nf: simplify AnalyticsConstantsTest
* Extract stream
* Invert if
* Extract exception to throws
* use .get(null) as it's a static call
* new UsageAnalytics.Actions().getClass -> UsageAnalytics.Actions.class
* Early return
2021-04-14 11:17:36 -05:00
David Allison
3c4f603b87 fix: AnalyticsConstantsTest
listOfConstantFields was initialized multiple times on certain runs

This lead to the wrong counts being calculated
2021-04-14 11:17:36 -05:00
Nicola Dardanis
901260bed6 lint: Reorder rules lexicographically in IssueRegistry 2021-04-14 11:15:14 -05:00