Code Monkey home page Code Monkey logo

material-range-bar's People

Contributors

2math avatar ahuang13 avatar ajharry69 avatar alqasrawi avatar amoslital avatar ardacebi avatar bryant1410 avatar byteofsilicon avatar cheenu avatar darius-janusauskas avatar dericc avatar idan-an avatar jmiecz avatar johnjohndoe avatar kimor79 avatar krazykira avatar kwiky avatar lam-amsiq avatar lital-nanit avatar lucamtudor avatar mdpearce avatar oknesif avatar oli107 avatar rlshep avatar rubensousa avatar tt1943 avatar ultraon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

material-range-bar's Issues

Bug in RangeBar.onTouchEvent

Hello, please fix bug in RangeBar.onTouchEvent, line #433.
Current version:

case MotionEvent.ACTION_UP:
            case MotionEvent.ACTION_CANCEL:
                this.getParent().requestDisallowInterceptTouchEvent(false);
                onActionUp(event.getX(), event.getY());
                return true;

Replace with:

            case MotionEvent.ACTION_UP:
                this.getParent().requestDisallowInterceptTouchEvent(false);
                onActionUp(event.getX(), event.getY());
                return true;
            case MotionEvent.ACTION_CANCEL:
                this.getParent().requestDisallowInterceptTouchEvent(false);
                return false;

These changes fix scrolling issue (unprompted rangebar changes) when RangebBar is in scrollable view.

tickInterval is 100 but rangebar is jumping 600 for first tick.

For first tick left pin is jumping by 600 and after that it is jumping by 100.
What's the issue?

<com.appyvet.rangebar.RangeBar xmlns:custom="http://schemas.android.com/apk/res-auto"
android:id="@+id/rbPrice"
android:layout_width="match_parent"
android:layout_height="72dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
custom:tickEnd="4000"
custom:tickHeight="0sp"
custom:tickInterval="100"
custom:tickStart="600" />

Full Code:-

                <TextView
                    android:id="@+id/tvMinPrice"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_centerVertical="true"
                    android:text="₹ 600"
                    android:textColor="@color/black" />

                <com.appyvet.rangebar.RangeBar xmlns:custom="http://schemas.android.com/apk/res-auto"
                    android:id="@+id/rbPrice"
                    android:layout_width="match_parent"
                    android:layout_height="72dp"
                    android:layout_marginLeft="16dp"
                    android:layout_marginRight="16dp"
                    android:layout_toLeftOf="@+id/tvMaxPrice"
                    android:layout_toRightOf="@+id/tvMinPrice"
                    custom:connectingLineColor="@color/colorAccent"
                    custom:pinColor="@color/colorAccent"
                    custom:rangeBarColor="@color/colorAccent"
                    custom:selectorColor="@color/colorAccent"
                    custom:tickColor="@color/colorAccent"
                    custom:tickEnd="4000"
                    custom:tickHeight="0sp"
                    custom:tickInterval="100"
                    custom:tickStart="600" />

                <TextView
                    android:id="@+id/tvMaxPrice"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentRight="true"
                    android:layout_centerVertical="true"
                    android:text="₹ 4000"
                    android:textColor="@color/black" />

            </RelativeLayout>

It is possible to move thumb out of range

If i drag the thumb fast towards the edge of the screen, it is possible to move the thumb out of the range. I am using pinRadius 0dp and selectorSize 16dp.

Please see attached screenshot. Normally the min value is 0.

screenshot_20151112-123210

rangeBar throws NullPointer exception when it crosses an index

Hi,
I'm using the rangeBar with a single value. I have a bar with 24 indexes and whenever the pin crosses the index 3 the application throws a NullPointerException. Anyone having the same problem?
I already try to play with some xml properties but I still have the problem.

Below is my xml code:

