codenameone / CodenameOne

Cross-platform framework for building truly native mobile apps with Java or Kotlin. Write Once Run Anywhere support for iOS, Android, Desktop & Web.
https://www.codenameone.com/
Other
1.71k stars 408 forks source link

Text in TextArea gets invisible when not typing #2317

Open KlausHeywinkel opened 6 years ago

KlausHeywinkel commented 6 years ago

On some Android Versions (or devices...) the text in an TextArea gets invisible, when not typing. When I start typing again, the text is visible again - until I stop typing. This happens on an "real device" Huawei Y300 with Android 4.1.1. It can be reproduced with VirtualBox Installations with Android 4.2 and 5.1. Can not be reproduced with an VirtualBox Installation with Android 7.1. Can also not be reproduced on an Samsung S5 with Android 4.2.2. This does not happen on any iOS device I tested.

codenameone commented 6 years ago

Reference link https://stackoverflow.com/questions/48348030/text-in-textfield-invisible-when-not-typing-in-android

shannah commented 6 years ago

@KlausHeywinkel Are you using an off the shelf distro for your VirtualBox installations that I can download and install myself?

I have a Nexus 5 device running Android 5.1 and it doesn't seem to exhibit this behaviour.

If you can, please provide a self-contained test case that I can use to reproduce the issue.

KlausHeywinkel commented 6 years ago

I Uploaded a VDI-File with an Android 5.1 installation for use with VirtualBox: https://drive.google.com/open?id=1VR4DcGLJGNVeaeRgITtJuXImi4tLMoYX https://drive.google.com/open?id=1VR4DcGLJGNVeaeRgITtJuXImi4tLMoYX

My App, where I have this behavior, is installed and called „Zeitkünstler“. You can see the behavior after starting the app with tapping on the icon in the middle (see Screen1) and then type in the input-field (see Screen2).

Hope this works.

Am 09.02.2018 um 15:46 schrieb Steve Hannah notifications@github.com:

@KlausHeywinkel https://github.com/klausheywinkel Are you using an off the shelf distro for your VirtualBox installations that I can download and install myself?

I have a Nexus 5 device running Android 5.1 and it doesn't seem to exhibit this behaviour.

If you can, please provide a self-contained test case that I can use to reproduce the issue.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/codenameone/CodenameOne/issues/2317#issuecomment-364453406, or mute the thread https://github.com/notifications/unsubscribe-auth/AcapMRY0n7_W0YFkhCzyfJkC7Y9WhBkZks5tTFpJgaJpZM4Rlwvn.

shannah commented 6 years ago

We've gone full circle on this issue. It is the same as

http://stackoverflow.com/questions/41305052/textfields-content-disappears-during-typing?noredirect=1#comment69977316_41305052

which was resolved, but the fix was removed because it was causing problems with the paste menu, reported here https://github.com/codenameone/CodenameOne/issues/2147

I've spent the better part of a day trying to track this down but I so far haven't been able to find a way even detect that this is occurring at runtime. For now, I have added a client property

textField.putClientProperty("android.cursorVisible", Boolean.FALSE)

Will hide the cursor for that field on Android, which is not ideal, but at least gives the developer some power to be able to workaround it themselves.

Checking the Android version isn't sufficient for seeing if this will occur. I have a Nexus 5 running 5.1.1, that does not exhibit this behaviour. But the VDI provided in the previous comment is running 5.1.1 and does exhibit this behaviour. Getting VirtualBox set up for debugging has been tricky so, ideally, I'd like to find either a device or Android simulator that exhibits this behaviour so that I can debug it in Android Studio.

Changing milestone to 5.0, as there likely won't be time to track this down for 4.0.

shannah commented 6 years ago

Note: This SO comment shows a solution to add a solid cursor (instead of blinking) https://stackoverflow.com/a/31403843/2935174

Might be a better workaround than just hiding the cursor. It seems stupid to have to add these sorts of kludges in.. Need to find a way to actually detect/fix this situation, but for now this would offer a quick workaround.

shannah commented 6 years ago

Another related issue reported here https://stackoverflow.com/questions/49004370/focus-behaviour-in-textarea-in-cn1

No blinking cursor in text area when arriving there with the "Next" button.

private void testAndroidTextAreaFocus() {
        Form f = new Form("TextArea Focus", new BorderLayout());
        createToolbar(f);
        Form prev = Display.getInstance().getCurrent();
        f.setBackCommand(new Command(" \ue81a ") {
            @Override
            public void actionPerformed(ActionEvent evt) {
                prev.showBack();
            }
        });

        TextField tf1 = new TextField(TextArea.PHONENUMBER);
        tf1.setHint("Contact Number");

        TextArea remarksArea = new TextArea();
        remarksArea.setUIID("TextField");
        remarksArea.setConstraint(TextField.NON_PREDICTIVE);
        remarksArea.setRows(4);
        remarksArea.getAllStyles().setAlignment(Label.TOP);
        remarksArea.setHint("  Remarks");
        remarksArea.getHintLabel().setUIID("TextField");
        remarksArea.getAllStyles().setPadding(2, 2, 2, 2);
        remarksArea.getHintLabel().getAllStyles().setPadding(2, 2, 2, 2);

        tf1.setNextFocusDown(remarksArea);

        f.add(BorderLayout.CENTER, BoxLayout.encloseY(tf1, remarksArea));
        f.show();
    }

When we fix this issue, we'll need to make sure that this test case also works.

shannah commented 6 years ago

Note. It is possible that https://github.com/codenameone/CodenameOne/commit/e0332481cf2f6fdb13989de209df6d91e2d39541 fixes this issue.

The VirtualBox image provided here is practically unusable as it doesn't seem to support the mouse, so I'm unable to test it out on there, and the issue didn't occur on any other devices or Android emulators that I have access to currently.

That fix should be up on Friday, so it will be worth a try to see if it fixes it.

shannah commented 6 years ago

Moving to 6.0 milestone as I don't have a way to reproduce this issue - likely won't be enough time before 5.0. It would nice to get confirmation of whether or not https://github.com/codenameone/CodenameOne/commit/e0332481cf2f6fdb13989de209df6d91e2d39541 fixed it.

KlausHeywinkel commented 6 years ago

This issue is not fixed with a new build from today (08.08.18)

Am 08.08.2018 um 14:46:22 schrieb Steve Hannah notifications@github.com:

Moving to 6.0 milestone as I don't have a way to reproduce this issue - likely won't be enough time before 5.0. It would nice to get confirmation of whether or not e033248 https://github.com/codenameone/CodenameOne/commit/e0332481cf2f6fdb13989de209df6d91e2d39541 fixed it.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/codenameone/CodenameOne/issues/2317#issuecomment-411392543, or mute the thread https://github.com/notifications/unsubscribe-auth/AcapMUQj8yxeihCddLS1NZvWgFctjh4zks5uOt2egaJpZM4Rlwvn.

shannah commented 6 years ago

Can it be reproduced on anything other than that virtual box instance that you provided? Touch events don't work properly on that VM for me so I can't reproduce the issue right now.

KlausHeywinkel commented 6 years ago

I tested it on my HUAWEI Y300 with Android 4.1.1

Am 08.08.2018 um 17:17:18 schrieb Steve Hannah notifications@github.com:

Can it be reproduced on anything other than that virtual box instance that you provided? Touch events don't work properly on that VM for me so I can't reproduce the issue right now.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/codenameone/CodenameOne/issues/2317#issuecomment-411443298, or mute the thread https://github.com/notifications/unsubscribe-auth/AcapMbudhQ340SW48y1D04ApxUVgA3o9ks5uOwD-gaJpZM4Rlwvn.

shannah commented 5 years ago

Pushed to 7.0, as I don't have any devices that can reproduce this still