Here’s a wrapper for a RangeSeekBar widget I found on GitHub : https://github.com/yahoo/android-range-seek-bar.
I have modified the original code to suit my needs as it had a couple of issues.
You can add a RangeSeekBar in the designer, by code or XML layout. It can use as easily Integer or Decimal values. You'll notice that some of the return values are shown as data type T by BA4 intellisense. No worry, just use int if you want integer values, and float for decimal values.
You can initialize a one thumb RangeSeekBar (in effect a SeekBar) or a RangeSeekBar. You can switch from one to the other by changing its propery:
To install:
1. Download the zip file
2. Copy RangeSeekBar.jar and RangeSeekBar.xml to your shared library folder
3. Add a reference to RangeSeekBar in your B4A project
4. Copy the res folder into your project and add a line in your project pointing to the folder on your hard-drive. Leave the package name unchanged.
There’s a short demo project you can run to see what it all looks like. Make sure you add the resource folder and change the path to it.
I coded the wrapper and compiled the libraries using Android Studio (AS) in a gradle project, which is now the recommended Google IDE.
It was a bit of a challenge to produce the jar and XML (javadoc stuff) using Gradle as I had to manipulate Android Studio archive files (aar).
The toughest part was to produce a gradle task to generate the XML file using the BADoclet.
However gradle is a very powerful script language to build applications, and from Android Studio I was able, at the click of a button, to automatically compile the sources, merge the jars, create and edit the XML file (replace T parameters with double where relevant) and copy it all into my shared library folder.
If anyone is interested, let me know and I will post the XML generation code here.
Enjoy
10.4.2015
Version 1.0.1
Added Initialize2 method to initialize a RangeSeekBar instance with range settings and single/double thumb widget in one call.
Added property to hide numbers above thumbs.
Added property to change colour of numbers above thumbs.
Added property to change labels colour.
Edit: 23/3/2016
Posted java library code & java wrapper code.
I have modified the original code to suit my needs as it had a couple of issues.
You can add a RangeSeekBar in the designer, by code or XML layout. It can use as easily Integer or Decimal values. You'll notice that some of the return values are shown as data type T by BA4 intellisense. No worry, just use int if you want integer values, and float for decimal values.
You can initialize a one thumb RangeSeekBar (in effect a SeekBar) or a RangeSeekBar. You can switch from one to the other by changing its propery:
B4X:
Dim rsb As RangeSeekBar
.....
rsb.SingleThumb = True
To install:
1. Download the zip file
2. Copy RangeSeekBar.jar and RangeSeekBar.xml to your shared library folder
3. Add a reference to RangeSeekBar in your B4A project
4. Copy the res folder into your project and add a line in your project pointing to the folder on your hard-drive. Leave the package name unchanged.
B4X:
#AdditionalRes: C:\<YourPath>\testrangeseekbar\res, com.yahoo.mobile.client.android.util;
There’s a short demo project you can run to see what it all looks like. Make sure you add the resource folder and change the path to it.
I coded the wrapper and compiled the libraries using Android Studio (AS) in a gradle project, which is now the recommended Google IDE.
It was a bit of a challenge to produce the jar and XML (javadoc stuff) using Gradle as I had to manipulate Android Studio archive files (aar).
The toughest part was to produce a gradle task to generate the XML file using the BADoclet.
However gradle is a very powerful script language to build applications, and from Android Studio I was able, at the click of a button, to automatically compile the sources, merge the jars, create and edit the XML file (replace T parameters with double where relevant) and copy it all into my shared library folder.
If anyone is interested, let me know and I will post the XML generation code here.
Enjoy
10.4.2015
Version 1.0.1
Added Initialize2 method to initialize a RangeSeekBar instance with range settings and single/double thumb widget in one call.
Added property to hide numbers above thumbs.
Added property to change colour of numbers above thumbs.
Added property to change labels colour.
Edit: 23/3/2016
Posted java library code & java wrapper code.
Attachments
Last edited: