0
0
mirror of https://github.com/ankidroid/Anki-Android.git synced 2024-09-19 19:42:17 +02:00
Commit Graph

19583 Commits

Author SHA1 Message Date
AnkiDroid Translations
97275199a3 Updated strings from Crowdin 2024-08-08 15:00:52 +00:00
Ashish Yadav
6a8ede0916 enhancement: add drawing option to multimedia fragment
* refactor: compress camera clicked pictures
* refactor: add camera permission check
2024-08-07 13:26:45 +00:00
Ashish Yadav
541ef81697 enhancement: add audio recorder option in multimedia editor 2024-08-07 13:26:45 +00:00
Ashish Yadav
1c878bbe25 refactor: arguments in show error dialog in multimedia fragment 2024-08-07 13:26:45 +00:00
Ashish Yadav
f0a319379a chore: remove old multimedia editor code 2024-08-07 13:26:45 +00:00
Ashish Yadav
01a6c0e6f6 chore: make new multimedia editor public 2024-08-07 13:26:45 +00:00
David Allison
54cd95b479 refactor(libanki): rename legacy methods & fix camelCase
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
2024-08-04 10:58:50 +00:00
David Allison
d1c63b12de refactor(libanki): rename methods/params to camelCase
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
2024-08-04 10:58:50 +00:00
David Allison
ef88a1cd06 refactor: Hungarian Notation rename 2024-08-04 09:21:16 +00:00
peyman79
edfe9b7125 fix(instant-editor): punctuation handling
* Add Apostrophe and Parentheses to the cloze regex
* Add tests
2024-08-03 17:33:33 +00:00
Ashish Yadav
796e58b91f refactor: move audio package to multimedia package 2024-08-03 16:38:37 +00:00
David Allison
5f5745b093 docs: dependencies - changelogs
For when Dependabot doesn't link through
2024-08-02 15:34:48 +00:00
David Allison
f14d60ed4e refactor(deps): rename/refactor
* androidxText -> androidxTest
* androidxRunner -> androidxTest
* remove 'core' - unused
* androidxImageCropper -> imageCropper (not AndroidX)
* androidxMedia3 is combined from the following
    * media3Exoplayer
    * media3ExoplayerDash
    * media3Ui

** Renames **
* androidxSqliteFramework -> androidxSqlite
* androidxSwiperefreshlayout -> androidxSwipeRefreshLayout
* androidxUiautomator -> androidxTestUiAutomator
2024-08-02 15:34:48 +00:00
SanjaySargam
e6127154c8 deckpicker: keyboard shortcuts
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
2024-08-01 22:53:45 +00:00
AnkiDroid Translations
8863de71a0 Updated strings from Crowdin 2024-08-01 17:59:07 +00:00
Ashish Yadav
ce1b7780a0 Refactor: vibration methods to use Duration
Co-authored-by: David Allison <62114487+david-allison@users.noreply.github.com>
2024-08-01 11:55:26 +00:00
Ashish Yadav
7d82d127ca enhacement: add Audio and Video multimedia options
* 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
2024-07-31 14:54:09 +00:00
AnkiDroid Translations
de309bb1ea Updated strings from Crowdin 2024-07-30 12:31:06 +00:00
SanjaySargam
76eea74a2b Implement Right-Click Support for Long Click Listeners
-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.
2024-07-28 14:15:41 +00:00
SanjaySargam
87e2a79b67 card-template-editor: keyboard shortcuts
- Implemented keyboard shortcuts:
  - Ctrl+P: Perform Preview
  - Ctrl+1: Navigate to Front Edit
  - Ctrl+2: Navigate to Back Edit
  - Ctrl+3: Navigate to Styling Edit
  - Ctrl+S: Save Note
  - Ctrl+R: Rename template
  - Ctrl+I: Show Insert Field Dialog
  - Ctrl+A: Add template
  - Ctrl+B: Open Browser Appearance
  - Ctrl+D: Delete template
  - Ctrl+O: Display Deck Override Dialog
  - Ctrl+M: Copy Markdown Template to Clipboard
2024-07-28 14:13:38 +00:00
Ashish Yadav
f52b6276da fix: cloze number incorrect on undo
* refactor: update the viewmodel tests
2024-07-28 11:39:14 +00:00
anoop
f7d1b97b25 Introducing AnalyticsWidgetProvider as ancestor of all widget classes.
This will ensure any widgets Timber and send analytics on enabling, disabling and updating.
2024-07-26 05:48:51 +00:00
SanjaySargam
d76e69586d refactor: rename pager
Renaming these two pager ids so that android-studio should know both are different pager
2024-07-26 02:26:35 +00:00
CLIDragon
2c7c0c5bda Replace CRLF with LF 2024-07-23 09:54:01 +00:00
CLIDragon
1feb8b31b8 Prevent CRLF line endings
* Set .gitattributes to automatically detect text files, enabling git to
remove CRLF.
* Keep CRLF for .bat files
* Use .editorconfig to avoid further introduction of CRLF
2024-07-23 09:54:01 +00:00
snowtimeglass
ece272e7af Make "Gallery" labels translatable from Crowdin
Use the existing "Gallery" string which is translatable in Crowdin for:
 - the "Gallery" option label in the menu of "Select image" in "Image Occlusion" note type
 - the "Gallery" option label in the menu of multimedia file attachment in the note editor
2024-07-22 11:39:32 +00:00
SanjaySargam
b9aacdee33 Unify imagePath and audioPath into a single mediaPath 2024-07-21 22:28:03 +00:00
MorenoTropical
17565b99e2 improve deleted deck message 2024-07-21 22:04:19 +00:00
Ashish Yadav
73dde8aef5 feature: enable instant editor for public use 2024-07-21 06:15:56 +00:00
MorenoTropical
f3e8b497d1 fix: Processing... popup in app startup
8e0b537b1d introduced a call to `updateMenuState()` at the
loadDeckCounts job to update the undo label state when the deck is
reloaded.

Following the method name, the whole menu is updated instead of only the
undo label, which includes checking if there are changes to sync
remotely, and that takes time, so it shouldn't be done if not necessary.
2024-07-21 05:43:29 +00:00
jainv4156
88d4a983d4 Dynamicaly set in sentence case... Flag,Toggle Witeboard,Abort Learning
fdasdf

asdfasfd

sfad
2024-07-21 03:41:38 +00:00
AnkiDroid Translations
972b12af7c Updated strings from Crowdin 2024-07-20 09:49:52 +00:00
Ashish Yadav
bb85307f88 feat: setup new multimedia bottom sheet
* feat: added multimedia activity and base fragment
* enhancement: setup the gallery and camera options
2024-07-20 07:58:30 +00:00
Ashish Yadav
c7a2488a72 feat: add multimedia UI dev option 2024-07-20 07:58:30 +00:00
Sumit Singh
9f45f58390 Update the snackbar to show a due date card 2024-07-20 07:36:57 +00:00
AnkiDroid Translations
987a925060 Updated strings from Crowdin 2024-07-20 04:56:27 +00:00
David Allison
93333ed57c fix: "MissingDefaultResource" lint: iw
This should only be checked on `/values`

Added in 0f795cea36
2024-07-19 15:38:08 -03:00
AnkiDroid Translations
bc26f7fd62 Updated strings from Crowdin 2024-07-19 11:43:32 +00:00
Mike Hardy
4afa7ec41e Bumped version to 2.19alpha10 2024-07-19 11:19:21 +00:00
lukstbit
8c352ec3de Remove "app.brant.amazonappstorepublisher" plugin
The plugin hasn't been updated for quite some time and it currently
breaks the build and apk publishing. This PR removes it along its
configuration and any additional setup code.

The plugin was already removed from the publishing process as it
didn't work anymore. See https://github.com/ankidroid/Anki-Android/issues/14161
2024-07-19 06:18:30 -05:00
SanjaySargam
336736faec NoteEditor intent creation using NoteEditorLauncher interface
Refactored NoteEditor integration with NoteEditorLauncher interface to centralize configuration for various entry points.