<com.appyvet.rangebar.RangeBar
                xmlns:custom="http://schemas.android.com/apk/res-auto"
                android:id="@+id/slider"
                android:layout_width="wrap_content"
                android:layout_height="64dp"
                custom:tickStart="0"
                custom:tickInterval="1"
                custom:tickEnd="24"
                custom:pinColor="#ec3852"
                custom:pinRadius="10dp"
                custom:selectorColor="#ec3852"
                custom:tickColor="#00ffffff"
                custom:selectorSize="4dp"
                custom:connectingLineColor="#ec3852"
                custom:connectingLineWeight="1dp"
                custom:pinMaxFont="10sp"
                custom:barWeight="1dp"
                custom:rangeBar="false"
                android:layout_alignTop="@+id/search_radius"
                android:layout_alignEnd="@+id/slider2"
                android:layout_toEndOf="@+id/auto"
                android:layout_alignStart="@+id/slider2"
                android:layout_marginTop="8dp" />

Request : foreverPins

I have a request : always show the pins with values, even when user don't drag it. (poke @jkwiecien who have made a good work with temporaryPins)

Not possible to track when I release my finger from the rangebar?

I want to send something to a server when I stop touching the rangebar, i.e do the same thing as onStopTrackingTouch() in the Android SeekBar. The only way I've found of doing this is to use an onTouchListener and check MotionEvent.ACTION_UP, but then the view of the RangeBar does not update until I release my finger.

I can't use onRangeBarChangeListener() for this, as I don't want to be sending information to the server on every change.

Is there any easy way of doing this? :)

Thanks in advance!

Seekbar mode => thumb not moving when user touching the x axis(value)

If u will disable RangeBar Mode
isRangeBar = false

Visible thumb on seekbar moving only when u do something like drag and drog..
It should also moving like in RangeBar Mode ( click on the axis x Value and thumb moving to this value).

FAST SOLUTION:

private void onActionMove(float x) {

    // Move the pressed thumb to the new x-position.
    if (mIsRangeBar && mLeftThumb.isPressed()) {
        movePin(mLeftThumb, x);
    } else if (mRightThumb.isPressed()) {
        movePin(mRightThumb, x);
   **  add This condition to onActionMove**
    } else if ( mIsRangeBar == false){
        movePin(mRightThumb, x);
    }

Make the size of the bubble text constant?

Is there anyway to stop the bubble text from getting bigger as it goes from smaller to bigger numbers, and v.v.? I really think it's just ugly to scale the size of the text and not making it constant.

Also, is there anyway to set the typeface, style, etc. of the bubble text? I find this library so helpful if only not on these issues. Thanks.

barColor attribute not working

custom:barColor = "#ffffff"

gives error "No resource identifier found for attribute 'barColor' in package 'com.example.android'

setEnabled(false) makes pins invisible when using permanent pins

custom:temporaryPins="false"
I switch rangeBars enabled property with this: mRangeBar.setEnabled(enable);
Setting it false makes pins invisible (I think it should only set the color gray). Switching it back to enabled doesn't make the pins visible again.
When temporaryPins set to true, it works as intended.

RangeBar Mode => thumbs hiding when u setRangePingByValue , setByIndex, setTick = w/e its always hiding thumbs :D

Problem is there

if (pinRadiusDP == -1) {
            mPinRadiusPx = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
                    DEFAULT_THUMB_RADIUS_DP,
                    mRes.getDisplayMetrics());
        } else {
            mPinRadiusPx = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
            ->>     pinRadiusDP,
                    mRes.getDisplayMetrics());
        }

pinRadiusDP == 0..0
soo its not going to the first condition.. and setting pinRadius to 0.0 DP so pins are invisible.

FAST SOLUTION:
change the dp value

  if (pinRadiusDP == -1) {
            mPinRadiusPx = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
                    DEFAULT_THUMB_RADIUS_DP,
                    mRes.getDisplayMetrics());
        } else {
            mPinRadiusPx = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
                -->>    DEFAULT_THUMB_RADIUS_DP,
                    mRes.getDisplayMetrics());
        }

but if You will update this library to new version change the condition

Event with start and finish of drag

Hello, I'd like to know if exists a way to can add listeners when starts drag and finish because I need this data to save in remove database and doing it every time is dragging is very heavy.

Thanks.

float number precision loss when the range is large.

Since all the methods like setTickStart(), setTickEnd(), setTickInterval(),setRangePinsByValue() and the others all take float values, when the range is large the numbers loose precision and hence loose data.
Please take note on this issue

Pin text length limitation

