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
Mike Hardy
519fefc7ee
Dependency updates 20210805 (#9373)
* build(deps): bump activity-ktx from 1.2.3 to 1.2.4

Bumps activity-ktx from 1.2.3 to 1.2.4.

---
updated-dependencies:
- dependency-name: androidx.activity:activity-ktx
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

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

* build(deps): bump fragment-testing from 1.3.5 to 1.3.6

Bumps fragment-testing from 1.3.5 to 1.3.6.

---
updated-dependencies:
- dependency-name: androidx.fragment:fragment-testing
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

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

* build(deps): bump appcompat from 1.3.0 to 1.3.1

Bumps appcompat from 1.3.0 to 1.3.1.

---
updated-dependencies:
- dependency-name: androidx.appcompat:appcompat
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

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

* build(deps): bump fragment-ktx from 1.3.5 to 1.3.6

Bumps fragment-ktx from 1.3.5 to 1.3.6.

---
updated-dependencies:
- dependency-name: androidx.fragment:fragment-ktx
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

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

* build(deps): bump constraintlayout from 2.0.4 to 2.1.0

Bumps [constraintlayout](https://github.com/androidx/constraintlayout) from 2.0.4 to 2.1.0.
- [Release notes](https://github.com/androidx/constraintlayout/releases)
- [Commits](https://github.com/androidx/constraintlayout/compare/2.0.4...2.1.0)

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

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

* Bump jackson-databind from 2.12.3 to 2.12.4

Bumps [jackson-databind](https://github.com/FasterXML/jackson) from 2.12.3 to 2.12.4.
- [Release notes](https://github.com/FasterXML/jackson/releases)
- [Commits](https://github.com/FasterXML/jackson/commits)

---
updated-dependencies:
- dependency-name: com.fasterxml.jackson.core:jackson-databind
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

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

* build(deps): bump activity-ktx from 1.2.4 to 1.3.0

Bumps activity-ktx from 1.2.4 to 1.3.0.

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

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

* build(deps): bump activity-ktx from 1.3.0 to 1.3.1

Bumps activity-ktx from 1.3.0 to 1.3.1.

---
updated-dependencies:
- dependency-name: androidx.activity:activity-ktx
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

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

* build(deps): bump exifinterface from 1.3.2 to 1.3.3

Bumps exifinterface from 1.3.2 to 1.3.3.

---
updated-dependencies:
- dependency-name: androidx.exifinterface:exifinterface
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-08-05 15:54:43 -05:00
AnkiDroid Translations
76787752f8 Updated strings from Crowdin 2021-08-05 15:53:21 -05:00
Mani
ebe5c6c36f html-js debugging default true in prefs in DEBUG build 2021-08-05 15:52:18 -05:00
Mani
12f24b93a1 js api to search card 2021-08-05 15:27:23 -05:00
David Allison
2ac3e804c3 feat: Add schema v16 tags class
Taken from
ef5c38dbc6/pylib/anki/tags.py

Also adds a number of extension methods to apply Python-named methods in the Kotlin

Untested, adding for interface compatibility

Related: 8988
2021-08-05 15:08:40 -05:00
Shridhar Goel
ab4a40536a Browse AnkiWeb shared decks in app
This will allow the downloading of decks and let AnkiDroid import them
2021-08-05 15:01:07 -05:00
David Allison
2bee386507
NF: Start on Preference deprecation (#9290)
* nf: add abstraction for preference fragments

SpecificSettingsFragment is a base class for screen-specific
preference fragments.

Initially, we want each class to handle initSubscreen()
so we can remove this from the Preference activity.

For 5019

* nf: Add one class per preference screen

These classes are not used yet, but allow extraction of methods
methods from the Preference activity

Afterwards, we will move the implementation of initSubscreen
to these classes

Related: 5019

* nf: add requireContext()

* to SpecificSettingsFragment to allow for methods to be copied over
* to Preferences to ensure a consistent API when copying

For 5019

* nf: make initializeLanguageDialog static

* nf: move initializeLanguageDialog

initSubscreen will be moved to GeneralSettingsFragment

* nf: Use GeneralSettingsFragment

This removes a reference to getPreferenceScreen from the activity
and adds it to the fragment

Related: 5019

* nf: make initializeLanguageDialog nonstatic

* nf: extract ReviewingSettingsFragment

To start off with 5019, we want to remove
`PreferenceContext.getPreferenceScreen();`

as this is a reference from Activity -> PreferenceScreen, rather
than a concern of the fragment

Related: 5019

* nf: initializeCustomFontsDialog - make static

* nf: extract initializeCustomFontsDialog

We'll move initSubscreen here in a later commit

* nf: Appearance Settings: use requireContext()

To be used when extracting the methods to a fragment

* nf: extract AppearanceSettingsFragment

To start off with 5019, we want to remove
`PreferenceContext.getPreferenceScreen();`

as this is a reference from Activity -> PreferenceScreen, rather
than a concern of the fragment

Related: 5019

* nf: make initializeCustomFontsDialog nonstatic

* nf: make updateGestureCornerTouch static

* nf: move updateGestureCornerTouch to fragment

* nf: extract GestureSettingsFragment

To start off with 5019, we want to remove
`PreferenceContext.getPreferenceScreen();`

as this is a reference from Activity -> PreferenceScreen, rather
than a concern of the fragment

Related: 5019

* nf: move getSubscreenIntent to fragment

* nf: extract Advanced Prefs Intent generation

* nf: make setupContextMenuPreference static

* nf: extract setupContextMenuPreference

* nf: make removeUnnecessaryAdvancedPrefs static

* nf: extract removeUnnecessaryAdvancedPrefs

* nf: make addThirdPartyAppsListener static

* nf: extract addThirdPartyAppsListener

* nf: advanced prefs: use requireContext()

Allows less code changes when code is extracted

* nf: Add getCol() to SpecificSettingsFragment

helper method

* nf: extract AdvancedSettingsFragment

To start off with 5019, we want to remove
`PreferenceContext.getPreferenceScreen();`

as this is a reference from Activity -> PreferenceScreen, rather
than a concern of the fragment

Related: 5019

* nf: Advanced Settings - make methods nonstatic

* nf: Buttons prefs: extract getSubscreenIntent

* nf: add setTitle() helper function

* nf: extract CustomButtonsSettingsFragment

To start off with 5019, we want to remove
`PreferenceContext.getPreferenceScreen();`

as this is a reference from Activity -> PreferenceScreen, rather
than a concern of the fragment

Related: 5019

* nf: extract refreshScreen

* nf: extract AdvancedStatisticsSettingsFragment

To start off with 5019, we want to remove
`PreferenceContext.getPreferenceScreen();`

as this is a reference from Activity -> PreferenceScreen, rather
than a concern of the fragment

Related: 5019

* nf: extract CustomSyncServerSettingsFragment

To start off with 5019, we want to remove
`PreferenceContext.getPreferenceScreen();`

as this is a reference from Activity -> PreferenceScreen, rather
than a concern of the fragment

Related: 5019

* nf: remove initSubscreen

This removes one of the two usages of PreferenceContext, and a method
call: `addPreferencesFromResource`

We want PreferenceContext removed as it's a reference from
Activity -> PreferenceScreen, rather than a concern of the fragment

Related: 5019
2021-08-05 11:49:09 -05:00
Mani
abd564ce8b
New JS API for bury & suspend card and bury & suspend note and tag card (#9245) 2021-08-05 11:38:42 -05:00
Shridhar Goel
1d4cb60197 Add support for dimmed background when tutorial is being displayed
Includes decorator pattern with adapters so that interfaces can be used which is required since PromptBackground is an abstract class instead of an interface
2021-08-05 11:14:38 -05:00
Shridhar Goel
26a7db2ca4 Add onboarding related library 2021-08-05 11:14:38 -05:00
David Allison
9605fba66c [WIP] SchemaV16: Implement Decks
This converts decks.py to DecksV16.kt as it was in Anki 2.1.34

To move to the v16 schema, we need to upgrade the classes
associated with the collection columns

These have moved from JSON in a single column to one row per protobuf

After this is merged, we can start migrating Decks.java to use the
same interface and consolidate functionality.

Once the interfaces are the same, we can build a new "Collection" class
with the new table-based classes, flip to opening the collection via
the v16 upgrade mechanism, and then check for bugs.

Some of this functionality is explicitly WIP (DecksBackend.kt)

Related: 8988
2021-08-05 06:48:03 +01:00
Mike Hardy
5ffefa2db4 Bumped version to 2.16alpha8
@branch-specific
2021-08-05 03:39:47 +00:00
AnkiDroid Translations
7e41e244b8 Updated strings from Crowdin 2021-08-04 22:28:29 -05:00
dorrin-sot
307663856f Update 03-dialogs.xml 2021-08-04 22:09:38 -05:00
dorrin-sot
56ad45afda reversed negative and positive buttons in dialog 2021-08-04 22:09:38 -05:00
dorrin-sot
9816e588eb changed to TextUtils.join and moved string to 03-dialogs.xml 2021-08-04 22:09:38 -05:00
dorrin-sot
f995c189b2 reverted codestyle xml file to normal and added license for dialog xml 2021-08-04 22:09:38 -05:00
dorrin-sot
4829abea8e moved the media check dialog's body to a seperate xml 2021-08-04 22:09:38 -05:00
dorrin-sot
815e8d5869 added scrollable file list in media check dialog 2021-08-04 22:09:38 -05:00
Mike Hardy
0362f4c4d4 build(deps): bump TripleT publisher to 3.6.0 2021-08-04 21:57:14 -05:00
Mike Hardy
d27a4f8568 Add JDK dev support for JDK16 2021-08-04 21:57:14 -05:00
Mike Hardy
75a9fadd71 fix: use .all instead of .each for gradle iteration
https://developer.android.com/studio/known-issues#variant_output
2021-08-04 21:57:14 -05:00
Farjad Ilyas
424bc60eb8 nf: change getImageInfo.. methods to getImageName
- getImageInfoFromUri() & getImageInfoFromContentResolver() methods
  returned the path, and the display name of the file identified by the
  URI

- Direct file path access not used in BasicImageFieldController anymore.
  Hence, both getImageInfo methods can be changed so that they only
  return the display name of the file identified by the URI, and not the
  path

- As a side effect, removes the need to use deprecated
  MediaStore.MediaColumns.DATA to get the path of the file identified by
  the URI
2021-08-04 21:31:08 -05:00
Farjad Ilyas
47fb7e12e0 Remove direct file path access in internalizeUri()
- Direct File Path access to non-app-specific directories will not be
  available to apps targeting API 30+

- Use ContentResolver instead of direct file path access in
  internalizeUri() to open the InputStream used to copy a file
  identified by a URI
2021-08-04 21:31:08 -05:00
Farjad Ilyas
fa80726ade Explicity enable file system access within WebView
- WebView has access to the device file system by default for apps
  targeting API <= 29 (targetSdk <= 29)

- File system access for WebView has to be explicity enabled in apps
  which target API > 29. Hence, this change ensures that WebView will
  continue to be able to access files the same way when AnkiDroid
  targets API 30

- WebView file system access required to access media files stored in
  the AnkiDroid directory
2021-08-04 21:31:08 -05:00
Akshay
e2516a28c0 MediaRegistration: Paste as PNG, if alpha channel exists 2021-08-04 21:23:12 -05:00
Arthur Milchior
15324a87e8 NF: assert double equals uses Delta
The current test was deprecated
2021-08-04 21:16:32 -05:00
Arthur Milchior
2c60148b0a NF: comment model/deck/deckconfig
This comes from #8817 from @TarekkMA
2021-08-04 21:15:47 -05:00
Arthur Milchior
c749409b2e NF: remove throws JSONException
It is not a catched exception anymore, and useless for test
2021-08-04 21:14:55 -05:00
David Allison
37b924539e feat: pink, turquoise & purple flags
From Anki 2.1.45
https://github.com/ankitects/anki/pull/1213

Fixes 9347
2021-08-04 20:45:34 -05:00
TheItsyBitsySpider
17149cb78e
Added/updated copyright statements to files (#9346) 2021-07-31 19:07:06 -05:00
dorrin-sot
f62b200150 status bar color in dark theme changed to dark grey 2021-07-31 15:00:41 -05:00
Mike Hardy
5dae9d90f9 build(deps): bump android gradle plugin to 7.0.0
- ignore bcprov via ignorelist, can remove w/AGP7.1+ https://issuetracker.google.com/issues/159151549#comment12
- Triple-T publisher needs a switch to their agp7.0 track
- Obsolete versionCode/version/dexOptions removed (suggested by AGP migration task in Android Studio)
- AGP 7+ requires JDK11 to run, retire JDK8 from development
2021-07-31 14:58:53 -05:00
David Allison
b392f10618 API: Handle lint checks from AnkiDroid only libs
The API project used the same lint checks as AnkiDroid,
this failed, as "BinaryOperationInTimber" was defined but
Timber wasn't included in the project.

Related: AGP 7 upgrade: 9338
2021-07-31 14:58:53 -05:00
David Allison
0a696b1b51 lint: ignore all Timber checks
Timber Lint is currently incompatible with AGP 7

See: https://github.com/JakeWharton/timber/issues/408

Related: 9338
2021-07-31 14:58:53 -05:00
David Allison
0c1a38ea34 lint: fix UnspecifiedImmutableFlag
Lint was added in AGP 7
http://googlesamples.github.io/android-custom-lint-rules/user-guide.html

Apps targeting Android 12 and higher must specify either
`FLAG_IMMUTABLE` or `FLAG_MUTABLE` when constructing a `PendingIntent`.

Since we don't have `FLAG_IMMUTABLE` (API 23), we define this in Compat
and pass it in with a new compat method

We use `FLAG_IMMUTABLE`.
`FLAG_MUTABLE` should only be used when some functionality relies on
modifying the underlying intent, e.g. any PendingIntent that needs
to be used with inline reply or bubbles.

https://developer.android.com/reference/android/app/PendingIntent#FLAG_IMMUTABLE
https://developer.android.com/reference/android/app/PendingIntent#FLAG_MUTABLE

Related: Upgrade to AGP 7: 9338
2021-07-31 14:58:53 -05:00
David Allison
62116894b3 lint: fix IntentFilterExportedReceiver
Added in AGP 7:
http://googlesamples.github.io/android-custom-lint-rules/user-guide.html

We set `android:exported="true"` as each of the associated receivers
had an intent filter

This matches the previously implicit default

---
Documentation:

Apps targeting Android 12 and higher are required to specify an
explicit value for `android:exported` when the corresponding
component has an intent filter defined. Otherwise, installation
will fail.

Previously, `android:exported` for components without any intent
filters present used to default to false, and when intent filters
were present, the default was true. Defaults which change value
based on other values are confusing and lead to apps accidentally
exporting components as a side-effect of adding intent filters.
This is a security risk, and we have made this change to avoid
introducing accidental vulnerabilities.

While the default without intent filters remains unchanged,
it is now required to explicitly specify a value when intent filters
are present. Any app failing to meet this requirement will fail to
 install on any Android version after Android 11.

We recommend setting android:exported to false (even on previous
versions of Android prior to this requirement) unless you have a
good reason to export a particular component.

---

Related: 9338
2021-07-31 14:58:53 -05:00
David Allison
fcf111c329 lint: remove "debug" config
After moving to AGP 7, we can no longer apply lintConfig on
`task.doFirst`

Since we're not using the baseline/debug config, we might as well
simplify this file and remove the implementation.

Baseline usage was never properly implemented, and was on Travis CI
which we are no longer using.

Related: 9338
2021-07-31 14:58:53 -05:00
David Allison
498fa1738d add (ignore) new lint warnings in new AGP
* CustomX509TrustManager
* NotifyDataSetChanged
2021-07-31 09:15:04 -05:00
David Allison
355ecd5d36 fix lint: TimberArgCount 2021-07-31 09:15:04 -05:00
David Allison
79981a0097 fix lint: WrongConstant 2021-07-31 09:15:04 -05:00
Farjad Ilyas
42aa300b02 Use URI & ContentResolver for background img pref
- Moves away from using direct file path access (using a File object) to
  the new DeckPicker background image selected by the user since the
  image may be in a directory which will not be accessible via direct
  file path access under Scoped Storage

- Use ContentResolver's query()'s projection parameter to query the
  MediaStore Images collection and obtain image size directly instead of
  querying for the image's path, then using direct file path access to
  obtain size

- Open File stream using ContentResolver & URI instead of direct file
  path access
2021-07-31 14:33:55 +02:00
Farjad Ilyas
93959b61ba Add moveDirectory() method
- Expected to be used to move user data from legacy to app-specific
  dirs that will be accessible under scoped storage
2021-07-31 14:29:25 +02:00
Farjad Ilyas
659f6b3a22 Add copyDirectory() method
- Expected to be used to copy user data from legacy to app-specific
  dirs that will be accessible under scoped storage
2021-07-31 14:29:25 +02:00
Farjad Ilyas
26cf2b71af Add ensureFileIsDirectory() method
- To be used in future directory I/O methods which will need to throw
  an exception if a given File object is not a directory
2021-07-31 14:29:25 +02:00
Farjad Ilyas
b9f52c5306 Add getDirectorySize() method
- One expected use is to get the amount of data to be transferred, which
  can be used to calculate percentage progress updates for file transfer
  tasks
2021-07-31 14:29:25 +02:00
Farjad Ilyas
da7a97cda1 Add listFiles() method for directories
- To be used in future directory I/O methods
2021-07-31 14:29:25 +02:00
TheItsyBitsySpider
5efa59bf0d Added copyright statement 2021-07-30 10:32:35 -05:00
TheItsyBitsySpider
459d30b997 Added unit tests for AudioRecorder 2021-07-30 10:32:35 -05:00
David Allison
937970d9f3 nf: import cleanup 2021-07-29 20:39:05 -05:00