Software engineer focused on front-end mobile with special care for UX/UI @blissapps.
Currently working with Koltin Multiplatform and Compose Multiplatform.
When Iβm not coding Iβm π§ or πββοΈ
A SeekBarView restrained by a minimum and maximum value.
Home Page: https://guilhe.github.io/SeekbarRangedView
License: Apache License 2.0
Software engineer focused on front-end mobile with special care for UX/UI @blissapps.
Currently working with Koltin Multiplatform and Compose Multiplatform.
When Iβm not coding Iβm π§ or πββοΈ
how to set current max min in java side
setSelectedValue not working
duplicate value for resource 'attr/min' with config ''.
When i use the custom:thumbsResource, i get a null pointer exception in the SeekBarRangedView class
I you try to use an XML defined drawable as the thumb image, it fails with an NPE.
To work around this, I am currently converting my Drawable to a bitmap and then setting it. It would be nice if I could just specify the Drawable in the XML layout instead.
filter_slider.setThumbsImage(getBitmap(requireContext(), R.drawable.slider_thumb)) /**
fun getBitmap(context: Context, drawableResourceId: Int): Bitmap? {
val drawable = AppCompatResources.getDrawable(context, drawableResourceId)
return if (drawable == null) {
null
} else {
val canvas = Canvas()
val bitmap = Bitmap.createBitmap(drawable.intrinsicWidth, drawable.intrinsicHeight, Bitmap.Config.ARGB_8888)
canvas.setBitmap(bitmap)
drawable.setBounds(0, 0, drawable.intrinsicWidth, drawable.intrinsicHeight)
drawable.draw(canvas)
bitmap
}
}
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="oval">
<size
android:width="32dp"
android:height="32dp" />
<solid android:color="@color/blue" />
</shape>
</item>
<item>
<shape android:shape="oval">
<size
android:width="32dp"
android:height="32dp" />
<solid android:color="@color/white" />
<stroke
android:width="12dp"
android:color="@android:color/transparent" />
</shape>
</item>
</layer-list>
Can i change min and max value from program (not in layout)? If yes, how?
I have a screen with the component, rotate it and there is this exception.
W/Bundle: Attempt to cast generated internal exception:
java.lang.ClassCastException: java.lang.Double cannot be cast to java.lang.Float
at android.os.BaseBundle.getFloat(BaseBundle.java:1104)
at android.os.Bundle.getFloat(Bundle.java:834)
at android.os.BaseBundle.getFloat(BaseBundle.java:1086)
at android.os.Bundle.getFloat(Bundle.java:821)
at com.github.guilhe.rangeseekbar.SeekBarRangedView.onRestoreInstanceState(SeekBarRangedView.java:834)
at android.view.View.dispatchRestoreInstanceState(View.java:18608)
at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:3827)
at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:3827)
at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:3827)
at android.view.View.restoreHierarchyState(View.java:18586)
at androidx.fragment.app.Fragment.restoreViewState(Fragment.java:576)
at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1349)
at androidx.fragment.app.FragmentManager.moveFragmentToExpectedState(FragmentManager.java:1686)
at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1750)
at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:3074)
at androidx.fragment.app.FragmentManager.dispatchActivityCreated(FragmentManager.java:3028)
at androidx.fragment.app.Fragment.performActivityCreated(Fragment.java:2693)
at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1346)
at androidx.fragment.app.FragmentManager.moveFragmentToExpectedState(FragmentManager.java:1686)
at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1750)
at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:3074)
at androidx.fragment.app.FragmentManager.dispatchActivityCreated(FragmentManager.java:3028)
at androidx.fragment.app.FragmentController.dispatchActivityCreated(FragmentController.java:247)
at androidx.fragment.app.FragmentActivity.onStart(FragmentActivity.java:541)
at androidx.appcompat.app.AppCompatActivity.onStart(AppCompatActivity.java:201)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1391)
at android.app.Activity.performStart(Activity.java:7157)
at android.app.ActivityThread.handleStartActivity(ActivityThread.java:2937)
at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:180)
at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:165)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:142)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:70)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
W/Bundle: Key MAX expected Float but value was a java.lang.Double. The default value 0.0 was returned.
W/Bundle: Attempt to cast generated internal exception:
java.lang.ClassCastException: java.lang.Double cannot be cast to java.lang.Float
at android.os.BaseBundle.getFloat(BaseBundle.java:1104)
at android.os.Bundle.getFloat(Bundle.java:834)
at android.os.BaseBundle.getFloat(BaseBundle.java:1086)
at android.os.Bundle.getFloat(Bundle.java:821)
at com.github.guilhe.rangeseekbar.SeekBarRangedView.onRestoreInstanceState(SeekBarRangedView.java:835)
at android.view.View.dispatchRestoreInstanceState(View.java:18608)
at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:3827)
at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:3827)
at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:3827)
at android.view.View.restoreHierarchyState(View.java:18586)
at androidx.fragment.app.Fragment.restoreViewState(Fragment.java:576)
at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1349)
at androidx.fragment.app.FragmentManager.moveFragmentToExpectedState(FragmentManager.java:1686)
at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1750)
at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:3074)
at androidx.fragment.app.FragmentManager.dispatchActivityCreated(FragmentManager.java:3028)
at androidx.fragment.app.Fragment.performActivityCreated(Fragment.java:2693)
at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1346)
at androidx.fragment.app.FragmentManager.moveFragmentToExpectedState(FragmentManager.java:1686)
at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1750)
at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:3074)
at androidx.fragment.app.FragmentManager.dispatchActivityCreated(FragmentManager.java:3028)
at androidx.fragment.app.FragmentController.dispatchActivityCreated(FragmentController.java:247)
at androidx.fragment.app.FragmentActivity.onStart(FragmentActivity.java:541)
at androidx.appcompat.app.AppCompatActivity.onStart(AppCompatActivity.java:201)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1391)
at android.app.Activity.performStart(Activity.java:7157)
at android.app.ActivityThread.handleStartActivity(ActivityThread.java:2937)
at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:180)
at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:165)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:142)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:70)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
The block of code saves a double and tries to restore a float. Shouldn't it be the same type on save and on restore?
@Override
protected Parcelable onSaveInstanceState() {
final Bundle bundle = new Bundle();
bundle.putParcelable("SUPER", super.onSaveInstanceState());
bundle.putDouble("MIN", mNormalizedMinValue);
bundle.putDouble("MAX", mNormalizedMaxValue);
return bundle;
}
@Override
protected void onRestoreInstanceState(Parcelable parcel) {
final Bundle bundle = (Bundle) parcel;
super.onRestoreInstanceState(bundle.getParcelable("SUPER"));
mNormalizedMinValue = bundle.getFloat("MIN");
mNormalizedMaxValue = bundle.getFloat("MAX");
onChangedValues();
onChangingValues();
}
Hey, I really like the lib and I use it on production ! :)
Could you indicate some changelog? What changed in version 2.0.3 e.g. ?
Can we avoid thumb to overlap? Thanks.
Is there any way I can change the step size of the range bar?
Is there a change from 1.0.2 to 1.0.3? After I change to 1.0.3 I can't get a reference anymore and the app won't start.
min in 100 and max in 500
when i scroll, min can reach to 500 and max can reach to 100 on sliding
considering above case if the diff between min and max selection should to 100.
that is is min is 100 and max in 400 , when i slide min head it should stop at 300 after 300 min should not slide in similar way.
if max in 400 and min is 100 when i scroll/move max head it should stop at 200 so that difference between min max should be 100
A clear and concise description of any alternative solutions or features you've considered.
Help me to achieve this enchantment.
I'd like to report a bug that occured for Android 5 (motorola Moto X (1st Gen)) when using
setProgressColorResource
java.lang.NoSuchMethodError: No virtual method getColor(I)I in class Landroid/content/Context; or its super classes (declaration of 'android.content.Context' appears in /system/framework/framework.jar)
at com.github.guilhe.views.SeekBarRangedView.setProgressColorResource + 460(SeekBarRangedView.java:460)
Context.getColor(int) method is from SDK 23 so please switch to ContextCompat.getColor(this, colorId) :)
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.