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
* 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
Includes decorator pattern with adapters so that interfaces can be used which is required since PromptBackground is an abstract class instead of an interface
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
- 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
- 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
- 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
- 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
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
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
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
- 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