B4A Library B4AFluidSlider

B4AFluidSlider

Here is another Slider-library :). A slider widget with a popup bubble displaying the precise value selected.

Original source/creator: https://github.com/Ramotion/fluid-slider-android


deviceslider1.gif


I wrapped this one because it looks nice but mainly because the original library is written in Kotlin. This wrapper is a result of my ongoing learning process with Kotlin.

I have attached a B4A example and also the library-files. Copy the lib-files to your Additional Lib folder.
As to the required Kotlin Standard Library (version 1.2.31), you need to download it from this link.

minSdkVersion = 16

Here is the lib-info (thanks to @Informatix for his LibDoc app):

B4AKotlinFluidSlider

Author: Github: Ramotion, Wrapped by: moster67/Mikael Osterhed
Version: 0.1
  • B4AFluidSlider
    • Events:
      • OnBeginTracking
      • OnEndTracking
      • OnPositionChanged (value As Int)
    • Fields:
      • ba As BA
    • Functions:
      • BringToFront
      • DesignerCreateView (base As Panel, lw As Label, props As Map)
      • GetValue As Int
        Get current value
      • Initialize (arg1 As String)
      • Invalidate
      • Invalidate2 (arg0 As android.graphics.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 android.graphics.Bitmap) As BitmapDrawable
      • SetColorAnimated (arg0 As Int, arg1 As Int, arg2 As Int)
      • SetInitialValues (StartValue As Int, MinValue As Int, MaxValue 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)
      • SetValue (startValue As Int)
        Set manually new start value
      • SetVisibleAnimated (arg0 As Int, arg1 As Boolean)
    • Properties:
      • Background As android.graphics.drawable.Drawable
      • Color As Int [write only]
      • ColorBar As Int
        Color of slider.
      • ColorBarText As Int
        Color of start and end texts of slider.
      • ColorBubble As Int
        Color of circle "bubble" inside bar.
      • ColorBubbleText As Int
        Color of text inside "bubble".
      • Duration As Long
        Duration of "bubble" rise in milliseconds.
      • Enabled As Boolean
      • EndText As String
        End (right) text of slider.
      • Height As Int
      • Left As Int
      • Padding As Int()
      • Parent As Object [read only]
      • StartText As String
        Start (left) text of slider.
      • Tag As Object
      • TextSize As Float
        Text size.
      • Top As Int
      • Visible As Boolean
      • Width As Int


I hope you like it.

Please remember that creating libraries and maintaining them takes time and so does supporting them. Please consider a donation if you use my free libraries as this will surely help keeping me motivated. Thank you!
 

Attachments

  • B4AFluidSliderExample.zip
    8.6 KB · Views: 338
  • B4AFluidSliderLibs.zip
    42.5 KB · Views: 387
Last edited:

beelze69

Active Member
Licensed User
Longtime User
B4AFluidSlider

Here is another Slider-library :). A slider widget with a popup bubble displaying the precise value selected.

Original source/creator: https://github.com/Ramotion/fluid-slider-android


View attachment 66369

I wrapped this one because it looks nice but mainly because the original library is written in Kotlin. This wrapper is a result of my ongoing learning process with Kotlin.

I have attached a B4A example and also the library-files. Copy the lib-files to your Additional Lib folder.
As to the required Kotlin Standard Library (version 1.2.31), you need to download it from this link.

Here is the lib-info (thanks to @Informatix for his LibDoc app):

B4AKotlinFluidSlider

Author: Github: Ramotion, Wrapped by: moster67/Mikael Osterhed
Version: 0.1
  • B4AFluidSlider
    • Events:
      • OnBeginTracking
      • OnEndTracking
      • OnPositionChanged (value As Int)
    • Fields:
      • ba As BA
    • Functions:
      • BringToFront
      • DesignerCreateView (base As Panel, lw As Label, props As Map)
      • GetValue As Int
        Get current value
      • Initialize (arg1 As String)
      • Invalidate
      • Invalidate2 (arg0 As android.graphics.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 android.graphics.Bitmap) As BitmapDrawable
      • SetColorAnimated (arg0 As Int, arg1 As Int, arg2 As Int)
      • SetInitialValues (StartValue As Int, MinValue As Int, MaxValue 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)
      • SetValue (startValue As Int)
        Set manually new start value
      • SetVisibleAnimated (arg0 As Int, arg1 As Boolean)
    • Properties:
      • Background As android.graphics.drawable.Drawable
      • Color As Int [write only]
      • ColorBar As Int
        Color of slider.
      • ColorBarText As Int
        Color of start and end texts of slider.
      • ColorBubble As Int
        Color of circle "bubble" inside bar.
      • ColorBubbleText As Int
        Color of text inside "bubble".
      • Duration As Long
        Duration of "bubble" rise in milliseconds.
      • Enabled As Boolean
      • EndText As String
        End (right) text of slider.
      • Height As Int
      • Left As Int
      • Padding As Int()
      • Parent As Object [read only]
      • StartText As String
        Start (left) text of slider.
      • Tag As Object
      • TextSize As Float
        Text size.
      • Top As Int
      • Visible As Boolean
      • Width As Int


