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

Android 7 the checkbox icons on the tabs do not color correctly #2652

Open mab1423 opened 5 years ago

mab1423 commented 5 years ago

IDE: NetBeans/Eclipse/IDEANetbeans 8.2 Desktop OS Windows 10 Pro Simulator Latest Device Android 7

Have a Tabs component where each tab's icon is a colored checkbox. (green, yellow, red) (materialIcon) On my Android 7 the checkbox icons on the tabs do not color correctly On My Android 4.42, PC and IOS, The Tab Icon Coloring is as expected

I have skeleton project demonstrating issue. (TabsWithChkBox.zip) https://drive.google.com/file/d/1yjWO_D6p1XDBaxQo-LrquBmnKVe3iCkI/view?usp=sharing

Here is the simple reproducible case. I can send screen shots if needed.

Form hi = new Form("", new BorderLayout());

        int green = 0x00cc66;
        int yellow = 0xffff00;
        int red = 0xff0000;

        Tabs MpiInspectionForm = new Tabs(Component.TOP);
        Tabs SubSystemTabs = new Tabs(Component.LEFT);
        SubSystemTabs.setTabTextPosition(Tabs.LEFT);
//        SubSystemTabs.setTabUIID("tab");
        MpiInspectionForm.setTabUIID("tab");
        MpiInspectionForm.setTabTextPosition(Tabs.LEFT);
        MpiInspectionForm.addTab("Mpi Sub Systems  ",materialIcon(FontImage.MATERIAL_CHECK_BOX, 4, red), SubSystemTabs);
        Container container2 = new Container(new BoxLayout(BoxLayout.Y_AXIS));
        container2.addComponent(getMpiOkSoonNowContainer());
        SpanLabel spl2 = new SpanLabel("Some text directly in the tab 345");
        SubSystemTabs.addTab("Check Fill & Replace  ",materialIcon(FontImage.MATERIAL_CHECK_BOX, 4, green), MpiSubSystemsContainer());
        SubSystemTabs.addTab("Common Consumable Items  ",materialIcon(FontImage.MATERIAL_CHECK_BOX, 4, yellow), container2);
        SubSystemTabs.addTab("BRAKING SYSTEM  ", spl2);
        SubSystemTabs.addTab("DRIVE BELTS", new SpanLabel("Some text directly in the tab"));
        SubSystemTabs.setTabTitle(SubSystemTabs.getTabTitle(0), materialIcon(FontImage.MATERIAL_CHECK_BOX, 4, green), 0);
        SubSystemTabs.setTabSelectedIcon(0, materialIcon(FontImage.MATERIAL_CHECK_BOX, 4, green));

        SubSystemTabs.setTabTitle(SubSystemTabs.getTabTitle(1), materialIcon(FontImage.MATERIAL_CHECK_BOX, 4, yellow), 1);
        SubSystemTabs.setTabSelectedIcon(1, materialIcon(FontImage.MATERIAL_CHECK_BOX, 4, yellow));

        SubSystemTabs.setTabTitle(SubSystemTabs.getTabTitle(2), materialIcon(FontImage.MATERIAL_CHECK_BOX, 4, red), 2);
        SubSystemTabs.setTabSelectedIcon(2, materialIcon(FontImage.MATERIAL_CHECK_BOX, 4, red));

        SubSystemTabs.setTabTitle(SubSystemTabs.getTabTitle(3), materialIcon(FontImage.MATERIAL_CHECK_BOX, 4, green), 3);
        SubSystemTabs.setTabSelectedIcon(3, materialIcon(FontImage.MATERIAL_CHECK_BOX, 4, green));

        hi.add(BorderLayout.NORTH, MpiInspectionForm);
        hi.show();

    public static FontImage materialIcon(char charCode, float size, int color) {

        Font fnt = Font.createTrueTypeFont("native:MainBold", "native:MainBold").derive(CN.convertToPixels(size), Font.STYLE_PLAIN);

        Style s = new Style(color, 0, fnt, (byte) 0);
        FontImage fm = FontImage.createMaterial(charCode, s);
        return fm;
    }

    public Container MpiSubSystemsContainer() {
        Container MpiSubSystemsContainer = new Container(new BoxLayout(BoxLayout.Y_AXIS));
        MpiSubSystemsContainer.setScrollableY(true);
        MpiSubSystemsContainer.addComponent(getMpiOkSoonNowContainer());
        return MpiSubSystemsContainer;
    }

    public Component getMpiOkSoonNowContainer() {
        CheckBox button = new CheckBox("Ok");
        button.setUIID("greenHeaderTextArea");

        CheckBox button1 = new CheckBox("Soon");
        button1.setSelected(true);
        button1.setUIID("yellowHeaderTextArea");

        CheckBox button2 = new CheckBox("Needed");
        button2.setUIID("redHeaderTextArea");

        Container containerA = new Container(new BoxLayout(BoxLayout.Y_AXIS));
        containerA.addComponent(button);
        containerA.addComponent(button1);
        containerA.addComponent(button2);
        return containerA;
    }

Attached is the theme.

Thanks In Advance.

PS. I suspect the solution will solve other coloring issues such as lists in a dialog do not color until a pressed event. Very Odd.

Happy Holidays!

shannah commented 5 years ago

I just downloaded and built your project and it looks OK to me. Tried running in the Codename One simulator, on an actual device running Android 6, and in the Android emulator with Android 7 and Android 8. All gave the same results with what appears to be the correct styling.

CN1 Simulator:

image

Android 7 emulator:

image

Android 8 emulator:

image

Very hard to fix unless I can reproduce. Removing this from the milestone, but keeping the issue open in case others run across it and/or a way to reproduce it is discovered.

mab1423 commented 5 years ago

The issue is on Android 7 with Huawei Tablet Model BTV-W09

Can you please test this on Android 7 Phone or Tablet?

Regards

[cid:image001.jpg@01D27C64.63ED8510] Digital End to End, Shop Management Software Suite

Auto Shop Technologies, Corp. Mark Bolduc: VP, Engineering & Product Development 195 Millville St Salem, NH 03079

Cell Number 603-327-8465 Email markb@autoshoptechnologies.commailto:markb@autoshoptechnologies.com Web: www.autoshoptechnologies.comhttp://www.autoshoptechnologies.com/

From: Steve Hannah [mailto:notifications@github.com] Sent: Thursday, January 10, 2019 8:56 AM To: codenameone/CodenameOne Cc: Mark Bolduc; Author Subject: Re: [codenameone/CodenameOne] Android 7 the checkbox icons on the tabs do not color correctly (#2652)

I just downloaded and built your project and it looks OK to me. Tried running in the Codename One simulator, on an actual device running Android 6, and in the Android emulator with Android 7 and Android 8. All gave the same results with what appears to be the correct styling.

CN1 Simulator:

[image]https://user-images.githubusercontent.com/2677562/50972546-c939b700-149b-11e9-9f2d-a5ccbd01af72.png

Android 7 emulator:

[image]https://user-images.githubusercontent.com/2677562/50972598-e8d0df80-149b-11e9-9c22-113c917ae0d0.png

Android 8 emulator:

[image]https://user-images.githubusercontent.com/2677562/50972622-f5553800-149b-11e9-965e-ebf2bd2574d8.png

Very hard to fix unless I can reproduce. Removing this from the milestone, but keeping the issue open in case others run across it and/or a way to reproduce it is discovered.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/codenameone/CodenameOne/issues/2652#issuecomment-453103644, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AXzsQo-GDOkadjMfkf8JR6WvHxXHjnpGks5vB0ZVgaJpZM4ZixQd.

mab1423 commented 5 years ago

Thanks for your effort.

Just purchased new Huawei MediaPad M5 tablet with android 8.0.0 Model CMR-W09 RAM 4GB, SSD 64GB, Screen Resolution 2560 X 1600. Unfortunately the same results.

Thoughts?

codenameone commented 5 years ago

I'll try to reproduce this on my device

mab1423 commented 5 years ago

I have tested this on other manufacturers (Samsung etc) running Android 7 and 8 and they perform correctly. Hopefully you can test this on a Huawei box.

codenameone commented 5 years ago

This got a bit buried under my tasks but it seems to work OK on my device so I can't reproduce that issue either.