Open RawanHamad opened 6 years ago
Hi Rawan,
Thats a great question, however my recommendation would be to increase the max value in that case.
So, for example, instead of setting a max value of 10, and progressing in bunch's of 1, you could set a max value of 100 and progress in a bunch of 10's. In this case, if you want to set a value of 1.5/10, you could use 15/100.
Thanks and Regards, Rachit Goyal
On Tue, 14 Aug 2018, 7:20 pm Rawan Hamad, notifications@github.com wrote:
Hello Ray, great library , but I'm wondering if we can have list of doubles as values not only integers. to represent 1.5 and so on ?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/rayzone107/SegmentedProgressBar/issues/1, or mute the thread https://github.com/notifications/unsubscribe-auth/AGcebLTNP45dTTN_1sP83Vh_RDYbDa7aks5uQtWrgaJpZM4V8eaU .
so it's doable using your library ? what do you mean by max value ? the divisions ?
Yes, this can be done using my library.
So, for starters, there is a property of the view called "divisions". This property defines the maximum number of divisions. You can set it as below within the XML (bold line):
<com.rachitgoyal.segmented.SegmentedProgressBar android:id="@+id/segmented_progress_bar" android:layout_width="match_parent" android:layout_height="10dp"
app:divisions="100" \ Integer value for total number of divisions* app:progressBarBackgroundColor="#b4b4b4" \ Progress bar background color app:progressBarColor="#3d70d6" \ Progress bar color
app:dividerColor="#ffffff" \\ Divider color
app:dividerWidth="0dp" \\ Divider width -
set 0dp for no divider app:isDividerEnabled="true" \ Whether to show divider or not - no effect if dividerWidth not set app:cornerRadius="4dp" \ Corner radius for the progress bar />
Or you could set it programmatically as below:
SegmentedProgressBar spb = findViewById(R.id.segmented_progress_bar);
spb.setDivisions(100);
Now that your maximum divisions are defined, it's a simple matter of enabling the divisions you want.
So say suppose you want to enable the first 1.5 divisions out of 10, you can set them programmatically like below:
spb.setEnabledDivisions(Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15));
But the true power of the library is that it allows you to enable non-contiguous sections of the progress bar.
So you don't have to enable the sections in a sequential order. You just have to maintain a list of values, and only the sections that you want enabled.
So for instance, if you wanted to enable sections 3, 6, 8 and 9, you could do it like below:
spb.setEnabledDivisions(Arrays.asList(3, 6, 8, 9));
The above code would only enable the above sections, and the rest would remain disabled.
I hope I was able to explain it properly. If you have any further questions, feel free to ask me anytime.
Thanks and Regards, Rachit Goyal
On Tue, Aug 14, 2018 at 7:33 PM Rawan Hamad notifications@github.com wrote:
so it's doable using your library ? what do you mean by max value ? the divisions ?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/rayzone107/SegmentedProgressBar/issues/1#issuecomment-412882893, or mute the thread https://github.com/notifications/unsubscribe-auth/AGcebEGZUk3NJBSobKtweIg1YA9SYkXFks5uQtiogaJpZM4V8eaU .
I see I see , but using that way, it will no longer shows the divisions , it will not be segmented right ?
Yes yes, it can be.
That totally depends on which sections you enable.
Instead of enabling the 1 to 15 divisions, you can enable any set of sections.
For example, if you want the 3rd and half of the 5th section to be enabled, you can put values 30 - 40 and 50 - 55 in your enabled list. The logic at the end is just which sections you enable and how.
On Tue, 14 Aug 2018, 7:47 pm Rawan Hamad, notifications@github.com wrote:
I see I see , but using that way, it will no longer shows the divisions , it will not be segmented right ?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/rayzone107/SegmentedProgressBar/issues/1#issuecomment-412887753, or mute the thread https://github.com/notifications/unsubscribe-auth/AGcebG8X9F99ktFfMrKH1nWsN4JC7OjRks5uQtwHgaJpZM4V8eaU .
sorry for bothering, but I don't seem to get your answers , can we see an example together, for example I want the bar to have 10 division , and I want to highlight 6.5
how can I implement it :)
Ok, I'll give you the code for that, but what do you mean by enabling 6.5?
Do you mean like enabling sections from 1 to 6 and half of the 7th section?
On Tue, 14 Aug 2018, 8:00 pm Rawan Hamad, notifications@github.com wrote:
sorry for bothering, but I don't seem to get your answers , can we see an example together, for example I want the bar to have 10 division , and I want to highlight 6.5
how can I implement it :)
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/rayzone107/SegmentedProgressBar/issues/1#issuecomment-412891999, or mute the thread https://github.com/notifications/unsubscribe-auth/AGcebA9Et4xG0obLg48JX5bELLsxImsiks5uQt7ugaJpZM4V8eaU .
I want it like this for example
I think there is some confusion in how the library functions.
Let me explain, this library is like a normal android progress bar, with the added benefit that you can enable and disable any segment.
How an android progress bar works is that you give it a max value and a progress value. So for example, if you set the max value as 10 and the current progress as 4, the progress bar would be created in such a way that the first 40% of it would be enabled, while the last 60% would be disabled.
In my library, however, you have the added benefit that the sections don't have to be enabled sequentially and can be enabled in any order. So for instance, if you wanted a progress bar where there are 10 sections but you want the 3rd and 6th section to be enabled, you can do that with this library.
Does that help?
On Tue, 14 Aug 2018, 8:03 pm Rachit Goyal, rachitgoy@gmail.com wrote:
Ok, I'll give you the code for that, but what do you mean by enabling 6.5?
Do you mean like enabling sections from 1 to 6 and half of the 7th section?
On Tue, 14 Aug 2018, 8:00 pm Rawan Hamad, notifications@github.com wrote:
sorry for bothering, but I don't seem to get your answers , can we see an example together, for example I want the bar to have 10 division , and I want to highlight 6.5
how can I implement it :)
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/rayzone107/SegmentedProgressBar/issues/1#issuecomment-412891999, or mute the thread https://github.com/notifications/unsubscribe-auth/AGcebA9Et4xG0obLg48JX5bELLsxImsiks5uQt7ugaJpZM4V8eaU .
so we can't achieve the above result using this library ?
Ok, so this can't be done using my library yet. Let me see if I can do some work on this when I get some time.
Otherwise, you can fork my library and try and update the code yourself. I've no problems with that.
On Tue, 14 Aug 2018, 8:06 pm Rawan Hamad, notifications@github.com wrote:
I want it like this for example
[image: screen shot 2018-08-14 at 5 35 10 pm] https://user-images.githubusercontent.com/7834987/44098286-774dd430-9fe8-11e8-924b-6dd4711cd8aa.png
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/rayzone107/SegmentedProgressBar/issues/1#issuecomment-412894181, or mute the thread https://github.com/notifications/unsubscribe-auth/AGcebBBfahDWY3QZHD194TB-nL8xvDZfks5uQuBOgaJpZM4V8eaU .
thanks for your time and quick responses.
Not a problem buddy. If I do update the library, I'll let you know.
On Tue, 14 Aug 2018, 8:12 pm Rawan Hamad, notifications@github.com wrote:
thanks for your time and quick responses.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/rayzone107/SegmentedProgressBar/issues/1#issuecomment-412896519, or mute the thread https://github.com/notifications/unsubscribe-auth/AGcebJLGkv-RZiVErsMR2O8fNKGHwW04ks5uQuHYgaJpZM4V8eaU .
Hello Ray, great library , but I'm wondering if we can have list of doubles as values not only integers. to represent 1.5 and so on ?