Code Monkey home page Code Monkey logo

Comments (16)

TheJuki avatar TheJuki commented on May 30, 2024 1

Sounds good!

from kformmaster.

TheJuki avatar TheJuki commented on May 30, 2024 1

Stroke size: https://thejuki.github.io/KFormMaster/element/segmented/#margin-stroke
Stroke color: https://thejuki.github.io/KFormMaster/element/segmented/#tint-color

from kformmaster.

darkwood-studios avatar darkwood-studios commented on May 30, 2024 1

So I close this issue now. You did a great job on this feature.

from kformmaster.

TheJuki avatar TheJuki commented on May 30, 2024

I could try implementing this library:
https://github.com/Kaopiz/android-segmented-control
or this one:
https://github.com/RobertApikyan/SegmentedControl

from kformmaster.

darkwood-studios avatar darkwood-studios commented on May 30, 2024

@TheJuki
I think this one could do the trick: https://github.com/Kaopiz/android-segmented-control

Or maybe an even better source without an library -> https://medium.com/@staceypyee/revealing-the-magic-of-creating-ios-segmented-control-with-image-in-android-kotlin-part-1-7d817f9d5c7

from kformmaster.

TheJuki avatar TheJuki commented on May 30, 2024

I just released 4.6.1. Please update your dependency and let me know if the Segmented element works for you. Check out the docs: https://thejuki.github.io/KFormMaster/element/segmented/

from kformmaster.

darkwood-studios avatar darkwood-studios commented on May 30, 2024

Hi @TheJuki

looks really great! One question left:

I want to customize colors, spacings and sizes. So my idea was to create a custom layout as you explained here : StarkSoftware/SSForms#3

I copied the form_element_segment.xml into my project and changed some values - but unfortunately nothing changes in the app. Do you have any idea why that does not work?

Thanks for your great support.

from kformmaster.

darkwood-studios avatar darkwood-studios commented on May 30, 2024

And one more idea:
if no title is provided, the view of the label should be removed - otherwise we'll have some unnecessary space above the button group.

from kformmaster.

TheJuki avatar TheJuki commented on May 30, 2024

I copied and converted the main class from https://github.com/Kaopiz/android-segmented-control

Here: https://github.com/TheJuki/KFormMaster/blob/master/form/src/main/java/com/thejuki/kformmaster/widget/SegmentedGroup.kt

It controls most of styling. I can add new properties to the FormSegmentedElement class which can talk to and update the SegmentedGroup class.

Also, the RadioButtons are added programmatically, so, adding RadioButtons to the XML would not work. The ones in form_element_segment.xml should probably just be removed.

As for the title, I can check if the title is null or empty and make the View be View.GONE.

from kformmaster.

darkwood-studios avatar darkwood-studios commented on May 30, 2024

As for the title, I can check if the title is null or empty and make the View be View.GONE.

That would be perfect.

It controls most of styling. I can add new properties to the FormSegmentedElement class which can talk to and update the SegmentedGroup class.

Ah I see. So I can set colors and corner with that class. But what I'm missing is to set the layout to fill horizontal. Perhaps you have an idea to implement this.

Thats now:

before

So it should look like:

after

from kformmaster.

TheJuki avatar TheJuki commented on May 30, 2024

Oh. Hmm. I'll play around with it but it should be possible. Again, I'll make this a property in FormSegmentedElement.

from kformmaster.

TheJuki avatar TheJuki commented on May 30, 2024

Setting android:layout_weight="1" in the XML for the RadioButton seems to work. So, I'll add "fillSpace" as a property.

from kformmaster.

darkwood-studios avatar darkwood-studios commented on May 30, 2024

So, I'll add "fillSpace" as a property.

Sound perfect. Thank you.

Maybe you could add some properties for colors, corner and margin/padding as well.

I may be able to change color by adding "colorFormMasterElementRadioSelected" in my colors, but changing the corner radius by adding R.dimen.elementRadioCornerRadius to my dimens.xml is not working. Maybe a property could handle that.

And some properties to change text size and button padding would add more flexibility, too. What do you think?

from kformmaster.

TheJuki avatar TheJuki commented on May 30, 2024

Making progress...

from kformmaster.

TheJuki avatar TheJuki commented on May 30, 2024

I just released 4.6.2. Please update your dependency and let me know if the new properties work for you. The title for segmented will also be View.GONE if null or empty.

from kformmaster.

darkwood-studios avatar darkwood-studios commented on May 30, 2024

works great and looks fantastic! 🥇

Some further ideas for later:

  • change stroke size with params
  • change stroke color with params

from kformmaster.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.