Introduced NoteEditorLauncher as a sealed interface to streamline and unify configurations for opening NoteEditor from different contexts. Provides clear and standardized methods (e.g., AddNote, EditCard) for invoking NoteEditor with specific behaviors and data, improving code clarity and reducing potential errors in bundle creation. Promotes modularization by consolidating NoteEditor-related logic into a single location (noteeditor folder), enhancing maintainability and reducing redundancy across fragments and activities.

- ImageOcclusion: Handles opening NoteEditor with an image URI for creating an image occlusion.
- PassArguments: Directly passes arguments to the NoteEditor for scenarios like sharing text or processing text.
- AddNote: Opens NoteEditor from DeckPicker with optional deck ID.
- AddNoteFromCardBrowser: Opens NoteEditor from CardBrowser, optionally passing search terms and last deck ID.
- AddNoteFromReviewer: Opens NoteEditor from Reviewer, optionally specifying activity transition animation.
- AddInstantNote: Opens NoteEditor for instant note creation with shared text.
- EditCard: Edits a card in NoteEditor, specifying card ID and animation direction.
- EditNoteFromPreviewer: Edits a note in NoteEditor from Previewer, using the card ID.
- CopyNote: Copies a note in NoteEditor, optionally specifying deck ID, field texts, and tags.
2024-07-19 10:13:04 +00:00
SanjaySargam
ba341fc788 Convert NoteEditor to Fragment
1. AnkiFragment:
   - Introduced a base class for fragments (`AnkiFragment`) with a `@param layout` documentation referencing `CardViewerFragment`. This base class consolidates common functionality and methods for all future fragments by inheriting `AnkiFragment`.
   - Extracted methods from NoteEditor to AnkiFragment for potential reuse in other fragments.

2. NoteEditor Fragment:
   - Implemented `OnMenuItemClickListener` to handle toolbar menu item clicks.
   - Implemented `DispatchKeyEventListener` to manage key events.
   - Initialized Onboarding after the view is created to prevent initialization errors.
   - Split `onCreate()` into `onCreate()` and `onViewCreated()` to accommodate differences between activities and fragments in Android. In fragments, the view hierarchy setup (`onViewCreated()`) occurs separately from initialization (`onCreate()`), ensuring operations requiring access to the fragment's view are correctly handled post-creation.
   - Replaced `IntentCompat` with `BundleCompat` to handle null data scenarios.
   - Utilized `Bundle` instead of `Intent` in `openNewNoteEditor()` to avoid null data issues with `intent.extras`.

5. Intent Handling:
   - Updated `SingleFragmentActivity.getIntent()` to support optional `intentAction` parameters, enabling dynamic intent actions like sharing text, images, and processing text.
   - Created `IntentHandler2` for:
     - Sharing text to NoteEditor
     - Sharing image to NoteEditor
     - Sharing process text to NoteEditor
     - `Add Note` shortcut
   - Created AbstractIntentHandler:
     - Extract common initialization from IntentHandler and IntentHandler2 into AbstractIntentHandler.

6. NavigationDrawerActivity:
   - Resolved error triggering when opening NoteEditor from a shortcut (`Long press AnkiDroid App -> Add`) by redirecting the intent target from NoteEditor to IntentHandler2.

7. ManifestFile:
   - Removed NoteEditor from the manifest file due to its transition from an Activity to a Fragment.
   - Moved `NoteEditor` specific intent filters from `NoteEditor` to `IntentHandler2`

8. Testing:
   - Updated test files under the guidance of David in discord channel and feedback to ensure comprehensive test coverage aligns with the updated architecture and intent handling in AnkiDroid.
   - CardBrowserTest: The addIntent returns both SingleFragmentActivity.FRAGMENT_NAME_EXTRA and SingleFragmentActivity.FRAGMENT_ARGS_EXTRA. Since NoteEditor.EXTRA_DID is located within SingleFragmentActivity.FRAGMENT_ARGS_EXTRA, the assertions needed to be adjusted to extract and verify the arguments bundle directly.

