0
0
mirror of https://github.com/ankidroid/Anki-Android.git synced 2024-09-20 03:52:15 +02:00
Anki-Android/.idea/dictionaries
David Allison ea8ceeace1
fix: crash if image dimensions are too large (#15452)
* refactor: invert 'if'

* refactor: extract logic to BackgroundImage

* fix: large bitmap crashes DeckPicker

An image < 10MB can decompress to >100MB, which crashes

Example was: 4 * 4921 * 6983 = 137453372 bytes

This call-stack did not include our code

```
java.lang.RuntimeException: Canvas: trying to draw too large(137453372bytes) bitmap.
	at android.graphics.RecordingCanvas.throwIfCannotDraw(RecordingCanvas.java:280)
	at android.graphics.BaseRecordingCanvas.drawBitmap(BaseRecordingCanvas.java:88)
	at android.graphics.drawable.BitmapDrawable.draw(BitmapDrawable.java:548)
	at android.widget.ImageView.onDraw(ImageView.java:1436)
```

Fixes 15450

* crash fix for background image too large

The check internally is `> MAX_BITMAP_SIZE`

Issue 15450
2024-02-08 10:43:45 -05:00
..
android.xml Dialog: 'media sync unavailable' before migration 2023-03-24 11:12:48 -05:00
anki.xml Enable the backend UI screens for importing an anki package 2023-11-21 18:03:43 -05:00
Cath.xml Fix typo errors in card.js / add user spelling dictionary (#14305) 2023-08-26 10:33:13 -05:00
davidallison.xml fix: crash if image dimensions are too large (#15452) 2024-02-08 10:43:45 -05:00
README.md adding links to the readme 2023-12-31 09:36:50 +00:00
usernames.xml added README.md file for project dictionaries 2023-12-31 09:36:50 +00:00

Dictionary Management for AnkiDroid

Introduction

This guide addresses the issue of managing custom dictionaries within JetBrains IDE -Android Studio. Often, when adding a word to the dictionary within the IDE, it remains user-specific and doesn't propagate across a team. This README explores a workaround for better collaboration regarding custom dictionaries in the IDE.

Implementation Steps

1. Understanding Directory Structure

  • The directory idea/dictionaries within the project root holds user-specific dictionary files.
  • Each user's added words are stored in a file named after their OS login username (e.g., catio.xml for a user named "catio") and this file is shared within the project.
  • anki.xml - Anki Desktop specific terminology: 'did'
  • android.xml - Android and dependencies: 'miui.securitycenter'
  • usernames.xml - Usernames in copyright declarations

2. Leveraging Shared Dictionary Files

  • Create a dictionary file formatted as an XML (similar to the user-specific ones) containing shared project-specific words.
  • Naming this file differently (not tied to a username) allows reuse across projects sharing the same terminology.

3. Managing Collaborative Editing

  • When multiple developers commit their dictionary files, potential word duplications may occur.
  • Manual editing of these XML files is necessary, as the IDE doesn't provide direct options to write to a shared dictionary.
  • Syntax: Use the XML structure specified in the example below to manually craft or edit dictionary files.

Note: Restart the IDE after editing the file or adding the file for the changes to take place

Example Dictionary File Structure

<component name="ProjectDictionaryState">
    <dictionary name="project-dictionary">
        <words>
            <w>someword</w>
        </words>
    </dictionary>
</component>

Best Practice for VCS Integration

  • Consider adding manually created shared dictionary files to the VCS, while ignoring the rest of idea/dictionaries.
  • This prevents automatic addition of words from individual IDEs to the shared dictionary, minimizing unnecessary duplications.