yushilong / android-wheel Goto Github PK
View Code? Open in Web Editor NEWAutomatically exported from code.google.com/p/android-wheel
Automatically exported from code.google.com/p/android-wheel
Current NumericWheelAdapter implementation only takes an integer, then convert
to string. It would be nice if it could allow formatted string i.e.
00,01,02,... as in minutes or even decimal.
It can be easily done by introducing an additional constructor to
NumericWheelAdapter:
private String format = null;
public NumericWheelAdapter(int minValue, int maxValue, String format) {
this.minValue = minValue;
this.maxValue = maxValue;
this.format = format;
}
// And modification to the getItem method:
public String getItem(int index) {
if (index >= 0 && index < getItemsCount()) {
if(this.format != null) {
return String.format(this.format, minValue+index);
} else {
return Integer.toString(minValue + index);
}
}
return null;
}
I'm attaching a new NumericWheelAdapter.java
Original issue reported on code.google.com by [email protected]
on 8 Nov 2010 at 3:01
Attachments:
Hi, I would love to have the following missing animations:
a)
onFling animation. When I scroll too fast, it should go fast until it stops.
b)
Animate to the correct position.
When you select in the middle between two options instead of animateTo it just
place the correct one.
You can get some code that does the following here:
http://code.google.com/p/android-misc-widgets/source/browse/trunk/android-misc-w
idgets/src/org/miscwidgets/widget/Switcher.java
Thanks!
Original issue reported on code.google.com by [email protected]
on 8 Nov 2010 at 6:17
Dear sir, first.thanks for your great work .I get a issue to report,maybe it
can make this view more helpful.
What steps will reproduce the problem?
1. setup two wheel view called level1 and level2
2. setup a change listener to level1,update the level2's adapter in the
listener's method
3. scroll up and down of level1 wheel, level2 not update (repaint)
What is the expected output? What do you see instead?
It should update the level2 wheel.
Code likes below:
this.level1ItemWheel = (WheelView) findViewById(R.id.level1Item);
this.level2ItemWheel = (WheelView) findViewById(R.id.level2Item);
level1ItemWheel.setAdapter(new ArrayWheelAdapter<String>(
new String[]{"level1A","level1B"}));
level1ItemWheel.setVisibleItems(5);
level1ItemWheel.setCurrentItem(0);
level2ItemWheel.setAdapter(new ArrayWheelAdapter<String>(
new String["child1_of_level1A","child2_of_level1A"]));
level2ItemWheel.setVisibleItems(5);
level2ItemWheel.setCurrentItem(0);
level1ItemWheel.addChangingListener(new OnWheelChangedListener(){
public void onChanged(WheelView wheel, int oldValue, int newValue) {
if (wheel == level1ItemWheel && newValue==1) { //when scroll to levelB,change it's child list.
String level1Item = wheel.getAdapter().getItem(newValue);
//not working!!!!!!!!!!!!!!!!here
level2ItemWheel.setAdapter(new ArrayWheelAdapter<String>( new String[]{"child1_of_level1B"} ));
level2ItemWheel.setVisibleItems(5);
level2ItemWheel.setCurrentItem(0);
return;
}
);
How to fix it:
I found that setCurrentItem of WheelView ,check the select index before
invalidate the ui.
public void setCurrentItem(int index, boolean forceInvalidate) {
if (index != currentItem) {
invalidateLayouts();
int old = currentItem;
currentItem = index;
notifyChangingListeners(old, currentItem);
invalidate();
}
}
This may cause the second wheel not update view in this situation. I overload a
new method:
public void setCurrentItem(int index, boolean forceInvalidate) {
if (forceInvalidate || index != currentItem) { //use can choose weather he want to update the ui to new adapter here
invalidateLayouts();
int old = currentItem;
currentItem = index;
notifyChangingListeners(old, currentItem);
invalidate();
}
}
And modify the code line in the change listener:
level2ItemWheel.setAdapter(new ArrayWheelAdapter<String>( new
String[]{"child1_of_level1B"} ));
level2ItemWheel.setVisibleItems(5);
level2ItemWheel.setCurrentItem(0,true);///And now it can work now!!!
Hope this can help....
Original issue reported on code.google.com by [email protected]
on 31 Oct 2010 at 12:06
What steps will reproduce the problem?
>adb.exe install wheel.apk
825 KB/s (29602 bytes in 0.035s)
Can't dispatch DDM chunk 46454154: no handler defined
Can't dispatch DDM chunk 4d505251: no handler defined
pkg: /data/local/tmp/wheel.apk
Success
After this I can see the application icon, but I can't access the menu items
Cities, and others
What version of the product are you using? On what operating system?
Version of wheel demo: 1.2
Version of android sdk: r06 for windows
Eclipse: Galileo
OS: Vista Business
Original issue reported on code.google.com by [email protected]
on 11 Sep 2010 at 12:02
Attachments:
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.