Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge in updates from buttercookie42 #11

Open
wants to merge 142 commits into
base: main
Choose a base branch
from
Open

Conversation

xxv
Copy link
Owner

@xxv xxv commented Jan 13, 2025

No description provided.

buttercookie42 and others added 30 commits December 30, 2023 18:47
Gradle sync completes successfully, but some further changes are required for
actually building.
That code doesn't even build, because the support library doesn't allow over-
riding onRetainNonConfigurationInstance(), (although there might be an easy
workaround by using onRetainCustomNonConfigurationInstance() instead), and it
causes the app to crash when changing orientation.

Maybe we can revisit this at some later point.
After backing out the attempt to use cursor loaders for now, we don't need the
support library for the moment. If/when we'll need it again, we'll include it
the modern way.
Not compatible with Windows unfortunately, plus the main readme in the
repository root is now a Markdown file, anyway.
Required to be able to use them in switch statements
Mixed tabs and spaces and Android Studio partially reformatting every XML file I
touch are too annoying going forward.

Also add license headers where they are missing.
Android 10 dropped support for showing the legacy menu button in the navbar, so
some alternative way of accessing the menu is required.

Adding a long-press action to the Equals key seems like the most minimally-
invasive way of accomplishing this.
Delete strings that were erroneously translated anyway, and mark more strings as
(at least currently) untranslateable, because the button text ends up directly
in the input window and the calculator core of course only understand the
English names.
We're now always writing into an application-private directory, so just directly
name the file fingerprints.json, so I no longer have to rename it when copying
it back into the repository.
DefinedFunction is the base class for TabularFunction and ComputedFunction, and
both implementations share the same function table. Also curiously that code was
commented out already in the commit that added it.
The units auto-complete is powered by the unit usage database, so whenever the
underlying units data file might have changed, we need to re-run the task.
The units data can change both after an app update, if we've updated the data
file itself, or due to a locale change, because the unit definitions get
dynamically filtered depending on the current locale.

To also catch any units that might have been deleted in an update or locale
change, we create a temporary copy of the old usage data, clear out the database
table, repopulate based on the current units definitions and then copy any
existing usage values over.
Non-touch devices (especially without even faketouch capability) are too obscure
to bother with, as are performance bugs on stone-age Android devices.
…er needed

Units-in-java 1.89 now reads the units definition files as Unicode, and the
units definition file already includes those entries.
So far there's only the Ångström, but for completeness.
Seems like it was never used at all.
It seems Android sends us an explicit intent, so we don't need to declare
a public intent filter for that one.
Android 14's regional preferences end up as extensions to the user's locale,
which doesn't play well with units-in-java's (and original GNU Units) simple
string matching for handling the !locale directive, which only expects classic
language_REGION locale tags. Therefore, for the time being just strip them off.
It seems those strings were originally imported from the AOSP calculator.
However except for recently repurposing the 'del' string as the accessible
description for the backspace button, we weren't actually using any of the
advanced strings, and most of the button texts weren't actually translateable
anyway.

Android Studio's translation editor also doesn't quite like string definitions
spread out across multiple files, so we just move the English button texts into
the main strings file and otherwise get rid of those files.

The 'del' string also wasn't ideal for the accessible description anyway,
because it was in all uppercase, and in German it was actually translated as
'C' (as in the corresponding calculator key on physical calculators).
Some small tweaks, and mostly adding more localised currency signs.
Also a rudimentary Romanian translation.
Units definitions can change afer a locale change, too.
Seems like IzzyOnDroid doesn't like the linebreaks.
When rounding zero in SEPARATED_FRACTION mode, we need to apply the same (now
renamed) !printedSomething check, otherwise we wouldn't print anything at all.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants