0
0
mirror of https://github.com/ankidroid/Anki-Android.git synced 2024-09-20 03:52:15 +02:00
Commit Graph

17528 Commits

Author SHA1 Message Date
Robozinho
56da7fae2c
NF: clean study options nulls (#13877)
* lateinit textDeckname

* lateinit deckInfoLayout

* lateinit textETA

* lateinit textCongrats

* lateinit buttonStart

* lateinit textDeckDescription

* lateinit more variables

* make col null safe

* make mFullNewCountThread call safer

* remove null early return

inflate() takes a nullable "root" argument so there is no reason to early return

the documentation says that the root argument is an "*******Optional******* view to be the parent of the generated hierarchy (if attachToRoot is true), or else simply an object that provides a set of LayoutParams values for root of the returned hierarchy (if attachToRoot is false.)"

so the view is inflated anyway if you give a null root (or container)

Asked by @Arthur-Milchior
2023-05-30 04:26:36 -03:00
Prince kushwaha
6c5c663917 Changed Material Dialog with Alert Dialog for ModelEditorContextMenu.kt 2023-05-26 12:52:52 -03:00
sargamgayatri0803@gmail.com
dcebd49032 IntegerDialog showing keyboard 2023-05-26 12:50:36 -03:00
Ashish Yadav
5dd9ebacdc using activity.package to fix the authority issue while exporting col 2023-05-25 23:40:38 +01:00
snowtimeglass
10812cea19 Use "Finish" as Timebox negative button label
The current label of the negative button of "Timebox reached" dialog is "Close",
but it misleads as if it merely closes the dialog.
(It actually finishes the review session and shows the deck picker screen.)

This commit will replace the label with "Finish",
which is used on the counterpart dialog in Anki Desktop.
The string is reused from Anki Desktop.

Incidentally, this commit will also add the title comment
to the section of Timebox in 02-string.xml, for organization.
2023-05-24 10:50:14 -03:00
AnkiDroid Translations
c25579a645 Updated strings from Crowdin 2023-05-22 06:33:00 +03:00
Sanjaykumar Sargam
2076bcb698 Replaced Toast with Snackbar in AnkiDroidJSAPI.kt 2023-05-20 08:48:37 -03:00
David Allison
f27dc86645 hack: workaround .nomedia being mutated
During a storage migration, we had a case where `.nomedia` failed the
 content equality checks.

We do not know why, could not reproduce this and could not see it in
 any further crash reports.

To work around this case, log and ignore the failure.
We log to further understand the issue.

Fixes 13807
2023-05-18 18:00:14 +03:00
David Allison
c588042bb1 improve exception if files not equal
We didn't include the file name

Improves 13807
2023-05-18 18:00:14 +03:00
lukstbit
66320038eb Add International Phonetic Alphabet as a note field language hint option
This wasn't available from Locale.getAvailableLocales() but creating a new locale using "und-fonipa" as a language tag
seems to be understood as IPA. Will appear in the language hint dialog as "IPA Phonetics" and will work with GBoard.

See https://en.wikipedia.org/wiki/International_Phonetic_Alphabet#IETF_language_tags
2023-05-17 15:07:19 -03:00
Robozinho
a064351ca1 add feedback to about buttons 2023-05-16 20:55:10 -03:00
sargamgayatri0803@gmail.com
cfc12ec917 cursor to end 2023-05-16 18:28:42 +03:00
Arthur Milchior
3fe7c1a2b3
NF: simplify some requirePreference calls (#13860) 2023-05-15 19:41:49 -03:00
Arthur Milchior
00d2d9a864 NF: refactor Creating hexadecimal string 2023-05-15 15:17:58 -03:00
Sanjaykumar Sargam
5d66753d8f EditTextPreference -> AutoFocusEditTextPreference 2023-05-15 10:36:48 -03:00
Arthur Milchior
94328239e6 NF: Refactor as DeckPicker
This is equivalent (at least as long as `when (selectedoption)` is exhaustive),
and more readable.
2023-05-15 09:21:08 -03:00
Ashish Yadav
165c74ee6d orientation lock for gesture picker dialog 2023-05-15 06:48:14 -05:00
Arthur Milchior
82951b853b NF: add documentation for Path 2023-05-15 06:46:46 -05:00
Mike Hardy
1e95d1ce85 Bumped version to 2.16.0beta2 2023-05-13 22:38:24 +00:00
AnkiDroid Translations
dd325625d9 Updated strings from Crowdin 2023-05-13 17:37:22 -05:00
oakkitten
b268a933e4
Fix UI being in bad state when storage migration fails (#13774)
When migration fails, we used to be stuck in a kind of a limbo:
the migration is considered done (failed, but done) by the service,
but `userMigrationIsInProgress` still returned true, so the UI was not
updated to reflect the state of the migration.

To overcome the issue, this introduces the state of “migration is
paused due to an error”, which is saved in shared preferences.
In this state, the toolbar shows the same migrate button that offers
to resume migration, and the sync icon is hidden.

A few TODOs were also added.

Co-authored-by: Mike Hardy <github@mikehardy.net>
2023-05-13 13:57:51 -05:00
Mike Hardy
330e585985
Dependency updates 20231305 (#13846)
* build(deps): bump com.fasterxml.jackson.core:jackson-databind

Bumps [com.fasterxml.jackson.core:jackson-databind](https://github.com/FasterXML/jackson) from 2.12.0 to 2.15.0.
- [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-minor
...

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

* build(deps): bump org.robolectric:robolectric from 4.10.1 to 4.10.2

Bumps [org.robolectric:robolectric](https://github.com/robolectric/robolectric) from 4.10.1 to 4.10.2.
- [Release notes](https://github.com/robolectric/robolectric/releases)
- [Commits](https://github.com/robolectric/robolectric/compare/robolectric-4.10.1...robolectric-4.10.2)

---
updated-dependencies:
- dependency-name: org.robolectric:robolectric
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

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

* build(deps): bump com.google.protobuf:protobuf-kotlin

Bumps com.google.protobuf:protobuf-kotlin from 3.22.3 to 3.22.4.

---
updated-dependencies:
- dependency-name: com.google.protobuf:protobuf-kotlin
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

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

* build(deps): bump com.google.protobuf:protobuf-kotlin

Bumps com.google.protobuf:protobuf-kotlin from 3.22.4 to 3.23.0.

---
updated-dependencies:
- dependency-name: com.google.protobuf:protobuf-kotlin
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

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

* build(deps): bump com.github.triplet.play from 3.8.2 to 3.8.3

Bumps com.github.triplet.play from 3.8.2 to 3.8.3.

---
updated-dependencies:
- dependency-name: com.github.triplet.play
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

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

* build(deps): bump androidx.core:core-ktx from 1.10.0 to 1.10.1

Bumps androidx.core:core-ktx from 1.10.0 to 1.10.1.

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

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

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-13 13:45:08 -05:00
oakkitten
4e708502c2
Refactor AggregateException, making it translatable, & sligtly fix up the migration failed notification (#13762)
* test: aggregateExceptionStackTrace

Requested? in issue 13667

* AggregateException: Define message + localizedMessage

Requested in issue 13667

* Refactor AggregateException

This also creates concepts of translatable strings and translatable
exceptions.

I decided to drop the logic of former AggregateException.raise, which
would return the one exception from the given list if it only had one
element, or create a new AggregateException, because:

  * the logic is only used in two places, and:

  * in non-trivial cases which involve the creation of translatable
    strings, we'd want to create them lazily as they might not be
    always needed. This might be done, perhaps, with something like
    the following:

        fun getSingleOrAggregateException(
            causes: List<Exception>,
            ifManyCauses: TranslatableAggregateException.MessageBuilder.() -> Unit
        ): Exception {
            require(causes.isNotEmpty()) { "The list of exceptions was empty" }
            return if (causes.size == 1) {
                causes.single()
            } else {
                val messageBuilder = TranslatableAggregateException.MessageBuilder()
                ifManyCauses(messageBuilder)
                TranslatableAggregateException(messageBuilder.message, messageBuilder.translatableMessage, causes)
            }
        }

    I suggest that we do not employ complications like these unless
    AggregateException is extensively used in the codebase.

* Show big, friendly error text in migration failed notification

* Remove multiple-argument `TranslatableString.by`

As discussed in the PR
https://github.com/ankidroid/Anki-Android/pull/13762#discussion_r1182926595,
this method was not subject to string format linting.

Plus minor renaming.

---------

Co-authored-by: David Allison <62114487+david-allison@users.noreply.github.com>
2023-05-13 13:28:38 -05:00
AnkiDroid Translations
773a8b59b3 Updated strings from Crowdin 2023-05-13 13:28:17 -05:00
David Allison
868b6c740c fix: IndexOutOfBoundsException: Inconsistency detected (maybe)
This is fixed by stopping the mutating m[Current]DeckList

This should fix the issue:
`IndexOutOfBoundsException: Inconsistency detected. Invalid item position [N]`

Fixes 13794
2023-05-13 12:56:51 -05:00
David Allison
519da438d0 refactor: make processNodes pure
This is a next step in stopping mutation of `m[Current]DeckList` lists
2023-05-13 12:56:51 -05:00
David Allison
76bbd76e26 refactor: remove 'suspend' from findDeckPosition
We did not need to access the collection for this.
We have a cache of the mapping, which was produced at the same
  time as `mCurrentDeckList`

Which in turn removes a number of 'suspend' calls throughout the code

Cleanup for 70151c563e
2023-05-13 12:56:51 -05:00
David Allison
126489d627 refactor: detecting isCollapsed
* more efficient (no need to check all parents, just immediate)
* simpler code
2023-05-13 12:56:51 -05:00
David Allison
25c050d3de refactor: simplify 'lrn/new/rev' calculations 2023-05-13 12:56:51 -05:00
David Allison
537d8ccfd8 docs: minor backend inconsistency 2023-05-13 12:56:51 -05:00
David Allison
b9111e2b67 fix: 'hasSubdecks' [new backend]
Before this change, a single deck in the list set 'hasSubdecks'
which caused padding to appear. This should not have been the
case
2023-05-13 12:56:51 -05:00
Arthur Milchior
9311b7262a NF: clarify a constant name 2023-05-13 12:53:38 -05:00
Arthur Milchior
c86f6def97 NF: Advanced Fragment code follow appearance order
While adding an advanced setting, I found confusing that the code appears in an
order that is not related to the order in the actual presentation. So I reorder
it.

Actual change will appear in a distinct PR.
2023-05-13 11:04:32 -03:00
Sanjaykumar Sargam
3ea5c51d01 Video is playing 2023-05-12 13:59:19 +05:30
Sanjaykumar Sargam
1d431cafe4 DiscardChangesDialog is closed in one click 2023-05-11 04:08:44 +01:00
David Allison
0a572ba631 Fix TODOs/conditionally skip confirmation dialog
This PR skips the 'Are you sure?' warning if the user is syncing
and their collection is safe

This is primarily documentation, the previous code has one minor
bug in that a user could be preserving legacy storage AND not syncing
AND had the ability to `MANAGE_EXTERNAL_STORAGE` then the 'backup'
dialog was shown when it was not necessary

Mostly making use of newer documented methods in `ScopedStorageService`

Fixes 13663
2023-05-10 20:55:01 -03:00
David Allison
ca4ba96709 extract: userIsPromptedToDeleteCollectionOnUninstall 2023-05-10 20:55:01 -03:00
Sanjaykumar Sargam
149c4b303b fix item getting bold 2023-05-10 19:46:04 -03:00
AnkiDroid Translations
8e17b08ee5 Updated strings from Crowdin 2023-05-10 20:38:30 +03:00
Ashish Yadav
0c31df5fe7 Added remember settings to your connection is metered dialog 2023-05-10 19:38:30 +03:00
AnkiDroid Translations
c5a05db1bd Updated strings from Crowdin 2023-05-10 19:04:38 +03:00
David Allison
e603d75745 fix: make lint run in CI/gradle
reverts lint to 30.4.2

lint was updated in 8e4b6d17a5

But this stopped lint working in via 'gradlew'
https://github.com/ankidroid/Anki-Android/issues/13786#issuecomment-1534189784

tested with `/gradlew lintFullRelease`

Fixes 13786
2023-05-10 06:25:13 +03:00
Arthur Milchior
456b9caa42 NF. make safeEndInTransaction a SupportSQLiteDatabase method 2023-05-08 23:17:48 +01:00
Arthur Milchior
644d32f74c NF: make safeEndInTransaction a method 2023-05-08 23:17:48 +01:00
Tomek Garbus
8a93414e89
Resolve NeedsTests annotations in LoginActivity.kt (#13780)
* Resolve one NeedsTest occurrence

* Update LoginActivityTest.kt and add one more scenario

* Add GPL block, apply suggestions from PR review

* Remove blank line

---------

Co-authored-by: Tomasz Garbus <tomasz.garrbus1@gmail.com>
2023-05-07 08:17:41 +03:00
Sanjaykumar Sargam
9574dac1be cursor to end 2023-05-07 07:22:35 +03:00
yellowjello
20a8394b42 Re-enable support for custom text selection actions 2023-05-06 20:58:37 -03:00
David Allison
be7bb3ea8e
Improve Diagnostics for issue 13807 (files not equal: .nomedia) (#13809)
* vendor FileUtils.contentEquals

We're going to need to modify the code to provide more information.
So bring the code into the app

* requireFile was private so needed to be extracted

* convert `contentEquals` to `throwIfContentUnequal`

This provides a better error message for diagnostics

Related: 13807 - we had `.nomedia` throw here, and we want to know why
2023-05-06 08:06:55 +03:00
David Allison
0fa6e76ea8 manual revert "Use fragments resources on AsyncDialogFragment"
This reverts commit 6ea36860a8

I performed the revert by hand as there were conflicts

This caused issue 13795
2023-05-06 07:07:27 +03:00
David Allison
351a889e82 Revert "fixed the crash that occured due to getResources() error (#13086)"
This reverts commit 385afba7

Issue 13795 raised additional concerns and we should resolve this correctly
2023-05-06 07:07:27 +03:00