HelloVolla / volla-os-beta-test

Manual, status overview and issus for beta tests of Volla OS
19 stars 1 forks source link

Corruption in android.R ? #91

Closed mtotschnig closed 1 year ago

mtotschnig commented 1 year ago

A user of my app reported that on a certain dialog (generated with Jetpack Compose) a button which uses "android.R.string.Cancel" as text is rendered in a strange way on his Volla OS phone, when the locale is set to English. He provided me with the following screenshots that show the difference between German and English. The only explanation I am currently able to think of is that there is some corruption in how Volla OS sets up the android.R resources. It seems as if the system resolves android.R.string.cancel to the expression Cancel preceded by some white space.

Screenshot_20230120-144427_Trebuchet Screenshot_20230120-144510_Trebuchet

wurzer commented 1 year ago

This is an issue of the app not the operating system. Android.R is a frequently used reference in many apps

mtotschnig commented 1 year ago

Still, the problem only occurs on Volla OS, which made me assume some misbehavior on OS level. Unfortunately I do not have access to a Volla phone, which would allow me to create a minimal project showcasing the problem.

wurzer commented 1 year ago

Thanks for the reply. As a developer I'm using Android.R in our Volla launcher for sure. And this works. I also think, that almost all Android apps make use of that basic concept.

I don't want to carry owls to Athens. So excuse my question: Did you include the translation in your app instead of using the preference framework strings of the Android API?

By the way: We can offer you as a developer a special 20% discount for Volla devices.

mtotschnig commented 1 year ago

I am definitely using "android.R.string.cancel". If I had access to a device, I could test if replacing "android.R.string.cancel" with an app specific resource or a hardcoded string would make a difference. Thank you for the offer, but I am not able to afford to buy every potential device for which users report problems. It would be great, if Volla OS could be tried out on an Emulator.

mtotschnig commented 1 year ago

By the way, my app is Open Source (https://github.com/mtotschnig/MyExpenses), in case someone with access to Volla Os wants to give it a try. The bug is generated by code in this file: https://github.com/mtotschnig/MyExpenses/blob/master/myExpenses/src/main/java/org/totschnig/myexpenses/compose/CategoryEdit.kt

wurzer commented 1 year ago

I have just installed the app on my Volla Phone. I can't reproduce the issue. I'm using Volla OS 11.1 from 11 January 2023.

wurzer commented 1 year ago

Can't reproduce it. I can see "Cancel" and "Save"

wurzer commented 1 year ago

Yes. Maybe there is an additional condition. Maybe some accessability setting.

mtotschnig commented 1 year ago

@Antiwhore Your version (October 29, 2022) seems to be older than the one @wurzer is using (11 January 2023). Any chance for you to update to that latest version?

wurzer commented 1 year ago

By the way. I check the dialog for an additional category. Is that correct?

wurzer commented 1 year ago

Maybe you have modified the colors in the accessibility settings? Unfortunately I can't reproduce this issue. I have used this advice:

Go to system settings, set the font size to Maximum and then back to app settings and set font size to default + 20%. The language in the app must be English.

wurzer commented 1 year ago

Thanks. Looks fine. Did you try to reset the app?

wurzer commented 1 year ago

You can do it this way:

  1. Open system settings
  2. Go to apps & notifications
  3. Go to all installed apps
  4. Go to the MyExpenses app settings
  5. Force quit
  6. Delete app data
  7. Reopen the app

Please not, that the data of the app will be removed. You may want to make a backup of the app data before.

wurzer commented 1 year ago

As I said. I can't reproduce the issue. So I couldn't even debug the issue.

My suggestion is therefore to reset the app or modify the settings. You could keep the default scaling of the font in the app and scale the display instead.

mtotschnig commented 1 year ago

Based on the information I got from @Antiwhore, I conclude that the problem would not be dependent on font-scale settings. It is just made worse with larger font-settings because the Save button is pushed out. Even with smaller font size, the Cancel button which should be right aligned has this unwarranted left margin. Screenshot_20230110-192014_Trebuchet @Antiwhore Could you provide a screenshot with English language and the minimal system font size, and with no increase on app level? @wurzer In your case you see the Cancel button with English locale correctly left aligned in any configuration?

wurzer commented 1 year ago

So it looks like a layout issue. Different behavior of different devices can be caused by different display resolution. I have checked the use case on a Volla Phone of the first generation. Like the Volla Phone 22 it has display has a higher resolution than the Volla Phone X. This could also be a reason for different results on devices of another brand. Anyway, it looks like a corner case, because the scaling is extremely high.

mtotschnig commented 1 year ago

@Antiwhore May I ask you for another peace of information/check? Are you using the language selection feature integrated into the app? If yes, could you verify if it makes a difference if you select English as the device language (and the in-app language selection set to "System default). Eventually kill the app and restart it after having modified these settings.

mtotschnig commented 1 year ago

@Antiwhore That is interesting. I suppose when you selected English from the System settings, you selected "United States" or "United Kingdom" as region. My Expenses sets Locale("en") without a region, so it seems that this makes a difference. So I suppose by using "en-US" instead, I might be able to solve the problem on app level, but there still might be something wrong on the OS level. Of course it is a corner case, because Android normally does not allow users to set a region-less English locale. @wurzer Out of interest, even if you set English on MyExpenses settings screen, you cannot reproduce the problem?

wurzer commented 1 year ago

I can confirm. If I select the language in the app, the button disappears. However I think, its a layout issue. I you don't scale the font in the app to plus 20%, you can see, that the button label "save" is shown in two lines.

mtotschnig commented 1 year ago

There is a layout issue, insofar that if for a given locale "android.R.string.cancel" resolves to a String with an unusual length, and in addition the font is scaled up, the Save button should remain visible, and I will fix this in the next version of the app. But I also assume a broken behavior on OS level which resolves "android.R.string.cancel" to "Cancel" for locale en-US, and to something like " Cancel" (i.e the word Cancel preceded by unusual white space") for locale en.

mtotschnig commented 1 year ago

If I had access to a Volla phone, I would try to validate that assumption by writing an app, that outputs the translations of "android.R.string.cancel" for different locales. If someone is willing to test this, I could send an APK, or publish a test project to Github.

mtotschnig commented 1 year ago

Emulating my assumption: I replace stringResource(id = android.R.string.cancel) with " Cancel" and I get the behavior that @Antiwhore reported grafik

wurzer commented 1 year ago

Please also note, that the font on the Volla Phone is different to the default Android font. It's wider. I recommend to place the two buttons "cancel" and "save" with a flexible (no predefined) width. There should be enough space in the line. Also the button group shouldn't have a fixed width. Anyway. It looks like a corner case. almost no one will scale the text system wide to maximum and in addition in the app.

mtotschnig commented 1 year ago

There is no consensus and clear understanding yet what exactly happens on VollaOS (different from other Android devices) that causes the white space in front of the Cancel button (independent of any font scale). But for My Expenses, 3.5.0 will have a workaround, that prevents the Save button from disappearing.

mtotschnig commented 1 year ago

I think it is an edge case, because the problem seems only to happen with Locale "en", but normally Android does not use this Locale without a region, but always uses "en-US", "en-GB" etc.