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

OnOffSwitch needs updating #2556

Closed
mwarnett opened this Issue Sep 23, 2018 · 3 comments

Comments

Projects
None yet
4 participants
@mwarnett

mwarnett commented Sep 23, 2018

The OnOffSwitch UI component needs updating.

It has not kept up with the evolution of on/off switches especially on Android. Attached is an Android 8.0 settings panel which shows two on/off switches, one in each state.

CodenameOne is still generating separate On/Off buttons on Android which take up a lot of space.

screenshot_20180923-131739

@codenameone codenameone added this to the Version 6.0 milestone Sep 24, 2018

@codenameone

This comment has been minimized.

Show comment
Hide comment
@codenameone

codenameone Sep 24, 2018

Owner

I think it warrants a complete rewrite on iOS too. It might make sense to deprecate the current component and create a new one.

Owner

codenameone commented Sep 24, 2018

I think it warrants a complete rewrite on iOS too. It might make sense to deprecate the current component and create a new one.

@ramsestom

This comment has been minimized.

Show comment
Hide comment
@ramsestom

ramsestom Sep 25, 2018

The code of a Material design look and fill (by default) OnOffSwitch that you can use as a starting point for your rewrite of this component:
MDCOnOffSwitch.zip

I had to remove and change a few stuff that depend on my own version of CN1 (mostly the support of dp and sp units and the usage of my own system of animations) to make it fully compatible with the official CN1 (tell me if you have import issues, I may have missed some) but it still should be a good starting point for a rewrite of the OnOffSwitch component.

ramsestom commented Sep 25, 2018

The code of a Material design look and fill (by default) OnOffSwitch that you can use as a starting point for your rewrite of this component:
MDCOnOffSwitch.zip

I had to remove and change a few stuff that depend on my own version of CN1 (mostly the support of dp and sp units and the usage of my own system of animations) to make it fully compatible with the official CN1 (tell me if you have import issues, I may have missed some) but it still should be a good starting point for a rewrite of the OnOffSwitch component.

@shannah

This comment has been minimized.

Show comment
Hide comment
@shannah

shannah Oct 5, 2018

Collaborator

@ramsestom Thanks for the component. I used it as a basis for https://github.com/codenameone/CodenameOne/blob/master/CodenameOne/src/com/codename1/components/Switch.java

The new Switch component supports Android and iOS native themes out of the box, and styling it for other platforms should be significantly easier than the old switch. The iOS7Theme and android_holo_theme include fairly close replicas of iOS and Android native switches. I have provided reference styling for the other themes (legacy iOS and Android, and UWP) that don't match their native switches exactly, but still look good.

That javadocs include details on how to customize the rendering of this component using styles and theme constants.

Collaborator

shannah commented Oct 5, 2018

@ramsestom Thanks for the component. I used it as a basis for https://github.com/codenameone/CodenameOne/blob/master/CodenameOne/src/com/codename1/components/Switch.java

The new Switch component supports Android and iOS native themes out of the box, and styling it for other platforms should be significantly easier than the old switch. The iOS7Theme and android_holo_theme include fairly close replicas of iOS and Android native switches. I have provided reference styling for the other themes (legacy iOS and Android, and UWP) that don't match their native switches exactly, but still look good.

That javadocs include details on how to customize the rendering of this component using styles and theme constants.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment