The onItemClicked() method is called whenever a wheel item is clicked
22 | *
New Wheel position is set
23 | *
Wheel view is scrolled
24 | */
25 | public interface OnWheelClickedListener {
26 | /**
27 | * Callback method to be invoked when current item clicked
28 | * @param wheel the wheel view
29 | * @param itemIndex the index of clicked item
30 | */
31 | void onItemClicked(WheelView wheel, int itemIndex);
32 | }
33 |
--------------------------------------------------------------------------------
/wheel/src/kankan/wheel/widget/.svn/text-base/OnWheelScrollListener.java.svn-base:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010 Yuri Kanivets
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package kankan.wheel.widget;
18 |
19 | /**
20 | * Wheel scrolled listener interface.
21 | */
22 | public interface OnWheelScrollListener {
23 | /**
24 | * Callback method to be invoked when scrolling started.
25 | * @param wheel the wheel view whose state has changed.
26 | */
27 | void onScrollingStarted(WheelView wheel);
28 |
29 | /**
30 | * Callback method to be invoked when scrolling ended.
31 | * @param wheel the wheel view whose state has changed.
32 | */
33 | void onScrollingFinished(WheelView wheel);
34 | }
35 |
--------------------------------------------------------------------------------
/wheel/src/kankan/wheel/widget/.svn/text-base/OnWheelClickedListener.java.svn-base:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 Yuri Kanivets
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package kankan.wheel.widget;
18 |
19 | /**
20 | * Wheel clicked listener interface.
21 | *
The onItemClicked() method is called whenever a wheel item is clicked
22 | *
New Wheel position is set
23 | *
Wheel view is scrolled
24 | */
25 | public interface OnWheelClickedListener {
26 | /**
27 | * Callback method to be invoked when current item clicked
28 | * @param wheel the wheel view
29 | * @param itemIndex the index of clicked item
30 | */
31 | void onItemClicked(WheelView wheel, int itemIndex);
32 | }
33 |
--------------------------------------------------------------------------------
/wheel-demo/res/layout/date_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
17 |
18 |
21 |
24 |
27 |
28 |
--------------------------------------------------------------------------------
/wheel-demo/res/layout/.svn/text-base/date_layout.xml.svn-base:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
17 |
18 |
21 |
24 |
27 |
28 |
--------------------------------------------------------------------------------
/wheel-demo/res/layout/time2_day.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
13 |
21 |
22 |
25 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/wheel/src/kankan/wheel/widget/OnWheelChangedListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 Yuri Kanivets
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package kankan.wheel.widget;
18 |
19 | /**
20 | * Wheel changed listener interface.
21 | *
The onChanged() method is called whenever current wheel positions is changed:
22 | *
New Wheel position is set
23 | *
Wheel view is scrolled
24 | */
25 | public interface OnWheelChangedListener {
26 | /**
27 | * Callback method to be invoked when current item changed
28 | * @param wheel the wheel view whose state has changed
29 | * @param oldValue the old value of current item
30 | * @param newValue the new value of current item
31 | */
32 | void onChanged(WheelView wheel, int oldValue, int newValue);
33 | }
34 |
--------------------------------------------------------------------------------
/wheel-demo/res/layout/.svn/text-base/time2_day.xml.svn-base:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
13 |
21 |
22 |
25 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/wheel/src/kankan/wheel/widget/.svn/text-base/OnWheelChangedListener.java.svn-base:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 Yuri Kanivets
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package kankan.wheel.widget;
18 |
19 | /**
20 | * Wheel changed listener interface.
21 | *
The onChanged() method is called whenever current wheel positions is changed:
22 | *
New Wheel position is set
23 | *
Wheel view is scrolled
24 | */
25 | public interface OnWheelChangedListener {
26 | /**
27 | * Callback method to be invoked when current item changed
28 | * @param wheel the wheel view whose state has changed
29 | * @param oldValue the old value of current item
30 | * @param newValue the new value of current item
31 | */
32 | void onChanged(WheelView wheel, int oldValue, int newValue);
33 | }
34 |
--------------------------------------------------------------------------------
/wheel-demo/src/kankan/wheel/demo/.svn/all-wcprops:
--------------------------------------------------------------------------------
1 | K 25
2 | svn:wc:ra_dav:version-url
3 | V 55
4 | /svn/!svn/ver/20/trunk/wheel-demo/src/kankan/wheel/demo
5 | END
6 | SlotMachineActivity.java
7 | K 25
8 | svn:wc:ra_dav:version-url
9 | V 80
10 | /svn/!svn/ver/20/trunk/wheel-demo/src/kankan/wheel/demo/SlotMachineActivity.java
11 | END
12 | WheelDemo.java
13 | K 25
14 | svn:wc:ra_dav:version-url
15 | V 70
16 | /svn/!svn/ver/18/trunk/wheel-demo/src/kankan/wheel/demo/WheelDemo.java
17 | END
18 | DateActivity.java
19 | K 25
20 | svn:wc:ra_dav:version-url
21 | V 73
22 | /svn/!svn/ver/18/trunk/wheel-demo/src/kankan/wheel/demo/DateActivity.java
23 | END
24 | PasswActivity.java
25 | K 25
26 | svn:wc:ra_dav:version-url
27 | V 74
28 | /svn/!svn/ver/18/trunk/wheel-demo/src/kankan/wheel/demo/PasswActivity.java
29 | END
30 | TimeActivity.java
31 | K 25
32 | svn:wc:ra_dav:version-url
33 | V 73
34 | /svn/!svn/ver/18/trunk/wheel-demo/src/kankan/wheel/demo/TimeActivity.java
35 | END
36 | Time2Activity.java
37 | K 25
38 | svn:wc:ra_dav:version-url
39 | V 74
40 | /svn/!svn/ver/18/trunk/wheel-demo/src/kankan/wheel/demo/Time2Activity.java
41 | END
42 | SpeedActivity.java
43 | K 25
44 | svn:wc:ra_dav:version-url
45 | V 74
46 | /svn/!svn/ver/18/trunk/wheel-demo/src/kankan/wheel/demo/SpeedActivity.java
47 | END
48 | CitiesActivity.java
49 | K 25
50 | svn:wc:ra_dav:version-url
51 | V 75
52 | /svn/!svn/ver/18/trunk/wheel-demo/src/kankan/wheel/demo/CitiesActivity.java
53 | END
54 |
--------------------------------------------------------------------------------
/wheel/src/kankan/wheel/widget/.svn/all-wcprops:
--------------------------------------------------------------------------------
1 | K 25
2 | svn:wc:ra_dav:version-url
3 | V 52
4 | /svn/!svn/ver/20/trunk/wheel/src/kankan/wheel/widget
5 | END
6 | WheelView.java
7 | K 25
8 | svn:wc:ra_dav:version-url
9 | V 67
10 | /svn/!svn/ver/20/trunk/wheel/src/kankan/wheel/widget/WheelView.java
11 | END
12 | OnWheelChangedListener.java
13 | K 25
14 | svn:wc:ra_dav:version-url
15 | V 80
16 | /svn/!svn/ver/16/trunk/wheel/src/kankan/wheel/widget/OnWheelChangedListener.java
17 | END
18 | WheelAdapter.java
19 | K 25
20 | svn:wc:ra_dav:version-url
21 | V 70
22 | /svn/!svn/ver/14/trunk/wheel/src/kankan/wheel/widget/WheelAdapter.java
23 | END
24 | OnWheelScrollListener.java
25 | K 25
26 | svn:wc:ra_dav:version-url
27 | V 78
28 | /svn/!svn/ver/8/trunk/wheel/src/kankan/wheel/widget/OnWheelScrollListener.java
29 | END
30 | OnWheelClickedListener.java
31 | K 25
32 | svn:wc:ra_dav:version-url
33 | V 80
34 | /svn/!svn/ver/16/trunk/wheel/src/kankan/wheel/widget/OnWheelClickedListener.java
35 | END
36 | WheelScroller.java
37 | K 25
38 | svn:wc:ra_dav:version-url
39 | V 71
40 | /svn/!svn/ver/15/trunk/wheel/src/kankan/wheel/widget/WheelScroller.java
41 | END
42 | WheelRecycle.java
43 | K 25
44 | svn:wc:ra_dav:version-url
45 | V 70
46 | /svn/!svn/ver/17/trunk/wheel/src/kankan/wheel/widget/WheelRecycle.java
47 | END
48 | ItemsRange.java
49 | K 25
50 | svn:wc:ra_dav:version-url
51 | V 68
52 | /svn/!svn/ver/17/trunk/wheel/src/kankan/wheel/widget/ItemsRange.java
53 | END
54 |
--------------------------------------------------------------------------------
/wheel-demo/res/layout/time2_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
17 |
18 |
21 |
24 |
27 |
30 |
31 |
--------------------------------------------------------------------------------
/wheel-demo/res/drawable-hdpi/.svn/entries:
--------------------------------------------------------------------------------
1 | 10
2 |
3 | dir
4 | 20
5 | http://android-wheel.googlecode.com/svn/trunk/wheel-demo/res/drawable-hdpi
6 | http://android-wheel.googlecode.com/svn
7 |
8 |
9 |
10 | 2011-02-13T20:30:08.799354Z
11 | 18
12 | yuri.kanivets
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | c364614a-9a97-51b3-f556-90fca60df64e
28 |
29 | my_icon.png
30 | file
31 |
32 |
33 |
34 |
35 | 2011-11-04T10:44:55.000000Z
36 | 20be96179e5cd1c7bfdff74a3bb0e344
37 | 2011-02-13T20:30:08.799354Z
38 | 18
39 | yuri.kanivets
40 | has-props
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 | 13834
62 |
63 | wheel.png
64 | file
65 |
66 |
67 |
68 |
69 | 2011-11-04T10:44:55.000000Z
70 | 7c1d7de12e8af6fade3e5a9d89b77ee0
71 | 2011-02-13T20:30:08.799354Z
72 | 18
73 | yuri.kanivets
74 | has-props
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 | 4763
96 |
97 | icon.png
98 | file
99 |
100 |
101 |
102 |
103 | 2011-11-04T10:44:55.000000Z
104 | b627720bde39c611e308368d97d33af5
105 | 2011-02-13T20:30:08.799354Z
106 | 18
107 | yuri.kanivets
108 | has-props
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 | 4147
130 |
131 |
--------------------------------------------------------------------------------
/wheel-demo/res/layout/.svn/text-base/time2_layout.xml.svn-base:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
17 |
18 |
21 |
24 |
27 |
30 |
31 |
--------------------------------------------------------------------------------
/wheel/src/kankan/wheel/widget/WheelAdapter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010 Yuri Kanivets
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package kankan.wheel.widget;
18 |
19 | /**
20 | * Wheel adapter interface
21 | *
22 | * @deprecated Use WheelViewAdapter
23 | */
24 | public interface WheelAdapter {
25 | /**
26 | * Gets items count
27 | * @return the count of wheel items
28 | */
29 | public int getItemsCount();
30 |
31 | /**
32 | * Gets a wheel item by index.
33 | *
34 | * @param index the item index
35 | * @return the wheel item text or null
36 | */
37 | public String getItem(int index);
38 |
39 | /**
40 | * Gets maximum item length. It is used to determine the wheel width.
41 | * If -1 is returned there will be used the default wheel width.
42 | *
43 | * @return the maximum item length or -1
44 | */
45 | public int getMaximumLength();
46 | }
47 |
--------------------------------------------------------------------------------
/wheel/src/kankan/wheel/widget/.svn/text-base/WheelAdapter.java.svn-base:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010 Yuri Kanivets
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package kankan.wheel.widget;
18 |
19 | /**
20 | * Wheel adapter interface
21 | *
22 | * @deprecated Use WheelViewAdapter
23 | */
24 | public interface WheelAdapter {
25 | /**
26 | * Gets items count
27 | * @return the count of wheel items
28 | */
29 | public int getItemsCount();
30 |
31 | /**
32 | * Gets a wheel item by index.
33 | *
34 | * @param index the item index
35 | * @return the wheel item text or null
36 | */
37 | public String getItem(int index);
38 |
39 | /**
40 | * Gets maximum item length. It is used to determine the wheel width.
41 | * If -1 is returned there will be used the default wheel width.
42 | *
43 | * @return the maximum item length or -1
44 | */
45 | public int getMaximumLength();
46 | }
47 |
--------------------------------------------------------------------------------
/wheel/res/drawable/wheel_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
20 |
21 |
22 |
23 |
24 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/wheel/res/drawable/.svn/text-base/wheel_bg.xml.svn-base:
--------------------------------------------------------------------------------
1 |
2 |
3 |
20 |
21 |
22 |
23 |
24 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/wheel-demo/res/layout/cities_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
16 |
17 |
26 |
27 |
32 |
33 |
39 |
40 |
41 |
42 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/wheel-demo/res/layout/slot_machine_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
14 |
15 |
18 |
21 |
24 |
25 |
26 |
34 |
35 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/wheel-demo/res/layout/.svn/text-base/cities_layout.xml.svn-base:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
16 |
17 |
26 |
27 |
32 |
33 |
39 |
40 |
41 |
42 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/wheel-demo/res/layout/.svn/text-base/slot_machine_layout.xml.svn-base:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
14 |
15 |
18 |
21 |
24 |
25 |
26 |
34 |
35 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/wheel/src/kankan/wheel/widget/adapters/ArrayWheelAdapter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 Yuri Kanivets
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package kankan.wheel.widget.adapters;
17 |
18 | import android.content.Context;
19 |
20 | /**
21 | * The simple Array wheel adapter
22 | * @param the element type
23 | */
24 | public class ArrayWheelAdapter extends AbstractWheelTextAdapter {
25 |
26 | // items
27 | private T items[];
28 |
29 | /**
30 | * Constructor
31 | * @param context the current context
32 | * @param items the items
33 | */
34 | public ArrayWheelAdapter(Context context, T items[]) {
35 | super(context);
36 |
37 | //setEmptyItemResource(TEXT_VIEW_ITEM_RESOURCE);
38 | this.items = items;
39 | }
40 |
41 | @Override
42 | public CharSequence getItemText(int index) {
43 | if (index >= 0 && index < items.length) {
44 | T item = items[index];
45 | if (item instanceof CharSequence) {
46 | return (CharSequence) item;
47 | }
48 | return item.toString();
49 | }
50 | return null;
51 | }
52 |
53 | @Override
54 | public int getItemsCount() {
55 | return items.length;
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/wheel/.svn/entries:
--------------------------------------------------------------------------------
1 | 10
2 |
3 | dir
4 | 20
5 | http://android-wheel.googlecode.com/svn/trunk/wheel
6 | http://android-wheel.googlecode.com/svn
7 |
8 |
9 |
10 | 2011-03-03T20:28:37.246582Z
11 | 20
12 | yuri.kanivets
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | c364614a-9a97-51b3-f556-90fca60df64e
28 |
29 | default.properties
30 | file
31 |
32 |
33 |
34 |
35 | 2011-11-04T10:44:55.000000Z
36 | a525912cd77e3896da11cab0aefa98b7
37 | 2011-02-13T20:30:08.799354Z
38 | 18
39 | yuri.kanivets
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 | 469
62 |
63 | .classpath
64 | file
65 |
66 |
67 |
68 |
69 | 2011-11-04T10:44:55.000000Z
70 | 20cf7e6f1cd84dd2fc63bde4738a2a5e
71 | 2011-01-27T20:19:05.469651Z
72 | 14
73 | yuri.kanivets
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 | 273
96 |
97 | .project
98 | file
99 |
100 |
101 |
102 |
103 | 2011-11-04T10:44:55.000000Z
104 | b29b2d32e46955706fa612cecc8b7084
105 | 2010-06-09T13:12:40.940062Z
106 | 2
107 | yuri.kanivets
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 | 841
130 |
131 | AndroidManifest.xml
132 | file
133 |
134 |
135 |
136 |
137 | 2011-11-04T10:44:55.000000Z
138 | 56b27d33a2ffa2de0436e715a01dda97
139 | 2011-02-13T20:30:08.799354Z
140 | 18
141 | yuri.kanivets
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 | 342
164 |
165 | src
166 | dir
167 |
168 | gen
169 | dir
170 |
171 | res
172 | dir
173 |
174 |
--------------------------------------------------------------------------------
/wheel-demo/.svn/entries:
--------------------------------------------------------------------------------
1 | 10
2 |
3 | dir
4 | 20
5 | http://android-wheel.googlecode.com/svn/trunk/wheel-demo
6 | http://android-wheel.googlecode.com/svn
7 |
8 |
9 |
10 | 2011-03-03T20:28:37.246582Z
11 | 20
12 | yuri.kanivets
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | c364614a-9a97-51b3-f556-90fca60df64e
28 |
29 | default.properties
30 | file
31 |
32 |
33 |
34 |
35 | 2011-11-04T10:44:55.000000Z
36 | cc12338858d42aede326457c32169c09
37 | 2011-02-13T20:30:08.799354Z
38 | 18
39 | yuri.kanivets
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 | 486
62 |
63 | .classpath
64 | file
65 |
66 |
67 |
68 |
69 | 2011-11-04T10:44:55.000000Z
70 | fbdfdc634ad985dd48da73cf5d07573a
71 | 2011-02-13T20:30:08.799354Z
72 | 18
73 | yuri.kanivets
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 | 320
96 |
97 | .project
98 | file
99 |
100 |
101 |
102 |
103 | 2011-11-04T10:44:55.000000Z
104 | 1b8c427db03bcb7b6db4ffc75e068509
105 | 2011-02-13T20:30:08.799354Z
106 | 18
107 | yuri.kanivets
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 | 972
130 |
131 | AndroidManifest.xml
132 | file
133 |
134 |
135 |
136 |
137 | 2011-11-04T10:44:55.000000Z
138 | 2cca5f1e442b40cec0786ec40155d968
139 | 2011-02-13T20:30:08.799354Z
140 | 18
141 | yuri.kanivets
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 | 2678
164 |
165 | src
166 | dir
167 |
168 | gen
169 | dir
170 |
171 | res
172 | dir
173 |
174 |
--------------------------------------------------------------------------------
/wheel/src/kankan/wheel/widget/adapters/.svn/text-base/ArrayWheelAdapter.java.svn-base:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 Yuri Kanivets
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package kankan.wheel.widget.adapters;
17 |
18 | import android.content.Context;
19 |
20 | /**
21 | * The simple Array wheel adapter
22 | * @param the element type
23 | */
24 | public class ArrayWheelAdapter extends AbstractWheelTextAdapter {
25 |
26 | // items
27 | private T items[];
28 |
29 | /**
30 | * Constructor
31 | * @param context the current context
32 | * @param items the items
33 | */
34 | public ArrayWheelAdapter(Context context, T items[]) {
35 | super(context);
36 |
37 | //setEmptyItemResource(TEXT_VIEW_ITEM_RESOURCE);
38 | this.items = items;
39 | }
40 |
41 | @Override
42 | public CharSequence getItemText(int index) {
43 | if (index >= 0 && index < items.length) {
44 | T item = items[index];
45 | if (item instanceof CharSequence) {
46 | return (CharSequence) item;
47 | }
48 | return item.toString();
49 | }
50 | return null;
51 | }
52 |
53 | @Override
54 | public int getItemsCount() {
55 | return items.length;
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/wheel/src/kankan/wheel/widget/adapters/AdapterWheel.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 Yuri Kanivets
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package kankan.wheel.widget.adapters;
18 |
19 | import kankan.wheel.widget.WheelAdapter;
20 | import android.content.Context;
21 |
22 | /**
23 | * Adapter class for old wheel adapter (deprecated WheelAdapter class).
24 | *
25 | * @deprecated Will be removed soon
26 | */
27 | public class AdapterWheel extends AbstractWheelTextAdapter {
28 |
29 | // Source adapter
30 | private WheelAdapter adapter;
31 |
32 | /**
33 | * Constructor
34 | * @param context the current context
35 | * @param adapter the source adapter
36 | */
37 | public AdapterWheel(Context context, WheelAdapter adapter) {
38 | super(context);
39 |
40 | this.adapter = adapter;
41 | }
42 |
43 | /**
44 | * Gets original adapter
45 | * @return the original adapter
46 | */
47 | public WheelAdapter getAdapter() {
48 | return adapter;
49 | }
50 |
51 | @Override
52 | public int getItemsCount() {
53 | return adapter.getItemsCount();
54 | }
55 |
56 | @Override
57 | protected CharSequence getItemText(int index) {
58 | return adapter.getItem(index);
59 | }
60 |
61 | }
62 |
--------------------------------------------------------------------------------
/wheel-demo/res/layout/.svn/all-wcprops:
--------------------------------------------------------------------------------
1 | K 25
2 | svn:wc:ra_dav:version-url
3 | V 44
4 | /svn/!svn/ver/18/trunk/wheel-demo/res/layout
5 | END
6 | units_item.xml
7 | K 25
8 | svn:wc:ra_dav:version-url
9 | V 59
10 | /svn/!svn/ver/18/trunk/wheel-demo/res/layout/units_item.xml
11 | END
12 | country_layout.xml
13 | K 25
14 | svn:wc:ra_dav:version-url
15 | V 63
16 | /svn/!svn/ver/18/trunk/wheel-demo/res/layout/country_layout.xml
17 | END
18 | slot_machine_layout.xml
19 | K 25
20 | svn:wc:ra_dav:version-url
21 | V 68
22 | /svn/!svn/ver/18/trunk/wheel-demo/res/layout/slot_machine_layout.xml
23 | END
24 | wheel_text_item.xml
25 | K 25
26 | svn:wc:ra_dav:version-url
27 | V 64
28 | /svn/!svn/ver/18/trunk/wheel-demo/res/layout/wheel_text_item.xml
29 | END
30 | date_layout.xml
31 | K 25
32 | svn:wc:ra_dav:version-url
33 | V 60
34 | /svn/!svn/ver/18/trunk/wheel-demo/res/layout/date_layout.xml
35 | END
36 | passw_layout.xml
37 | K 25
38 | svn:wc:ra_dav:version-url
39 | V 61
40 | /svn/!svn/ver/18/trunk/wheel-demo/res/layout/passw_layout.xml
41 | END
42 | time_layout.xml
43 | K 25
44 | svn:wc:ra_dav:version-url
45 | V 60
46 | /svn/!svn/ver/18/trunk/wheel-demo/res/layout/time_layout.xml
47 | END
48 | cities_layout.xml
49 | K 25
50 | svn:wc:ra_dav:version-url
51 | V 62
52 | /svn/!svn/ver/18/trunk/wheel-demo/res/layout/cities_layout.xml
53 | END
54 | time2_layout.xml
55 | K 25
56 | svn:wc:ra_dav:version-url
57 | V 61
58 | /svn/!svn/ver/18/trunk/wheel-demo/res/layout/time2_layout.xml
59 | END
60 | time2_day.xml
61 | K 25
62 | svn:wc:ra_dav:version-url
63 | V 58
64 | /svn/!svn/ver/18/trunk/wheel-demo/res/layout/time2_day.xml
65 | END
66 | speed1_layout.xml
67 | K 25
68 | svn:wc:ra_dav:version-url
69 | V 62
70 | /svn/!svn/ver/18/trunk/wheel-demo/res/layout/speed1_layout.xml
71 | END
72 | slot_item.xml
73 | K 25
74 | svn:wc:ra_dav:version-url
75 | V 58
76 | /svn/!svn/ver/18/trunk/wheel-demo/res/layout/slot_item.xml
77 | END
78 |
--------------------------------------------------------------------------------
/wheel/src/kankan/wheel/widget/adapters/.svn/text-base/AdapterWheel.java.svn-base:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 Yuri Kanivets
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package kankan.wheel.widget.adapters;
18 |
19 | import kankan.wheel.widget.WheelAdapter;
20 | import android.content.Context;
21 |
22 | /**
23 | * Adapter class for old wheel adapter (deprecated WheelAdapter class).
24 | *
25 | * @deprecated Will be removed soon
26 | */
27 | public class AdapterWheel extends AbstractWheelTextAdapter {
28 |
29 | // Source adapter
30 | private WheelAdapter adapter;
31 |
32 | /**
33 | * Constructor
34 | * @param context the current context
35 | * @param adapter the source adapter
36 | */
37 | public AdapterWheel(Context context, WheelAdapter adapter) {
38 | super(context);
39 |
40 | this.adapter = adapter;
41 | }
42 |
43 | /**
44 | * Gets original adapter
45 | * @return the original adapter
46 | */
47 | public WheelAdapter getAdapter() {
48 | return adapter;
49 | }
50 |
51 | @Override
52 | public int getItemsCount() {
53 | return adapter.getItemsCount();
54 | }
55 |
56 | @Override
57 | protected CharSequence getItemText(int index) {
58 | return adapter.getItem(index);
59 | }
60 |
61 | }
62 |
--------------------------------------------------------------------------------
/wheel-demo/res/layout/passw_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
17 |
18 |
23 |
24 |
27 |
30 |
33 |
36 |
37 |
38 |
46 |
47 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/wheel-demo/res/layout/.svn/text-base/passw_layout.xml.svn-base:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
17 |
18 |
23 |
24 |
27 |
30 |
33 |
36 |
37 |
38 |
46 |
47 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/wheel/src/kankan/wheel/widget/ItemsRange.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Android Wheel Control.
3 | * https://code.google.com/p/android-wheel/
4 | *
5 | * Copyright 2011 Yuri Kanivets
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | */
19 |
20 | package kankan.wheel.widget;
21 |
22 | /**
23 | * Range for visible items.
24 | */
25 | public class ItemsRange {
26 | // First item number
27 | private int first;
28 |
29 | // Items count
30 | private int count;
31 |
32 | /**
33 | * Default constructor. Creates an empty range
34 | */
35 | public ItemsRange() {
36 | this(0, 0);
37 | }
38 |
39 | /**
40 | * Constructor
41 | * @param first the number of first item
42 | * @param count the count of items
43 | */
44 | public ItemsRange(int first, int count) {
45 | this.first = first;
46 | this.count = count;
47 | }
48 |
49 | /**
50 | * Gets number of first item
51 | * @return the number of the first item
52 | */
53 | public int getFirst() {
54 | return first;
55 | }
56 |
57 | /**
58 | * Gets number of last item
59 | * @return the number of last item
60 | */
61 | public int getLast() {
62 | return getFirst() + getCount() - 1;
63 | }
64 |
65 | /**
66 | * Get items count
67 | * @return the count of items
68 | */
69 | public int getCount() {
70 | return count;
71 | }
72 |
73 | /**
74 | * Tests whether item is contained by range
75 | * @param index the item number
76 | * @return true if item is contained
77 | */
78 | public boolean contains(int index) {
79 | return index >= getFirst() && index <= getLast();
80 | }
81 | }
--------------------------------------------------------------------------------
/wheel/src/kankan/wheel/widget/.svn/text-base/ItemsRange.java.svn-base:
--------------------------------------------------------------------------------
1 | /*
2 | * Android Wheel Control.
3 | * https://code.google.com/p/android-wheel/
4 | *
5 | * Copyright 2011 Yuri Kanivets
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | */
19 |
20 | package kankan.wheel.widget;
21 |
22 | /**
23 | * Range for visible items.
24 | */
25 | public class ItemsRange {
26 | // First item number
27 | private int first;
28 |
29 | // Items count
30 | private int count;
31 |
32 | /**
33 | * Default constructor. Creates an empty range
34 | */
35 | public ItemsRange() {
36 | this(0, 0);
37 | }
38 |
39 | /**
40 | * Constructor
41 | * @param first the number of first item
42 | * @param count the count of items
43 | */
44 | public ItemsRange(int first, int count) {
45 | this.first = first;
46 | this.count = count;
47 | }
48 |
49 | /**
50 | * Gets number of first item
51 | * @return the number of the first item
52 | */
53 | public int getFirst() {
54 | return first;
55 | }
56 |
57 | /**
58 | * Gets number of last item
59 | * @return the number of last item
60 | */
61 | public int getLast() {
62 | return getFirst() + getCount() - 1;
63 | }
64 |
65 | /**
66 | * Get items count
67 | * @return the count of items
68 | */
69 | public int getCount() {
70 | return count;
71 | }
72 |
73 | /**
74 | * Tests whether item is contained by range
75 | * @param index the item number
76 | * @return true if item is contained
77 | */
78 | public boolean contains(int index) {
79 | return index >= getFirst() && index <= getLast();
80 | }
81 | }
--------------------------------------------------------------------------------
/wheel-demo/res/drawable/.svn/entries:
--------------------------------------------------------------------------------
1 | 10
2 |
3 | dir
4 | 20
5 | http://android-wheel.googlecode.com/svn/trunk/wheel-demo/res/drawable
6 | http://android-wheel.googlecode.com/svn
7 |
8 |
9 |
10 | 2011-02-13T20:30:08.799354Z
11 | 18
12 | yuri.kanivets
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | c364614a-9a97-51b3-f556-90fca60df64e
28 |
29 | france.png
30 | file
31 |
32 |
33 |
34 |
35 | 2011-11-04T10:44:55.000000Z
36 | 5c23ece99e39d64fe110f47e112f7678
37 | 2011-02-13T20:30:08.799354Z
38 | 18
39 | yuri.kanivets
40 | has-props
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 | 349
62 |
63 | ukraine.png
64 | file
65 |
66 |
67 |
68 |
69 | 2011-11-04T10:44:55.000000Z
70 | 7487ad604fde25813ad5e4f6a0e7179d
71 | 2011-02-13T20:30:08.799354Z
72 | 18
73 | yuri.kanivets
74 | has-props
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 | 333
96 |
97 | layout_bg.xml
98 | file
99 |
100 |
101 |
102 |
103 | 2011-11-04T10:44:55.000000Z
104 | de1d0303b927ef4a4f17912bd4ab1759
105 | 2011-02-13T20:30:08.799354Z
106 | 18
107 | yuri.kanivets
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 | 973
130 |
131 | canada.png
132 | file
133 |
134 |
135 |
136 |
137 | 2011-11-04T10:44:55.000000Z
138 | cf6908d63b639c100942b467c534016f
139 | 2011-02-13T20:30:08.799354Z
140 | 18
141 | yuri.kanivets
142 | has-props
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 | 1378
164 |
165 | usa.png
166 | file
167 |
168 |
169 |
170 |
171 | 2011-11-04T10:44:55.000000Z
172 | 4417ac40c87f96465b1365bf9727c321
173 | 2011-02-13T20:30:08.799354Z
174 | 18
175 | yuri.kanivets
176 | has-props
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 | 3556
198 |
199 |
--------------------------------------------------------------------------------
/wheel/src/kankan/wheel/widget/adapters/WheelViewAdapter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 Yuri Kanivets
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package kankan.wheel.widget.adapters;
18 |
19 | import android.database.DataSetObserver;
20 | import android.view.View;
21 | import android.view.ViewGroup;
22 |
23 | /**
24 | * Wheel items adapter interface
25 | */
26 | public interface WheelViewAdapter {
27 | /**
28 | * Gets items count
29 | * @return the count of wheel items
30 | */
31 | public int getItemsCount();
32 |
33 | /**
34 | * Get a View that displays the data at the specified position in the data set
35 | *
36 | * @param index the item index
37 | * @param convertView the old view to reuse if possible
38 | * @param parent the parent that this view will eventually be attached to
39 | * @return the wheel item View
40 | */
41 | public View getItem(int index, View convertView, ViewGroup parent);
42 |
43 | /**
44 | * Get a View that displays an empty wheel item placed before the first or after
45 | * the last wheel item.
46 | *
47 | * @param convertView the old view to reuse if possible
48 | * @param parent the parent that this view will eventually be attached to
49 | * @return the empty item View
50 | */
51 | public View getEmptyItem(View convertView, ViewGroup parent);
52 |
53 | /**
54 | * Register an observer that is called when changes happen to the data used by this adapter.
55 | * @param observer the observer to be registered
56 | */
57 | public void registerDataSetObserver(DataSetObserver observer);
58 |
59 | /**
60 | * Unregister an observer that has previously been registered
61 | * @param observer the observer to be unregistered
62 | */
63 | void unregisterDataSetObserver (DataSetObserver observer);
64 | }
65 |
--------------------------------------------------------------------------------
/wheel/src/kankan/wheel/widget/adapters/.svn/text-base/WheelViewAdapter.java.svn-base:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 Yuri Kanivets
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package kankan.wheel.widget.adapters;
18 |
19 | import android.database.DataSetObserver;
20 | import android.view.View;
21 | import android.view.ViewGroup;
22 |
23 | /**
24 | * Wheel items adapter interface
25 | */
26 | public interface WheelViewAdapter {
27 | /**
28 | * Gets items count
29 | * @return the count of wheel items
30 | */
31 | public int getItemsCount();
32 |
33 | /**
34 | * Get a View that displays the data at the specified position in the data set
35 | *
36 | * @param index the item index
37 | * @param convertView the old view to reuse if possible
38 | * @param parent the parent that this view will eventually be attached to
39 | * @return the wheel item View
40 | */
41 | public View getItem(int index, View convertView, ViewGroup parent);
42 |
43 | /**
44 | * Get a View that displays an empty wheel item placed before the first or after
45 | * the last wheel item.
46 | *
47 | * @param convertView the old view to reuse if possible
48 | * @param parent the parent that this view will eventually be attached to
49 | * @return the empty item View
50 | */
51 | public View getEmptyItem(View convertView, ViewGroup parent);
52 |
53 | /**
54 | * Register an observer that is called when changes happen to the data used by this adapter.
55 | * @param observer the observer to be registered
56 | */
57 | public void registerDataSetObserver(DataSetObserver observer);
58 |
59 | /**
60 | * Unregister an observer that has previously been registered
61 | * @param observer the observer to be unregistered
62 | */
63 | void unregisterDataSetObserver (DataSetObserver observer);
64 | }
65 |
--------------------------------------------------------------------------------
/wheel/src/kankan/wheel/widget/adapters/AbstractWheelAdapter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 Yuri Kanivets
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package kankan.wheel.widget.adapters;
18 |
19 | import java.util.LinkedList;
20 | import java.util.List;
21 |
22 | import android.database.DataSetObserver;
23 | import android.view.View;
24 | import android.view.ViewGroup;
25 |
26 | /**
27 | * Abstract Wheel adapter.
28 | */
29 | public abstract class AbstractWheelAdapter implements WheelViewAdapter {
30 | // Observers
31 | private List datasetObservers;
32 |
33 | @Override
34 | public View getEmptyItem(View convertView, ViewGroup parent) {
35 | return null;
36 | }
37 |
38 | @Override
39 | public void registerDataSetObserver(DataSetObserver observer) {
40 | if (datasetObservers == null) {
41 | datasetObservers = new LinkedList();
42 | }
43 | datasetObservers.add(observer);
44 | }
45 |
46 | @Override
47 | public void unregisterDataSetObserver(DataSetObserver observer) {
48 | if (datasetObservers != null) {
49 | datasetObservers.remove(observer);
50 | }
51 | }
52 |
53 | /**
54 | * Notifies observers about data changing
55 | */
56 | protected void notifyDataChangedEvent() {
57 | if (datasetObservers != null) {
58 | for (DataSetObserver observer : datasetObservers) {
59 | observer.onChanged();
60 | }
61 | }
62 | }
63 |
64 | /**
65 | * Notifies observers about invalidating data
66 | */
67 | protected void notifyDataInvalidatedEvent() {
68 | if (datasetObservers != null) {
69 | for (DataSetObserver observer : datasetObservers) {
70 | observer.onInvalidated();
71 | }
72 | }
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/wheel/src/kankan/wheel/widget/adapters/.svn/text-base/AbstractWheelAdapter.java.svn-base:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 Yuri Kanivets
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package kankan.wheel.widget.adapters;
18 |
19 | import java.util.LinkedList;
20 | import java.util.List;
21 |
22 | import android.database.DataSetObserver;
23 | import android.view.View;
24 | import android.view.ViewGroup;
25 |
26 | /**
27 | * Abstract Wheel adapter.
28 | */
29 | public abstract class AbstractWheelAdapter implements WheelViewAdapter {
30 | // Observers
31 | private List datasetObservers;
32 |
33 | @Override
34 | public View getEmptyItem(View convertView, ViewGroup parent) {
35 | return null;
36 | }
37 |
38 | @Override
39 | public void registerDataSetObserver(DataSetObserver observer) {
40 | if (datasetObservers == null) {
41 | datasetObservers = new LinkedList();
42 | }
43 | datasetObservers.add(observer);
44 | }
45 |
46 | @Override
47 | public void unregisterDataSetObserver(DataSetObserver observer) {
48 | if (datasetObservers != null) {
49 | datasetObservers.remove(observer);
50 | }
51 | }
52 |
53 | /**
54 | * Notifies observers about data changing
55 | */
56 | protected void notifyDataChangedEvent() {
57 | if (datasetObservers != null) {
58 | for (DataSetObserver observer : datasetObservers) {
59 | observer.onChanged();
60 | }
61 | }
62 | }
63 |
64 | /**
65 | * Notifies observers about invalidating data
66 | */
67 | protected void notifyDataInvalidatedEvent() {
68 | if (datasetObservers != null) {
69 | for (DataSetObserver observer : datasetObservers) {
70 | observer.onInvalidated();
71 | }
72 | }
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/wheel/src/kankan/wheel/widget/adapters/.svn/entries:
--------------------------------------------------------------------------------
1 | 10
2 |
3 | dir
4 | 20
5 | http://android-wheel.googlecode.com/svn/trunk/wheel/src/kankan/wheel/widget/adapters
6 | http://android-wheel.googlecode.com/svn
7 |
8 |
9 |
10 | 2011-02-12T20:25:00.503011Z
11 | 17
12 | yuri.kanivets
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | c364614a-9a97-51b3-f556-90fca60df64e
28 |
29 | WheelViewAdapter.java
30 | file
31 |
32 |
33 |
34 |
35 | 2011-11-04T10:44:55.000000Z
36 | 5985deab8a5630192823679566bb6507
37 | 2011-02-12T20:25:00.503011Z
38 | 17
39 | yuri.kanivets
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 | 2040
62 |
63 | ArrayWheelAdapter.java
64 | file
65 |
66 |
67 |
68 |
69 | 2011-11-04T10:44:55.000000Z
70 | 334e56939f4ec9904213775e15f35753
71 | 2011-02-12T20:25:00.503011Z
72 | 17
73 | yuri.kanivets
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 | 1566
96 |
97 | AdapterWheel.java
98 | file
99 |
100 |
101 |
102 |
103 | 2011-11-04T10:44:55.000000Z
104 | 3da8d278f0d6cd3ecdcb604e4a2d79fa
105 | 2011-02-12T20:25:00.503011Z
106 | 17
107 | yuri.kanivets
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 | 1578
130 |
131 | NumericWheelAdapter.java
132 | file
133 |
134 |
135 |
136 |
137 | 2011-11-04T10:44:55.000000Z
138 | 6532ae41e3282b2fca0f6e6aa938026e
139 | 2011-02-12T20:25:00.503011Z
140 | 17
141 | yuri.kanivets
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 | 2387
164 |
165 | AbstractWheelAdapter.java
166 | file
167 |
168 |
169 |
170 |
171 | 2011-11-04T10:44:55.000000Z
172 | c12d137e26dc8677ed7ada4f1493fc3b
173 | 2011-02-12T20:25:00.503011Z
174 | 17
175 | yuri.kanivets
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 | 2102
198 |
199 | AbstractWheelTextAdapter.java
200 | file
201 |
202 |
203 |
204 |
205 | 2011-11-04T10:44:55.000000Z
206 | 37bde65be0589d8fe33d87fd72b68855
207 | 2011-02-12T20:25:00.503011Z
208 | 17
209 | yuri.kanivets
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 | 8112
232 |
233 |
--------------------------------------------------------------------------------
/wheel/src/kankan/wheel/widget/adapters/NumericWheelAdapter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 Yuri Kanivets
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package kankan.wheel.widget.adapters;
18 |
19 | import android.content.Context;
20 |
21 | /**
22 | * Numeric Wheel adapter.
23 | */
24 | public class NumericWheelAdapter extends AbstractWheelTextAdapter {
25 |
26 | /** The default min value */
27 | public static final int DEFAULT_MAX_VALUE = 9;
28 |
29 | /** The default max value */
30 | private static final int DEFAULT_MIN_VALUE = 0;
31 |
32 | // Values
33 | private int minValue;
34 | private int maxValue;
35 |
36 | // format
37 | private String format;
38 |
39 | /**
40 | * Constructor
41 | * @param context the current context
42 | */
43 | public NumericWheelAdapter(Context context) {
44 | this(context, DEFAULT_MIN_VALUE, DEFAULT_MAX_VALUE);
45 | }
46 |
47 | /**
48 | * Constructor
49 | * @param context the current context
50 | * @param minValue the wheel min value
51 | * @param maxValue the wheel max value
52 | */
53 | public NumericWheelAdapter(Context context, int minValue, int maxValue) {
54 | this(context, minValue, maxValue, null);
55 | }
56 |
57 | /**
58 | * Constructor
59 | * @param context the current context
60 | * @param minValue the wheel min value
61 | * @param maxValue the wheel max value
62 | * @param format the format string
63 | */
64 | public NumericWheelAdapter(Context context, int minValue, int maxValue, String format) {
65 | super(context);
66 |
67 | this.minValue = minValue;
68 | this.maxValue = maxValue;
69 | this.format = format;
70 | }
71 |
72 | @Override
73 | public CharSequence getItemText(int index) {
74 | if (index >= 0 && index < getItemsCount()) {
75 | int value = minValue + index;
76 | return format != null ? String.format(format, value) : Integer.toString(value);
77 | }
78 | return null;
79 | }
80 |
81 | @Override
82 | public int getItemsCount() {
83 | return maxValue - minValue + 1;
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/wheel/src/kankan/wheel/widget/adapters/.svn/text-base/NumericWheelAdapter.java.svn-base:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 Yuri Kanivets
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package kankan.wheel.widget.adapters;
18 |
19 | import android.content.Context;
20 |
21 | /**
22 | * Numeric Wheel adapter.
23 | */
24 | public class NumericWheelAdapter extends AbstractWheelTextAdapter {
25 |
26 | /** The default min value */
27 | public static final int DEFAULT_MAX_VALUE = 9;
28 |
29 | /** The default max value */
30 | private static final int DEFAULT_MIN_VALUE = 0;
31 |
32 | // Values
33 | private int minValue;
34 | private int maxValue;
35 |
36 | // format
37 | private String format;
38 |
39 | /**
40 | * Constructor
41 | * @param context the current context
42 | */
43 | public NumericWheelAdapter(Context context) {
44 | this(context, DEFAULT_MIN_VALUE, DEFAULT_MAX_VALUE);
45 | }
46 |
47 | /**
48 | * Constructor
49 | * @param context the current context
50 | * @param minValue the wheel min value
51 | * @param maxValue the wheel max value
52 | */
53 | public NumericWheelAdapter(Context context, int minValue, int maxValue) {
54 | this(context, minValue, maxValue, null);
55 | }
56 |
57 | /**
58 | * Constructor
59 | * @param context the current context
60 | * @param minValue the wheel min value
61 | * @param maxValue the wheel max value
62 | * @param format the format string
63 | */
64 | public NumericWheelAdapter(Context context, int minValue, int maxValue, String format) {
65 | super(context);
66 |
67 | this.minValue = minValue;
68 | this.maxValue = maxValue;
69 | this.format = format;
70 | }
71 |
72 | @Override
73 | public CharSequence getItemText(int index) {
74 | if (index >= 0 && index < getItemsCount()) {
75 | int value = minValue + index;
76 | return format != null ? String.format(format, value) : Integer.toString(value);
77 | }
78 | return null;
79 | }
80 |
81 | @Override
82 | public int getItemsCount() {
83 | return maxValue - minValue + 1;
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/wheel-demo/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
58 |
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/wheel-demo/.svn/text-base/AndroidManifest.xml.svn-base:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
58 |
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/wheel-demo/src/kankan/wheel/demo/SpeedActivity.java:
--------------------------------------------------------------------------------
1 | package kankan.wheel.demo;
2 |
3 | import kankan.wheel.R;
4 | import kankan.wheel.widget.OnWheelChangedListener;
5 | import kankan.wheel.widget.WheelView;
6 | import kankan.wheel.widget.adapters.ArrayWheelAdapter;
7 | import kankan.wheel.widget.adapters.NumericWheelAdapter;
8 |
9 | import android.app.Activity;
10 | import android.content.Context;
11 | import android.os.Bundle;
12 |
13 | public class SpeedActivity extends Activity {
14 | @Override
15 | public void onCreate(Bundle savedInstanceState) {
16 | super.onCreate(savedInstanceState);
17 |
18 | setContentView(R.layout.speed1_layout);
19 | final WheelView speed = (WheelView) findViewById(R.id.speed);
20 | final SpeedAdapter speedAdapter = new SpeedAdapter(this, 245, 5);
21 | speed.setViewAdapter(speedAdapter);
22 |
23 | final String unitsValues[] = new String[] {
24 | "km/h",
25 | "m/h",
26 | "m/s",
27 | };
28 |
29 | final WheelView units = (WheelView) findViewById(R.id.units);
30 | ArrayWheelAdapter unitsAdapter =
31 | new ArrayWheelAdapter(this, unitsValues);
32 | unitsAdapter.setItemResource(R.layout.units_item);
33 | unitsAdapter.setItemTextResource(R.id.text);
34 | unitsAdapter.setEmptyItemResource(R.layout.units_item);
35 | units.setViewAdapter(unitsAdapter);
36 | //units.setVisibleItems(3);
37 |
38 | units.addChangingListener(new OnWheelChangedListener() {
39 | @Override
40 | public void onChanged(WheelView wheel, int oldValue, int newValue) {
41 | String value = unitsValues[units.getCurrentItem()];
42 | speedAdapter.setUnits(" " + value);
43 | speed.invalidateWheel(false);
44 | }
45 | });
46 |
47 | units.setCurrentItem(1);
48 | }
49 |
50 | /**
51 | * Speed adapter
52 | */
53 | private class SpeedAdapter extends NumericWheelAdapter {
54 | // Items step value
55 | private int step;
56 |
57 | /**
58 | * Constructor
59 | */
60 | public SpeedAdapter(Context context, int maxValue, int step) {
61 | super(context, 0, maxValue / step);
62 | this.step = step;
63 |
64 | setItemResource(R.layout.wheel_text_item);
65 | setItemTextResource(R.id.text);
66 | }
67 |
68 | /**
69 | * Sets units
70 | */
71 | public void setUnits(String units) {
72 | //this.units = units;
73 | }
74 |
75 | @Override
76 | public CharSequence getItemText(int index) {
77 | if (index >= 0 && index < getItemsCount()) {
78 | int value = index * step;
79 | return Integer.toString(value);
80 | }
81 | return null;
82 | }
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/wheel-demo/src/kankan/wheel/demo/.svn/text-base/SpeedActivity.java.svn-base:
--------------------------------------------------------------------------------
1 | package kankan.wheel.demo;
2 |
3 | import kankan.wheel.R;
4 | import kankan.wheel.widget.OnWheelChangedListener;
5 | import kankan.wheel.widget.WheelView;
6 | import kankan.wheel.widget.adapters.ArrayWheelAdapter;
7 | import kankan.wheel.widget.adapters.NumericWheelAdapter;
8 |
9 | import android.app.Activity;
10 | import android.content.Context;
11 | import android.os.Bundle;
12 |
13 | public class SpeedActivity extends Activity {
14 | @Override
15 | public void onCreate(Bundle savedInstanceState) {
16 | super.onCreate(savedInstanceState);
17 |
18 | setContentView(R.layout.speed1_layout);
19 | final WheelView speed = (WheelView) findViewById(R.id.speed);
20 | final SpeedAdapter speedAdapter = new SpeedAdapter(this, 245, 5);
21 | speed.setViewAdapter(speedAdapter);
22 |
23 | final String unitsValues[] = new String[] {
24 | "km/h",
25 | "m/h",
26 | "m/s",
27 | };
28 |
29 | final WheelView units = (WheelView) findViewById(R.id.units);
30 | ArrayWheelAdapter unitsAdapter =
31 | new ArrayWheelAdapter(this, unitsValues);
32 | unitsAdapter.setItemResource(R.layout.units_item);
33 | unitsAdapter.setItemTextResource(R.id.text);
34 | unitsAdapter.setEmptyItemResource(R.layout.units_item);
35 | units.setViewAdapter(unitsAdapter);
36 | //units.setVisibleItems(3);
37 |
38 | units.addChangingListener(new OnWheelChangedListener() {
39 | @Override
40 | public void onChanged(WheelView wheel, int oldValue, int newValue) {
41 | String value = unitsValues[units.getCurrentItem()];
42 | speedAdapter.setUnits(" " + value);
43 | speed.invalidateWheel(false);
44 | }
45 | });
46 |
47 | units.setCurrentItem(1);
48 | }
49 |
50 | /**
51 | * Speed adapter
52 | */
53 | private class SpeedAdapter extends NumericWheelAdapter {
54 | // Items step value
55 | private int step;
56 |
57 | /**
58 | * Constructor
59 | */
60 | public SpeedAdapter(Context context, int maxValue, int step) {
61 | super(context, 0, maxValue / step);
62 | this.step = step;
63 |
64 | setItemResource(R.layout.wheel_text_item);
65 | setItemTextResource(R.id.text);
66 | }
67 |
68 | /**
69 | * Sets units
70 | */
71 | public void setUnits(String units) {
72 | //this.units = units;
73 | }
74 |
75 | @Override
76 | public CharSequence getItemText(int index) {
77 | if (index >= 0 && index < getItemsCount()) {
78 | int value = index * step;
79 | return Integer.toString(value);
80 | }
81 | return null;
82 | }
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/wheel-demo/gen/kankan/wheel/R.java:
--------------------------------------------------------------------------------
1 | /* AUTO-GENERATED FILE. DO NOT MODIFY.
2 | *
3 | * This class was automatically generated by the
4 | * aapt tool from the resource data it found. It
5 | * should not be modified by hand.
6 | */
7 |
8 | package kankan.wheel;
9 |
10 | public final class R {
11 | public static final class attr {
12 | }
13 | public static final class drawable {
14 | public static final int canada=0x7f020000;
15 | public static final int france=0x7f020001;
16 | public static final int icon=0x7f020002;
17 | public static final int layout_bg=0x7f020003;
18 | public static final int my_icon=0x7f020004;
19 | public static final int ukraine=0x7f020005;
20 | public static final int usa=0x7f020006;
21 | public static final int wheel=0x7f020007;
22 | public static final int wheel_bg=0x7f020008;
23 | public static final int wheel_val=0x7f020009;
24 | }
25 | public static final class id {
26 | public static final int ampm=0x7f040017;
27 | public static final int btn_mix=0x7f04000c;
28 | public static final int city=0x7f040001;
29 | public static final int country=0x7f040000;
30 | public static final int country_name=0x7f040003;
31 | public static final int day=0x7f040004;
32 | public static final int flag=0x7f040002;
33 | public static final int hour=0x7f040015;
34 | public static final int item=0x7f04000d;
35 | public static final int mins=0x7f040016;
36 | public static final int month=0x7f040005;
37 | public static final int passw_1=0x7f040007;
38 | public static final int passw_2=0x7f040008;
39 | public static final int passw_3=0x7f040009;
40 | public static final int passw_4=0x7f04000a;
41 | public static final int pwd_status=0x7f04000b;
42 | public static final int slot_1=0x7f04000e;
43 | public static final int slot_2=0x7f04000f;
44 | public static final int slot_3=0x7f040010;
45 | public static final int speed=0x7f040011;
46 | public static final int text=0x7f040019;
47 | public static final int time=0x7f040018;
48 | public static final int time2_monthday=0x7f040014;
49 | public static final int time2_weekday=0x7f040013;
50 | public static final int units=0x7f040012;
51 | public static final int year=0x7f040006;
52 | }
53 | public static final class layout {
54 | public static final int cities_layout=0x7f030000;
55 | public static final int country_layout=0x7f030001;
56 | public static final int date_layout=0x7f030002;
57 | public static final int passw_layout=0x7f030003;
58 | public static final int slot_item=0x7f030004;
59 | public static final int slot_machine_layout=0x7f030005;
60 | public static final int speed1_layout=0x7f030006;
61 | public static final int time2_day=0x7f030007;
62 | public static final int time2_layout=0x7f030008;
63 | public static final int time_layout=0x7f030009;
64 | public static final int units_item=0x7f03000a;
65 | public static final int wheel_text_item=0x7f03000b;
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/wheel-demo/gen/kankan/wheel/demo/R.java:
--------------------------------------------------------------------------------
1 | /* AUTO-GENERATED FILE. DO NOT MODIFY.
2 | *
3 | * This class was automatically generated by the
4 | * aapt tool from the resource data it found. It
5 | * should not be modified by hand.
6 | */
7 |
8 | package kankan.wheel.demo;
9 |
10 | public final class R {
11 | public static final class attr {
12 | }
13 | public static final class drawable {
14 | public static final int canada=0x7f020000;
15 | public static final int france=0x7f020001;
16 | public static final int icon=0x7f020002;
17 | public static final int layout_bg=0x7f020003;
18 | public static final int my_icon=0x7f020004;
19 | public static final int ukraine=0x7f020005;
20 | public static final int usa=0x7f020006;
21 | public static final int wheel=0x7f020007;
22 | public static final int wheel_bg=0x7f020008;
23 | public static final int wheel_val=0x7f020009;
24 | }
25 | public static final class id {
26 | public static final int ampm=0x7f040017;
27 | public static final int btn_mix=0x7f04000c;
28 | public static final int city=0x7f040001;
29 | public static final int country=0x7f040000;
30 | public static final int country_name=0x7f040003;
31 | public static final int day=0x7f040004;
32 | public static final int flag=0x7f040002;
33 | public static final int hour=0x7f040015;
34 | public static final int item=0x7f04000d;
35 | public static final int mins=0x7f040016;
36 | public static final int month=0x7f040005;
37 | public static final int passw_1=0x7f040007;
38 | public static final int passw_2=0x7f040008;
39 | public static final int passw_3=0x7f040009;
40 | public static final int passw_4=0x7f04000a;
41 | public static final int pwd_status=0x7f04000b;
42 | public static final int slot_1=0x7f04000e;
43 | public static final int slot_2=0x7f04000f;
44 | public static final int slot_3=0x7f040010;
45 | public static final int speed=0x7f040011;
46 | public static final int text=0x7f040019;
47 | public static final int time=0x7f040018;
48 | public static final int time2_monthday=0x7f040014;
49 | public static final int time2_weekday=0x7f040013;
50 | public static final int units=0x7f040012;
51 | public static final int year=0x7f040006;
52 | }
53 | public static final class layout {
54 | public static final int cities_layout=0x7f030000;
55 | public static final int country_layout=0x7f030001;
56 | public static final int date_layout=0x7f030002;
57 | public static final int passw_layout=0x7f030003;
58 | public static final int slot_item=0x7f030004;
59 | public static final int slot_machine_layout=0x7f030005;
60 | public static final int speed1_layout=0x7f030006;
61 | public static final int time2_day=0x7f030007;
62 | public static final int time2_layout=0x7f030008;
63 | public static final int time_layout=0x7f030009;
64 | public static final int units_item=0x7f03000a;
65 | public static final int wheel_text_item=0x7f03000b;
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/wheel-demo/gen/kankan/wheel/.svn/text-base/R.java.svn-base:
--------------------------------------------------------------------------------
1 | /* AUTO-GENERATED FILE. DO NOT MODIFY.
2 | *
3 | * This class was automatically generated by the
4 | * aapt tool from the resource data it found. It
5 | * should not be modified by hand.
6 | */
7 |
8 | package kankan.wheel;
9 |
10 | public final class R {
11 | public static final class attr {
12 | }
13 | public static final class drawable {
14 | public static final int canada=0x7f020000;
15 | public static final int france=0x7f020001;
16 | public static final int icon=0x7f020002;
17 | public static final int layout_bg=0x7f020003;
18 | public static final int my_icon=0x7f020004;
19 | public static final int ukraine=0x7f020005;
20 | public static final int usa=0x7f020006;
21 | public static final int wheel=0x7f020007;
22 | public static final int wheel_bg=0x7f020008;
23 | public static final int wheel_val=0x7f020009;
24 | }
25 | public static final class id {
26 | public static final int ampm=0x7f040017;
27 | public static final int btn_mix=0x7f04000c;
28 | public static final int city=0x7f040001;
29 | public static final int country=0x7f040000;
30 | public static final int country_name=0x7f040003;
31 | public static final int day=0x7f040004;
32 | public static final int flag=0x7f040002;
33 | public static final int hour=0x7f040015;
34 | public static final int item=0x7f04000d;
35 | public static final int mins=0x7f040016;
36 | public static final int month=0x7f040005;
37 | public static final int passw_1=0x7f040007;
38 | public static final int passw_2=0x7f040008;
39 | public static final int passw_3=0x7f040009;
40 | public static final int passw_4=0x7f04000a;
41 | public static final int pwd_status=0x7f04000b;
42 | public static final int slot_1=0x7f04000e;
43 | public static final int slot_2=0x7f04000f;
44 | public static final int slot_3=0x7f040010;
45 | public static final int speed=0x7f040011;
46 | public static final int text=0x7f040019;
47 | public static final int time=0x7f040018;
48 | public static final int time2_monthday=0x7f040014;
49 | public static final int time2_weekday=0x7f040013;
50 | public static final int units=0x7f040012;
51 | public static final int year=0x7f040006;
52 | }
53 | public static final class layout {
54 | public static final int cities_layout=0x7f030000;
55 | public static final int country_layout=0x7f030001;
56 | public static final int date_layout=0x7f030002;
57 | public static final int passw_layout=0x7f030003;
58 | public static final int slot_item=0x7f030004;
59 | public static final int slot_machine_layout=0x7f030005;
60 | public static final int speed1_layout=0x7f030006;
61 | public static final int time2_day=0x7f030007;
62 | public static final int time2_layout=0x7f030008;
63 | public static final int time_layout=0x7f030009;
64 | public static final int units_item=0x7f03000a;
65 | public static final int wheel_text_item=0x7f03000b;
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/wheel-demo/gen/kankan/wheel/demo/.svn/text-base/R.java.svn-base:
--------------------------------------------------------------------------------
1 | /* AUTO-GENERATED FILE. DO NOT MODIFY.
2 | *
3 | * This class was automatically generated by the
4 | * aapt tool from the resource data it found. It
5 | * should not be modified by hand.
6 | */
7 |
8 | package kankan.wheel.demo;
9 |
10 | public final class R {
11 | public static final class attr {
12 | }
13 | public static final class drawable {
14 | public static final int canada=0x7f020000;
15 | public static final int france=0x7f020001;
16 | public static final int icon=0x7f020002;
17 | public static final int layout_bg=0x7f020003;
18 | public static final int my_icon=0x7f020004;
19 | public static final int ukraine=0x7f020005;
20 | public static final int usa=0x7f020006;
21 | public static final int wheel=0x7f020007;
22 | public static final int wheel_bg=0x7f020008;
23 | public static final int wheel_val=0x7f020009;
24 | }
25 | public static final class id {
26 | public static final int ampm=0x7f040017;
27 | public static final int btn_mix=0x7f04000c;
28 | public static final int city=0x7f040001;
29 | public static final int country=0x7f040000;
30 | public static final int country_name=0x7f040003;
31 | public static final int day=0x7f040004;
32 | public static final int flag=0x7f040002;
33 | public static final int hour=0x7f040015;
34 | public static final int item=0x7f04000d;
35 | public static final int mins=0x7f040016;
36 | public static final int month=0x7f040005;
37 | public static final int passw_1=0x7f040007;
38 | public static final int passw_2=0x7f040008;
39 | public static final int passw_3=0x7f040009;
40 | public static final int passw_4=0x7f04000a;
41 | public static final int pwd_status=0x7f04000b;
42 | public static final int slot_1=0x7f04000e;
43 | public static final int slot_2=0x7f04000f;
44 | public static final int slot_3=0x7f040010;
45 | public static final int speed=0x7f040011;
46 | public static final int text=0x7f040019;
47 | public static final int time=0x7f040018;
48 | public static final int time2_monthday=0x7f040014;
49 | public static final int time2_weekday=0x7f040013;
50 | public static final int units=0x7f040012;
51 | public static final int year=0x7f040006;
52 | }
53 | public static final class layout {
54 | public static final int cities_layout=0x7f030000;
55 | public static final int country_layout=0x7f030001;
56 | public static final int date_layout=0x7f030002;
57 | public static final int passw_layout=0x7f030003;
58 | public static final int slot_item=0x7f030004;
59 | public static final int slot_machine_layout=0x7f030005;
60 | public static final int speed1_layout=0x7f030006;
61 | public static final int time2_day=0x7f030007;
62 | public static final int time2_layout=0x7f030008;
63 | public static final int time_layout=0x7f030009;
64 | public static final int units_item=0x7f03000a;
65 | public static final int wheel_text_item=0x7f03000b;
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/wheel-demo/src/kankan/wheel/demo/.svn/entries:
--------------------------------------------------------------------------------
1 | 10
2 |
3 | dir
4 | 20
5 | http://android-wheel.googlecode.com/svn/trunk/wheel-demo/src/kankan/wheel/demo
6 | http://android-wheel.googlecode.com/svn
7 |
8 |
9 |
10 | 2011-03-03T20:28:37.246582Z
11 | 20
12 | yuri.kanivets
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | c364614a-9a97-51b3-f556-90fca60df64e
28 |
29 | SlotMachineActivity.java
30 | file
31 |
32 |
33 |
34 |
35 | 2011-11-04T10:44:55.000000Z
36 | dcdd324b6b22542ad12e9478e0abf369
37 | 2011-03-03T20:28:37.246582Z
38 | 20
39 | yuri.kanivets
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 | 6120
62 |
63 | WheelDemo.java
64 | file
65 |
66 |
67 |
68 |
69 | 2011-11-04T10:44:55.000000Z
70 | caf69cbd8ca48ac196b7f7590d636532
71 | 2011-02-13T20:30:08.799354Z
72 | 18
73 | yuri.kanivets
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 | 4295
96 |
97 | DateActivity.java
98 | file
99 |
100 |
101 |
102 |
103 | 2011-11-04T10:44:55.000000Z
104 | e3e6d0e9ce4580230bb9ea5ba63360db
105 | 2011-02-13T20:30:08.799354Z
106 | 18
107 | yuri.kanivets
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 | 4774
130 |
131 | PasswActivity.java
132 | file
133 |
134 |
135 |
136 |
137 | 2011-11-04T10:44:55.000000Z
138 | de48a0305869628d234d1dd29e4707fc
139 | 2011-02-13T20:30:08.799354Z
140 | 18
141 | yuri.kanivets
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 | 3956
164 |
165 | TimeActivity.java
166 | file
167 |
168 |
169 |
170 |
171 | 2011-11-04T10:44:55.000000Z
172 | 052217c3c72e61bb77c0d5c2955939b2
173 | 2011-02-13T20:30:08.799354Z
174 | 18
175 | yuri.kanivets
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 | 3547
198 |
199 | Time2Activity.java
200 | file
201 |
202 |
203 |
204 |
205 | 2011-11-04T10:44:55.000000Z
206 | 7984bd69737b0185dcd696243bfbdf57
207 | 2011-02-13T20:30:08.799354Z
208 | 18
209 | yuri.kanivets
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 | 4114
232 |
233 | SpeedActivity.java
234 | file
235 |
236 |
237 |
238 |
239 | 2011-11-04T10:44:55.000000Z
240 | af9eaa2685e7dc1ba9f9f7c1d6ce6896
241 | 2011-02-13T20:30:08.799354Z
242 | 18
243 | yuri.kanivets
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 |
265 | 2645
266 |
267 | CitiesActivity.java
268 | file
269 |
270 |
271 |
272 |
273 | 2011-11-04T10:44:55.000000Z
274 | b53f2e965349cda18a9e984bd2083289
275 | 2011-02-13T20:30:08.799354Z
276 | 18
277 | yuri.kanivets
278 |
279 |
280 |
281 |
282 |
283 |
284 |
285 |
286 |
287 |
288 |
289 |
290 |
291 |
292 |
293 |
294 |
295 |
296 |
297 |
298 |
299 | 3749
300 |
301 |
--------------------------------------------------------------------------------
/wheel/src/kankan/wheel/widget/.svn/entries:
--------------------------------------------------------------------------------
1 | 10
2 |
3 | dir
4 | 20
5 | http://android-wheel.googlecode.com/svn/trunk/wheel/src/kankan/wheel/widget
6 | http://android-wheel.googlecode.com/svn
7 |
8 |
9 |
10 | 2011-03-03T20:28:37.246582Z
11 | 20
12 | yuri.kanivets
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | c364614a-9a97-51b3-f556-90fca60df64e
28 |
29 | WheelView.java
30 | file
31 |
32 |
33 |
34 |
35 | 2011-11-04T10:44:55.000000Z
36 | a1bab49e4b41cb39ac0ac6167f5986b4
37 | 2011-03-03T20:28:37.246582Z
38 | 20
39 | yuri.kanivets
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 | 23156
62 |
63 | OnWheelChangedListener.java
64 | file
65 |
66 |
67 |
68 |
69 | 2011-11-04T10:44:55.000000Z
70 | ff43c80b89dbf0c4d2a235c2a9a752b2
71 | 2011-01-31T20:09:00.908159Z
72 | 16
73 | yuri.kanivets
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 | 1160
96 |
97 | adapters
98 | dir
99 |
100 | WheelAdapter.java
101 | file
102 |
103 |
104 |
105 |
106 | 2011-11-04T10:44:55.000000Z
107 | 0311cb24d6c48d1504a2de8c2d823c3f
108 | 2011-01-27T20:19:05.469651Z
109 | 14
110 | yuri.kanivets
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 | 1271
133 |
134 | OnWheelScrollListener.java
135 | file
136 |
137 |
138 |
139 |
140 | 2011-11-04T10:44:55.000000Z
141 | 457824f98919a11700361d4454944811
142 | 2010-10-30T18:27:33.465293Z
143 | 8
144 | yuri.kanivets
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 | 1060
167 |
168 | OnWheelClickedListener.java
169 | file
170 |
171 |
172 |
173 |
174 | 2011-11-04T10:44:55.000000Z
175 | 62556e469cce1cd1ecf245fd6f870fec
176 | 2011-01-31T20:09:00.908159Z
177 | 16
178 | yuri.kanivets
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 | 1084
201 |
202 | WheelScroller.java
203 | file
204 |
205 |
206 |
207 |
208 | 2011-11-04T10:44:55.000000Z
209 | 726f7b6351f9a0374d041dcef641a4cc
210 | 2011-01-30T18:43:37.273447Z
211 | 15
212 | yuri.kanivets
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 |
232 |
233 |
234 | 7293
235 |
236 | WheelRecycle.java
237 | file
238 |
239 |
240 |
241 |
242 | 2011-11-04T10:44:55.000000Z
243 | af2cf8a5ef333e117c33a04f6fd05b8a
244 | 2011-02-12T20:25:00.503011Z
245 | 17
246 | yuri.kanivets
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 |
265 |
266 |
267 |
268 | 3538
269 |
270 | ItemsRange.java
271 | file
272 |
273 |
274 |
275 |
276 | 2011-11-04T10:44:55.000000Z
277 | ab53b6a01db2ef021a56c8b354d4ce82
278 | 2011-02-12T20:25:00.503011Z
279 | 17
280 | yuri.kanivets
281 |
282 |
283 |
284 |
285 |
286 |
287 |
288 |
289 |
290 |
291 |
292 |
293 |
294 |
295 |
296 |
297 |
298 |
299 |
300 |
301 |
302 | 1762
303 |
304 |
--------------------------------------------------------------------------------
/wheel-demo/src/kankan/wheel/demo/TimeActivity.java:
--------------------------------------------------------------------------------
1 | package kankan.wheel.demo;
2 |
3 | import java.util.Calendar;
4 |
5 | import kankan.wheel.R;
6 | import kankan.wheel.widget.OnWheelChangedListener;
7 | import kankan.wheel.widget.OnWheelClickedListener;
8 | import kankan.wheel.widget.OnWheelScrollListener;
9 | import kankan.wheel.widget.WheelView;
10 | import kankan.wheel.widget.adapters.NumericWheelAdapter;
11 |
12 | import android.app.Activity;
13 | import android.os.Bundle;
14 | import android.widget.TimePicker;
15 |
16 | public class TimeActivity extends Activity {
17 | // Time changed flag
18 | private boolean timeChanged = false;
19 |
20 | // Time scrolled flag
21 | private boolean timeScrolled = false;
22 |
23 | @Override
24 | public void onCreate(Bundle savedInstanceState) {
25 | super.onCreate(savedInstanceState);
26 |
27 | setContentView(R.layout.time_layout);
28 |
29 | final WheelView hours = (WheelView) findViewById(R.id.hour);
30 | hours.setViewAdapter(new NumericWheelAdapter(this, 0, 23));
31 |
32 | final WheelView mins = (WheelView) findViewById(R.id.mins);
33 | mins.setViewAdapter(new NumericWheelAdapter(this, 0, 59, "%02d"));
34 | mins.setCyclic(true);
35 |
36 | final TimePicker picker = (TimePicker) findViewById(R.id.time);
37 | picker.setIs24HourView(true);
38 |
39 | // set current time
40 | Calendar c = Calendar.getInstance();
41 | int curHours = c.get(Calendar.HOUR_OF_DAY);
42 | int curMinutes = c.get(Calendar.MINUTE);
43 |
44 | hours.setCurrentItem(curHours);
45 | mins.setCurrentItem(curMinutes);
46 |
47 | picker.setCurrentHour(curHours);
48 | picker.setCurrentMinute(curMinutes);
49 |
50 | // add listeners
51 | addChangingListener(mins, "min");
52 | addChangingListener(hours, "hour");
53 |
54 | OnWheelChangedListener wheelListener = new OnWheelChangedListener() {
55 | public void onChanged(WheelView wheel, int oldValue, int newValue) {
56 | if (!timeScrolled) {
57 | timeChanged = true;
58 | picker.setCurrentHour(hours.getCurrentItem());
59 | picker.setCurrentMinute(mins.getCurrentItem());
60 | timeChanged = false;
61 | }
62 | }
63 | };
64 | hours.addChangingListener(wheelListener);
65 | mins.addChangingListener(wheelListener);
66 |
67 | OnWheelClickedListener click = new OnWheelClickedListener() {
68 | public void onItemClicked(WheelView wheel, int itemIndex) {
69 | wheel.setCurrentItem(itemIndex, true);
70 | }
71 | };
72 | hours.addClickingListener(click);
73 | mins.addClickingListener(click);
74 |
75 | OnWheelScrollListener scrollListener = new OnWheelScrollListener() {
76 | public void onScrollingStarted(WheelView wheel) {
77 | timeScrolled = true;
78 | }
79 | public void onScrollingFinished(WheelView wheel) {
80 | timeScrolled = false;
81 | timeChanged = true;
82 | picker.setCurrentHour(hours.getCurrentItem());
83 | picker.setCurrentMinute(mins.getCurrentItem());
84 | timeChanged = false;
85 | }
86 | };
87 |
88 | hours.addScrollingListener(scrollListener);
89 | mins.addScrollingListener(scrollListener);
90 |
91 | picker.setOnTimeChangedListener(new TimePicker.OnTimeChangedListener() {
92 | public void onTimeChanged(TimePicker view, int hourOfDay, int minute) {
93 | if (!timeChanged) {
94 | hours.setCurrentItem(hourOfDay, true);
95 | mins.setCurrentItem(minute, true);
96 | }
97 | }
98 | });
99 | }
100 |
101 | /**
102 | * Adds changing listener for wheel that updates the wheel label
103 | * @param wheel the wheel
104 | * @param label the wheel label
105 | */
106 | private void addChangingListener(final WheelView wheel, final String label) {
107 | wheel.addChangingListener(new OnWheelChangedListener() {
108 | public void onChanged(WheelView wheel, int oldValue, int newValue) {
109 | //wheel.setLabel(newValue != 1 ? label + "s" : label);
110 | }
111 | });
112 | }
113 | }
114 |
--------------------------------------------------------------------------------
/wheel-demo/src/kankan/wheel/demo/.svn/text-base/TimeActivity.java.svn-base:
--------------------------------------------------------------------------------
1 | package kankan.wheel.demo;
2 |
3 | import java.util.Calendar;
4 |
5 | import kankan.wheel.R;
6 | import kankan.wheel.widget.OnWheelChangedListener;
7 | import kankan.wheel.widget.OnWheelClickedListener;
8 | import kankan.wheel.widget.OnWheelScrollListener;
9 | import kankan.wheel.widget.WheelView;
10 | import kankan.wheel.widget.adapters.NumericWheelAdapter;
11 |
12 | import android.app.Activity;
13 | import android.os.Bundle;
14 | import android.widget.TimePicker;
15 |
16 | public class TimeActivity extends Activity {
17 | // Time changed flag
18 | private boolean timeChanged = false;
19 |
20 | // Time scrolled flag
21 | private boolean timeScrolled = false;
22 |
23 | @Override
24 | public void onCreate(Bundle savedInstanceState) {
25 | super.onCreate(savedInstanceState);
26 |
27 | setContentView(R.layout.time_layout);
28 |
29 | final WheelView hours = (WheelView) findViewById(R.id.hour);
30 | hours.setViewAdapter(new NumericWheelAdapter(this, 0, 23));
31 |
32 | final WheelView mins = (WheelView) findViewById(R.id.mins);
33 | mins.setViewAdapter(new NumericWheelAdapter(this, 0, 59, "%02d"));
34 | mins.setCyclic(true);
35 |
36 | final TimePicker picker = (TimePicker) findViewById(R.id.time);
37 | picker.setIs24HourView(true);
38 |
39 | // set current time
40 | Calendar c = Calendar.getInstance();
41 | int curHours = c.get(Calendar.HOUR_OF_DAY);
42 | int curMinutes = c.get(Calendar.MINUTE);
43 |
44 | hours.setCurrentItem(curHours);
45 | mins.setCurrentItem(curMinutes);
46 |
47 | picker.setCurrentHour(curHours);
48 | picker.setCurrentMinute(curMinutes);
49 |
50 | // add listeners
51 | addChangingListener(mins, "min");
52 | addChangingListener(hours, "hour");
53 |
54 | OnWheelChangedListener wheelListener = new OnWheelChangedListener() {
55 | public void onChanged(WheelView wheel, int oldValue, int newValue) {
56 | if (!timeScrolled) {
57 | timeChanged = true;
58 | picker.setCurrentHour(hours.getCurrentItem());
59 | picker.setCurrentMinute(mins.getCurrentItem());
60 | timeChanged = false;
61 | }
62 | }
63 | };
64 | hours.addChangingListener(wheelListener);
65 | mins.addChangingListener(wheelListener);
66 |
67 | OnWheelClickedListener click = new OnWheelClickedListener() {
68 | public void onItemClicked(WheelView wheel, int itemIndex) {
69 | wheel.setCurrentItem(itemIndex, true);
70 | }
71 | };
72 | hours.addClickingListener(click);
73 | mins.addClickingListener(click);
74 |
75 | OnWheelScrollListener scrollListener = new OnWheelScrollListener() {
76 | public void onScrollingStarted(WheelView wheel) {
77 | timeScrolled = true;
78 | }
79 | public void onScrollingFinished(WheelView wheel) {
80 | timeScrolled = false;
81 | timeChanged = true;
82 | picker.setCurrentHour(hours.getCurrentItem());
83 | picker.setCurrentMinute(mins.getCurrentItem());
84 | timeChanged = false;
85 | }
86 | };
87 |
88 | hours.addScrollingListener(scrollListener);
89 | mins.addScrollingListener(scrollListener);
90 |
91 | picker.setOnTimeChangedListener(new TimePicker.OnTimeChangedListener() {
92 | public void onTimeChanged(TimePicker view, int hourOfDay, int minute) {
93 | if (!timeChanged) {
94 | hours.setCurrentItem(hourOfDay, true);
95 | mins.setCurrentItem(minute, true);
96 | }
97 | }
98 | });
99 | }
100 |
101 | /**
102 | * Adds changing listener for wheel that updates the wheel label
103 | * @param wheel the wheel
104 | * @param label the wheel label
105 | */
106 | private void addChangingListener(final WheelView wheel, final String label) {
107 | wheel.addChangingListener(new OnWheelChangedListener() {
108 | public void onChanged(WheelView wheel, int oldValue, int newValue) {
109 | //wheel.setLabel(newValue != 1 ? label + "s" : label);
110 | }
111 | });
112 | }
113 | }
114 |
--------------------------------------------------------------------------------
/wheel-demo/src/kankan/wheel/demo/CitiesActivity.java:
--------------------------------------------------------------------------------
1 | package kankan.wheel.demo;
2 |
3 | import kankan.wheel.R;
4 | import kankan.wheel.widget.OnWheelChangedListener;
5 | import kankan.wheel.widget.OnWheelScrollListener;
6 | import kankan.wheel.widget.WheelView;
7 | import kankan.wheel.widget.adapters.AbstractWheelTextAdapter;
8 | import kankan.wheel.widget.adapters.ArrayWheelAdapter;
9 |
10 | import android.app.Activity;
11 | import android.content.Context;
12 | import android.os.Bundle;
13 | import android.view.View;
14 | import android.view.ViewGroup;
15 | import android.widget.ImageView;
16 |
17 | public class CitiesActivity extends Activity {
18 | // Scrolling flag
19 | private boolean scrolling = false;
20 |
21 | @Override
22 | public void onCreate(Bundle savedInstanceState) {
23 | super.onCreate(savedInstanceState);
24 |
25 | setContentView(R.layout.cities_layout);
26 |
27 | final WheelView country = (WheelView) findViewById(R.id.country);
28 | country.setVisibleItems(3);
29 | country.setViewAdapter(new CountryAdapter(this));
30 |
31 | final String cities[][] = new String[][] {
32 | new String[] {"New York", "Washington", "Chicago", "Atlanta", "Orlando"},
33 | new String[] {"Ottawa", "Vancouver", "Toronto", "Windsor", "Montreal"},
34 | new String[] {"Kiev", "Dnipro", "Lviv", "Kharkiv"},
35 | new String[] {"Paris", "Bordeaux"},
36 | };
37 |
38 | final WheelView city = (WheelView) findViewById(R.id.city);
39 | city.setVisibleItems(5);
40 |
41 | country.addChangingListener(new OnWheelChangedListener() {
42 | public void onChanged(WheelView wheel, int oldValue, int newValue) {
43 | if (!scrolling) {
44 | updateCities(city, cities, newValue);
45 | }
46 | }
47 | });
48 |
49 | country.addScrollingListener( new OnWheelScrollListener() {
50 | public void onScrollingStarted(WheelView wheel) {
51 | scrolling = true;
52 | }
53 | public void onScrollingFinished(WheelView wheel) {
54 | scrolling = false;
55 | updateCities(city, cities, country.getCurrentItem());
56 | }
57 | });
58 |
59 | country.setCurrentItem(1);
60 | }
61 |
62 | /**
63 | * Updates the city wheel
64 | */
65 | private void updateCities(WheelView city, String cities[][], int index) {
66 | ArrayWheelAdapter adapter =
67 | new ArrayWheelAdapter(this, cities[index]);
68 | adapter.setTextSize(18);
69 | city.setViewAdapter(adapter);
70 | city.setCurrentItem(cities[index].length / 2);
71 | }
72 |
73 | /**
74 | * Adapter for countries
75 | */
76 | private class CountryAdapter extends AbstractWheelTextAdapter {
77 | // Countries names
78 | private String countries[] =
79 | new String[] {"USA", "Canada", "Ukraine", "France"};
80 | // Countries flags
81 | private int flags[] =
82 | new int[] {R.drawable.usa, R.drawable.canada, R.drawable.ukraine, R.drawable.france};
83 |
84 | /**
85 | * Constructor
86 | */
87 | protected CountryAdapter(Context context) {
88 | super(context, R.layout.country_layout, NO_RESOURCE);
89 |
90 | setItemTextResource(R.id.country_name);
91 | }
92 |
93 | @Override
94 | public View getItem(int index, View cachedView, ViewGroup parent) {
95 | View view = super.getItem(index, cachedView, parent);
96 | ImageView img = (ImageView) view.findViewById(R.id.flag);
97 | img.setImageResource(flags[index]);
98 | return view;
99 | }
100 |
101 | @Override
102 | public int getItemsCount() {
103 | return countries.length;
104 | }
105 |
106 | @Override
107 | protected CharSequence getItemText(int index) {
108 | return countries[index];
109 | }
110 | }
111 | }
112 |
--------------------------------------------------------------------------------
/wheel-demo/src/kankan/wheel/demo/.svn/text-base/CitiesActivity.java.svn-base:
--------------------------------------------------------------------------------
1 | package kankan.wheel.demo;
2 |
3 | import kankan.wheel.R;
4 | import kankan.wheel.widget.OnWheelChangedListener;
5 | import kankan.wheel.widget.OnWheelScrollListener;
6 | import kankan.wheel.widget.WheelView;
7 | import kankan.wheel.widget.adapters.AbstractWheelTextAdapter;
8 | import kankan.wheel.widget.adapters.ArrayWheelAdapter;
9 |
10 | import android.app.Activity;
11 | import android.content.Context;
12 | import android.os.Bundle;
13 | import android.view.View;
14 | import android.view.ViewGroup;
15 | import android.widget.ImageView;
16 |
17 | public class CitiesActivity extends Activity {
18 | // Scrolling flag
19 | private boolean scrolling = false;
20 |
21 | @Override
22 | public void onCreate(Bundle savedInstanceState) {
23 | super.onCreate(savedInstanceState);
24 |
25 | setContentView(R.layout.cities_layout);
26 |
27 | final WheelView country = (WheelView) findViewById(R.id.country);
28 | country.setVisibleItems(3);
29 | country.setViewAdapter(new CountryAdapter(this));
30 |
31 | final String cities[][] = new String[][] {
32 | new String[] {"New York", "Washington", "Chicago", "Atlanta", "Orlando"},
33 | new String[] {"Ottawa", "Vancouver", "Toronto", "Windsor", "Montreal"},
34 | new String[] {"Kiev", "Dnipro", "Lviv", "Kharkiv"},
35 | new String[] {"Paris", "Bordeaux"},
36 | };
37 |
38 | final WheelView city = (WheelView) findViewById(R.id.city);
39 | city.setVisibleItems(5);
40 |
41 | country.addChangingListener(new OnWheelChangedListener() {
42 | public void onChanged(WheelView wheel, int oldValue, int newValue) {
43 | if (!scrolling) {
44 | updateCities(city, cities, newValue);
45 | }
46 | }
47 | });
48 |
49 | country.addScrollingListener( new OnWheelScrollListener() {
50 | public void onScrollingStarted(WheelView wheel) {
51 | scrolling = true;
52 | }
53 | public void onScrollingFinished(WheelView wheel) {
54 | scrolling = false;
55 | updateCities(city, cities, country.getCurrentItem());
56 | }
57 | });
58 |
59 | country.setCurrentItem(1);
60 | }
61 |
62 | /**
63 | * Updates the city wheel
64 | */
65 | private void updateCities(WheelView city, String cities[][], int index) {
66 | ArrayWheelAdapter adapter =
67 | new ArrayWheelAdapter(this, cities[index]);
68 | adapter.setTextSize(18);
69 | city.setViewAdapter(adapter);
70 | city.setCurrentItem(cities[index].length / 2);
71 | }
72 |
73 | /**
74 | * Adapter for countries
75 | */
76 | private class CountryAdapter extends AbstractWheelTextAdapter {
77 | // Countries names
78 | private String countries[] =
79 | new String[] {"USA", "Canada", "Ukraine", "France"};
80 | // Countries flags
81 | private int flags[] =
82 | new int[] {R.drawable.usa, R.drawable.canada, R.drawable.ukraine, R.drawable.france};
83 |
84 | /**
85 | * Constructor
86 | */
87 | protected CountryAdapter(Context context) {
88 | super(context, R.layout.country_layout, NO_RESOURCE);
89 |
90 | setItemTextResource(R.id.country_name);
91 | }
92 |
93 | @Override
94 | public View getItem(int index, View cachedView, ViewGroup parent) {
95 | View view = super.getItem(index, cachedView, parent);
96 | ImageView img = (ImageView) view.findViewById(R.id.flag);
97 | img.setImageResource(flags[index]);
98 | return view;
99 | }
100 |
101 | @Override
102 | public int getItemsCount() {
103 | return countries.length;
104 | }
105 |
106 | @Override
107 | protected CharSequence getItemText(int index) {
108 | return countries[index];
109 | }
110 | }
111 | }
112 |
--------------------------------------------------------------------------------
/wheel/src/kankan/wheel/widget/WheelRecycle.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Android Wheel Control.
3 | * https://code.google.com/p/android-wheel/
4 | *
5 | * Copyright 2011 Yuri Kanivets
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | */
19 |
20 | package kankan.wheel.widget;
21 |
22 | import java.util.LinkedList;
23 | import java.util.List;
24 |
25 | import android.view.View;
26 | import android.widget.LinearLayout;
27 |
28 | /**
29 | * Recycle stores wheel items to reuse.
30 | */
31 | public class WheelRecycle {
32 | // Cached items
33 | private List items;
34 |
35 | // Cached empty items
36 | private List emptyItems;
37 |
38 | // Wheel view
39 | private WheelView wheel;
40 |
41 | /**
42 | * Constructor
43 | * @param wheel the wheel view
44 | */
45 | public WheelRecycle(WheelView wheel) {
46 | this.wheel = wheel;
47 | }
48 |
49 | /**
50 | * Recycles items from specified layout.
51 | * There are saved only items not included to specified range.
52 | * All the cached items are removed from original layout.
53 | *
54 | * @param layout the layout containing items to be cached
55 | * @param firstItem the number of first item in layout
56 | * @param range the range of current wheel items
57 | * @return the new value of first item number
58 | */
59 | public int recycleItems(LinearLayout layout, int firstItem, ItemsRange range) {
60 | int index = firstItem;
61 | for (int i = 0; i < layout.getChildCount();) {
62 | if (!range.contains(index)) {
63 | recycleView(layout.getChildAt(i), index);
64 | layout.removeViewAt(i);
65 | if (i == 0) { // first item
66 | firstItem++;
67 | }
68 | } else {
69 | i++; // go to next item
70 | }
71 | index++;
72 | }
73 | return firstItem;
74 | }
75 |
76 | /**
77 | * Gets item view
78 | * @return the cached view
79 | */
80 | public View getItem() {
81 | return getCachedView(items);
82 | }
83 |
84 | /**
85 | * Gets empty item view
86 | * @return the cached empty view
87 | */
88 | public View getEmptyItem() {
89 | return getCachedView(emptyItems);
90 | }
91 |
92 | /**
93 | * Clears all views
94 | */
95 | public void clearAll() {
96 | if (items != null) {
97 | items.clear();
98 | }
99 | if (emptyItems != null) {
100 | emptyItems.clear();
101 | }
102 | }
103 |
104 | /**
105 | * Adds view to specified cache. Creates a cache list if it is null.
106 | * @param view the view to be cached
107 | * @param cache the cache list
108 | * @return the cache list
109 | */
110 | private List addView(View view, List cache) {
111 | if (cache == null) {
112 | cache = new LinkedList();
113 | }
114 |
115 | cache.add(view);
116 | return cache;
117 | }
118 |
119 | /**
120 | * Adds view to cache. Determines view type (item view or empty one) by index.
121 | * @param view the view to be cached
122 | * @param index the index of view
123 | */
124 | private void recycleView(View view, int index) {
125 | int count = wheel.getViewAdapter().getItemsCount();
126 |
127 | if ((index < 0 || index >= count) && !wheel.isCyclic()) {
128 | // empty view
129 | emptyItems = addView(view, emptyItems);
130 | } else {
131 | while (index < 0) {
132 | index = count + index;
133 | }
134 | index %= count;
135 | items = addView(view, items);
136 | }
137 | }
138 |
139 | /**
140 | * Gets view from specified cache.
141 | * @param cache the cache
142 | * @return the first view from cache.
143 | */
144 | private View getCachedView(List cache) {
145 | if (cache != null && cache.size() > 0) {
146 | View view = cache.get(0);
147 | cache.remove(0);
148 | return view;
149 | }
150 | return null;
151 | }
152 |
153 | }
154 |
--------------------------------------------------------------------------------
/wheel/src/kankan/wheel/widget/.svn/text-base/WheelRecycle.java.svn-base:
--------------------------------------------------------------------------------
1 | /*
2 | * Android Wheel Control.
3 | * https://code.google.com/p/android-wheel/
4 | *
5 | * Copyright 2011 Yuri Kanivets
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | */
19 |
20 | package kankan.wheel.widget;
21 |
22 | import java.util.LinkedList;
23 | import java.util.List;
24 |
25 | import android.view.View;
26 | import android.widget.LinearLayout;
27 |
28 | /**
29 | * Recycle stores wheel items to reuse.
30 | */
31 | public class WheelRecycle {
32 | // Cached items
33 | private List items;
34 |
35 | // Cached empty items
36 | private List emptyItems;
37 |
38 | // Wheel view
39 | private WheelView wheel;
40 |
41 | /**
42 | * Constructor
43 | * @param wheel the wheel view
44 | */
45 | public WheelRecycle(WheelView wheel) {
46 | this.wheel = wheel;
47 | }
48 |
49 | /**
50 | * Recycles items from specified layout.
51 | * There are saved only items not included to specified range.
52 | * All the cached items are removed from original layout.
53 | *
54 | * @param layout the layout containing items to be cached
55 | * @param firstItem the number of first item in layout
56 | * @param range the range of current wheel items
57 | * @return the new value of first item number
58 | */
59 | public int recycleItems(LinearLayout layout, int firstItem, ItemsRange range) {
60 | int index = firstItem;
61 | for (int i = 0; i < layout.getChildCount();) {
62 | if (!range.contains(index)) {
63 | recycleView(layout.getChildAt(i), index);
64 | layout.removeViewAt(i);
65 | if (i == 0) { // first item
66 | firstItem++;
67 | }
68 | } else {
69 | i++; // go to next item
70 | }
71 | index++;
72 | }
73 | return firstItem;
74 | }
75 |
76 | /**
77 | * Gets item view
78 | * @return the cached view
79 | */
80 | public View getItem() {
81 | return getCachedView(items);
82 | }
83 |
84 | /**
85 | * Gets empty item view
86 | * @return the cached empty view
87 | */
88 | public View getEmptyItem() {
89 | return getCachedView(emptyItems);
90 | }
91 |
92 | /**
93 | * Clears all views
94 | */
95 | public void clearAll() {
96 | if (items != null) {
97 | items.clear();
98 | }
99 | if (emptyItems != null) {
100 | emptyItems.clear();
101 | }
102 | }
103 |
104 | /**
105 | * Adds view to specified cache. Creates a cache list if it is null.
106 | * @param view the view to be cached
107 | * @param cache the cache list
108 | * @return the cache list
109 | */
110 | private List addView(View view, List cache) {
111 | if (cache == null) {
112 | cache = new LinkedList();
113 | }
114 |
115 | cache.add(view);
116 | return cache;
117 | }
118 |
119 | /**
120 | * Adds view to cache. Determines view type (item view or empty one) by index.
121 | * @param view the view to be cached
122 | * @param index the index of view
123 | */
124 | private void recycleView(View view, int index) {
125 | int count = wheel.getViewAdapter().getItemsCount();
126 |
127 | if ((index < 0 || index >= count) && !wheel.isCyclic()) {
128 | // empty view
129 | emptyItems = addView(view, emptyItems);
130 | } else {
131 | while (index < 0) {
132 | index = count + index;
133 | }
134 | index %= count;
135 | items = addView(view, items);
136 | }
137 | }
138 |
139 | /**
140 | * Gets view from specified cache.
141 | * @param cache the cache
142 | * @return the first view from cache.
143 | */
144 | private View getCachedView(List cache) {
145 | if (cache != null && cache.size() > 0) {
146 | View view = cache.get(0);
147 | cache.remove(0);
148 | return view;
149 | }
150 | return null;
151 | }
152 |
153 | }
154 |
--------------------------------------------------------------------------------
/wheel-demo/res/layout/.svn/entries:
--------------------------------------------------------------------------------
1 | 10
2 |
3 | dir
4 | 20
5 | http://android-wheel.googlecode.com/svn/trunk/wheel-demo/res/layout
6 | http://android-wheel.googlecode.com/svn
7 |
8 |
9 |
10 | 2011-02-13T20:30:08.799354Z
11 | 18
12 | yuri.kanivets
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | c364614a-9a97-51b3-f556-90fca60df64e
28 |
29 | units_item.xml
30 | file
31 |
32 |
33 |
34 |
35 | 2011-11-04T10:44:55.000000Z
36 | d1a1ee440548c72e3891548163d12390
37 | 2011-02-13T20:30:08.799354Z
38 | 18
39 | yuri.kanivets
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 | 829
62 |
63 | country_layout.xml
64 | file
65 |
66 |
67 |
68 |
69 | 2011-11-04T10:44:55.000000Z
70 | 57e37f54d0aa993cda8b768053b7aa10
71 | 2011-02-13T20:30:08.799354Z
72 | 18
73 | yuri.kanivets
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 | 823
96 |
97 | slot_machine_layout.xml
98 | file
99 |
100 |
101 |
102 |
103 | 2011-11-04T10:44:55.000000Z
104 | 01237a42557eb98a08ff0ba31f3a798d
105 | 2011-02-13T20:30:08.799354Z
106 | 18
107 | yuri.kanivets
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 | 1620
130 |
131 | wheel_text_item.xml
132 | file
133 |
134 |
135 |
136 |
137 | 2011-11-04T10:44:55.000000Z
138 | aa2e4f7a90b086519142bf1aa9661e38
139 | 2011-02-13T20:30:08.799354Z
140 | 18
141 | yuri.kanivets
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 | 367
164 |
165 | date_layout.xml
166 | file
167 |
168 |
169 |
170 |
171 | 2011-11-04T10:44:55.000000Z
172 | 3fa3d7d58352a400f457c679593cd5ab
173 | 2011-02-13T20:30:08.799354Z
174 | 18
175 | yuri.kanivets
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 | 1159
198 |
199 | passw_layout.xml
200 | file
201 |
202 |
203 |
204 |
205 | 2011-11-04T10:44:55.000000Z
206 | aed2058ef8f77ba4764ceb8147c1e7d2
207 | 2011-02-13T20:30:08.799354Z
208 | 18
209 | yuri.kanivets
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 | 1862
232 |
233 | time_layout.xml
234 | file
235 |
236 |
237 |
238 |
239 | 2011-11-04T10:44:55.000000Z
240 | c3891ec7697509a7b4e5ebdf294570a3
241 | 2011-02-13T20:30:08.799354Z
242 | 18
243 | yuri.kanivets
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 |
265 | 1059
266 |
267 | cities_layout.xml
268 | file
269 |
270 |
271 |
272 |
273 | 2011-11-04T10:44:55.000000Z
274 | acedc38b0537436a3d94d0d3f3b6af46
275 | 2011-02-13T20:30:08.799354Z
276 | 18
277 | yuri.kanivets
278 |
279 |
280 |
281 |
282 |
283 |
284 |
285 |
286 |
287 |
288 |
289 |
290 |
291 |
292 |
293 |
294 |
295 |
296 |
297 |
298 |
299 | 1591
300 |
301 | time2_layout.xml
302 | file
303 |
304 |
305 |
306 |
307 | 2011-11-04T10:44:55.000000Z
308 | bcd053bf2a5a631cecfa2ab01abe9bc1
309 | 2011-02-13T20:30:08.799354Z
310 | 18
311 | yuri.kanivets
312 |
313 |
314 |
315 |
316 |
317 |
318 |
319 |
320 |
321 |
322 |
323 |
324 |
325 |
326 |
327 |
328 |
329 |
330 |
331 |
332 |
333 | 1330
334 |
335 | time2_day.xml
336 | file
337 |
338 |
339 |
340 |
341 | 2011-11-04T10:44:55.000000Z
342 | 161e3280127e41886a486fd93439b94c
343 | 2011-02-13T20:30:08.799354Z
344 | 18
345 | yuri.kanivets
346 |
347 |
348 |
349 |
350 |
351 |
352 |
353 |
354 |
355 |
356 |
357 |
358 |
359 |
360 |
361 |
362 |
363 |
364 |
365 |
366 |
367 | 1165
368 |
369 | speed1_layout.xml
370 | file
371 |
372 |
373 |
374 |
375 | 2011-11-04T10:44:55.000000Z
376 | d75e91b35f9b5b68cf6d770a9637f9ef
377 | 2011-02-13T20:30:08.799354Z
378 | 18
379 | yuri.kanivets
380 |
381 |
382 |
383 |
384 |
385 |
386 |
387 |
388 |
389 |
390 |
391 |
392 |
393 |
394 |
395 |
396 |
397 |
398 |
399 |
400 |
401 | 822
402 |
403 | slot_item.xml
404 | file
405 |
406 |
407 |
408 |
409 | 2011-11-04T10:44:55.000000Z
410 | ea8f8afbe8c3ebf60513a55daa230d29
411 | 2011-02-13T20:30:08.799354Z
412 | 18
413 | yuri.kanivets
414 |
415 |
416 |
417 |
418 |
419 |
420 |
421 |
422 |
423 |
424 |
425 |
426 |
427 |
428 |
429 |
430 |
431 |
432 |
433 |
434 |
435 | 388
436 |
437 |
--------------------------------------------------------------------------------
/wheel-demo/src/kankan/wheel/demo/PasswActivity.java:
--------------------------------------------------------------------------------
1 | package kankan.wheel.demo;
2 |
3 | import kankan.wheel.R;
4 | import kankan.wheel.widget.OnWheelChangedListener;
5 | import kankan.wheel.widget.OnWheelScrollListener;
6 | import kankan.wheel.widget.WheelView;
7 | import kankan.wheel.widget.adapters.NumericWheelAdapter;
8 | import android.app.Activity;
9 | import android.os.Bundle;
10 | import android.view.View;
11 | import android.view.View.OnClickListener;
12 | import android.view.animation.AnticipateOvershootInterpolator;
13 | import android.widget.Button;
14 | import android.widget.TextView;
15 |
16 | public class PasswActivity extends Activity {
17 | @Override
18 | public void onCreate(Bundle savedInstanceState) {
19 | super.onCreate(savedInstanceState);
20 |
21 | setContentView(R.layout.passw_layout);
22 | initWheel(R.id.passw_1);
23 | initWheel(R.id.passw_2);
24 | initWheel(R.id.passw_3);
25 | initWheel(R.id.passw_4);
26 |
27 | Button mix = (Button)findViewById(R.id.btn_mix);
28 | mix.setOnClickListener(new OnClickListener() {
29 | public void onClick(View v) {
30 | mixWheel(R.id.passw_1);
31 | mixWheel(R.id.passw_2);
32 | mixWheel(R.id.passw_3);
33 | mixWheel(R.id.passw_4);
34 | }
35 | });
36 |
37 | updateStatus();
38 | }
39 |
40 | // Wheel scrolled flag
41 | private boolean wheelScrolled = false;
42 |
43 | // Wheel scrolled listener
44 | OnWheelScrollListener scrolledListener = new OnWheelScrollListener() {
45 | public void onScrollingStarted(WheelView wheel) {
46 | wheelScrolled = true;
47 | }
48 | public void onScrollingFinished(WheelView wheel) {
49 | wheelScrolled = false;
50 | updateStatus();
51 | }
52 | };
53 |
54 | // Wheel changed listener
55 | private OnWheelChangedListener changedListener = new OnWheelChangedListener() {
56 | public void onChanged(WheelView wheel, int oldValue, int newValue) {
57 | if (!wheelScrolled) {
58 | updateStatus();
59 | }
60 | }
61 | };
62 |
63 | /**
64 | * Updates entered PIN status
65 | */
66 | private void updateStatus() {
67 | TextView text = (TextView) findViewById(R.id.pwd_status);
68 | if (testPin(2, 4, 6, 1)) {
69 | text.setText("Congratulation!");
70 | } else {
71 | text.setText("Invalid PIN");
72 | }
73 | }
74 |
75 | /**
76 | * Initializes wheel
77 | * @param id the wheel widget Id
78 | */
79 | private void initWheel(int id) {
80 | WheelView wheel = getWheel(id);
81 | wheel.setViewAdapter(new NumericWheelAdapter(this, 0, 9));
82 | wheel.setCurrentItem((int)(Math.random() * 10));
83 |
84 | wheel.addChangingListener(changedListener);
85 | wheel.addScrollingListener(scrolledListener);
86 | wheel.setCyclic(true);
87 | wheel.setInterpolator(new AnticipateOvershootInterpolator());
88 | }
89 |
90 | /**
91 | * Returns wheel by Id
92 | * @param id the wheel Id
93 | * @return the wheel with passed Id
94 | */
95 | private WheelView getWheel(int id) {
96 | return (WheelView) findViewById(id);
97 | }
98 |
99 | /**
100 | * Tests entered PIN
101 | * @param v1
102 | * @param v2
103 | * @param v3
104 | * @param v4
105 | * @return true
106 | */
107 | private boolean testPin(int v1, int v2, int v3, int v4) {
108 | return testWheelValue(R.id.passw_1, v1) && testWheelValue(R.id.passw_2, v2) &&
109 | testWheelValue(R.id.passw_3, v3) && testWheelValue(R.id.passw_4, v4);
110 | }
111 |
112 | /**
113 | * Tests wheel value
114 | * @param id the wheel Id
115 | * @param value the value to test
116 | * @return true if wheel value is equal to passed value
117 | */
118 | private boolean testWheelValue(int id, int value) {
119 | return getWheel(id).getCurrentItem() == value;
120 | }
121 |
122 | /**
123 | * Mixes wheel
124 | * @param id the wheel id
125 | */
126 | private void mixWheel(int id) {
127 | WheelView wheel = getWheel(id);
128 | wheel.scroll(-25 + (int)(Math.random() * 50), 2000);
129 | }
130 | }
131 |
--------------------------------------------------------------------------------
/wheel-demo/src/kankan/wheel/demo/.svn/text-base/PasswActivity.java.svn-base:
--------------------------------------------------------------------------------
1 | package kankan.wheel.demo;
2 |
3 | import kankan.wheel.R;
4 | import kankan.wheel.widget.OnWheelChangedListener;
5 | import kankan.wheel.widget.OnWheelScrollListener;
6 | import kankan.wheel.widget.WheelView;
7 | import kankan.wheel.widget.adapters.NumericWheelAdapter;
8 | import android.app.Activity;
9 | import android.os.Bundle;
10 | import android.view.View;
11 | import android.view.View.OnClickListener;
12 | import android.view.animation.AnticipateOvershootInterpolator;
13 | import android.widget.Button;
14 | import android.widget.TextView;
15 |
16 | public class PasswActivity extends Activity {
17 | @Override
18 | public void onCreate(Bundle savedInstanceState) {
19 | super.onCreate(savedInstanceState);
20 |
21 | setContentView(R.layout.passw_layout);
22 | initWheel(R.id.passw_1);
23 | initWheel(R.id.passw_2);
24 | initWheel(R.id.passw_3);
25 | initWheel(R.id.passw_4);
26 |
27 | Button mix = (Button)findViewById(R.id.btn_mix);
28 | mix.setOnClickListener(new OnClickListener() {
29 | public void onClick(View v) {
30 | mixWheel(R.id.passw_1);
31 | mixWheel(R.id.passw_2);
32 | mixWheel(R.id.passw_3);
33 | mixWheel(R.id.passw_4);
34 | }
35 | });
36 |
37 | updateStatus();
38 | }
39 |
40 | // Wheel scrolled flag
41 | private boolean wheelScrolled = false;
42 |
43 | // Wheel scrolled listener
44 | OnWheelScrollListener scrolledListener = new OnWheelScrollListener() {
45 | public void onScrollingStarted(WheelView wheel) {
46 | wheelScrolled = true;
47 | }
48 | public void onScrollingFinished(WheelView wheel) {
49 | wheelScrolled = false;
50 | updateStatus();
51 | }
52 | };
53 |
54 | // Wheel changed listener
55 | private OnWheelChangedListener changedListener = new OnWheelChangedListener() {
56 | public void onChanged(WheelView wheel, int oldValue, int newValue) {
57 | if (!wheelScrolled) {
58 | updateStatus();
59 | }
60 | }
61 | };
62 |
63 | /**
64 | * Updates entered PIN status
65 | */
66 | private void updateStatus() {
67 | TextView text = (TextView) findViewById(R.id.pwd_status);
68 | if (testPin(2, 4, 6, 1)) {
69 | text.setText("Congratulation!");
70 | } else {
71 | text.setText("Invalid PIN");
72 | }
73 | }
74 |
75 | /**
76 | * Initializes wheel
77 | * @param id the wheel widget Id
78 | */
79 | private void initWheel(int id) {
80 | WheelView wheel = getWheel(id);
81 | wheel.setViewAdapter(new NumericWheelAdapter(this, 0, 9));
82 | wheel.setCurrentItem((int)(Math.random() * 10));
83 |
84 | wheel.addChangingListener(changedListener);
85 | wheel.addScrollingListener(scrolledListener);
86 | wheel.setCyclic(true);
87 | wheel.setInterpolator(new AnticipateOvershootInterpolator());
88 | }
89 |
90 | /**
91 | * Returns wheel by Id
92 | * @param id the wheel Id
93 | * @return the wheel with passed Id
94 | */
95 | private WheelView getWheel(int id) {
96 | return (WheelView) findViewById(id);
97 | }
98 |
99 | /**
100 | * Tests entered PIN
101 | * @param v1
102 | * @param v2
103 | * @param v3
104 | * @param v4
105 | * @return true
106 | */
107 | private boolean testPin(int v1, int v2, int v3, int v4) {
108 | return testWheelValue(R.id.passw_1, v1) && testWheelValue(R.id.passw_2, v2) &&
109 | testWheelValue(R.id.passw_3, v3) && testWheelValue(R.id.passw_4, v4);
110 | }
111 |
112 | /**
113 | * Tests wheel value
114 | * @param id the wheel Id
115 | * @param value the value to test
116 | * @return true if wheel value is equal to passed value
117 | */
118 | private boolean testWheelValue(int id, int value) {
119 | return getWheel(id).getCurrentItem() == value;
120 | }
121 |
122 | /**
123 | * Mixes wheel
124 | * @param id the wheel id
125 | */
126 | private void mixWheel(int id) {
127 | WheelView wheel = getWheel(id);
128 | wheel.scroll(-25 + (int)(Math.random() * 50), 2000);
129 | }
130 | }
131 |
--------------------------------------------------------------------------------
/wheel-demo/src/kankan/wheel/demo/Time2Activity.java:
--------------------------------------------------------------------------------
1 | package kankan.wheel.demo;
2 |
3 | import java.text.DateFormat;
4 | import java.text.SimpleDateFormat;
5 | import java.util.Calendar;
6 | import java.util.Locale;
7 |
8 | import kankan.wheel.R;
9 | import kankan.wheel.widget.WheelView;
10 | import kankan.wheel.widget.adapters.AbstractWheelTextAdapter;
11 | import kankan.wheel.widget.adapters.ArrayWheelAdapter;
12 | import kankan.wheel.widget.adapters.NumericWheelAdapter;
13 |
14 | import android.app.Activity;
15 | import android.content.Context;
16 | import android.os.Bundle;
17 | import android.view.View;
18 | import android.view.ViewGroup;
19 | import android.widget.TextView;
20 |
21 | public class Time2Activity extends Activity {
22 | @Override
23 | public void onCreate(Bundle savedInstanceState) {
24 | super.onCreate(savedInstanceState);
25 |
26 | setContentView(R.layout.time2_layout);
27 |
28 | final WheelView hours = (WheelView) findViewById(R.id.hour);
29 | NumericWheelAdapter hourAdapter = new NumericWheelAdapter(this, 0, 23);
30 | hourAdapter.setItemResource(R.layout.wheel_text_item);
31 | hourAdapter.setItemTextResource(R.id.text);
32 | hours.setViewAdapter(hourAdapter);
33 |
34 | final WheelView mins = (WheelView) findViewById(R.id.mins);
35 | NumericWheelAdapter minAdapter = new NumericWheelAdapter(this, 0, 59, "%02d");
36 | minAdapter.setItemResource(R.layout.wheel_text_item);
37 | minAdapter.setItemTextResource(R.id.text);
38 | mins.setViewAdapter(minAdapter);
39 | mins.setCyclic(true);
40 |
41 | final WheelView ampm = (WheelView) findViewById(R.id.ampm);
42 | ArrayWheelAdapter ampmAdapter =
43 | new ArrayWheelAdapter(this, new String[] {"AM", "PM"});
44 | ampmAdapter.setItemResource(R.layout.wheel_text_item);
45 | ampmAdapter.setItemTextResource(R.id.text);
46 | ampm.setViewAdapter(ampmAdapter);
47 |
48 | // set current time
49 | Calendar calendar = Calendar.getInstance(Locale.US);
50 | hours.setCurrentItem(calendar.get(Calendar.HOUR));
51 | mins.setCurrentItem(calendar.get(Calendar.MINUTE));
52 | ampm.setCurrentItem(calendar.get(Calendar.AM_PM));
53 |
54 | final WheelView day = (WheelView) findViewById(R.id.day);
55 | day.setViewAdapter(new DayArrayAdapter(this, calendar));
56 | }
57 |
58 | /**
59 | * Day adapter
60 | *
61 | */
62 | private class DayArrayAdapter extends AbstractWheelTextAdapter {
63 | // Count of days to be shown
64 | private final int daysCount = 20;
65 |
66 | // Calendar
67 | Calendar calendar;
68 |
69 | /**
70 | * Constructor
71 | */
72 | protected DayArrayAdapter(Context context, Calendar calendar) {
73 | super(context, R.layout.time2_day, NO_RESOURCE);
74 | this.calendar = calendar;
75 |
76 | setItemTextResource(R.id.time2_monthday);
77 | }
78 |
79 | @Override
80 | public View getItem(int index, View cachedView, ViewGroup parent) {
81 | int day = -daysCount/2 + index;
82 | Calendar newCalendar = (Calendar) calendar.clone();
83 | newCalendar.roll(Calendar.DAY_OF_YEAR, day);
84 |
85 | View view = super.getItem(index, cachedView, parent);
86 | TextView weekday = (TextView) view.findViewById(R.id.time2_weekday);
87 | if (day == 0) {
88 | weekday.setText("");
89 | } else {
90 | DateFormat format = new SimpleDateFormat("EEE");
91 | weekday.setText(format.format(newCalendar.getTime()));
92 | }
93 |
94 | TextView monthday = (TextView) view.findViewById(R.id.time2_monthday);
95 | if (day == 0) {
96 | monthday.setText("Today");
97 | monthday.setTextColor(0xFF0000F0);
98 | } else {
99 | DateFormat format = new SimpleDateFormat("MMM d");
100 | monthday.setText(format.format(newCalendar.getTime()));
101 | monthday.setTextColor(0xFF111111);
102 | }
103 |
104 | return view;
105 | }
106 |
107 | @Override
108 | public int getItemsCount() {
109 | return daysCount + 1;
110 | }
111 |
112 | @Override
113 | protected CharSequence getItemText(int index) {
114 | return "";
115 | }
116 | }
117 | }
118 |
--------------------------------------------------------------------------------
/wheel-demo/src/kankan/wheel/demo/.svn/text-base/Time2Activity.java.svn-base:
--------------------------------------------------------------------------------
1 | package kankan.wheel.demo;
2 |
3 | import java.text.DateFormat;
4 | import java.text.SimpleDateFormat;
5 | import java.util.Calendar;
6 | import java.util.Locale;
7 |
8 | import kankan.wheel.R;
9 | import kankan.wheel.widget.WheelView;
10 | import kankan.wheel.widget.adapters.AbstractWheelTextAdapter;
11 | import kankan.wheel.widget.adapters.ArrayWheelAdapter;
12 | import kankan.wheel.widget.adapters.NumericWheelAdapter;
13 |
14 | import android.app.Activity;
15 | import android.content.Context;
16 | import android.os.Bundle;
17 | import android.view.View;
18 | import android.view.ViewGroup;
19 | import android.widget.TextView;
20 |
21 | public class Time2Activity extends Activity {
22 | @Override
23 | public void onCreate(Bundle savedInstanceState) {
24 | super.onCreate(savedInstanceState);
25 |
26 | setContentView(R.layout.time2_layout);
27 |
28 | final WheelView hours = (WheelView) findViewById(R.id.hour);
29 | NumericWheelAdapter hourAdapter = new NumericWheelAdapter(this, 0, 23);
30 | hourAdapter.setItemResource(R.layout.wheel_text_item);
31 | hourAdapter.setItemTextResource(R.id.text);
32 | hours.setViewAdapter(hourAdapter);
33 |
34 | final WheelView mins = (WheelView) findViewById(R.id.mins);
35 | NumericWheelAdapter minAdapter = new NumericWheelAdapter(this, 0, 59, "%02d");
36 | minAdapter.setItemResource(R.layout.wheel_text_item);
37 | minAdapter.setItemTextResource(R.id.text);
38 | mins.setViewAdapter(minAdapter);
39 | mins.setCyclic(true);
40 |
41 | final WheelView ampm = (WheelView) findViewById(R.id.ampm);
42 | ArrayWheelAdapter ampmAdapter =
43 | new ArrayWheelAdapter(this, new String[] {"AM", "PM"});
44 | ampmAdapter.setItemResource(R.layout.wheel_text_item);
45 | ampmAdapter.setItemTextResource(R.id.text);
46 | ampm.setViewAdapter(ampmAdapter);
47 |
48 | // set current time
49 | Calendar calendar = Calendar.getInstance(Locale.US);
50 | hours.setCurrentItem(calendar.get(Calendar.HOUR));
51 | mins.setCurrentItem(calendar.get(Calendar.MINUTE));
52 | ampm.setCurrentItem(calendar.get(Calendar.AM_PM));
53 |
54 | final WheelView day = (WheelView) findViewById(R.id.day);
55 | day.setViewAdapter(new DayArrayAdapter(this, calendar));
56 | }
57 |
58 | /**
59 | * Day adapter
60 | *
61 | */
62 | private class DayArrayAdapter extends AbstractWheelTextAdapter {
63 | // Count of days to be shown
64 | private final int daysCount = 20;
65 |
66 | // Calendar
67 | Calendar calendar;
68 |
69 | /**
70 | * Constructor
71 | */
72 | protected DayArrayAdapter(Context context, Calendar calendar) {
73 | super(context, R.layout.time2_day, NO_RESOURCE);
74 | this.calendar = calendar;
75 |
76 | setItemTextResource(R.id.time2_monthday);
77 | }
78 |
79 | @Override
80 | public View getItem(int index, View cachedView, ViewGroup parent) {
81 | int day = -daysCount/2 + index;
82 | Calendar newCalendar = (Calendar) calendar.clone();
83 | newCalendar.roll(Calendar.DAY_OF_YEAR, day);
84 |
85 | View view = super.getItem(index, cachedView, parent);
86 | TextView weekday = (TextView) view.findViewById(R.id.time2_weekday);
87 | if (day == 0) {
88 | weekday.setText("");
89 | } else {
90 | DateFormat format = new SimpleDateFormat("EEE");
91 | weekday.setText(format.format(newCalendar.getTime()));
92 | }
93 |
94 | TextView monthday = (TextView) view.findViewById(R.id.time2_monthday);
95 | if (day == 0) {
96 | monthday.setText("Today");
97 | monthday.setTextColor(0xFF0000F0);
98 | } else {
99 | DateFormat format = new SimpleDateFormat("MMM d");
100 | monthday.setText(format.format(newCalendar.getTime()));
101 | monthday.setTextColor(0xFF111111);
102 | }
103 |
104 | return view;
105 | }
106 |
107 | @Override
108 | public int getItemsCount() {
109 | return daysCount + 1;
110 | }
111 |
112 | @Override
113 | protected CharSequence getItemText(int index) {
114 | return "";
115 | }
116 | }
117 | }
118 |
--------------------------------------------------------------------------------
/wheel-demo/src/kankan/wheel/demo/WheelDemo.java:
--------------------------------------------------------------------------------
1 | package kankan.wheel.demo;
2 |
3 | import java.text.Collator;
4 | import java.util.ArrayList;
5 | import java.util.Collections;
6 | import java.util.Comparator;
7 | import java.util.HashMap;
8 | import java.util.List;
9 | import java.util.Map;
10 |
11 | import android.app.ListActivity;
12 | import android.content.Intent;
13 | import android.content.pm.PackageManager;
14 | import android.content.pm.ResolveInfo;
15 | import android.os.Bundle;
16 | import android.view.View;
17 | import android.widget.ListView;
18 | import android.widget.SimpleAdapter;
19 |
20 | public class WheelDemo extends ListActivity {
21 | @Override
22 | public void onCreate(Bundle savedInstanceState) {
23 | super.onCreate(savedInstanceState);
24 |
25 | Intent intent = getIntent();
26 | String path = intent.getStringExtra("com.example.android.apis.Path");
27 |
28 | if (path == null) {
29 | path = "";
30 | }
31 |
32 | setListAdapter(new SimpleAdapter(this, getData(path),
33 | android.R.layout.simple_list_item_1, new String[] { "title" },
34 | new int[] { android.R.id.text1 }));
35 | }
36 |
37 | protected List getData(String prefix) {
38 | List