This commit refactors NoteEditor into a Fragment, improves intent handling across activities, and enhances fragment lifecycle management for consistent behavior and performance in AnkiDroid.
2024-07-19 10:13:04 +00:00
SanjaySargam
698a74236f Refactor NoteEditor
Used requireContext() when a method or parameter specifically requires a Context

Used requireActivity() when a method or parameter needs to interact with the hosting Activity is required

Used requireArguments() to retrieve fragment arguments. Replaced intent.extras with requireArguments because intent.extras returns both SingleFragmentActivity.FRAGMENT_NAME_EXTRA and SingleFragmentAcitivity.FRAGMENT_ARGS_EXTRA but we need only SingleFragmentAcitivity.FRAGMENT_ARGS_EXTRA

requireContext() and requireActivity() ensure that the Fragment is currently attached and prevent null pointer exceptions, providing safer access to the Context or Activity
2024-07-19 10:13:04 +00:00
Ashish Yadav
2e429bc009 enhancement: add long press listener on cloze chips 2024-07-19 10:11:29 +00:00
AnkiDroid Translations
8167b20d35 Updated strings from Crowdin 2024-07-19 09:19:57 +00:00
Mike Hardy
fab5a8caad
Dependency updates 20240718 (#16755)
* build(deps): bump lint from 31.5.0 to 31.5.1 (#16724)

Bumps `lint` from 31.5.0 to 31.5.1.

Updates `com.android.tools.lint:lint-api` from 31.5.0 to 31.5.1

Updates `com.android.tools.lint:lint` from 31.5.0 to 31.5.1

Updates `com.android.tools.lint:lint-tests` from 31.5.0 to 31.5.1

---
updated-dependencies:
- dependency-name: com.android.tools.lint:lint-api
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: com.android.tools.lint:lint
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: com.android.tools.lint:lint-tests
  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>

* build(deps): bump androidGradlePlugin from 8.5.0 to 8.5.1

Bumps `androidGradlePlugin` from 8.5.0 to 8.5.1.

Updates `com.android.application` from 8.5.0 to 8.5.1

Updates `com.android.library` from 8.5.0 to 8.5.1

---
updated-dependencies:
- dependency-name: com.android.application
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: com.android.library
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

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

* Update Gradle Wrapper from 8.8 to 8.9.

Signed-off-by: gradle-update-robot <gradle-update-robot@regolo.cc>

* build(deps): bump io.mockk:mockk from 1.13.11 to 1.13.12 (#16743)

Bumps [io.mockk:mockk](https://github.com/mockk/mockk) from 1.13.11 to 1.13.12.
- [Release notes](https://github.com/mockk/mockk/releases)
- [Commits](https://github.com/mockk/mockk/compare/1.13.11...1.13.12)

---
updated-dependencies:
- dependency-name: io.mockk:mockk
  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>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: gradle-update-robot <gradle-update-robot@regolo.cc>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: gradle-update-robot <gradle-update-robot@regolo.cc>
2024-07-18 17:57:13 -05:00
Ashish Yadav
a7811e4a4a improvement(instant-editor): punctuation handling
Primarily dashes and underscores

unitTest: create unit test for connecting punctuation
2024-07-18 21:19:53 +00:00
Arthur Milchior
f62471c71a refactor: small code cleanups
First, I wanted to replace
`isEmpty` by `containsNoCard`. It seems interesting to note that this
may still contains non-default note-type and decks, and still consider
the collection empty.

This makes me look at Pairs, and found that, often, destructing the
Pair seems more readable to me than using `.first` and
`.second`. Especially when it eiher allows to have a single non-null
assertion, or allows to have name value instead.

I also added some `@NotLibAnki` instead of comments, as I just
dicovered that annotation.
2024-07-18 21:13:11 +00:00
AnkiDroid Translations
b1692c5f75 Updated strings from Crowdin 2024-07-18 18:55:40 +00:00
Brayan Oliveira
4f47106675 feat(new reviewer): hide answer buttons 2024-07-18 15:11:41 +00:00