B4A Library RangeSeekBar Wrapper

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.

screenshot-png.33372


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

  • Screenshot.png
    Screenshot.png
    50.9 KB · Views: 610
  • RangeSeekBar.1.0.1.zip
    61.7 KB · Views: 280
  • rangeseekbarJava.zip
    51.8 KB · Views: 214
  • rangeseekbarwrapper.zip
    9.4 KB · Views: 218
Last edited:

cimperia

Active Member
Licensed User
Longtime User
10.4.2015
Version 1.0.1

After using this library in one of my own project, I've added a bit of functionality that it was lacking.

  • 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.
 
Last edited:

PABLO2013

Well-Known Member
Licensed User
Longtime User
tks ,
regards
1. How to change the width of the bar
2. as changing values in integers and not in decimals
3 could add circles or other patterns to suggest values
you would bar the most complete



tks in advanced
 

Attachments

  • barra.PNG
    barra.PNG
    3.9 KB · Views: 183

cimperia

Active Member
Licensed User
Longtime User
If you download the example you'll see answers to your points 1 & 2.

As far as suggested values are concerned I have no plan to add them (lack of time). I could post the Java & wrapper code if you want to tackle it yourself?
 
Last edited:

scsjc

Well-Known Member
Licensed User
Longtime User
Hello, nice work !!!!
is possible change color line (now is blue and darkgray)

thanks !!!
 

cimperia

Active Member
Licensed User
Longtime User
Yes it is. I have posted the source and wrapper java code, so you can modify to your heart's content ;)
 

scsjc

Well-Known Member
Licensed User
Longtime User
ok, and another question, i dont know take off decimals, always show. can force without decimals on bar ?
Screenshot_20160919-232603.png
 

cimperia

Active Member
Licensed User
Longtime User
If you study the demo, you'll see that it shows decimal bars and integer bars.
 
Top