In PR 16620, I encountered the following error on
ubuntu CI
After research, `CppAssetManager2` errors are typically due to memory leaks, often by not calling close on Scenarios
```
TagsDialogTest > test_SearchTag_spaceWillBeFilteredCorrectly FAILED
java.lang.OutOfMemoryError: Java heap space
at org.robolectric.res.android.ResourceTypes$ResTable_typeSpec.getSpecFlags(ResourceTypes.java:1095)
at org.robolectric.res.android.LoadedArsc$TypeSpec.GetFlagsForEntryIndex(LoadedArsc.java:116)
at org.robolectric.res.android.CppAssetManager2.FindEntry(CppAssetManager2.java:699)
at org.robolectric.res.android.CppAssetManager2.GetResource(CppAssetManager2.java:869)
at org.robolectric.res.android.CppAssetManager2.ResolveReference(CppAssetManager2.java:935)
at org.robolectric.res.android.AttributeResolution10.ApplyStyle(AttributeResolution10.java:414)
at org.robolectric.shadows.ShadowArscAssetManager10.nativeApplyStyle_measured(ShadowArscAssetManager10.java:1414)
at org.robolectric.shadows.ShadowArscAssetManager10.lambda$nativeApplyStyle$1(ShadowArscAssetManager10.java:1374)
at org.robolectric.shadows.ShadowArscAssetManager10$$Lambda/0x00007f40d092a740.run(Unknown Source)
at org.robolectric.util.PerfStatsCollector.measure(PerfStatsCollector.java:82)
at org.robolectric.shadows.ShadowArscAssetManager10.nativeApplyStyle(ShadowArscAssetManager10.java:1371)
at java.base/java.lang.invoke.LambdaForm$DMH/0x00007f40d0946800.invokeStatic(LambdaForm$DMH)
at java.base/java.lang.invoke.LambdaForm$MH/0x00007f40d0948800.guardWithCatch(LambdaForm$MH)
at java.base/java.lang.invoke.LambdaForm$MH/0x00007f40d0ab3400.delegate(LambdaForm$MH)
at java.base/java.lang.invoke.LambdaForm$MH/0x00007f40d094ac00.guard(LambdaForm$MH)
at java.base/java.lang.invoke.LambdaForm$MH/0x00007f40d094b000.linkToCallSite(LambdaForm$MH)
at android.content.res.AssetManager.nativeApplyStyle(AssetManager.java)
at android.content.res.AssetManager.applyStyle(AssetManager.java:1147)
at java.base/java.lang.invoke.LambdaForm$DMH/0x00007f40d0941400.invokeSpecial(LambdaForm$DMH)
at java.base/java.lang.invoke.LambdaForm$MH/0x00007f40d0943c00.guardWithCatch(LambdaForm$MH)
at java.base/java.lang.invoke.LambdaForm$MH/0x00007f40d0ab3000.delegate(LambdaForm$MH)
at java.base/java.lang.invoke.LambdaForm$MH/0x00007f40d0946000.guard(LambdaForm$MH)
at java.base/java.lang.invoke.LambdaForm$MH/0x00007f40d0946400.linkToCallSite(LambdaForm$MH)
at android.content.res.AssetManager.applyStyle(AssetManager.java)
at android.content.res.ResourcesImpl$ThemeImpl.obtainStyledAttributes(ResourcesImpl.java:1394)
at java.base/java.lang.invoke.LambdaForm$DMH/0x00007f40d035d400.invokeSpecial(LambdaForm$DMH)
at java.base/java.lang.invoke.LambdaForm$MH/0x00007f40d093fc00.guardWithCatch(LambdaForm$MH)
at java.base/java.lang.invoke.LambdaForm$MH/0x00007f40d035dc00.delegate(LambdaForm$MH)
at java.base/java.lang.invoke.LambdaForm$MH/0x00007f40d0940c00.guard(LambdaForm$MH)
at java.base/java.lang.invoke.LambdaForm$MH/0x00007f40d0941000.linkToCallSite(LambdaForm$MH)
at android.content.res.ResourcesImpl$ThemeImpl.obtainStyledAttributes(ResourcesImpl.java)
at android.content.res.Resources$Theme.obtainStyledAttributes(Resources.java:1692)
```
If a call to super is requested, `null` may be returned
In this case, `super` would be called
This is useful if you would optionally want to inherit from
a class (say `EditTextPreference`), but also allow conditionally
return a different fragment
Links to the repo are unpleasant to see:
* Link previews are too large & distracting
* Links without a preview give no context
I want something which both gives context, and is compact
`macos-clipboard-to-discord` converts an issue link:
https://github.com/ankidroid/Anki-Android/pull/16804
into:
* A link with text: "#16804: refactor/docs: `libs.versions.toml` changelogs/renames"
* Without a preview
* Redirecting to the correct PR
`./format-for-discord` performs this formatting: accepting a PR/Issue number: 16804
and outputting the above to stdout
This commit ensures that we can drop files (photos, videos, and audio) in NoteEditor (FixedEditText).
Fix: Handle minSdkVersion conflict with DropHelper and enable file drop in NoteEditor
Added DropHelperCompat to handle the incompatibility issue with DropHelper and minSdkVersion 23. The manifest merger failed with the following error:
> Manifest merger failed: uses-sdk:minSdkVersion 23 cannot be smaller than version 24 declared in library [androidx.draganddrop:draganddrop:1.0.0] /Users/davidallison/.gradle/cache> s/8.8/transforms/0a1688833d368c1b9b07d2054911030e/transformed/draganddrop-1.0.0/AndroidManifest.xml as the library might be using APIs not available in 23
> Suggestion: use a compatible library with a minSdk of at most 23,
> or increase this project's minSdk version to at least 24,
> or use tools:overrideLibrary="androidx.draganddrop" to force usage
> (may lead to runtime failures)
To resolve this, the DropHelperCompat class is used to conditionally configure the view for drag and drop operations only when the SDK version is 24 or higher.
Context Receivers are an experimental Kotlin feature
. They will be removed and replaced with Context Parameters.
It is unlikely that there will be any overlap period, so we need
to remove our Context Receiver code, with the intention of replacing it
at a later date
> * **2.0.20**: A warning is introduced for declarations that use
> context receivers.
> The warning should mention that the design of context receivers
> is about to change, according to the new design (add a link to the KEEP/YT).
> The safest workaround is to migrate your code to extensions.
> * **2.1.20**: The implementation of context receivers is removed from the compiler.
> Effectively, this warning is turned into an error.
> Note that this part is most likely inevitable as the implementation
> of context parameters requires quite extensive refactoring in the compiler,
> and there are significant chances that we won't have either
> context receivers or context parameters at that time.
> [There is a slight chance that we'll have an early prototype of context parameters,
> but we are not counting on that.]
> * **2.2.0**: Context parameters are introduced under a new compiler flag.
https://youtrack.jetbrains.com/issue/KT-67119/Migration-warning-from-context-receivers-to-context-parameters
> **Phased removal of context receivers feature**
> In Kotlin 1.6.20, we introduced context receivers as an
> Experimental feature. After listening to community
> feedback, we've decided not to continue with it. Instead,
> we plan to introduce a replacement in future Kotlin
> releases: context parameters. You can find the proposal
> for context parameters in the KEEP.
https://kotlinlang.org/docs/whatsnew-eap.html#phased-removal-of-context-receivers-feature
Deprecated:
https://redirect.github.com/Kotlin/KEEP/blob/context-parameters/proposals/context-receivers.md
* https://redirect.github.com/Kotlin/KEEP/issues/259
To be replaced by:
https://redirect.github.com/Kotlin/KEEP/blob/context-parameters/proposals/context-parameters.md
* https://redirect.github.com/Kotlin/KEEP/issues/367
Fixes 16863
Reverts: 672b075a54
Reverts: 1c01e4cb6f
refresh fragment after one second of text changed. And hide preview icon if fragmented as there is no point of having this option because the fragment will auto-refresh the content.
This commit updates the UI to ensure that the previewer theme matches the card template editor theme.
CardTemplateEditor
- Set navigation bar color to use alternative background color
- Update background color attribute
TemplatePreviewerFragment
- Apply style to TabLayout for consistent appearance
This commit switch the previewer menu from MateralToolbar to toolbar so that it has the same menu has the editor.
It introduces setupCommonMenu and handleCommonMenuItemSelected that add the previewer's menu entry and handle them. They are called from the editor's menu if the view is fragmented, and from the previewer's own menu otherwise.
This commit adds a fragmented variable to TemplatePreviewerArguments, to
let the previewer knows whether it belongs to a fragmented view. If so,
the previewer's back button is removed, hence only the editor's back
button remain.
On xlarge screen, display the previewer on the trailing side of the card template editor
This commit introduces a new view, card_template_editor.xml, that contains the card template editor (implemented in card_template_editor_activity.xml) and potentially the previewer on xlarge screen.
CardTemplateEditor.kt simply set the content view to card_template_editor instead of card_template_editor_activity, and add the previewer if needed.
It was agreed we use camelCase consistently and
that snake_case was to be applied by `@LibAnkiAlias`
A few legacy methods would have conflicted
rename:
* addField -> addFieldLegacy
* renameField -> renameFieldLegacy
* remField -> remFieldLegacy
* moveField -> moveFieldLegacy
implementation:
search for `fun.*_` inside `libAnki`
Fixes 11582
It was agreed we use camelCase consistently and
that snake_case was to be applied by `@LibAnkiAlias`
implementation:
search for `fun.*_` inside `libAnki`
inline:
* _addTemplate
* _addField
A few legacy methods in `Notetypes.kt` weren't handled
Fixes 11582
Implemented keyboard shortcuts to enhance the user experience by providing quick access to commonly used functionalitie. The following shortcuts have been added:
T: Opens Statistics.
D: Creates a Deck
C: Check database
F: Creates a Filtered Deck.
Del: Deletes the currently focused Deck (on large screen only) with
confirmation dialog.
Shift+Del: Deletes deck without confirmation dialog (on large screen
only)
R: Renames the Deck (on large screen only)
P: Opens Settings.
M: Checks Media.
Ctrl+ E: triggers the Export Collection dialog.
Ctrl + Shift + I: Opens the Import dialog.
Ctrl + Shift + N: Opens Manage Note Types.
Ctrl+B: Restore from backup
* refactor: viewModel to use generic media terms and livedata
* refactor: use reselect string instead of restart
* refactor: extract MenuProvider class
* refactor: show multimedia bottomsheet in case result is cancelled
-Added right-click support for all existing long click listeners.
-Created an OnContextAndLongClickListener interface to handle both context click and long click events consistently.
-This interface includes an onAction method to define the common action (context and long click).
-The interface ensures that both listeners are set without duplicating code.
-Applied the OnContextAndLongClickListener interface to handle right-click and long-click events uniformly.