anderweb / discreteseekbar Goto Github PK
View Code? Open in Web Editor NEWLicense: Apache License 2.0
License: Apache License 2.0
Hi Bro
This is a great and amzing lib.
but when i disable seekBar the colors still same as when they are enabled. can u set them to grey?
When dragging the seekbar quickly, the floaty thing gets clipped on the sides. I'm assuming this is because the view window isn't large enough or something like that. A proposed fix would be to alter the window manager code so that the bubble floaty thing is allowed to draw on the entire width of the seekbar
When using a custom string transform, the the librarys bubble measuring is wrong. I assume it is using 0 or something else to probe the size, transformToString results in.
What I was doing is I used.
@Override
public String transformToString(int value) {
DecimalFormat speedFormat = new DecimalFormat("#.##");
float speed = value / 1000F;
return speedFormat.format(value) + "x";
}
But set the minimum to 500
and the maxium to 2000
. The result was the text being cropped. I assume that the library probes for a 0
, which led to a result of x
for my app. And that the library used the x
as the bounds size for the bubble.
A good fix would be to use the mMax
value to probe for the size.
A workaround I impemented was to use:
if (value < internalMin)
value = internalMax;
inside
transformToString(int value)
That way the correct measurement is ensured.
I am using DiscreteSeekBar, And it is working like a charm. I want to change the progress color of DiscreteSeekBar if it is in disabled state. How can i do that? Any hint will be appreciated. Thanks for this awesome libarary. 👍
Is it possible to set the bubble text based on progress value?
Need to know the solution to disable focus and avoid change on touch the seekbar
With alwaysShowIndicator="true"
floating marker should stay on screen and don't dismiss until unset programatically.
Possible solution by @AnderWeb as discussed here:
The "proper" solution would be making DiscreteSeekBar extend from ViewGroup.
Then, if the alwaysShowIndicator flag is enabled, it would create and add the Floater to itself taking care of measuring/layout/positioning.
Else, it would behave as usual, creating the Popup with the Floater inside.
Missing styles. Is the correct theme chosen for this layout? Use the Theme combo box above the layout to choose a different layout, or fix the theme style references. The following classes could not be instantiated:
- org.adw.library.widgets.discreteseekbar.DiscreteSeekBar (Open Class, Show Exception)
Tip: Use View.isInEditMode() in your custom views to skip code or show sample data when shown in the IDE Exception Details java.lang.NullPointerException at org.adw.library.widgets.discreteseekbar.internal.drawable.StateDrawable.(StateDrawable.java:45) at org.adw.library.widgets.discreteseekbar.internal.drawable.AlmostRippleDrawable.(AlmostRippleDrawable.java:51) at org.adw.library.widgets.discreteseekbar.internal.compat.SeekBarCompat.getRipple(SeekBarCompat.java:62) at org.adw.library.widgets.discreteseekbar.DiscreteSeekBar.(DiscreteSeekBar.java:206) at org.adw.library.widgets.discreteseekbar.DiscreteSeekBar.(DiscreteSeekBar.java:141) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:756) at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64) at android.view.LayoutInflater.rInflate(LayoutInflater.java:728) at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:759) at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64) at android.view.LayoutInflater.rInflate(LayoutInflater.java:728) at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:759) at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64) at android.view.LayoutInflater.rInflate(LayoutInflater.java:728) at android.view.LayoutInflater.inflate(LayoutInflater.java:492) at android.view.LayoutInflater.inflate(LayoutInflater.java:373) Copy stack to clipboard Failed to find style 'DefaultSeekBar' in current theme (6 similar errors not shown)
i want to use these seekbar in my project,I write this in my build.gradle
dependencies{
compile 'org.adw.library:discrete-seekbar:1.0.0'
}
and my gradle sync complete without mistakes.
but i cannot import org.adw.samples.discretseekbar,what's wrong with my code?
Great and a complete lib.
wish to use this lib with Gradle 👍
hi,
At first appreciate your work guys.
But is there a way that I can add a bitmap to the thumb and hide the bubble text or somthing like that?
The seekbar does not move to the touched position , instead user is forced to touch and move a bit. This behaviour greatly affects the user experience.
Could you please make it seek-on-click? Any solutions for this?
Hi, i am using your library in my project and how do i set interval while moving means
I have a seekbar, while moving it I want to change values from 0 to 200 on Marker(bubble). I have a TextView, where I display those values while moving the seekbar. But I don't want to have every value from that interval(0,1,2,3,4,5...), but to have 10, 20, 30...so on. So when I move the seekbar, I want to display 10,20,30,40....to 200. Can somebody give me a hint or how to do this?
Hi,
The project is so good to me and everyone. I just use it for a few days and found something that I can't handle with the DiscreteSeekBar...
Here is my xml file activity_test.xml
:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<org.adw.library.widgets.discreteseekbar.DiscreteSeekBar
android:id="@+id/discrete3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:visibility="gone"
app:dsb_indicatorFormatter="%04d"
app:dsb_max="1000"
app:dsb_min="1" />
</RelativeLayout>
TestActivity.java
public class TestActivity extends BaseActivity {
private DiscreteSeekBar mDiscreteSeekBar;
@Override
protected int getLayoutResource() {
return R.layout.activity_test;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mDiscreteSeekBar = (DiscreteSeekBar) findViewById(R.id.discrete3);
mDiscreteSeekBar.setVisibility(View.VISIBLE);
}
}
The bubble can't be seen for this condition. No matter whether I set android:visibility="gone/invisible"
When I remove the code from the xml file, the bubble is back.
Hey, thanks for this sweet seekbar
Missing something from framework seekbar, when you tap on the sides it should increment/decrement value:
That being said, framework does not animate this kind of seeking, it would be nice to have it animated like touchwiz does (yes, something nice from samsung, that sounds weird.)
Missing styles. Is the correct theme chosen for this layout? Use the Theme combo box above the layout to choose a different layout, or fix the theme style references. The following classes could not be instantiated:
- org.adw.library.widgets.discreteseekbar.DiscreteSeekBar (Open Class, Show Exception)
Tip: Use View.isInEditMode() in your custom views to skip code or show sample data when shown in the IDE Exception Details java.lang.IllegalArgumentException: RippleDrawable requires a non-null color at android.graphics.drawable.RippleDrawable.(RippleDrawable.java:186) at org.adw.library.widgets.discreteseekbar.internal.compat.SeekBarCompatDontCrash.getRipple(SeekBarCompatDontCrash.java:50) at org.adw.library.widgets.discreteseekbar.internal.compat.SeekBarCompat.getRipple(SeekBarCompat.java:60) at org.adw.library.widgets.discreteseekbar.DiscreteSeekBar.(DiscreteSeekBar.java:206) at org.adw.library.widgets.discreteseekbar.DiscreteSeekBar.(DiscreteSeekBar.java:141) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:806) at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64) at android.view.LayoutInflater.rInflate(LayoutInflater.java:782) at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:809) at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64) at android.view.LayoutInflater.rInflate(LayoutInflater.java:782) at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:809) at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64) at android.view.LayoutInflater.rInflate(LayoutInflater.java:782) at android.view.LayoutInflater.inflate(LayoutInflater.java:504) at android.view.LayoutInflater.inflate(LayoutInflater.java:385) Copy stack to clipboard Failed to find style 'DefaultSeekBar' in current theme (6 similar errors not shown)
I want to change the size of indicator in order to adjust my text there, I reduced textSize to 8sp but it is still trimming. How can I change the size of indicator or more specifically PopupIndicator.
Another thing, I add drawable to indicator instead of color, is it possible and how?
Thanks in advance.
So how do I import into my project? I attempted to download the zip then unzip, then tried to open in Android Studio but not successful.
How to change ripple color Programmatically?
Hi I am new to android. Just checked your library. Can we use setOnSeekBarChangeListener in your seekbar? If so how? Awaiting your response at the earliest.
Thanks in advance.
Thank you for such nice component!
This issue happens on my device galaxy S2, android 4.0.4. But everything is OK on my another device which runs 4.2.2.
Indicator pops up as soon as I touch it, and then dismisses quickly before I release or begin to drag.
I guess hideFloater
was invoked by accident before my releasing. I debugged. It turns out that I'm wrong.
Any idea? Thank you.
hi,
Thumb size is small !
please add a feature to change thumb size
thanks
Hi!
I found the bug when I tried to use this widget into my floating menu that was implemented using PopupWindow.
WindowManager BadTokenException: Unable to add window -- token android.view.ViewRootImpl is not valid; is your activity running?
It fall on PopupIndicator:166
when I tried to
mWindowManager.addView(mPopupView, p);
Looks like parent view`s token (so parent are Popupwindow) are wrong.
When I tried to use as parent other view (for example root view of my activity) I got wrong placement of PopupIndicator.
so it goes :(
Hi AnderWeb,
¿When will next Release be available in JCenter?
There are several improvements like option for stepped values,etc. not avaible in release 1.0.0
Thanks!.
I used this library for a while , it is nice but in some situations it doesn't acts like the original SeekBar.
For example: when i call setMax() in runtime , it only changes maximum amount and doesn't regulate current slider position (progress) but the original SeekBar does.
An easy way to fix this problem , is to extend the original SeekBar Widget , many other problems will solve easily too. of course i'm sure you knew this solution , maybe you can't do this because of other interference or technical issues , but think again about it. :)
Thanks for your great work and sorry for my bad English , it isn't my native language.
Plz make sure this works this is the basic functionality of a seek bar user will get irritated if this doesn't work. Plz do it ASAP.
Hello everybody,
I'd rather not to use a single range bar for my min-max range, so I chose to use two seekbars. When I drag the value on the MinPrice bar, when I get to the same value I have on the MaxPrice the dragging should stop.
I handled this using the setOnProgressChangeListener in this way
maxPriceBar.setOnProgressChangeListener(new DiscreteSeekBar.OnProgressChangeListener() {
@Override
public void onProgressChanged(DiscreteSeekBar seekBar, int value, boolean fromUser) {
if(value <= minPriceBar.getProgress()) {
maxPriceBar.setProgress(minPriceBar.getProgress());
return;
}
}
@Override
public void onStartTrackingTouch(DiscreteSeekBar seekBar) {
}
@Override
public void onStopTrackingTouch(DiscreteSeekBar seekBar) {
if (maxPriceBar.getProgress() <= minPriceBar.getProgress()) {
maxPriceBar.setProgress(minPriceBar.getProgress());
}
}
});
The same applies to the other seekBar, with opposite checks.
I expect the two seekBars to prevent the user from dragging the marker higher than the value of the MaxPrice bar and lower than the value of the MinPrice bar. And it does! The only issue is that, if I keep dragging in the direction I'm prevented to, the marker does not move but the text in the bubble changes.
Two pictures are worth a thousand words:
Here I keep dragging the MaxPrice marker down. It does not move, but the value changes
Do you have any suggestion about how could I avoid this behavior?
Thank you
Hi there,
I cant attach the listener to seekbar. How can i do it? I wanna change a textview to display the new seekbar value. My code is:
DiscreteSeekBar seekBar = (DiscreteSeekBar)rootView.findViewById(R.id.seekBar);
seekBar.setOnScrollChangeListener(new View.OnScrollChangeListener() {
@Override
public void onScrollChange(View v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) {
tvRange.setText("New value is "+scrollY);
}
});
And the error is :
4336-4336/com.developement.mt.langapp E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.developement.mt.langapp, PID: 4336
java.lang.NoClassDefFoundError: com.developement.mt.langapp.SearchFragment$1
at com.developement.mt.langapp.SearchFragment.onCreateView(SearchFragment.java:37)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:1962)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1026)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1207)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:738)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1572)
at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:493)
at android.os.Handler.handleCallback(Handler.java:808)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:5292)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:824)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:640)
at dalvik.system.NativeStart.main(Native Method)
onProgressChanged is currently called multiple times during a sliding action. It's better to have an option of continuous = false/true. If continuous = false, onProgressChanged is only called when sliding is finished.
how to setSecondaryProgress
I have two seekbars on screen. One has range 500-5000, second 10-20. On screen rotation first seekbar gets min, max and current values of the first seekbar.
https://i.gyazo.com/0765c4c94eb04a16335b1fc1880f9bea.gif
Have changed screen orientation to horizontal: bubble hides on a half way. But if app starts in horizontal – it's OK.
Hi I would like to know if we can tilt the bubble? If so how to go about with that ? would like to tilt it it both right and left direction. Can you please help me?
Text in the popup indicator should always be as big or as small as needed to properly fit in the popup indicator. For seekbars with large ranges, this means that the text size for 1 would be quite large relatively, because there is a lot of room for one character, while the text size for 10,000 would be very small
Thanks for this great widget.
I would need the possibility to select a range with two thumbs, like e.g. range-seek-bar or range-bar.
I might start to adapt the code myself. But I'm an absolute beginner with implementing custom widgets. So my contributions would probably be of low value.
If you would like to instruct me a little bit then it might come out something generally useful.
Thanks,
Mick
Allow customizable size for the seek bar and pin. I will open a PR for this.
How to set min and max value and current value programmatically? I tried like the below snippet. the indicator dint appear.
prepTimeBar.setMin(0);
prepTimeBar.setMax(100);
when using AppCompat.Themes on Api 21+
When using setNumericTransformer
with a custom transformToString
, the library probes for the max and determines the size of the bubble by a call to mIndicator.updateSizes
using the current max value.
The problem is that if setNumericTransformer
is called on initialization, the max has not been set and thus is 100. So the bubble has the wrong size.
Also when you later change your seekbars max value, the value does not get updated and the bubble stays at the wrong size.
So my suggestion is to simply update the indicator size by a call on mIndicator.updateSizes
in setMax
.
Hi!
Would be great to have a GitHub release https://github.com/AnderWeb/discreteSeekBar/releases
Then we would get a version number that can be used with JitPack. At the moment seeing users installing using commit id https://jitpack.io/#AnderWeb/discreteSeekBar
what must I do in order to use this library in my project commercially
Is there any way to get the currently displayed text in the onProgressChanged event?
I know I can achieve this by manually formatting the value, but I just wondered if there was a shortcut.
Cheers
Hi
Good library.
but i want to change the drawable for Thumb and Indicator ( Progress BALLON when drag ). How can i change it ?
Thanks
Hi. Can set my color to secondary progress?
What I've done: added jcenter() to repositories and added compile 'org.adw.library:discrete-seekbar:1.0.0' to dependencies.
07-15 02:23:20.401 29558-29558/com.author.name E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.author.name/com.author.name.ui.CreateStackActivity}: android.view.InflateException: Binary XML file line #23: Error inflating class com.adw.library.widgets.discreteseekbar.DiscreteSeekBar
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2325)
...
Caused by: android.view.InflateException: Binary XML file line #23: Error inflating class com.adw.library.widgets.discreteseekbar.DiscreteSeekBar
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:757)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:809)
at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
at com.author.name.ui.CreateStackFragment.onCreateView(CreateStackFragment.java:46)
at android.app.Fragment.performCreateView(Fragment.java:2053)
...
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.adw.library.widgets.discreteseekbar.DiscreteSeekBar" on path: DexPathList[[zip file "/data/app/com.author.name-1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
...
Suppressed: java.lang.ClassNotFoundException: com.adw.library.widgets.discreteseekbar.DiscreteSeekBar
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 25 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
If you drag the seek handle around quickly for a short enough period of time that the bubble doesn't pop up, upon releasing the handle it jumps back to where it started and back really quickly creating a stuttery interaction.
It would be very useful to have vertical variant of this amazing seekbar.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.