B4A Library SlideSwitch V1.0.2

Similar threads

B4A Tutorial [java] Custom View with Designer Support (Java library)
B4A Library IPCamView
B4A Library msEmoji V1.0.0
B4A Library PDFium - Pdfview2
B4A Library CreditsRollView V1.0.0
B4A Library VRCalendarView

DonManfred

Expert
Licensed User
SlideSwitch
Version:
1.02
  • SlideSwitch
    Events:
    • close (swview as Object As , token as Object As )
    • onClick (swview as Object As )
    • open (swview as Object As , token as Object As )
    Fields:
    • ba As BA
    Methods:
    • AddToParent (Parent As ViewGroup, left As Int, top As Int, width As Int, height As Int)
    • BringToFront
    • DesignerCreateView (base As PanelWrapper, lw As LabelWrapper, props As Map)
    • Initialize (EventName As String)
    • Invalidate
    • Invalidate2 (arg0 As Rect)
    • Invalidate3 (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
    • IsInitialized As Boolean
    • RemoveView
    • RequestFocus As Boolean
    • SendToBack
    • SetBackgroundImage (arg0 As Bitmap)
    • SetColorAnimated (arg0 As Int, arg1 As Int, arg2 As Int)
    • SetLayout (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
    • SetLayoutAnimated (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int, arg4 As Int)
    • SetVisibleAnimated (arg0 As Int, arg1 As Boolean)
    Properties:
    • Background As Drawable
    • Color As Int [write only]
      Set the Color for the SlideSwitch
    • Enabled As Boolean
    • Height As Int
    • Left As Int
    • Rounded As Boolean [write only]
      Set this to true if you want to get an rounded SlideSwitch
      Default is false
    • State As Boolean
      The State of the the SlideSwitch
      If true the Switch is open
      false if Switch is closed
    • Tag As Object
    • Token As Object
    • Top As Int
    • Visible As Boolean
    • Width As Int

 

Attachments

Last edited:

NJDude

Expert
Licensed User
Very nice, however, would it be possible to make those arguments a little but more descriptive?
B4X:
SetColorAnimated(arg0 As Int, arg1 As Int, arg2 As Int)
arg0...arg1, gives no idea of what to do there.
 

DonManfred

Expert
Licensed User
Don't forget to mention this library in the Updates thread.
What? I did not do a post there? Oups, sorry ;-)
Will do that today when i update this lib here. Want to see first how much work it is to realize @NJDude wish for better method parameter names...
 

daemon

Active Member
Licensed User
Good one!

A feature request: Please add another class SlideToAction that behaves like 'slide to unlock'. Basically, it is always in closed position and raises an even when the slider is moved to beyond 90%.

Another feature request: Possibility to add text on slider.

Thanks!
 

ArminKH

Well-Known Member
Hi thank u 4 for sharing this usefull lib
but when i use this lib and ahviewpager lib together then when i want to use slide switch (swipe my hand from left side to right or right to left)
then my page (created by using ahviewpager changed and my slide switch not worked properly
if is possible please test this or let me to know if is there any way to disable slide switch (slide animation)
thank u again
 

DonManfred

Expert
Licensed User
Another feature request: Possibility to add text on slider.
I did not wrote the library. I just wrote a wrapper to use it in B4A.
I dont know how to change such things.

Find a java library which has exact the features needed and post the link to it. Maybe i´ll do a wrapper for it.
 

DonManfred

Expert
Licensed User
if is possible please test this or let me to know if is there any way to disable slide switch (slide animation)
I dont have this lib. And i dont have any example which uses this and my lib.

But intuitive i would say that is is not a good idea to have a swipe pager and the slideswitch on the same layout. Sounds not logically for me.

Create a small project which shows the problem. Maybe i can see anything
 

ArminKH

Well-Known Member
I dont have this lib. And i dont have any example which uses this and my lib.

But intuitive i would say that is is not a good idea to have a swipe pager and the slideswitch on the same layout. Sounds not logically for me.

Create a small project which shows the problem. Maybe i can see anything
OK I will create a small project to show the problem tonight
But now i can say:two touch event(AhviewPager' touch and slide switch's touch)works together for example when i touch and swipe slide switch to change state then at the same time my page(created by ahviewpager)changed because by using that we can change page's by touch and 2 touch event works together
Thank u i'll attach small project tonight
 
Last edited:

ArminKH

Well-Known Member
@DonManfred
this is a small project to show the problem
if is possible atleast please take an option 4 disable animation during state changed or disable touch and changing state just work by using click event
 

Attachments

  • 12.9 KB Views: 40

walterf25

Expert
Licensed User
Very nice, however, would it be possible to make those arguments a little but more descriptive?
B4X:
SetColorAnimated(arg0 As Int, arg1 As Int, arg2 As Int)
arg0...arg1, gives no idea of what to do there.
+1
 

walterf25

Expert
Licensed User
It cannot be done. The Javadocs is not inherited from the parent class. SetColorAnimated is a method in ViewWrapper not in the slideswitch.
That is why it is better to create your own function that can be exposed to B4A that way you can create the documentation and then just pass the viewwraper method inside that function.

Example:
B4X:
*/Sets the RGB color
*/<code>
*/dim whatever as slideswitch
*/whatever.Initialize
*/whatever.ColorAnimated(200, 50, 76)
*/</code>

public void ColorAnimated(BA ba, int R, int G, int B){
SetColorAnimated(R, G, B)
}
:D:D:D
 

thedesolatesoul

Expert
Licensed User
That is why it is better to create your own function that can be exposed to B4A that way you can create the documentation and then just pass the viewwraper method inside that function.

Example:
B4X:
*/Sets the RGB color
*/<code>
*/dim whatever as slideswitch
*/whatever.Initialize
*/whatever.SetColorAnimated(200, 50, 76)
*/</code>

public void SetColorAnimated(BA ba, int R, int G, int B){
SetColorAnimated(R, G, B)
}
:D:D:D
I'm simply not willing to do so much donkey work. Be my guest, take all my libraries and write the code for every method in ViewWrapper or other.
 
Top