I hope you like it.

Please remember that creating libraries and maintaining them takes time and so does supporting them. Please consider a donation if you use my free libraries as this will surely help keeping me motivated. Thank you!
B4AFluidSlider

Here is another Slider-library :). A slider widget with a popup bubble displaying the precise value selected.

Original source/creator: https://github.com/Ramotion/fluid-slider-android


View attachment 66369

I wrapped this one because it looks nice but mainly because the original library is written in Kotlin. This wrapper is a result of my ongoing learning process with Kotlin.

I have attached a B4A example and also the library-files. Copy the lib-files to your Additional Lib folder.
As to the required Kotlin Standard Library (version 1.2.31), you need to download it from this link.

Here is the lib-info (thanks to @Informatix for his LibDoc app):

B4AKotlinFluidSlider

Author: Github: Ramotion, Wrapped by: moster67/Mikael Osterhed
Version: 0.1
  • B4AFluidSlider
    • Events:
      • OnBeginTracking
      • OnEndTracking
      • OnPositionChanged (value As Int)
    • Fields:
      • ba As BA
    • Functions:
      • BringToFront
      • DesignerCreateView (base As Panel, lw As Label, props As Map)
      • GetValue As Int
        Get current value
      • Initialize (arg1 As String)
      • Invalidate
      • Invalidate2 (arg0 As android.graphics.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 android.graphics.Bitmap) As BitmapDrawable
      • SetColorAnimated (arg0 As Int, arg1 As Int, arg2 As Int)
      • SetInitialValues (StartValue As Int, MinValue As Int, MaxValue 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)
      • SetValue (startValue As Int)
        Set manually new start value
      • SetVisibleAnimated (arg0 As Int, arg1 As Boolean)
    • Properties:
      • Background As android.graphics.drawable.Drawable
      • Color As Int [write only]
      • ColorBar As Int
        Color of slider.
      • ColorBarText As Int
        Color of start and end texts of slider.
      • ColorBubble As Int
        Color of circle "bubble" inside bar.
      • ColorBubbleText As Int
        Color of text inside "bubble".
      • Duration As Long
        Duration of "bubble" rise in milliseconds.
      • Enabled As Boolean
      • EndText As String
        End (right) text of slider.
      • Height As Int
      • Left As Int
      • Padding As Int()
      • Parent As Object [read only]
      • StartText As String
        Start (left) text of slider.
      • Tag As Object
      • TextSize As Float
        Text size.
      • Top As Int
      • Visible As Boolean
      • Width As Int


I hope you like it.

Please remember that creating libraries and maintaining them takes time and so does supporting them. Please consider a donation if you use my free libraries as this will surely help keeping me motivated. Thank you!
B4AFluidSlider

Here is another Slider-library :). A slider widget with a popup bubble displaying the precise value selected.

Original source/creator: https://github.com/Ramotion/fluid-slider-android


View attachment 66369

I wrapped this one because it looks nice but mainly because the original library is written in Kotlin. This wrapper is a result of my ongoing learning process with Kotlin.

I have attached a B4A example and also the library-files. Copy the lib-files to your Additional Lib folder.
As to the required Kotlin Standard Library (version 1.2.31), you need to download it from this link.

Here is the lib-info (thanks to @Informatix for his LibDoc app):

B4AKotlinFluidSlider

Author: Github: Ramotion, Wrapped by: moster67/Mikael Osterhed
Version: 0.1
  • B4AFluidSlider
    • Events:
      • OnBeginTracking
      • OnEndTracking
      • OnPositionChanged (value As Int)
    • Fields:
      • ba As BA
    • Functions:
      • BringToFront
      • DesignerCreateView (base As Panel, lw As Label, props As Map)
      • GetValue As Int
        Get current value
      • Initialize (arg1 As String)
      • Invalidate
      • Invalidate2 (arg0 As android.graphics.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 android.graphics.Bitmap) As BitmapDrawable
      • SetColorAnimated (arg0 As Int, arg1 As Int, arg2 As Int)
      • SetInitialValues (StartValue As Int, MinValue As Int, MaxValue 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)
      • SetValue (startValue As Int)
        Set manually new start value
      • SetVisibleAnimated (arg0 As Int, arg1 As Boolean)
    • Properties:
      • Background As android.graphics.drawable.Drawable
      • Color As Int [write only]
      • ColorBar As Int
        Color of slider.
      • ColorBarText As Int
        Color of start and end texts of slider.
      • ColorBubble As Int
        Color of circle "bubble" inside bar.
      • ColorBubbleText As Int
        Color of text inside "bubble".
      • Duration As Long
        Duration of "bubble" rise in milliseconds.
      • Enabled As Boolean
      • EndText As String
        End (right) text of slider.
      • Height As Int
      • Left As Int
      • Padding As Int()
      • Parent As Object [read only]
      • StartText As String
        Start (left) text of slider.
      • Tag As Object
      • TextSize As Float
        Text size.
      • Top As Int
      • Visible As Boolean
      • Width As Int


I hope you like it.

Please remember that creating libraries and maintaining them takes time and so does supporting them. Please consider a donation if you use my free libraries as this will surely help keeping me motivated. Thank you!
 

beelze69

Active Member
Licensed User
Longtime User
Hi moster67 !

I tried to run your code.

But it is giving me the following error..

B4A Version: 8.00
Parsing code. (0.00s)
Compiling code. (0.02s)
Compiling layouts code. (0.02s)
Organizing libraries. (0.03s)
Generating R file. (1.04s)
Compiling generated Java code. Error
Cannot find: C:\Program Files\Anywhere Software\Basic4android\libraries\kotlin-stdlib-1.2.31.jar



I copied the JAR and AAR files to the correct Library folder to which I have set the path to in my PC.

Ps. help.. Thanks ..
 

mcqueccu

Well-Known Member
Licensed User
Longtime User
Hi moster67 !

I tried to run your code.

But it is giving me the following error..

B4A Version: 8.00
Parsing code. (0.00s)
Compiling code. (0.02s)
Compiling layouts code. (0.02s)
Organizing libraries. (0.03s)
Generating R file. (1.04s)
Compiling generated Java code. Error
Cannot find: C:\Program Files\Anywhere Software\Basic4android\libraries\kotlin-stdlib-1.2.31.jar



I copied the JAR and AAR files to the correct Library folder to which I have set the path to in my PC.

Ps. help.. Thanks ..

You are missing the Kotlin Standard library jar file.

The Instruction says download the Kotlin Standard library from a link to be added to the libraries folder. Click here to Download
 

beelze69

Active Member
Licensed User
Longtime User
Hi mcqueccu and master 67 !

Thanks for the link..

I downloaded, copied the kotlin std lib to appropriate library path and recompiled it .

It now gives me the following error:

:BEGIN OUTPUT DUMP:

Compiling generated Java code. (1.09s)
Convert byte code - optimized dex. (0.93s)
Packaging files. (0.50s)
Copying libraries resources (0.01s)
Found 6 resource files.
Signing package file (private key). (0.67s)
ZipAlign file. (0.09s)
Installing file to device. Error
[ 13%] /data/local/tmp/B4AKotlinFluidSlider.apk
[ 26%] /data/local/tmp/B4AKotlinFluidSlider.apk
[ 39%] /data/local/tmp/B4AKotlinFluidSlider.apk
[ 52%] /data/local/tmp/B4AKotlinFluidSlider.apk
[ 65%] /data/local/tmp/B4AKotlinFluidSlider.apk
[ 79%] /data/local/tmp/B4AKotlinFluidSlider.apk
[ 92%] /data/local/tmp/B4AKotlinFluidSlider.apk
[100%] /data/local/tmp/B4AKotlinFluidSlider.apk



B4AKotlinFluidSlider.apk: 1 file pushed. 1.8 MB/s (497438 bytes in 0.271s)
pkg: /data/local/tmp/B4AKotlinFluidSlider.apk
Failure [INSTALL_FAILED_OLDER_SDK]
rm failed for -f, No such file or directory
:END OUTPUT DUMP:

I also set the TargetSDK version to 26 in the manifest editor... still it is the same error.

Ps. help.

Thanks
 

moster67

Expert
Licensed User
Longtime User
If you are trying the sample-app, I believe I put the minSdkVersion = 17 although the library should work fine with as low as minSdkVersion = 16.
What is the SDK-version of the device you are trying with? Make sure that the device does not have a lower SDK-version than the minSdkVersion set in the b4a-project (or not lower than SDK 16).
 
Last edited:

beelze69

Active Member
Licensed User
Longtime User
Hi Moster67,

Mine is Android 4.0.3 (translates to SDK 15).

I tried with minSDKVersion=15 and it STILL WORKED !!

Very cool Feature ! Thanks a lot !
 

alimanam3386

Active Member
Licensed User
Longtime User
Hi

When I add the view by code I get this error ! I initialized the view

B4X:
(RuntimeException) java.lang.RuntimeException: Object should first be initialized (B4AFluidSlider).
 

Attachments

  • B4AFluidSlider_Exam.zip
    8.7 KB · Views: 221
Last edited:

moster67

Expert
Licensed User
Longtime User
This was really the first view I wrapped (never did it in java neither) with designer-support.
I am unsure if one adds designer-support, like I did, if it is possible to also add the view by code?
Maybe the view wrapper gurus here on the forum can answer? If it is possible, maybe they can teach me or link me to a tutorial and I can add support? :)
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
I am unsure if one adds designer-support, like I did, if it is possible to also add the view by code?
Technically it is possible. However most of the custom views I create must be added with the designer. Developers can always create a layout file with a single custom view and load it whenever they want to add a view.
 

moster67

Expert
Licensed User
Longtime User
The correct way is to use the Designer. One can create a simple layout with just the Slider on a Panel (in designer), add a Panel by code and then Load the layout to this panel.
Exactly how I thought it would be handled
 
Last edited:
Top