Hello!
Why you need this text formatter?
private PinTextFormatter mPinTextFormatter = new PinTextFormatter() { @Override public String getText(String value) { if (value.length() > 4) { return value.substring(0, 4); } else { return value; } } };

Have some corresponding issues.

Worst lib I ever seen

Nothing works properly, values are donated when I am getting left/right index also it goes out of range if you move it to the end couple of times also it not support setRangePinsByIndices(x,y) properly... in one word - it' a big bit SHIT!

Give user the ability to set Maximium and Minimum Pin font size

It would be a nice feature to allow the user to define what the maximum and minimum Pint texts font size. I have noticed that when a Pins text contains 2 characters the font size shrinks. I believe it would be more aesthetic if the font size was the same throughout and let the user decide.

It seems as though if you let the user change
mMinPinFont
https://github.com/oli107/material-range-bar/blob/master/rangebar/src/com/appyvet/rangebar/PinView.java#L88

and
mMaxPinFont
https://github.com/oli107/material-range-bar/blob/master/rangebar/src/com/appyvet/rangebar/PinView.java#L90

It would allow the user to define the right size that works for them.

Or implement a variable that if set, sets the font size of the text.

IllegalArgumentException: Pin value

On some devices I get crashes like this:

Fatal Exception: java.lang.IllegalArgumentException: Pin value left 0.0, or right 120.0 is out of bounds. Check that it is greater than the minimum (0.0) and less than the maximum value (100.0)

How can I avoid this? Because when I test it on all my devices that I have I never get that exception? I can't see how they can slide so far to the right that it goes over the max because the UI doesn't let you do that?

Unable to set Thumb Radius and Thumb Color from XML or Java

Wiki states that :
custom:thumbRadius / setThumbRadius(dim) can be used for thumb radius customisation and
custom:thumbColorNormal / setThumbColorNormal(int) can be used for thumb colour customisation

But I am unable to set any of these from XML or Java code.
I looked into the attrs.xml file in res/values, it doesn't even have these attributes. Neither does the RangeBar class have the stated methods.

Customization issue

  1. is there ability to write on selectors, instead of using pins?
  2. can i apply gradient as line color?

AppBaseTheme declaration causing issues on pre lollipop devices

I included this library in my project which already had a style AppTheme and AppBaseTheme defined. This caused an issue where the AppCompatBase theme from the library is used from the libraries values-v11/styles.xml instead of the AppCompatBase theme from my values/styles.xml.

removing float bubble

how can id disable bubble float of range bar? i just want sometimes to use without float bubble

Disable moving one pin to position where is second pin

Is possible to disable moving one pin to position where is second pin? Now user can set the same value for left and right pin and then it looks like there is only one pin. If I do condition in listener it do not looks good.

TickEnd and TickStart does not work

Hey.
I started to use your library, and noticed a strange bug that I found TickEnd and TickStart, but I can still move the pin of range (TickEnd and TickStart)
Here's a screenshot:
Before the move::

After the move:

It is observed on the Android 4.2.2 (API 17) and Android 5.1.1 (API 22)

onRestoreInstanceState IllegalArgumentException

I get this crash report from a Android 5.1 device (Xperia ZR). I think it's a problem with onRestoreInstanceState in Fragments. Any ideas?

