* 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
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.
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
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
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>
* 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>
This is fixed by stopping the mutating m[Current]DeckList
This should fix the issue:
`IndexOutOfBoundsException: Inconsistency detected. Invalid item position [N]`
Fixes 13794
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
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.
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
* 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>
* 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