java.lang.IllegalArgumentException: Pin index left 0, or right 31 is out of bounds. Check that it is greater than the minimum (100.0) and less than the maximum value (250.0)
at com.appyvet.rangebar.RangeBar.setRangePinsByIndices(RangeBar.java)
setRangePinsByValue(RangeBar.java)
rangeBarInit(RangeBar.java)
createBar(RangeBar.java)
isValidTickCount(RangeBar.java)
onActionMove(RangeBar.java)
pressPin(RangeBar.java)
movePin(RangeBar.java)
access$002(RangeBar.java)
access$000(RangeBar.java)
at com.appyvet.rangebar.RangeBar.onRestoreInstanceState(RangeBar.java)
at android.view.View.dispatchRestoreInstanceState(View.java:13823)
at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:2894)
at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:2894)
at android.view.View.restoreHierarchyState(View.java:13801)
at android.support.v4.app.Fragment.restoreViewState(Fragment.java)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java)
at android.support.v4.app.FragmentManagerImpl.execSingleAction(FragmentManagerImpl.java)
at android.support.v4.app.BackStackRecord.commitNowAllowingStateLoss(BackStackRecord.java)
at android.support.v4.app.FragmentStatePagerAdapter.finishUpdate(FragmentStatePagerAdapter.java)
at android.support.v4.view.ViewPager.populate(ViewPager.java)
at android.support.v4.view.ViewPager.setCurrentItemInternal(ViewPager.java)
at android.support.v4.view.ViewPager.setCurrentItemInternal(ViewPager.java)
at android.support.v4.view.ViewPager.setCurrentItem(ViewPager.java)
at com.astuetz.PagerSlidingTabStrip$2.onClick(PagerSlidingTabStrip.java)
at android.view.View.performClick(View.java:4856)
at android.view.View$PerformClick.run(View.java:19956)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:211)
at android.app.ActivityThread.main(ActivityThread.java:5389)
at java.lang.reflect.Method.invoke(Method.java)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1020)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:815)

Can't set the Maximum Value more than 9999.

I want to set the value for range bar is between 0-100000. The maximum value is set as 1000 after 9999. Below is my xml file.

<com.appyvet.rangebar.RangeBar
xmlns:custom="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="72dp"
android:id="@+id/priceRangeBar"
custom:tickStart="0"
custom:tickInterval="5000"
custom:tickEnd="100000"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_centerHorizontal="true"/>

Library to inherit from projects color file

I recently imported this library into my project, however the color of the range bar does not match the rest of my application?

I know i'm being picky now, but I really feel that by default the library should look at the accent and primary colors of the app, so it can be even more material design compatible.


    <color name="colorPrimaryDark">#01B169</color>
    <color name="colorPrimary">#78D64B</color>
    <color name="colorAccent">#2CD5C4</color>

onRestoreInstanceState, Thumbs are not visible

When onRestoreInstanceState of the view is called, the thumbs become invisible. I think that's because createPins method is called, and it creates thumbs with 0 radius pans.


mRightThumb
                .init(ctx, yPos, 0, mPinColor, mTextColor, mCircleSize, mCircleColor, mMinPinFont,
                        mMaxPinFont, false);

Please fix it.

Pin disappears on setRangePinsByIndices

My rangebar with constant pin (not the tmeporary one) and only right pin behaves badly when rangebar.setRangePinsByIndices(0, 3); is called. I managed to reproduce it on the sample app. The thing is it only reproduces when setRangePinsByIndices is called after some time like this:

rangebar.postDelayed(new Runnable() {
            @Override
            public void run() {
                rangebar.setRangePinsByIndices(0, 3);
            }
        }, 2000);

It's a simple sample but it behaves the same way when threading with rxjava and probably anything else.

I made a branch demonstrating that on my fork: https://github.com/jkwiecien/material-range-bar/tree/pin-disappear

Rangebar left pin stuck at beginning until dragged 1/3 of the way to the left.

I have noticed when the rangebar is aligned by component to the left of another view the left hand pin freezes when dragged until a certain distance is reached. It seems to "snap" to a certain index then "snap" back. Here is a video of it https://youtu.be/R0Q7NwYOskg.

As you can see as well clicks also do not work within the non functioning range.

Here is the setup for that video. Its a starter project with the following activity main.

<TextView
    android:text="@string/hello_world"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/textView"/>

<com.appyvet.rangebar.RangeBar
    xmlns:custom="http://schemas.android.com/apk/res-auto"
    android:id="@+id/waveDirectionRangebar"
    android:layout_width="250dp"
    android:layout_height="72dp"
    custom:tickStart="1"
    custom:tickInterval="1"
    custom:tickEnd="17"
    custom:connectingLineColor="#2196F3"
    custom:tickColor="#FFEBEE"
    custom:selectorColor="#FFEBEE"
    custom:pinColor="#F44336"
    custom:pinPadding="10dp"
    custom:rangeBarColor="#F44336"
    custom:pinMaxFont="12dp"
    custom:pinMinFont="12dp"
    android:layout_below="@+id/textView"
    android:layout_toRightOf="@+id/textView"
    android:layout_toEndOf="@+id/textView"/>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.