├── .gitignore
├── AndroidManifest.xml
├── LICENSE
├── README.md
├── anytime-activity-diagram.acd
├── anytime-class-diagram.cld
├── build.gradle
├── data
├── Achievement.json
├── AchievementList.json
├── DoingList.json
├── DoingListChild.json
├── DoingListGroup.json
└── SuggestionByUser.json
├── ic_launcher-web.png
├── libs
├── android-async-http-1.4.6.jar
├── android-support-v4.jar
├── avoscloud-v2.6.9.1.jar
├── avospush-v2.6.9.1.jar
├── avossearch-v2.6.9.1.jar
├── avosstatistics-v2.6.9.1.jar
├── fastjson.jar
└── httpmime-4.2.4.jar
├── proguard-project.txt
├── project.properties
├── res
├── drawable-hdpi
│ └── ic_launcher.png
├── drawable-mdpi
│ └── ic_launcher.png
├── drawable-xhdpi
│ └── ic_launcher.png
├── drawable-xxhdpi
│ ├── achievement_title.png
│ ├── ic_launcher.png
│ ├── qq.png
│ └── weibo.png
├── layout
│ ├── activity_about_app.xml
│ ├── activity_doing_detail.xml
│ ├── activity_forget_password.xml
│ ├── activity_login.xml
│ ├── activity_main.xml
│ ├── activity_register.xml
│ ├── fragment_main_doing_list.xml
│ ├── fragment_main_person.xml
│ ├── view_doing_list_child.xml
│ ├── view_doing_list_group.xml
│ └── view_user_response.xml
├── menu
│ └── main.xml
├── values-sw600dp
│ └── dimens.xml
├── values-sw720dp-land
│ └── dimens.xml
├── values-v11
│ └── styles.xml
├── values-v14
│ └── styles.xml
└── values
│ ├── colors.xml
│ ├── dimens.xml
│ ├── strings.xml
│ └── styles.xml
└── src
└── com
└── luna
└── anytime
├── AVService.java
├── AboutAppActivity.java
├── AnyTimeActivity.java
├── AnyTimeApplication.java
├── DoingDetailActivity.java
├── DoingListFragment.java
├── ForgetPasswordActivity.java
├── LoginActivity.java
├── MainActivity.java
├── PersonFragment.java
├── RegisterActivity.java
├── adapter
├── AnytimeExpandableListAdapter.java
└── AnytimeUserResponseListAdapter.java
└── data
└── DoingListData.java
/.gitignore:
--------------------------------------------------------------------------------
1 | bin/
2 | .DS_Store
3 | gen/
4 | *.iml
5 | .gradle
6 | /local.properties
7 | /build
8 |
--------------------------------------------------------------------------------
/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
26 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
38 |
39 |
42 |
43 |
48 |
49 |
52 |
53 |
56 |
57 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction, and
10 | distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by the copyright
13 | owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all other entities
16 | that control, are controlled by, or are under common control with that entity.
17 | For the purposes of this definition, "control" means (i) the power, direct or
18 | indirect, to cause the direction or management of such entity, whether by
19 | contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
20 | outstanding shares, or (iii) beneficial ownership of such entity.
21 |
22 | "You" (or "Your") shall mean an individual or Legal Entity exercising
23 | permissions granted by this License.
24 |
25 | "Source" form shall mean the preferred form for making modifications, including
26 | but not limited to software source code, documentation source, and configuration
27 | files.
28 |
29 | "Object" form shall mean any form resulting from mechanical transformation or
30 | translation of a Source form, including but not limited to compiled object code,
31 | generated documentation, and conversions to other media types.
32 |
33 | "Work" shall mean the work of authorship, whether in Source or Object form, made
34 | available under the License, as indicated by a copyright notice that is included
35 | in or attached to the work (an example is provided in the Appendix below).
36 |
37 | "Derivative Works" shall mean any work, whether in Source or Object form, that
38 | is based on (or derived from) the Work and for which the editorial revisions,
39 | annotations, elaborations, or other modifications represent, as a whole, an
40 | original work of authorship. For the purposes of this License, Derivative Works
41 | shall not include works that remain separable from, or merely link (or bind by
42 | name) to the interfaces of, the Work and Derivative Works thereof.
43 |
44 | "Contribution" shall mean any work of authorship, including the original version
45 | of the Work and any modifications or additions to that Work or Derivative Works
46 | thereof, that is intentionally submitted to Licensor for inclusion in the Work
47 | by the copyright owner or by an individual or Legal Entity authorized to submit
48 | on behalf of the copyright owner. For the purposes of this definition,
49 | "submitted" means any form of electronic, verbal, or written communication sent
50 | to the Licensor or its representatives, including but not limited to
51 | communication on electronic mailing lists, source code control systems, and
52 | issue tracking systems that are managed by, or on behalf of, the Licensor for
53 | the purpose of discussing and improving the Work, but excluding communication
54 | that is conspicuously marked or otherwise designated in writing by the copyright
55 | owner as "Not a Contribution."
56 |
57 | "Contributor" shall mean Licensor and any individual or Legal Entity on behalf
58 | of whom a Contribution has been received by Licensor and subsequently
59 | incorporated within the Work.
60 |
61 | 2. Grant of Copyright License.
62 |
63 | Subject to the terms and conditions of this License, each Contributor hereby
64 | grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
65 | irrevocable copyright license to reproduce, prepare Derivative Works of,
66 | publicly display, publicly perform, sublicense, and distribute the Work and such
67 | Derivative Works in Source or Object form.
68 |
69 | 3. Grant of Patent License.
70 |
71 | Subject to the terms and conditions of this License, each Contributor hereby
72 | grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
73 | irrevocable (except as stated in this section) patent license to make, have
74 | made, use, offer to sell, sell, import, and otherwise transfer the Work, where
75 | such license applies only to those patent claims licensable by such Contributor
76 | that are necessarily infringed by their Contribution(s) alone or by combination
77 | of their Contribution(s) with the Work to which such Contribution(s) was
78 | submitted. If You institute patent litigation against any entity (including a
79 | cross-claim or counterclaim in a lawsuit) alleging that the Work or a
80 | Contribution incorporated within the Work constitutes direct or contributory
81 | patent infringement, then any patent licenses granted to You under this License
82 | for that Work shall terminate as of the date such litigation is filed.
83 |
84 | 4. Redistribution.
85 |
86 | You may reproduce and distribute copies of the Work or Derivative Works thereof
87 | in any medium, with or without modifications, and in Source or Object form,
88 | provided that You meet the following conditions:
89 |
90 | You must give any other recipients of the Work or Derivative Works a copy of
91 | this License; and
92 | You must cause any modified files to carry prominent notices stating that You
93 | changed the files; and
94 | You must retain, in the Source form of any Derivative Works that You distribute,
95 | all copyright, patent, trademark, and attribution notices from the Source form
96 | of the Work, excluding those notices that do not pertain to any part of the
97 | Derivative Works; and
98 | If the Work includes a "NOTICE" text file as part of its distribution, then any
99 | Derivative Works that You distribute must include a readable copy of the
100 | attribution notices contained within such NOTICE file, excluding those notices
101 | that do not pertain to any part of the Derivative Works, in at least one of the
102 | following places: within a NOTICE text file distributed as part of the
103 | Derivative Works; within the Source form or documentation, if provided along
104 | with the Derivative Works; or, within a display generated by the Derivative
105 | Works, if and wherever such third-party notices normally appear. The contents of
106 | the NOTICE file are for informational purposes only and do not modify the
107 | License. You may add Your own attribution notices within Derivative Works that
108 | You distribute, alongside or as an addendum to the NOTICE text from the Work,
109 | provided that such additional attribution notices cannot be construed as
110 | modifying the License.
111 | You may add Your own copyright statement to Your modifications and may provide
112 | additional or different license terms and conditions for use, reproduction, or
113 | distribution of Your modifications, or for any such Derivative Works as a whole,
114 | provided Your use, reproduction, and distribution of the Work otherwise complies
115 | with the conditions stated in this License.
116 |
117 | 5. Submission of Contributions.
118 |
119 | Unless You explicitly state otherwise, any Contribution intentionally submitted
120 | for inclusion in the Work by You to the Licensor shall be under the terms and
121 | conditions of this License, without any additional terms or conditions.
122 | Notwithstanding the above, nothing herein shall supersede or modify the terms of
123 | any separate license agreement you may have executed with Licensor regarding
124 | such Contributions.
125 |
126 | 6. Trademarks.
127 |
128 | This License does not grant permission to use the trade names, trademarks,
129 | service marks, or product names of the Licensor, except as required for
130 | reasonable and customary use in describing the origin of the Work and
131 | reproducing the content of the NOTICE file.
132 |
133 | 7. Disclaimer of Warranty.
134 |
135 | Unless required by applicable law or agreed to in writing, Licensor provides the
136 | Work (and each Contributor provides its Contributions) on an "AS IS" BASIS,
137 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
138 | including, without limitation, any warranties or conditions of TITLE,
139 | NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
140 | solely responsible for determining the appropriateness of using or
141 | redistributing the Work and assume any risks associated with Your exercise of
142 | permissions under this License.
143 |
144 | 8. Limitation of Liability.
145 |
146 | In no event and under no legal theory, whether in tort (including negligence),
147 | contract, or otherwise, unless required by applicable law (such as deliberate
148 | and grossly negligent acts) or agreed to in writing, shall any Contributor be
149 | liable to You for damages, including any direct, indirect, special, incidental,
150 | or consequential damages of any character arising as a result of this License or
151 | out of the use or inability to use the Work (including but not limited to
152 | damages for loss of goodwill, work stoppage, computer failure or malfunction, or
153 | any and all other commercial damages or losses), even if such Contributor has
154 | been advised of the possibility of such damages.
155 |
156 | 9. Accepting Warranty or Additional Liability.
157 |
158 | While redistributing the Work or Derivative Works thereof, You may choose to
159 | offer, and charge a fee for, acceptance of support, warranty, indemnity, or
160 | other liability obligations and/or rights consistent with this License. However,
161 | in accepting such obligations, You may act only on Your own behalf and on Your
162 | sole responsibility, not on behalf of any other Contributor, and only if You
163 | agree to indemnify, defend, and hold each Contributor harmless for any liability
164 | incurred by, or claims asserted against, such Contributor by reason of your
165 | accepting any such warranty or additional liability.
166 |
167 | END OF TERMS AND CONDITIONS
168 |
169 | APPENDIX: How to apply the Apache License to your work
170 |
171 | To apply the Apache License to your work, attach the following boilerplate
172 | notice, with the fields enclosed by brackets "{}" replaced with your own
173 | identifying information. (Don't include the brackets!) The text should be
174 | enclosed in the appropriate comment syntax for the file format. We also
175 | recommend that a file or class name and description of purpose be included on
176 | the same "printed page" as the copyright notice for easier identification within
177 | third-party archives.
178 |
179 | Copyright 2014 LunaGao
180 |
181 | Licensed under the Apache License, Version 2.0 (the "License");
182 | you may not use this file except in compliance with the License.
183 | You may obtain a copy of the License at
184 |
185 | http://www.apache.org/licenses/LICENSE-2.0
186 |
187 | Unless required by applicable law or agreed to in writing, software
188 | distributed under the License is distributed on an "AS IS" BASIS,
189 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
190 | See the License for the specific language governing permissions and
191 | limitations under the License.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Anytime介绍
2 | [](http://lunagao.github.io/BlessYourCodeTag/)
3 |
4 | # 效果图&说明
5 |
6 | 
7 |
8 | 这是从开发者征集到的一个应用,演示了:
9 |
10 | * 用户注册、登陆、登出和忘记密码等用户系统相关的功能。
11 | * 相对复杂一些的数据增删改查操作。
12 | * 消息推送
13 |
14 | 项目开发记录和介绍在这里
15 |
16 | http://www.cnblogs.com/maomishen/p/3577480.html
17 |
18 | 将学会
19 |
20 | * 配置消息推送
21 | * AVQuery
22 | * 邮箱验证重设密码
23 | * 用户登录注册
24 | * 调用云函数
25 | * 创建 AVObject
26 |
27 | # 如何运行
28 |
29 | ## With Gradle
30 |
31 | The easiest way to build is to install [Android Studio](https://developer.android.com/sdk/index.html) v1.+
32 | with [Gradle](https://www.gradle.org/) v2.2.1.
33 | Once installed, then you can import the project into Android Studio:
34 |
35 | 1. Open `File`
36 | 2. Import Project
37 | 3. Select `build.gradle` under the project directory
38 | 4. Click `OK`
39 |
40 | Then, Gradle will do everything for you.
41 |
42 | ## With Eclipse
43 |
44 | * 导入本工程到 Eclipse
45 | * 右键点击项目,运行 `Run As -> Android Application`即可看到。
46 |
47 | # 替换 App 信息
48 |
49 | Demo 使用的是公共的 app id 和 app key,您可以在`com.luna.anytime.AnyTimeApplication`修改成您自己的应用 id 和 key。
50 |
51 | 您还需要导入 [data](./data) 目录下的数据,否则无法正常运行,可以在数据管理平台做数据导入。
52 |
53 | # 协议
54 |
55 | [Apache License 2](http://www.apache.org/licenses/LICENSE-2.0.html)
56 |
57 | # 核心代码
58 |
59 | ```java
60 | public class AVService {
61 | public static void countDoing(String doingObjectId, CountCallback countCallback) {
62 | AVQuery query = new AVQuery("DoingList");
63 | query.whereEqualTo("doingListChildObjectId", doingObjectId);
64 | Calendar c = Calendar.getInstance();
65 | c.add(Calendar.MINUTE, -10);
66 | // query.whereNotEqualTo("userObjectId", userId);
67 | query.whereGreaterThan("createdAt", c.getTime());
68 | query.countInBackground(countCallback);
69 | }
70 |
71 | //Use callFunctionMethod
72 | @SuppressWarnings({"unchecked", "rawtypes"})
73 | public static void getAchievement(String userObjectId) {
74 | Map parameters = new HashMap();
75 | parameters.put("userObjectId", userObjectId);
76 | AVCloud.callFunctionInBackground("hello", parameters,
77 | new FunctionCallback() {
78 | @Override
79 | public void done(Object object, AVException e) {
80 | if (e == null) {
81 | Log.e("at", object.toString());// processResponse(object);
82 | } else {
83 | // handleError();
84 | }
85 | }
86 | });
87 | }
88 |
89 | public static void createDoing(String userId, String doingObjectId) {
90 | AVObject doing = new AVObject("DoingList");
91 | doing.put("userObjectId", userId);
92 | doing.put("doingListChildObjectId", doingObjectId);
93 | doing.saveInBackground();
94 | }
95 |
96 | public static void requestPasswordReset(String email, RequestPasswordResetCallback callback) {
97 | AVUser.requestPasswordResetInBackground(email, callback);
98 | }
99 |
100 | public static void findDoingListGroup(FindCallback findCallback) {
101 | AVQuery query = new AVQuery("DoingListGroup");
102 | query.orderByAscending("Index");
103 | query.findInBackground(findCallback);
104 | }
105 |
106 | public static void findChildrenList(String groupObjectId, FindCallback findCallback) {
107 | AVQuery query = new AVQuery("DoingListChild");
108 | query.orderByAscending("Index");
109 | query.whereEqualTo("parentObjectId", groupObjectId);
110 | query.findInBackground(findCallback);
111 | }
112 |
113 | public static void initPushService(Context ctx) {
114 | PushService.setDefaultPushCallback(ctx, LoginActivity.class);
115 | PushService.subscribe(ctx, "public", LoginActivity.class);
116 | AVInstallation.getCurrentInstallation().saveInBackground();
117 | }
118 |
119 | public static void signUp(String username, String password, String email, SignUpCallback signUpCallback) {
120 | AVUser user = new AVUser();
121 | user.setUsername(username);
122 | user.setPassword(password);
123 | user.setEmail(email);
124 | user.signUpInBackground(signUpCallback);
125 | }
126 |
127 | public static void logout() {
128 | AVUser.logOut();
129 | }
130 |
131 | public static void createAdvice(String userId, String advice, SaveCallback saveCallback) {
132 | AVObject doing = new AVObject("SuggestionByUser");
133 | doing.put("UserObjectId", userId);
134 | doing.put("UserSuggestion", advice);
135 | doing.saveInBackground(saveCallback);
136 | }
137 | }
138 |
139 | ```
140 |
--------------------------------------------------------------------------------
/anytime-activity-diagram.acd:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 255
5 | 255
6 | 206
7 |
8 |
9 | 0
10 | 0
11 | 0
12 |
13 | true
14 |
15 |
16 |
17 |
18 | 2
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/anytime-class-diagram.cld:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 255
5 | 255
6 | 206
7 |
8 |
9 | 0
10 | 0
11 | 0
12 |
13 | true
14 |
15 |
16 |
17 |
18 | 2
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 | true
30 |
31 |
32 |
33 |
34 |
35 | 2
36 |
37 |
38 |
39 |
40 |
41 | -1
42 | -1
43 | 21
44 | 19
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 | true
53 |
54 |
55 |
56 |
57 |
58 | 2
59 |
60 |
61 |
62 |
63 |
64 | submitButton
65 | Button
66 | false
67 |
68 |
69 |
70 |
71 | true
72 |
73 |
74 |
75 |
76 |
77 | 2
78 |
79 |
80 |
81 |
82 |
83 | submitEditText
84 | EditText
85 | false
86 |
87 |
88 |
89 |
90 | true
91 |
92 |
93 |
94 |
95 |
96 | 2
97 |
98 |
99 |
100 |
101 |
102 | mUserResponseListView
103 | ListView
104 | false
105 |
106 |
107 |
108 |
109 | true
110 |
111 |
112 |
113 |
114 |
115 | 2
116 |
117 |
118 |
119 |
120 |
121 | buttonListener
122 | OnClickListener
123 | false
124 |
125 |
126 |
127 |
128 | true
129 |
130 |
131 |
132 |
133 |
134 | 2
135 |
136 |
137 |
138 |
139 |
140 | mHandler
141 | Handler
142 | false
143 |
144 |
145 |
146 |
147 | true
148 |
149 |
150 |
151 |
152 |
153 | 2
154 |
155 |
156 |
157 |
158 |
159 | onCreate
160 | void
161 |
162 |
163 | savedInstanceState
164 | Bundle
165 |
166 |
167 | false
168 | false
169 |
170 |
171 |
172 |
173 | true
174 |
175 |
176 |
177 |
178 |
179 | 2
180 |
181 |
182 |
183 |
184 |
185 | showResponseList
186 | void
187 |
188 |
189 | responseList
190 | List<AVObject>
191 |
192 |
193 | false
194 | false
195 |
196 |
197 |
198 |
199 | true
200 |
201 |
202 |
203 |
204 |
205 | 2
206 |
207 |
208 |
209 |
210 |
211 | onOptionsItemSelected
212 | boolean
213 |
214 |
215 | item
216 | MenuItem
217 |
218 |
219 | false
220 | false
221 |
222 |
223 |
224 |
225 |
226 | _stereo_type
227 | Stereo Type
228 | false
229 |
230 |
231 | _simpleEntityName
232 | Simple Name
233 | false
234 |
235 |
236 | _entityName
237 | Name
238 | false
239 |
240 |
241 | _background
242 | Background Color
243 | false
244 |
245 |
246 | _attrs
247 | Attributes...
248 | false
249 |
250 |
251 | _operations
252 | Operations...
253 | false
254 |
255 |
256 | _abstract
257 | abstract
258 | false
259 |
260 |
261 |
262 | com.luna.anytime.AboutAppActivity
263 | false
264 |
265 |
266 |
267 |
268 | true
269 |
270 |
271 |
272 |
273 |
274 | 2
275 |
276 |
277 |
278 |
279 |
280 | -1
281 | -1
282 | 21
283 | 210
284 |
285 |
286 |
287 |
288 |
289 |
290 |
291 | true
292 |
293 |
294 |
295 |
296 |
297 | 2
298 |
299 |
300 |
301 |
302 |
303 | mResponseList
304 | List<AVObject>
305 | false
306 |
307 |
308 |
309 |
310 | true
311 |
312 |
313 |
314 |
315 |
316 | 2
317 |
318 |
319 |
320 |
321 |
322 | mInflater
323 | LayoutInflater
324 | false
325 |
326 |
327 |
328 |
329 | true
330 |
331 |
332 |
333 |
334 |
335 | 2
336 |
337 |
338 |
339 |
340 |
341 | AnytimeUserResponseListAdapter
342 | void
343 |
344 |
345 | responseList
346 | List<AVObject>
347 |
348 |
349 | context
350 | Context
351 |
352 |
353 | false
354 | false
355 |
356 |
357 |
358 |
359 | true
360 |
361 |
362 |
363 |
364 |
365 | 2
366 |
367 |
368 |
369 |
370 |
371 | getCount
372 | int
373 |
374 | false
375 | false
376 |
377 |
378 |
379 |
380 | true
381 |
382 |
383 |
384 |
385 |
386 | 2
387 |
388 |
389 |
390 |
391 |
392 | getItem
393 | Object
394 |
395 |
396 | position
397 | int
398 |
399 |
400 | false
401 | false
402 |
403 |
404 |
405 |
406 | true
407 |
408 |
409 |
410 |
411 |
412 | 2
413 |
414 |
415 |
416 |
417 |
418 | getItemId
419 | long
420 |
421 |
422 | position
423 | int
424 |
425 |
426 | false
427 | false
428 |
429 |
430 |
431 |
432 | true
433 |
434 |
435 |
436 |
437 |
438 | 2
439 |
440 |
441 |
442 |
443 |
444 | getItemViewType
445 | int
446 |
447 |
448 | position
449 | int
450 |
451 |
452 | false
453 | false
454 |
455 |
456 |
457 |
458 | true
459 |
460 |
461 |
462 |
463 |
464 | 2
465 |
466 |
467 |
468 |
469 |
470 | getView
471 | View
472 |
473 |
474 | position
475 | int
476 |
477 |
478 | convertView
479 | View
480 |
481 |
482 | parent
483 | ViewGroup
484 |
485 |
486 | false
487 | false
488 |
489 |
490 |
491 |
492 | true
493 |
494 |
495 |
496 |
497 |
498 | 2
499 |
500 |
501 |
502 |
503 |
504 | getViewTypeCount
505 | int
506 |
507 | false
508 | false
509 |
510 |
511 |
512 |
513 | true
514 |
515 |
516 |
517 |
518 |
519 | 2
520 |
521 |
522 |
523 |
524 |
525 | hasStableIds
526 | boolean
527 |
528 | false
529 | false
530 |
531 |
532 |
533 |
534 | true
535 |
536 |
537 |
538 |
539 |
540 | 2
541 |
542 |
543 |
544 |
545 |
546 | isEmpty
547 | boolean
548 |
549 | false
550 | false
551 |
552 |
553 |
554 |
555 | true
556 |
557 |
558 |
559 |
560 |
561 | 2
562 |
563 |
564 |
565 |
566 |
567 | registerDataSetObserver
568 | void
569 |
570 |
571 | observer
572 | DataSetObserver
573 |
574 |
575 | false
576 | false
577 |
578 |
579 |
580 |
581 | true
582 |
583 |
584 |
585 |
586 |
587 | 2
588 |
589 |
590 |
591 |
592 |
593 | unregisterDataSetObserver
594 | void
595 |
596 |
597 | observer
598 | DataSetObserver
599 |
600 |
601 | false
602 | false
603 |
604 |
605 |
606 |
607 | true
608 |
609 |
610 |
611 |
612 |
613 | 2
614 |
615 |
616 |
617 |
618 |
619 | areAllItemsEnabled
620 | boolean
621 |
622 | false
623 | false
624 |
625 |
626 |
627 |
628 | true
629 |
630 |
631 |
632 |
633 |
634 | 2
635 |
636 |
637 |
638 |
639 |
640 | isEnabled
641 | boolean
642 |
643 |
644 | position
645 | int
646 |
647 |
648 | false
649 | false
650 |
651 |
652 |
653 |
654 |
655 | _stereo_type
656 | Stereo Type
657 | false
658 |
659 |
660 | _simpleEntityName
661 | Simple Name
662 | false
663 |
664 |
665 | _entityName
666 | Name
667 | false
668 |
669 |
670 | _background
671 | Background Color
672 | false
673 |
674 |
675 | _attrs
676 | Attributes...
677 | false
678 |
679 |
680 | _operations
681 | Operations...
682 | false
683 |
684 |
685 | _abstract
686 | abstract
687 | false
688 |
689 |
690 |
691 | com.luna.anytime.adapter.AnytimeUserResponseListAdapter
692 | false
693 |
694 |
695 |
696 |
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | repositories {
3 | jcenter()
4 | }
5 | dependencies {
6 | classpath 'com.android.tools.build:gradle:1.0.0'
7 | }
8 | }
9 |
10 | apply plugin: 'android'
11 |
12 | android {
13 | compileSdkVersion 21
14 | buildToolsVersion '21.1.2'
15 |
16 | buildTypes {
17 | release {
18 | }
19 | }
20 | packagingOptions {
21 | exclude 'META-INF/LICENSE.txt'
22 | exclude 'META-INF/NOTICE.txt'
23 | }
24 | sourceSets {
25 | main {
26 | manifest.srcFile 'AndroidManifest.xml'
27 | java.srcDirs = ['src']
28 | resources.srcDirs = ['src']
29 | aidl.srcDirs = ['src']
30 | renderscript.srcDirs = ['src']
31 | res.srcDirs = ['res']
32 | assets.srcDirs = ['assets']
33 | }
34 | }
35 | lintOptions {
36 | abortOnError false
37 | }
38 | }
39 |
40 | dependencies {
41 | compile fileTree(dir: 'libs', include: ['*.jar'])
42 | }
43 |
--------------------------------------------------------------------------------
/data/Achievement.json:
--------------------------------------------------------------------------------
1 | { "results": [
2 | ] }
--------------------------------------------------------------------------------
/data/AchievementList.json:
--------------------------------------------------------------------------------
1 | { "results": [
2 |
3 | {"objectId":"5312d149e4b02c7052866ccc","ACL":{"*":{"read":true,"write":true}},"AchievementName":"第一次说我在做神马","AchievementPhotoObjectId":"530ff710e4b0b3bfe702b98d","createdAt":"2014-03-02T14:35:53.194Z","updatedAt":"2014-03-31T21:36:22.850Z"}] }
--------------------------------------------------------------------------------
/data/DoingList.json:
--------------------------------------------------------------------------------
1 | { "results": [
2 |
3 | {"objectId":"53130f0ae4b02c7052869943","userObjectId":"5306b6bee4b068c9c65860b9","doingListChildObjectId":"53089931e4b01ec7d0915000","ACL":{"*":{"write":true,"read":true}},"createdAt":"2014-03-02T18:59:22.092Z","updatedAt":"2014-03-02T18:59:22.092Z"},
4 | {"objectId":"53130f20e4b02c705286994b","userObjectId":"5306b6bee4b068c9c65860b9","doingListChildObjectId":"53089983e4b01ec7d091509d","ACL":{"*":{"write":true,"read":true}},"createdAt":"2014-03-02T18:59:44.331Z","updatedAt":"2014-03-02T18:59:44.331Z"},
5 | {"objectId":"53131f18e4b02c705286a733","userObjectId":"5306b6bee4b068c9c65860b9","doingListChildObjectId":"530896ade4b01ec7d09149a0","ACL":{"*":{"write":true,"read":true}},"createdAt":"2014-03-02T20:07:52.075Z","updatedAt":"2014-03-02T20:07:52.075Z"},
6 | {"objectId":"53132202e4b02c705286a8d2","userObjectId":"5306b6bee4b068c9c65860b9","doingListChildObjectId":"530896a4e4b01ec7d091498e","ACL":{"*":{"write":true,"read":true}},"createdAt":"2014-03-02T20:20:18.371Z","updatedAt":"2014-03-02T20:20:18.371Z"},
7 | {"objectId":"53132208e4b02c705286a8db","userObjectId":"5306b6bee4b068c9c65860b9","doingListChildObjectId":"530896a4e4b01ec7d091498e","ACL":{"*":{"write":true,"read":true}},"createdAt":"2014-03-02T20:20:24.249Z","updatedAt":"2014-03-02T20:20:24.249Z"},
8 | {"objectId":"5313220de4b02c705286a8dc","userObjectId":"5306b6bee4b068c9c65860b9","doingListChildObjectId":"530896a4e4b01ec7d091498e","ACL":{"*":{"write":true,"read":true}},"createdAt":"2014-03-02T20:20:29.209Z","updatedAt":"2014-03-02T20:20:29.209Z"},
9 | {"objectId":"531322d4e4b02c705286a936","userObjectId":"5306b6bee4b068c9c65860b9","doingListChildObjectId":"530896a4e4b01ec7d091498e","ACL":{"*":{"write":true,"read":true}},"createdAt":"2014-03-02T20:23:48.452Z","updatedAt":"2014-03-02T20:23:48.452Z"},
10 | {"objectId":"5316b6fbe4b0f5f199cddd62","userObjectId":"5306b6bee4b068c9c65860b9","doingListChildObjectId":"5308997be4b01ec7d091508c","ACL":{"*":{"write":true,"read":true}},"createdAt":"2014-03-05T13:32:43.454Z","updatedAt":"2014-03-05T13:32:43.454Z"},
11 | {"objectId":"5316b70de4b0f5f199cddd94","userObjectId":"5306b6bee4b068c9c65860b9","doingListChildObjectId":"53089993e4b01ec7d09150ab","ACL":{"*":{"write":true,"read":true}},"createdAt":"2014-03-05T13:33:01.476Z","updatedAt":"2014-03-05T13:33:01.476Z"},
12 | {"objectId":"53183d72e4b0a0ce6ded2030","userObjectId":"5306b6bee4b068c9c65860b9","doingListChildObjectId":"530896ade4b01ec7d09149a0","ACL":{"*":{"write":true,"read":true}},"createdAt":"2014-03-06T17:18:42.682Z","updatedAt":"2014-03-06T17:18:42.682Z"},
13 | {"objectId":"53183d74e4b0a0ce6ded2031","userObjectId":"5306b6bee4b068c9c65860b9","doingListChildObjectId":"530896b4e4b01ec7d09149ac","ACL":{"*":{"write":true,"read":true}},"createdAt":"2014-03-06T17:18:44.211Z","updatedAt":"2014-03-06T17:18:44.211Z"},
14 | {"objectId":"53183d75e4b0a0ce6ded2032","userObjectId":"5306b6bee4b068c9c65860b9","doingListChildObjectId":"530896bde4b01ec7d09149d1","ACL":{"*":{"write":true,"read":true}},"createdAt":"2014-03-06T17:18:45.732Z","updatedAt":"2014-03-06T17:18:45.732Z"},
15 | {"objectId":"53183d77e4b0a0ce6ded2033","userObjectId":"5306b6bee4b068c9c65860b9","doingListChildObjectId":"530896bde4b01ec7d09149d1","ACL":{"*":{"write":true,"read":true}},"createdAt":"2014-03-06T17:18:47.253Z","updatedAt":"2014-03-06T17:18:47.253Z"},
16 | {"objectId":"5318452de4b0a0ce6ded2485","userObjectId":"5306b6bee4b068c9c65860b9","doingListChildObjectId":"530896ade4b01ec7d09149a0","ACL":{"*":{"write":true,"read":true}},"createdAt":"2014-03-06T17:51:41.727Z","updatedAt":"2014-03-06T17:51:41.727Z"},
17 | {"objectId":"531e8407e4b0d818eac1eaba","userObjectId":"5306b6bee4b068c9c65860b9","doingListChildObjectId":"530896a4e4b01ec7d091498e","ACL":{"*":{"write":true,"read":true}},"createdAt":"2014-03-11T11:33:27.239Z","updatedAt":"2014-03-11T11:33:27.239Z"},
18 | {"objectId":"532f964ae4b01c555fed15a3","userObjectId":"5306b6bee4b068c9c65860b9","doingListChildObjectId":"530896ade4b01ec7d09149a0","ACL":{"*":{"write":true,"read":true}},"createdAt":"2014-03-24T10:19:54.706Z","updatedAt":"2014-03-24T10:19:54.706Z"},
19 | {"objectId":"53396ad8e4b05533e362f9c1","userObjectId":"5306b6bee4b068c9c65860b9","doingListChildObjectId":"530896a4e4b01ec7d091498e","ACL":{"*":{"write":true,"read":true}},"createdAt":"2014-03-31T21:17:12.270Z","updatedAt":"2014-03-31T21:17:12.270Z"},
20 | {"objectId":"53396eb3e4b05533e363032b","userObjectId":"5306b6bee4b068c9c65860b9","doingListChildObjectId":"530896a4e4b01ec7d091498e","ACL":{"*":{"write":true,"read":true}},"createdAt":"2014-03-31T21:33:39.258Z","updatedAt":"2014-03-31T21:33:39.258Z"},
21 | {"objectId":"53416532e4b090f2b169b78a","userObjectId":"5306b6bee4b068c9c65860b9","doingListChildObjectId":"530896a4e4b01ec7d091498e","ACL":{"*":{"write":true,"read":true}},"createdAt":"2014-04-06T22:31:14.325Z","updatedAt":"2014-04-06T22:31:14.325Z"},
22 | {"objectId":"534165aae4b090f2b169b85c","userObjectId":"5306b6bee4b068c9c65860b9","doingListChildObjectId":"530896a4e4b01ec7d091498e","ACL":{"*":{"write":true,"read":true}},"createdAt":"2014-04-06T22:33:14.209Z","updatedAt":"2014-04-06T22:33:14.209Z"},
23 | {"objectId":"5350d5cce4b093fbd4b11680","userObjectId":"5306b6bee4b068c9c65860b9","doingListChildObjectId":"530896a4e4b01ec7d091498e","ACL":{"*":{"write":true,"read":true}},"createdAt":"2014-04-18T15:35:40.192Z","updatedAt":"2014-04-18T15:35:40.192Z"},
24 | {"objectId":"5350d5d1e4b093fbd4b11683","userObjectId":"5306b6bee4b068c9c65860b9","doingListChildObjectId":"530896b4e4b01ec7d09149ac","ACL":{"*":{"write":true,"read":true}},"createdAt":"2014-04-18T15:35:45.778Z","updatedAt":"2014-04-18T15:35:45.778Z"},
25 | {"objectId":"5350d5d3e4b093fbd4b11687","userObjectId":"5306b6bee4b068c9c65860b9","doingListChildObjectId":"53089931e4b01ec7d0915000","ACL":{"*":{"write":true,"read":true}},"createdAt":"2014-04-18T15:35:47.612Z","updatedAt":"2014-04-18T15:35:47.612Z"},
26 | {"objectId":"5350d5d8e4b093fbd4b1168c","userObjectId":"5306b6bee4b068c9c65860b9","doingListChildObjectId":"530896a4e4b01ec7d091498e","ACL":{"*":{"write":true,"read":true}},"createdAt":"2014-04-18T15:35:52.877Z","updatedAt":"2014-04-18T15:35:52.877Z"},
27 | {"objectId":"5350d5d9e4b093fbd4b1168e","userObjectId":"5306b6bee4b068c9c65860b9","doingListChildObjectId":"530896bde4b01ec7d09149d1","ACL":{"*":{"write":true,"read":true}},"createdAt":"2014-04-18T15:35:53.997Z","updatedAt":"2014-04-18T15:35:53.997Z"},
28 | {"objectId":"5350d5dbe4b093fbd4b11692","userObjectId":"5306b6bee4b068c9c65860b9","doingListChildObjectId":"5308d262e4b01ec7d091946b","ACL":{"*":{"write":true,"read":true}},"createdAt":"2014-04-18T15:35:55.832Z","updatedAt":"2014-04-18T15:35:55.832Z"},
29 | {"objectId":"5350d5dde4b093fbd4b11697","userObjectId":"5306b6bee4b068c9c65860b9","doingListChildObjectId":"53089931e4b01ec7d0915000","ACL":{"*":{"write":true,"read":true}},"createdAt":"2014-04-18T15:35:57.813Z","updatedAt":"2014-04-18T15:35:57.813Z"},
30 | {"objectId":"5355e6bee4b08421758c7370","userObjectId":"5306b6bee4b068c9c65860b9","doingListChildObjectId":"530896a4e4b01ec7d091498e","ACL":{"*":{"write":true,"read":true}},"createdAt":"2014-04-22T11:49:18.848Z","updatedAt":"2014-04-22T11:49:18.848Z"},
31 | {"objectId":"5355e6c1e4b08421758c7371","userObjectId":"5306b6bee4b068c9c65860b9","doingListChildObjectId":"530896b4e4b01ec7d09149ac","ACL":{"*":{"write":true,"read":true}},"createdAt":"2014-04-22T11:49:21.072Z","updatedAt":"2014-04-22T11:49:21.072Z"},
32 | {"objectId":"5355e6c7e4b08421758c7375","userObjectId":"5306b6bee4b068c9c65860b9","doingListChildObjectId":"5308d262e4b01ec7d091946b","ACL":{"*":{"write":true,"read":true}},"createdAt":"2014-04-22T11:49:27.703Z","updatedAt":"2014-04-22T11:49:27.703Z"},
33 | {"objectId":"5355e6e5e4b08421758c7393","userObjectId":"5306b6bee4b068c9c65860b9","doingListChildObjectId":"530896bde4b01ec7d09149d1","ACL":{"*":{"write":true,"read":true}},"createdAt":"2014-04-22T11:49:57.299Z","updatedAt":"2014-04-22T11:49:57.299Z"},
34 | {"objectId":"53996061e4b00c574e7dc363","userObjectId":"5306b6bee4b068c9c65860b9","doingListChildObjectId":"530896ade4b01ec7d09149a0","ACL":{"*":{"write":true,"read":true}},"createdAt":"2014-06-12T16:10:09.464Z","updatedAt":"2014-06-12T16:10:09.464Z"},
35 | {"objectId":"539962f5e4b0be5fcf772cd0","userObjectId":"539962ebe4b0be5fcf772cae","doingListChildObjectId":"530896b4e4b01ec7d09149ac","ACL":{"*":{"write":true,"read":true}},"createdAt":"2014-06-12T16:21:09.008Z","updatedAt":"2014-06-12T16:21:09.008Z"},
36 | {"objectId":"539962f9e4b0be5fcf772ce7","userObjectId":"539962ebe4b0be5fcf772cae","doingListChildObjectId":"530896fbe4b01ec7d0914a34","ACL":{"*":{"write":true,"read":true}},"createdAt":"2014-06-12T16:21:13.936Z","updatedAt":"2014-06-12T16:21:13.936Z"},
37 | {"objectId":"53996300e4b0be5fcf772cf4","userObjectId":"539962ebe4b0be5fcf772cae","doingListChildObjectId":"53089983e4b01ec7d091509d","ACL":{"*":{"write":true,"read":true}},"createdAt":"2014-06-12T16:21:20.913Z","updatedAt":"2014-06-12T16:21:20.913Z"},
38 | {"objectId":"5399630ae4b0be5fcf772d0e","userObjectId":"539962ebe4b0be5fcf772cae","doingListChildObjectId":"530896a4e4b01ec7d091498e","ACL":{"*":{"write":true,"read":true}},"createdAt":"2014-06-12T16:21:30.514Z","updatedAt":"2014-06-12T16:21:30.514Z"},
39 | {"objectId":"5399630ee4b0be5fcf772d1c","userObjectId":"539962ebe4b0be5fcf772cae","doingListChildObjectId":"530896a4e4b01ec7d091498e","ACL":{"*":{"write":true,"read":true}},"createdAt":"2014-06-12T16:21:34.802Z","updatedAt":"2014-06-12T16:21:34.802Z"},
40 | {"objectId":"53996312e4b0be5fcf772d28","userObjectId":"539962ebe4b0be5fcf772cae","doingListChildObjectId":"530896a4e4b01ec7d091498e","ACL":{"*":{"write":true,"read":true}},"createdAt":"2014-06-12T16:21:38.005Z","updatedAt":"2014-06-12T16:21:38.005Z"},
41 | {"objectId":"53996316e4b0be5fcf772d36","userObjectId":"539962ebe4b0be5fcf772cae","doingListChildObjectId":"530896a4e4b01ec7d091498e","ACL":{"*":{"write":true,"read":true}},"createdAt":"2014-06-12T16:21:42.962Z","updatedAt":"2014-06-12T16:21:42.962Z"},
42 | {"objectId":"5399631be4b0be5fcf772d44","userObjectId":"539962ebe4b0be5fcf772cae","doingListChildObjectId":"53089940e4b01ec7d0915015","ACL":{"*":{"write":true,"read":true}},"createdAt":"2014-06-12T16:21:47.654Z","updatedAt":"2014-06-12T16:21:47.654Z"},
43 | {"objectId":"5399631ee4b0be5fcf772d4b","userObjectId":"539962ebe4b0be5fcf772cae","doingListChildObjectId":"53089940e4b01ec7d0915015","ACL":{"*":{"write":true,"read":true}},"createdAt":"2014-06-12T16:21:50.069Z","updatedAt":"2014-06-12T16:21:50.069Z"},
44 | {"objectId":"53996321e4b0be5fcf772d58","userObjectId":"539962ebe4b0be5fcf772cae","doingListChildObjectId":"53089931e4b01ec7d0915000","ACL":{"*":{"write":true,"read":true}},"createdAt":"2014-06-12T16:21:53.824Z","updatedAt":"2014-06-12T16:21:53.824Z"},
45 | {"objectId":"53996323e4b0be5fcf772d5b","userObjectId":"539962ebe4b0be5fcf772cae","doingListChildObjectId":"53089931e4b01ec7d0915000","ACL":{"*":{"write":true,"read":true}},"createdAt":"2014-06-12T16:21:55.510Z","updatedAt":"2014-06-12T16:21:55.510Z"},
46 | {"objectId":"539967eae4b00c574e7dcf24","userObjectId":"5306b6bee4b068c9c65860b9","doingListChildObjectId":"530896a4e4b01ec7d091498e","ACL":{"*":{"write":true,"read":true}},"createdAt":"2014-06-12T16:42:18.548Z","updatedAt":"2014-06-12T16:42:18.548Z"},
47 | {"objectId":"539967f9e4b00c574e7dcf2f","userObjectId":"5306b6bee4b068c9c65860b9","doingListChildObjectId":"530896b4e4b01ec7d09149ac","ACL":{"*":{"write":true,"read":true}},"createdAt":"2014-06-12T16:42:33.136Z","updatedAt":"2014-06-12T16:42:33.136Z"},
48 | {"objectId":"53996800e4b00c574e7dcf43","userObjectId":"5306b6bee4b068c9c65860b9","doingListChildObjectId":"530896b4e4b01ec7d09149ac","ACL":{"*":{"write":true,"read":true}},"createdAt":"2014-06-12T16:42:40.438Z","updatedAt":"2014-06-12T16:42:40.438Z"},
49 | {"objectId":"53996803e4b00c574e7dcf4b","userObjectId":"5306b6bee4b068c9c65860b9","doingListChildObjectId":"530896bde4b01ec7d09149d1","ACL":{"*":{"write":true,"read":true}},"createdAt":"2014-06-12T16:42:43.636Z","updatedAt":"2014-06-12T16:42:43.636Z"},
50 | {"objectId":"53996805e4b00c574e7dcf4c","userObjectId":"5306b6bee4b068c9c65860b9","doingListChildObjectId":"530896bde4b01ec7d09149d1","ACL":{"*":{"write":true,"read":true}},"createdAt":"2014-06-12T16:42:45.419Z","updatedAt":"2014-06-12T16:42:45.419Z"},
51 | {"objectId":"53996807e4b00c574e7dcf4e","userObjectId":"5306b6bee4b068c9c65860b9","doingListChildObjectId":"530896bde4b01ec7d09149d1","ACL":{"*":{"write":true,"read":true}},"createdAt":"2014-06-12T16:42:47.486Z","updatedAt":"2014-06-12T16:42:47.486Z"},
52 | {"objectId":"53996821e4b00c574e7dcf6f","userObjectId":"5306b6bee4b068c9c65860b9","doingListChildObjectId":"53089983e4b01ec7d091509d","ACL":{"*":{"write":true,"read":true}},"createdAt":"2014-06-12T16:43:13.736Z","updatedAt":"2014-06-12T16:43:13.736Z"}] }
--------------------------------------------------------------------------------
/data/DoingListChild.json:
--------------------------------------------------------------------------------
1 | { "results": [
2 |
3 | {"objectId":"530896a4e4b01ec7d091498e","ACL":{"*":{"read":true}},"ChildName":"吃饭","Index":"1","createdAt":"2014-02-22T20:23:00.621Z","parentObjectId":"53088f55e4b01ec7d09138ab","updatedAt":"2014-02-22T20:34:21.312Z"},
4 | {"objectId":"530896ade4b01ec7d09149a0","ACL":{"*":{"read":true}},"ChildName":"睡觉","Index":"2","createdAt":"2014-02-22T20:23:09.885Z","parentObjectId":"53088f55e4b01ec7d09138ab","updatedAt":"2014-02-22T20:25:44.416Z"},
5 | {"objectId":"530896b4e4b01ec7d09149ac","ACL":{"*":{"read":true}},"ChildName":"走路","Index":"3","createdAt":"2014-02-22T20:23:16.017Z","parentObjectId":"53088f55e4b01ec7d09138ab","updatedAt":"2014-02-22T20:25:44.884Z"},
6 | {"objectId":"530896bde4b01ec7d09149d1","ACL":{"*":{"read":true}},"ChildName":"开车","Index":"4","createdAt":"2014-02-22T20:23:25.164Z","parentObjectId":"53088f55e4b01ec7d09138ab","updatedAt":"2014-02-22T20:25:45.768Z"},
7 | {"objectId":"530896fbe4b01ec7d0914a34","ACL":{"*":{"read":true}},"ChildName":"洗澡","Index":"5","createdAt":"2014-02-22T20:24:27.049Z","parentObjectId":"53088f55e4b01ec7d09138ab","updatedAt":"2014-02-22T20:25:46.796Z"},
8 | {"objectId":"53089931e4b01ec7d0915000","ACL":{"*":{"read":true}},"ChildName":"上班","Index":"1","createdAt":"2014-02-22T20:33:53.847Z","parentObjectId":"53088fabe4b01ec7d091395c","updatedAt":"2014-02-22T20:34:35.617Z"},
9 | {"objectId":"5308993be4b01ec7d091500e","ACL":{"*":{"read":true}},"ChildName":"工作","Index":"2","createdAt":"2014-02-22T20:34:03.413Z","parentObjectId":"53088fabe4b01ec7d091395c","updatedAt":"2014-02-22T20:34:36.522Z"},
10 | {"objectId":"53089940e4b01ec7d0915015","ACL":{"*":{"read":true}},"ChildName":"下班","Index":"3","createdAt":"2014-02-22T20:34:08.454Z","parentObjectId":"53088fabe4b01ec7d091395c","updatedAt":"2014-02-22T20:35:46.677Z"},
11 | {"objectId":"5308997be4b01ec7d091508c","ACL":{"*":{"read":true}},"ChildName":"玩电脑","Index":"1","createdAt":"2014-02-22T20:35:07.475Z","parentObjectId":"53088fa4e4b01ec7d091394e","updatedAt":"2014-02-22T20:36:00.497Z"},
12 | {"objectId":"53089983e4b01ec7d091509d","ACL":{"*":{"read":true}},"ChildName":"体育活动","Index":"2","createdAt":"2014-02-22T20:35:15.775Z","parentObjectId":"53088fa4e4b01ec7d091394e","updatedAt":"2014-02-22T20:36:00.868Z"},
13 | {"objectId":"53089993e4b01ec7d09150ab","ACL":{"*":{"read":true}},"ChildName":"唱K","Index":"3","createdAt":"2014-02-22T20:35:31.100Z","parentObjectId":"53088fa4e4b01ec7d091394e","updatedAt":"2014-02-22T20:36:02.263Z"},
14 | {"objectId":"53089997e4b01ec7d09150ae","ACL":{"*":{"read":true}},"ChildName":"聚餐","Index":"4","createdAt":"2014-02-22T20:35:35.598Z","parentObjectId":"53088fa4e4b01ec7d091394e","updatedAt":"2014-02-23T00:38:05.939Z"},
15 | {"objectId":"5308d262e4b01ec7d091946b","ACL":{"*":{"read":true}},"ChildName":"上厕所","Index":"6","createdAt":"2014-02-23T00:37:54.712Z","parentObjectId":"53088f55e4b01ec7d09138ab","updatedAt":"2014-02-23T00:39:49.773Z"},
16 | {"objectId":"5308d2cae4b01ec7d091948c","ACL":{"*":{"read":true}},"ChildName":"忙里偷闲","Index":"4","createdAt":"2014-02-23T00:39:38.986Z","parentObjectId":"53088fabe4b01ec7d091395c","updatedAt":"2014-02-23T00:39:55.823Z"}] }
--------------------------------------------------------------------------------
/data/DoingListGroup.json:
--------------------------------------------------------------------------------
1 | { "results": [
2 |
3 | {"objectId":"53088f55e4b01ec7d09138ab","ACL":{"*":{"read":true}},"GroupName":"生活","Index":1,"createdAt":"2014-02-22T19:51:49.990Z","updatedAt":"2014-02-22T19:54:02.159Z"},
4 | {"objectId":"53088fa4e4b01ec7d091394e","ACL":{"*":{"read":true}},"GroupName":"休闲","Index":3,"createdAt":"2014-02-22T19:53:08.281Z","updatedAt":"2014-02-22T19:54:05.603Z"},
5 | {"objectId":"53088fabe4b01ec7d091395c","ACL":{"*":{"read":true}},"GroupName":"工作","Index":2,"createdAt":"2014-02-22T19:53:15.485Z","updatedAt":"2014-02-22T20:25:23.768Z"}] }
--------------------------------------------------------------------------------
/data/SuggestionByUser.json:
--------------------------------------------------------------------------------
1 | { "results": [
2 |
3 | {"objectId":"531321d5e4b02c705286a8b8","ACL":{"*":{"write":true,"read":true}},"IsResponseToUser":false,"UserObjectId":"5306b6bee4b068c9c65860b9","UserSuggestion":"啊啊啊","createdAt":"2014-03-02T20:19:33.615Z","updatedAt":"2014-03-05T20:04:08.187Z"},
4 | {"objectId":"531322cfe4b02c705286a933","ACL":{"*":{"read":true,"write":true}},"IsResponseToUser":false,"UserObjectId":"5306b6bee4b068c9c65860b9","UserSuggestion":"人人","createdAt":"2014-03-02T20:23:43.029Z","updatedAt":"2014-03-05T20:04:45.129Z"},
5 | {"objectId":"531712c7e4b018d1ec879d98","ACL":{"*":{"read":true}},"IsResponseToUser":true,"UserObjectId":"5306b6bee4b068c9c65860b9","UserSuggestion":"this is response","createdAt":"2014-03-05T20:04:23.224Z","updatedAt":"2014-03-05T20:04:58.489Z"},
6 | {"objectId":"53180632e4b079c9b2276637","UserSuggestion":"你好吧!急急急需要成功能力量化妆品质量化妆师妹子宫廷shdhdhdh","UserObjectId":"5306f75ee4b068c9c6594c69","ACL":{"*":{"write":true,"read":true}},"createdAt":"2014-03-06T13:22:58.033Z","updatedAt":"2014-03-06T13:22:58.033Z"},
7 | {"objectId":"5399633ee4b0be5fcf772db3","UserSuggestion":"做的真不错,谢谢,来自avos cloud","UserObjectId":"539962ebe4b0be5fcf772cae","ACL":{"*":{"write":true,"read":true}},"createdAt":"2014-06-12T16:22:22.915Z","updatedAt":"2014-06-12T16:22:22.915Z"}] }
--------------------------------------------------------------------------------
/ic_launcher-web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LunaGao/AnyTime/2abfb1b33c273b1f3450f35f1242adba82c7c674/ic_launcher-web.png
--------------------------------------------------------------------------------
/libs/android-async-http-1.4.6.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LunaGao/AnyTime/2abfb1b33c273b1f3450f35f1242adba82c7c674/libs/android-async-http-1.4.6.jar
--------------------------------------------------------------------------------
/libs/android-support-v4.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LunaGao/AnyTime/2abfb1b33c273b1f3450f35f1242adba82c7c674/libs/android-support-v4.jar
--------------------------------------------------------------------------------
/libs/avoscloud-v2.6.9.1.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LunaGao/AnyTime/2abfb1b33c273b1f3450f35f1242adba82c7c674/libs/avoscloud-v2.6.9.1.jar
--------------------------------------------------------------------------------
/libs/avospush-v2.6.9.1.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LunaGao/AnyTime/2abfb1b33c273b1f3450f35f1242adba82c7c674/libs/avospush-v2.6.9.1.jar
--------------------------------------------------------------------------------
/libs/avossearch-v2.6.9.1.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LunaGao/AnyTime/2abfb1b33c273b1f3450f35f1242adba82c7c674/libs/avossearch-v2.6.9.1.jar
--------------------------------------------------------------------------------
/libs/avosstatistics-v2.6.9.1.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LunaGao/AnyTime/2abfb1b33c273b1f3450f35f1242adba82c7c674/libs/avosstatistics-v2.6.9.1.jar
--------------------------------------------------------------------------------
/libs/fastjson.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LunaGao/AnyTime/2abfb1b33c273b1f3450f35f1242adba82c7c674/libs/fastjson.jar
--------------------------------------------------------------------------------
/libs/httpmime-4.2.4.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LunaGao/AnyTime/2abfb1b33c273b1f3450f35f1242adba82c7c674/libs/httpmime-4.2.4.jar
--------------------------------------------------------------------------------
/proguard-project.txt:
--------------------------------------------------------------------------------
1 | # To enable ProGuard in your project, edit project.properties
2 | # to define the proguard.config property as described in that file.
3 | #
4 | # Add project specific ProGuard rules here.
5 | # By default, the flags in this file are appended to flags specified
6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt
7 | # You can edit the include path and order by changing the ProGuard
8 | # include property in project.properties.
9 | #
10 | # For more details, see
11 | # http://developer.android.com/guide/developing/tools/proguard.html
12 |
13 | # Add any project specific keep options here:
14 |
15 | # If your project uses WebView with JS, uncomment the following
16 | # and specify the fully qualified class name to the JavaScript interface
17 | # class:
18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
19 | # public *;
20 | #}
21 |
--------------------------------------------------------------------------------
/project.properties:
--------------------------------------------------------------------------------
1 | # This file is automatically generated by Android Tools.
2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 | #
4 | # This file must be checked in Version Control Systems.
5 | #
6 | # To customize properties used by the Ant build system edit
7 | # "ant.properties", and override values to adapt the script to your
8 | # project structure.
9 | #
10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
12 |
13 | # Project target.
14 | target=android-18
15 |
--------------------------------------------------------------------------------
/res/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LunaGao/AnyTime/2abfb1b33c273b1f3450f35f1242adba82c7c674/res/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LunaGao/AnyTime/2abfb1b33c273b1f3450f35f1242adba82c7c674/res/drawable-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/res/drawable-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LunaGao/AnyTime/2abfb1b33c273b1f3450f35f1242adba82c7c674/res/drawable-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/res/drawable-xxhdpi/achievement_title.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LunaGao/AnyTime/2abfb1b33c273b1f3450f35f1242adba82c7c674/res/drawable-xxhdpi/achievement_title.png
--------------------------------------------------------------------------------
/res/drawable-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LunaGao/AnyTime/2abfb1b33c273b1f3450f35f1242adba82c7c674/res/drawable-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/res/drawable-xxhdpi/qq.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LunaGao/AnyTime/2abfb1b33c273b1f3450f35f1242adba82c7c674/res/drawable-xxhdpi/qq.png
--------------------------------------------------------------------------------
/res/drawable-xxhdpi/weibo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LunaGao/AnyTime/2abfb1b33c273b1f3450f35f1242adba82c7c674/res/drawable-xxhdpi/weibo.png
--------------------------------------------------------------------------------
/res/layout/activity_about_app.xml:
--------------------------------------------------------------------------------
1 |
11 |
12 |
17 |
18 |
24 |
25 |
31 |
32 |
33 |
38 |
39 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/res/layout/activity_doing_detail.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
19 |
20 |
28 |
29 |
37 |
38 |
46 |
47 |
57 |
58 |
66 |
67 |
76 |
77 |
84 |
85 |
86 |
--------------------------------------------------------------------------------
/res/layout/activity_forget_password.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
18 |
19 |
20 |
27 |
28 |
--------------------------------------------------------------------------------
/res/layout/activity_login.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
17 |
18 |
19 |
28 |
29 |
30 |
37 |
38 |
45 |
46 |
53 |
54 |
--------------------------------------------------------------------------------
/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
7 |
--------------------------------------------------------------------------------
/res/layout/activity_register.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
17 |
18 |
19 |
28 |
29 |
30 |
39 |
40 |
41 |
50 |
51 |
52 |
59 |
60 |
--------------------------------------------------------------------------------
/res/layout/fragment_main_doing_list.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
18 |
19 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/res/layout/fragment_main_person.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
18 |
19 |
25 |
26 |
33 |
34 |
44 |
45 |
51 |
52 |
59 |
60 |
67 |
68 |
72 |
73 |
74 |
75 |
--------------------------------------------------------------------------------
/res/layout/view_doing_list_child.xml:
--------------------------------------------------------------------------------
1 |
13 |
--------------------------------------------------------------------------------
/res/layout/view_doing_list_group.xml:
--------------------------------------------------------------------------------
1 |
12 |
--------------------------------------------------------------------------------
/res/layout/view_user_response.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
13 |
14 |
19 |
20 |
27 |
28 |
--------------------------------------------------------------------------------
/res/menu/main.xml:
--------------------------------------------------------------------------------
1 |
16 |
--------------------------------------------------------------------------------
/res/values-sw600dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/res/values-sw720dp-land/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 | 128dp
8 |
9 |
10 |
--------------------------------------------------------------------------------
/res/values-v11/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/res/values-v14/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | #0099CC
5 |
6 |
--------------------------------------------------------------------------------
/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 16dp
5 | 16dp
6 |
7 |
8 |
--------------------------------------------------------------------------------
/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 我很忙
5 | 更换帐号
6 | 关于与建议
7 | 网络错误,请检查您的网络连接
8 | 确定
9 | 取消
10 | 错误
11 | 提示
12 | 成功
13 | 请等待
14 |
15 | 请输入名字
16 | 请输入密码
17 | 登录
18 | 注册
19 | 忘记用户名或密码?
20 | 登陆失败,请确认网络和用户名密码后重试
21 |
22 | 发送邮件
23 | 已发送邮件
24 | 邮件发送错误,请确认您的邮件地址
25 |
26 | 请再次输入密码
27 | 请输入E-mail地址
28 | 两次输入密码不一致,请重新输入
29 | 密码不可为空
30 | 用户名不可空
31 | E-mail地址不可空
32 | 用户名已被注册,请重新填写
33 | 邮箱已被注册,请更换邮箱
34 | 注册成功
35 |
36 | 我的成就
37 | 正在做
38 |
39 | 确定更换账号么?之前保留的账号信息将被删除。
40 | 关于作者:\n\thi,大家好,我是“孤独的猫咪神”。\n\t我的微博是:weibo.com/maomishen\n\t感谢您使用此APP。欢迎对本APP提出您宝贵的意见和建议。
41 | 我希望在“正在做”中,加入如下的事情:\n我要提意见:
42 | 提交
43 | 输入意见或希望添加在“正在做”中的内容。
44 | 感谢您的提交。祝您生活愉快。
45 | 非常抱歉,提交出错。
46 |
47 | 注册时间:{0}
48 | 暂无成就
49 |
50 | 正在加载
51 | 加载错误,请检查网络
52 |
53 | 努力查询中!
54 | 与您同时在{0}的人有
55 | 人
56 | 本次获得的成就
57 | 没有获得成就T.T
58 |
59 |
60 |
--------------------------------------------------------------------------------
/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
14 |
15 |
16 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/src/com/luna/anytime/AVService.java:
--------------------------------------------------------------------------------
1 | package com.luna.anytime;
2 |
3 | import android.content.Context;
4 | import android.util.Log;
5 | import com.avos.avoscloud.*;
6 |
7 | import java.util.Calendar;
8 | import java.util.HashMap;
9 | import java.util.Map;
10 |
11 | /**
12 | * Created by lzw on 14-9-11.
13 | */
14 | public class AVService {
15 | public static void countDoing(String doingObjectId, CountCallback countCallback) {
16 | AVQuery query = new AVQuery("DoingList");
17 | query.whereEqualTo("doingListChildObjectId", doingObjectId);
18 | Calendar c = Calendar.getInstance();
19 | c.add(Calendar.MINUTE, -10);
20 | // query.whereNotEqualTo("userObjectId", userId);
21 | query.whereGreaterThan("createdAt", c.getTime());
22 | query.countInBackground(countCallback);
23 | }
24 |
25 | //Use callFunctionMethod
26 | @SuppressWarnings({"unchecked", "rawtypes"})
27 | public static void getAchievement(String userObjectId) {
28 | Map parameters = new HashMap();
29 | parameters.put("userObjectId", userObjectId);
30 | AVCloud.callFunctionInBackground("hello", parameters,
31 | new FunctionCallback() {
32 | @Override
33 | public void done(Object object, AVException e) {
34 | if (e == null) {
35 | Log.e("at", object.toString());// processResponse(object);
36 | } else {
37 | // handleError();
38 | }
39 | }
40 | });
41 | }
42 |
43 | public static void createDoing(String userId, String doingObjectId) {
44 | AVObject doing = new AVObject("DoingList");
45 | doing.put("userObjectId", userId);
46 | doing.put("doingListChildObjectId", doingObjectId);
47 | doing.saveInBackground();
48 | }
49 |
50 | public static void requestPasswordReset(String email, RequestPasswordResetCallback callback) {
51 | AVUser.requestPasswordResetInBackground(email, callback);
52 | }
53 |
54 | public static void findDoingListGroup(FindCallback findCallback) {
55 | AVQuery query = new AVQuery("DoingListGroup");
56 | query.orderByAscending("Index");
57 | query.findInBackground(findCallback);
58 | }
59 |
60 | public static void findChildrenList(String groupObjectId, FindCallback findCallback) {
61 | AVQuery query = new AVQuery("DoingListChild");
62 | query.orderByAscending("Index");
63 | query.whereEqualTo("parentObjectId", groupObjectId);
64 | query.findInBackground(findCallback);
65 | }
66 |
67 | public static void initPushService(Context ctx) {
68 | PushService.setDefaultPushCallback(ctx, LoginActivity.class);
69 | PushService.subscribe(ctx, "public", LoginActivity.class);
70 | AVInstallation.getCurrentInstallation().saveInBackground();
71 | }
72 |
73 | public static void signUp(String username, String password, String email, SignUpCallback signUpCallback) {
74 | AVUser user = new AVUser();
75 | user.setUsername(username);
76 | user.setPassword(password);
77 | user.setEmail(email);
78 | user.signUpInBackground(signUpCallback);
79 | }
80 |
81 | public static void logout() {
82 | AVUser.logOut();
83 | }
84 |
85 | public static void createAdvice(String userId, String advice, SaveCallback saveCallback) {
86 | AVObject doing = new AVObject("SuggestionByUser");
87 | doing.put("UserObjectId", userId);
88 | doing.put("UserSuggestion", advice);
89 | doing.saveInBackground(saveCallback);
90 | }
91 | }
92 |
--------------------------------------------------------------------------------
/src/com/luna/anytime/AboutAppActivity.java:
--------------------------------------------------------------------------------
1 | package com.luna.anytime;
2 |
3 | import java.util.List;
4 |
5 | import com.avos.avoscloud.AVException;
6 | import com.avos.avoscloud.AVObject;
7 | import com.avos.avoscloud.AVQuery;
8 | import com.avos.avoscloud.FindCallback;
9 | import com.avos.avoscloud.SaveCallback;
10 | import com.luna.anytime.adapter.AnytimeUserResponseListAdapter;
11 |
12 | import android.annotation.SuppressLint;
13 | import android.app.AlertDialog;
14 | import android.content.DialogInterface;
15 | import android.os.Bundle;
16 | import android.os.Handler;
17 | import android.os.Message;
18 | import android.view.MenuItem;
19 | import android.view.View;
20 | import android.view.View.OnClickListener;
21 | import android.widget.Button;
22 | import android.widget.EditText;
23 | import android.widget.ListView;
24 |
25 | public class AboutAppActivity extends AnyTimeActivity {
26 | Button submitButton;
27 | EditText submitEditText;
28 | ListView mUserResponseListView;
29 |
30 | @Override
31 | protected void onCreate(Bundle savedInstanceState) {
32 | super.onCreate(savedInstanceState);
33 | setContentView(R.layout.activity_about_app);
34 | this.getActionBar().setDisplayHomeAsUpEnabled(true);
35 | submitButton = (Button) findViewById(R.id.button_about_app_submit_user_input);
36 | submitEditText = (EditText) findViewById(R.id.editText_about_app_user_input);
37 | mUserResponseListView = (ListView) findViewById(R.id.listView_user_back);
38 | submitButton.setOnClickListener(buttonListener);
39 |
40 | FindCallback findCallback=new FindCallback() {
41 | public void done(List avObjects, AVException e) {
42 | if (e == null) {
43 | Message msg = new Message();
44 | msg.what = 3;
45 | msg.obj = avObjects;
46 | mHandler.sendMessage(msg);
47 | } else {
48 | showError(activity.getString(R.string.network_error));
49 | }
50 | }
51 | };
52 | AVQuery query = new AVQuery("SuggestionByUser");
53 | query.whereEqualTo("UserObjectId", getUserId());
54 | query.findInBackground(findCallback);
55 | }
56 |
57 | OnClickListener buttonListener = new OnClickListener() {
58 |
59 | @Override
60 | public void onClick(View arg0) {
61 | // TODO Auto-generated method stub
62 | SaveCallback saveCallback=new SaveCallback() {
63 | @Override
64 | public void done(AVException e) {
65 | if (e == null) {
66 | mHandler.obtainMessage(1).sendToTarget();
67 | } else {
68 | mHandler.obtainMessage(2).sendToTarget();
69 | }
70 | }
71 | };
72 | String advice = submitEditText.getText().toString();
73 | AVService.createAdvice(getUserId(), advice, saveCallback);
74 | }
75 | };
76 |
77 | @SuppressLint("HandlerLeak")
78 | private Handler mHandler = new Handler() {
79 | @SuppressWarnings("unchecked")
80 | public void handleMessage(Message msg) {
81 | switch (msg.what) {
82 | case 1:
83 | new AlertDialog.Builder(activity)
84 | .setTitle(
85 | activity.getResources().getString(
86 | R.string.dialog_message_success))
87 | .setMessage(
88 | activity.getResources()
89 | .getString(
90 | R.string.action_about_app_submit_message_success))
91 | .setNegativeButton(android.R.string.ok,
92 | new DialogInterface.OnClickListener() {
93 | public void onClick(DialogInterface dialog,
94 | int which) {
95 | dialog.dismiss();
96 | submitEditText.setText("");
97 | }
98 | }).show();
99 | break;
100 | case 2:
101 | showError(activity
102 | .getString(R.string.action_about_app_submit_message_error));
103 | break;
104 | case 3:
105 | showResponseList((List) msg.obj);
106 | break;
107 | default:
108 | break;
109 | }
110 | }
111 | };
112 |
113 | private void showResponseList(List responseList) {
114 | if (responseList != null && responseList.size() != 0) {
115 | AnytimeUserResponseListAdapter adapter = new AnytimeUserResponseListAdapter(
116 | responseList, activity);
117 | mUserResponseListView.setAdapter(adapter);
118 | mUserResponseListView.setVisibility(View.VISIBLE);
119 | }
120 | }
121 |
122 | @Override
123 | public boolean onOptionsItemSelected(MenuItem item) {
124 | if (item.getItemId() == android.R.id.home) {
125 | finish();
126 | return true;
127 | }
128 | return super.onOptionsItemSelected(item);
129 | }
130 | }
131 |
--------------------------------------------------------------------------------
/src/com/luna/anytime/AnyTimeActivity.java:
--------------------------------------------------------------------------------
1 | package com.luna.anytime;
2 |
3 | import com.avos.avoscloud.AVAnalytics;
4 | import com.avos.avoscloud.AVUser;
5 |
6 | import android.app.Activity;
7 | import android.app.AlertDialog;
8 | import android.content.DialogInterface;
9 | import android.os.Bundle;
10 |
11 | public class AnyTimeActivity extends Activity {
12 |
13 | public AnyTimeActivity activity;
14 | private String userId;
15 |
16 | @Override
17 | protected void onCreate(Bundle savedInstanceState) {
18 | super.onCreate(savedInstanceState);
19 | activity = this;
20 | userId = null;
21 | AVUser currentUser = AVUser.getCurrentUser();
22 | if (currentUser != null) {
23 | userId = currentUser.getObjectId();
24 | }
25 | }
26 |
27 | public String getUserId() {
28 | return userId;
29 | }
30 |
31 | protected void showError(String errorMessage) {
32 | showError(errorMessage, activity);
33 | }
34 |
35 | public void showError(String errorMessage, Activity activity) {
36 | new AlertDialog.Builder(activity)
37 | .setTitle(
38 | activity.getResources().getString(
39 | R.string.dialog_message_title))
40 | .setMessage(errorMessage)
41 | .setNegativeButton(android.R.string.ok,
42 | new DialogInterface.OnClickListener() {
43 | public void onClick(DialogInterface dialog,
44 | int which) {
45 | dialog.dismiss();
46 | }
47 | }).show();
48 | }
49 |
50 | protected void onPause() {
51 | super.onPause();
52 | AVAnalytics.onPause(this);
53 | }
54 |
55 | protected void onResume() {
56 | super.onResume();
57 | AVAnalytics.onResume(this);
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/src/com/luna/anytime/AnyTimeApplication.java:
--------------------------------------------------------------------------------
1 | package com.luna.anytime;
2 |
3 | import com.avos.avoscloud.AVOSCloud;
4 |
5 | import android.app.Application;
6 |
7 | public class AnyTimeApplication extends Application {
8 |
9 | @Override
10 | public void onCreate() {
11 | // TODO Auto-generated method stub
12 | super.onCreate();
13 | AVOSCloud.useAVCloudCN();
14 | // U need your AVOS key and so on to run the code.
15 | AVOSCloud.initialize(this,
16 | "70l90kzm53nplnu013ala0j8wipr594d36m5zuz94ukvmh5s",
17 | "lamrsuheyiaqcx4o7m3jaz4awaeukerit1mucnjwk7ibokfv");
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/com/luna/anytime/DoingDetailActivity.java:
--------------------------------------------------------------------------------
1 | package com.luna.anytime;
2 |
3 | import com.avos.avoscloud.AVException;
4 | import com.avos.avoscloud.CountCallback;
5 |
6 | import android.annotation.SuppressLint;
7 | import android.content.Intent;
8 | import android.os.Bundle;
9 | import android.os.Handler;
10 | import android.os.Message;
11 | import android.view.MenuItem;
12 | import android.view.View;
13 | import android.widget.TextView;
14 |
15 | public class DoingDetailActivity extends AnyTimeActivity {
16 |
17 | TextView loadingText;
18 | TextView atTimeTitleText;
19 | TextView countText;
20 | String doingObjectId;
21 | String doingObjectTitle;
22 |
23 | @Override
24 | protected void onCreate(Bundle savedInstanceState) {
25 | super.onCreate(savedInstanceState);
26 | setContentView(R.layout.activity_doing_detail);
27 | this.getActionBar().setDisplayHomeAsUpEnabled(true);
28 |
29 | Intent intent = getIntent();
30 | doingObjectId = intent.getStringExtra("childobj");
31 | doingObjectTitle = intent.getStringExtra("childtitle");
32 | loadingText = (TextView) findViewById(R.id.textView_doing_detail_loading);
33 | atTimeTitleText = (TextView) findViewById(R.id.textView_doing_detail_same_time_title);
34 | countText = (TextView) findViewById(R.id.textView_doing_detail_count);
35 | SearchData();
36 | }
37 |
38 | private void SearchData() {
39 | CountCallback countCallback = new CountCallback() {
40 | @Override
41 | public void done(int count, AVException e) {
42 | if (e == null) {
43 | showDetail(count);
44 | } else {
45 | loadingText
46 | .setText(getString(R.string.doing_list_error_loading));
47 | }
48 | mHandler.obtainMessage(1).sendToTarget();
49 | }
50 | };
51 | String doingObjectId = this.doingObjectId;
52 | AVService.countDoing(doingObjectId, countCallback);
53 | }
54 |
55 | private void showDetail(int count) {
56 | findViewById(R.id.view_doing_detail_1).setVisibility(View.VISIBLE);
57 | findViewById(R.id.view_doing_detail_2).setVisibility(View.VISIBLE);
58 | findViewById(R.id.textView_doing_detail_get_chievement).setVisibility(
59 | View.VISIBLE);
60 | loadingText.setVisibility(View.INVISIBLE);
61 | atTimeTitleText
62 | .setText(getString(R.string.doing_detail_same_time_title)
63 | .replace("{0}", doingObjectTitle));
64 | countText.setText(count + getString(R.string.doing_detail_person));
65 | }
66 |
67 | private void uploadData(String doingObjectId) {
68 | String userId = getUserId();
69 | AVService.createDoing(userId, doingObjectId);
70 | }
71 |
72 | @Override
73 | public boolean onOptionsItemSelected(MenuItem item) {
74 | if (item.getItemId() == android.R.id.home) {
75 | finish();
76 | return true;
77 | }
78 | return super.onOptionsItemSelected(item);
79 | }
80 |
81 | @SuppressLint("HandlerLeak")
82 | private Handler mHandler = new Handler() {
83 | public void handleMessage(Message msg) {
84 | if (1 == msg.what) {
85 | uploadData(doingObjectId);
86 | AVService.getAchievement(getUserId());
87 | }
88 | }
89 | };
90 | }
91 |
--------------------------------------------------------------------------------
/src/com/luna/anytime/DoingListFragment.java:
--------------------------------------------------------------------------------
1 | package com.luna.anytime;
2 |
3 | import java.util.ArrayList;
4 | import java.util.List;
5 |
6 | import com.avos.avoscloud.AVException;
7 | import com.avos.avoscloud.AVObject;
8 | import com.avos.avoscloud.FindCallback;
9 | import com.luna.anytime.adapter.AnytimeExpandableListAdapter;
10 | import com.luna.anytime.data.DoingListData;
11 |
12 | import android.support.v4.app.Fragment;
13 | import android.annotation.SuppressLint;
14 | import android.app.Activity;
15 | import android.content.Intent;
16 | import android.os.Bundle;
17 | import android.os.Handler;
18 | import android.os.Message;
19 | import android.view.LayoutInflater;
20 | import android.view.View;
21 | import android.view.ViewGroup;
22 | import android.widget.ExpandableListView;
23 | import android.widget.ExpandableListView.OnChildClickListener;
24 | import android.widget.TextView;
25 |
26 | @SuppressLint("ValidFragment")
27 | public class DoingListFragment extends Fragment {
28 |
29 | ExpandableListView expandableListView;
30 | TextView messageText;
31 | AnytimeExpandableListAdapter adapter;
32 | Activity activity;
33 | // 列表数据
34 | private ArrayList mDoingListData;
35 |
36 | public DoingListFragment(Activity _activity) {
37 | activity = _activity;
38 | }
39 |
40 | @Override
41 | public View onCreateView(LayoutInflater inflater, ViewGroup container,
42 | Bundle savedInstanceState) {
43 | View rootView = inflater.inflate(R.layout.fragment_main_doing_list,
44 | container, false);
45 | mDoingListData = new ArrayList();
46 | expandableListView = (ExpandableListView) rootView
47 | .findViewById(R.id.expandableListView_doing_list);
48 | adapter = new AnytimeExpandableListAdapter(activity);
49 | expandableListView.setAdapter(adapter);
50 | expandableListView.setOnChildClickListener(listener);
51 | messageText = (TextView) rootView
52 | .findViewById(R.id.textView_loading_wait);
53 | LoadingData();
54 | return rootView;
55 | }
56 |
57 | private OnChildClickListener listener = new OnChildClickListener() {
58 | @Override
59 | public boolean onChildClick(ExpandableListView parent, View v,
60 | int groupPosition, int childPosition, long id) {
61 | // TODO Auto-generated method stub
62 | Intent intentDoingListDetail = new Intent(activity,
63 | DoingDetailActivity.class);
64 | intentDoingListDetail.putExtra("childobj",
65 | mDoingListData.get(groupPosition).doingListData
66 | .get(childPosition).objectId);
67 | intentDoingListDetail.putExtra(
68 | "childtitle",
69 | mDoingListData.get(groupPosition).doingListData.get(
70 | childPosition).toString());
71 | startActivity(intentDoingListDetail);
72 | return true;
73 | }
74 | };
75 |
76 | private void LoadingData() {
77 | FindCallback findCallback = new FindCallback() {
78 | @Override
79 | public void done(List avObjects, AVException e) {
80 | if (e == null) {
81 | for (AVObject avo : avObjects) {
82 | mDoingListData.add(new DoingListData(avo.getObjectId(),
83 | avo.getString("GroupName")));
84 | }
85 | mHandler.obtainMessage(1).sendToTarget();
86 | adapter.notifyDataSetChanged();
87 | } else {
88 | ERROR();
89 | }
90 | }
91 | };
92 | AVService.findDoingListGroup(findCallback);
93 | }
94 |
95 | private void ERROR() {
96 | messageText.setText(getString(R.string.doing_list_error_loading));
97 | expandableListView.setVisibility(View.INVISIBLE);
98 | }
99 |
100 | private void SetChildrenList(final String groupObjectId) {
101 | FindCallback findCallback=new FindCallback() {
102 | @Override
103 | public void done(List avObjects, AVException e) {
104 | if (e == null) {
105 | ArrayList childrenList = new ArrayList();
106 | for (AVObject avo : avObjects) {
107 | childrenList.add(new DoingListData(avo.getObjectId(),
108 | avo.getString("ChildName")));
109 | }
110 | for (DoingListData dld : mDoingListData) {
111 | if (dld.objectId.equals(groupObjectId)) {
112 | dld.doingListData = childrenList;
113 | }
114 | }
115 | adapter.setGroups(mDoingListData);
116 | expandableListView.setVisibility(View.VISIBLE);
117 | messageText.setVisibility(View.INVISIBLE);
118 | adapter.notifyDataSetChanged();
119 | } else {
120 | ERROR();
121 | }
122 | }
123 | };
124 | AVService.findChildrenList(groupObjectId, findCallback);
125 | }
126 |
127 | @SuppressLint("HandlerLeak")
128 | private Handler mHandler = new Handler() {
129 | public void handleMessage(Message msg) {
130 | if (1 == msg.what) {
131 | for (DoingListData dld : mDoingListData) {
132 | SetChildrenList(dld.objectId);
133 | }
134 | }
135 | }
136 | };
137 | }
138 |
--------------------------------------------------------------------------------
/src/com/luna/anytime/ForgetPasswordActivity.java:
--------------------------------------------------------------------------------
1 | package com.luna.anytime;
2 |
3 | import com.avos.avoscloud.AVException;
4 | import com.avos.avoscloud.RequestPasswordResetCallback;
5 |
6 | import android.content.Intent;
7 | import android.os.Bundle;
8 | import android.view.MenuItem;
9 | import android.view.View;
10 | import android.view.View.OnClickListener;
11 | import android.widget.Button;
12 | import android.widget.EditText;
13 | import android.widget.Toast;
14 |
15 | public class ForgetPasswordActivity extends AnyTimeActivity {
16 |
17 | EditText emailText;
18 | Button findPasswordButton;
19 |
20 | @Override
21 | protected void onCreate(Bundle savedInstanceState) {
22 | super.onCreate(savedInstanceState);
23 | setContentView(R.layout.activity_forget_password);
24 | this.getActionBar().setDisplayHomeAsUpEnabled(true);
25 | emailText = (EditText) findViewById(R.id.editText_forget_password_email);
26 | findPasswordButton = (Button) findViewById(R.id.button_find_password);
27 | findPasswordButton.setOnClickListener(findPasswordListener);
28 | }
29 |
30 | OnClickListener findPasswordListener = new OnClickListener() {
31 |
32 | @Override
33 | public void onClick(View v) {
34 | String email = emailText.getText()
35 | .toString();
36 | if (email != null) {
37 | RequestPasswordResetCallback callback=new RequestPasswordResetCallback() {
38 | public void done(AVException e) {
39 | if (e == null) {
40 | Toast.makeText(activity,
41 | R.string.forget_password_send_email,
42 | Toast.LENGTH_LONG).show();
43 | Intent LoginIntent = new Intent(activity,
44 | LoginActivity.class);
45 | startActivity(LoginIntent);
46 | finish();
47 | } else {
48 | showError(activity
49 | .getString(R.string.forget_password_email_error));
50 | }
51 | }
52 | };
53 | AVService.requestPasswordReset(email, callback);
54 | } else {
55 | showError(activity.getResources().getString(
56 | R.string.error_register_email_address_null));
57 | }
58 | }
59 | };
60 |
61 | @Override
62 | public boolean onOptionsItemSelected(MenuItem item) {
63 | if (item.getItemId() == android.R.id.home) {
64 | Intent LoginIntent = new Intent(this, LoginActivity.class);
65 | startActivity(LoginIntent);
66 | finish();
67 | return true;
68 | }
69 | return super.onOptionsItemSelected(item);
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/src/com/luna/anytime/LoginActivity.java:
--------------------------------------------------------------------------------
1 | package com.luna.anytime;
2 |
3 | import com.avos.avoscloud.AVAnalytics;
4 | import com.avos.avoscloud.AVException;
5 | import com.avos.avoscloud.AVUser;
6 | import com.avos.avoscloud.LogInCallback;
7 |
8 | import android.annotation.SuppressLint;
9 | import android.app.AlertDialog;
10 | import android.app.ProgressDialog;
11 | import android.content.DialogInterface;
12 | import android.content.Intent;
13 | import android.os.Bundle;
14 | import android.view.View;
15 | import android.view.View.OnClickListener;
16 | import android.widget.Button;
17 | import android.widget.EditText;
18 |
19 | public class LoginActivity extends AnyTimeActivity {
20 |
21 | Button loginButton;
22 | Button registerButton;
23 | Button forgetPasswordButton;
24 | EditText userNameEditText;
25 | EditText userPasswordEditText;
26 | private ProgressDialog progressDialog;
27 |
28 | @Override
29 | protected void onCreate(Bundle savedInstanceState) {
30 | super.onCreate(savedInstanceState);
31 | setContentView(R.layout.activity_login);
32 | AVAnalytics.trackAppOpened(getIntent());
33 |
34 | AVService.initPushService(this);
35 |
36 | loginButton = (Button) findViewById(R.id.button_login);
37 | registerButton = (Button) findViewById(R.id.button_register);
38 | forgetPasswordButton = (Button) findViewById(R.id.button_forget_password);
39 | userNameEditText = (EditText) findViewById(R.id.editText_userName);
40 | userPasswordEditText = (EditText) findViewById(R.id.editText_userPassword);
41 |
42 | if (getUserId() != null) {
43 | Intent mainIntent = new Intent(activity, MainActivity.class);
44 | startActivity(mainIntent);
45 | activity.finish();
46 | }
47 |
48 | loginButton.setOnClickListener(loginListener);
49 | registerButton.setOnClickListener(registerListener);
50 | forgetPasswordButton.setOnClickListener(forgetPasswordListener);
51 | }
52 |
53 | OnClickListener loginListener = new OnClickListener() {
54 |
55 | @SuppressLint("NewApi")
56 | @SuppressWarnings({ "unchecked", "rawtypes" })
57 | @Override
58 | public void onClick(View arg0) {
59 | String username = userNameEditText.getText().toString();
60 | if (username.isEmpty()) {
61 | showUserNameEmptyError();
62 | return;
63 | }
64 | if (password().isEmpty()) {
65 | showUserPasswordEmptyError();
66 | return;
67 | }
68 | progressDialogShow();
69 | AVUser.logInInBackground(username,
70 | password(),
71 | new LogInCallback() {
72 | public void done(AVUser user, AVException e) {
73 | if (user != null) {
74 | progressDialogDismiss();
75 | Intent mainIntent = new Intent(activity,
76 | MainActivity.class);
77 | startActivity(mainIntent);
78 | activity.finish();
79 | } else {
80 | progressDialogDismiss();
81 | showLoginError();
82 | }
83 | }
84 | });
85 | }
86 |
87 | private String password() {
88 | return userPasswordEditText.getText().toString();
89 | }
90 | };
91 |
92 | OnClickListener forgetPasswordListener = new OnClickListener() {
93 |
94 | @Override
95 | public void onClick(View arg0) {
96 | Intent forgetPasswordIntent = new Intent(activity, ForgetPasswordActivity.class);
97 | startActivity(forgetPasswordIntent);
98 | activity.finish();
99 | }
100 | };
101 |
102 | OnClickListener registerListener = new OnClickListener() {
103 |
104 | @Override
105 | public void onClick(View v) {
106 | Intent registerIntent = new Intent(activity, RegisterActivity.class);
107 | startActivity(registerIntent);
108 | activity.finish();
109 | }
110 | };
111 |
112 | private void progressDialogDismiss() {
113 | if (progressDialog != null)
114 | progressDialog.dismiss();
115 | }
116 |
117 | private void progressDialogShow() {
118 | progressDialog = ProgressDialog
119 | .show(activity,
120 | activity.getResources().getText(
121 | R.string.dialog_message_title),
122 | activity.getResources().getText(
123 | R.string.dialog_text_wait), true, false);
124 | }
125 |
126 | private void showLoginError() {
127 | new AlertDialog.Builder(activity)
128 | .setTitle(
129 | activity.getResources().getString(
130 | R.string.dialog_error_title))
131 | .setMessage(
132 | activity.getResources().getString(
133 | R.string.error_login_error))
134 | .setNegativeButton(android.R.string.ok,
135 | new DialogInterface.OnClickListener() {
136 | public void onClick(DialogInterface dialog,
137 | int which) {
138 | dialog.dismiss();
139 | }
140 | }).show();
141 | }
142 |
143 | private void showUserPasswordEmptyError() {
144 | new AlertDialog.Builder(activity)
145 | .setTitle(
146 | activity.getResources().getString(
147 | R.string.dialog_error_title))
148 | .setMessage(
149 | activity.getResources().getString(
150 | R.string.error_register_password_null))
151 | .setNegativeButton(android.R.string.ok,
152 | new DialogInterface.OnClickListener() {
153 | public void onClick(DialogInterface dialog,
154 | int which) {
155 | dialog.dismiss();
156 | }
157 | }).show();
158 | }
159 |
160 | private void showUserNameEmptyError() {
161 | new AlertDialog.Builder(activity)
162 | .setTitle(
163 | activity.getResources().getString(
164 | R.string.dialog_error_title))
165 | .setMessage(
166 | activity.getResources().getString(
167 | R.string.error_register_user_name_null))
168 | .setNegativeButton(android.R.string.ok,
169 | new DialogInterface.OnClickListener() {
170 | public void onClick(DialogInterface dialog,
171 | int which) {
172 | dialog.dismiss();
173 | }
174 | }).show();
175 | }
176 | }
177 |
--------------------------------------------------------------------------------
/src/com/luna/anytime/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.luna.anytime;
2 |
3 | import android.app.ActionBar;
4 | import android.app.AlertDialog;
5 | import android.app.FragmentTransaction;
6 | import android.content.DialogInterface;
7 | import android.content.Intent;
8 | import android.os.Bundle;
9 | import android.support.v4.app.Fragment;
10 | import android.support.v4.app.FragmentActivity;
11 | import android.support.v4.app.FragmentManager;
12 | import android.support.v4.app.FragmentPagerAdapter;
13 | import android.support.v4.view.ViewPager;
14 | import android.view.Menu;
15 | import android.view.MenuItem;
16 |
17 | public class MainActivity extends FragmentActivity implements
18 | ActionBar.TabListener {
19 | /**
20 | * The {@link android.support.v4.view.PagerAdapter} that will provide
21 | * fragments for each of the sections. We use a
22 | * {@link android.support.v4.app.FragmentPagerAdapter} derivative, which
23 | * will keep every loaded fragment in memory. If this becomes too memory
24 | * intensive, it may be best to switch to a
25 | * {@link android.support.v4.app.FragmentStatePagerAdapter}.
26 | */
27 | SectionsPagerAdapter mSectionsPagerAdapter;
28 | MainActivity activity;
29 |
30 | /**
31 | * The {@link ViewPager} that will host the section contents.
32 | */
33 | ViewPager mViewPager;
34 |
35 | @Override
36 | protected void onCreate(Bundle savedInstanceState) {
37 | super.onCreate(savedInstanceState);
38 | setContentView(R.layout.activity_main);
39 | activity = this;
40 | // Set up the action bar.
41 | final ActionBar actionBar = getActionBar();
42 | actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
43 |
44 | // Create the adapter that will return a fragment for each of the three
45 | // primary sections of the app.
46 | mSectionsPagerAdapter = new SectionsPagerAdapter(
47 | getSupportFragmentManager());
48 |
49 | // Set up the ViewPager with the sections adapter.
50 | mViewPager = (ViewPager) findViewById(R.id.pager);
51 | mViewPager.setAdapter(mSectionsPagerAdapter);
52 |
53 | // When swiping between different sections, select the corresponding
54 | // tab. We can also use ActionBar.Tab#select() to do this if we have
55 | // a reference to the Tab.
56 | mViewPager
57 | .setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
58 | @Override
59 | public void onPageSelected(int position) {
60 | actionBar.setSelectedNavigationItem(position);
61 | }
62 | });
63 |
64 | // For each of the sections in the app, add a tab to the action bar.
65 | for (int i = 0; i < mSectionsPagerAdapter.getCount(); i++) {
66 | // Create a tab with text corresponding to the page title defined by
67 | // the adapter. Also specify this Activity object, which implements
68 | // the TabListener interface, as the callback (listener) for when
69 | // this tab is selected.
70 | actionBar.addTab(actionBar.newTab()
71 | .setText(mSectionsPagerAdapter.getPageTitle(i))
72 | .setTabListener(this));
73 | }
74 | }
75 |
76 | @Override
77 | public boolean onCreateOptionsMenu(Menu menu) {
78 | // Inflate the menu; this adds items to the action bar if it is present.
79 | getMenuInflater().inflate(R.menu.main, menu);
80 | return true;
81 | }
82 |
83 | @Override
84 | public boolean onOptionsItemSelected(MenuItem item) {
85 | // Handle action buttons
86 | switch (item.getItemId()) {
87 | case R.id.action_about_app:
88 | Intent aboutIntent = new Intent(activity, AboutAppActivity.class);
89 | startActivity(aboutIntent);
90 | return true;
91 | case R.id.action_logout:
92 | new AlertDialog.Builder(activity)
93 | .setTitle(
94 | activity.getResources().getString(
95 | R.string.dialog_message_title))
96 | .setMessage(
97 | activity.getResources().getString(
98 | R.string.action_logout_alert_message))
99 | .setNegativeButton(android.R.string.ok,
100 | new DialogInterface.OnClickListener() {
101 | public void onClick(DialogInterface dialog,
102 | int which) {
103 | dialog.dismiss();
104 | Logout();
105 | }
106 | })
107 | .setPositiveButton(android.R.string.cancel,
108 | new DialogInterface.OnClickListener() {
109 |
110 | @Override
111 | public void onClick(DialogInterface dialog,
112 | int which) {
113 | dialog.dismiss();
114 | }
115 | }).show();
116 | return true;
117 | default:
118 | return super.onOptionsItemSelected(item);
119 | }
120 | }
121 |
122 | private void Logout() {
123 | AVService.logout();
124 | Intent loginIntent = new Intent(activity, LoginActivity.class);
125 | startActivity(loginIntent);
126 | activity.finish();
127 | }
128 |
129 | @Override
130 | public void onTabSelected(ActionBar.Tab tab,
131 | FragmentTransaction fragmentTransaction) {
132 | // When the given tab is selected, switch to the corresponding page in
133 | // the ViewPager.
134 | mViewPager.setCurrentItem(tab.getPosition());
135 | }
136 |
137 | @Override
138 | public void onTabUnselected(ActionBar.Tab tab,
139 | FragmentTransaction fragmentTransaction) {
140 | }
141 |
142 | @Override
143 | public void onTabReselected(ActionBar.Tab tab,
144 | FragmentTransaction fragmentTransaction) {
145 | }
146 |
147 | /**
148 | * A {@link FragmentPagerAdapter} that returns a fragment corresponding to
149 | * one of the sections/tabs/pages.
150 | */
151 | public class SectionsPagerAdapter extends FragmentPagerAdapter {
152 |
153 | public SectionsPagerAdapter(FragmentManager fm) {
154 | super(fm);
155 | }
156 |
157 | @Override
158 | public Fragment getItem(int position) {
159 | // getItem is called to instantiate the fragment for the given page.
160 | // Return a DummySectionFragment (defined as a static inner class
161 | // below) with the page number as its lone argument.
162 | Fragment fragment = null;
163 | if(position == 0) {
164 | fragment = new PersonFragment();
165 | } else if(position == 1) {
166 | fragment = new DoingListFragment(activity);
167 | }
168 | return fragment;
169 | }
170 |
171 | @Override
172 | public int getCount() {
173 | // Show 2 total pages.
174 | return 2;
175 | }
176 |
177 | @Override
178 | public CharSequence getPageTitle(int position) {
179 | switch (position) {
180 | case 0:
181 | return getString(R.string.main_view_person_title);
182 | case 1:
183 | return getString(R.string.main_view_anytime_title);
184 | }
185 | return null;
186 | }
187 | }
188 | }
189 |
--------------------------------------------------------------------------------
/src/com/luna/anytime/PersonFragment.java:
--------------------------------------------------------------------------------
1 | package com.luna.anytime;
2 |
3 | import com.avos.avoscloud.AVUser;
4 |
5 | import android.support.v4.app.Fragment;
6 | import android.text.format.DateFormat;
7 | import android.os.Bundle;
8 | import android.view.LayoutInflater;
9 | import android.view.View;
10 | import android.view.ViewGroup;
11 | import android.widget.TextView;
12 |
13 | public class PersonFragment extends Fragment {
14 |
15 | TextView nameTextView;
16 | TextView registerTimeTextView;
17 |
18 | public PersonFragment() {
19 | }
20 |
21 | @Override
22 | public View onCreateView(LayoutInflater inflater, ViewGroup container,
23 | Bundle savedInstanceState) {
24 | View rootView = inflater.inflate(R.layout.fragment_main_person,
25 | container, false);
26 |
27 | nameTextView = (TextView) rootView.findViewById(R.id.textView_userName);
28 | registerTimeTextView = (TextView) rootView
29 | .findViewById(R.id.textView_register_time);
30 |
31 | AVUser currentUser = AVUser.getCurrentUser();
32 | nameTextView.setText(currentUser.getUsername());
33 | String date = DateFormat.format("yyyy-MM-dd HH:mm",
34 | currentUser.getCreatedAt()).toString();
35 | registerTimeTextView.setText(getString(R.string.person_register_time)
36 | .replace("{0}", date));
37 | return rootView;
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/com/luna/anytime/RegisterActivity.java:
--------------------------------------------------------------------------------
1 | package com.luna.anytime;
2 |
3 | import com.avos.avoscloud.AVException;
4 | import com.avos.avoscloud.SignUpCallback;
5 |
6 | import android.annotation.SuppressLint;
7 | import android.app.AlertDialog;
8 | import android.app.ProgressDialog;
9 | import android.content.DialogInterface;
10 | import android.content.Intent;
11 | import android.os.Bundle;
12 | import android.view.MenuItem;
13 | import android.view.View;
14 | import android.view.View.OnClickListener;
15 | import android.widget.Button;
16 | import android.widget.EditText;
17 |
18 | public class RegisterActivity extends AnyTimeActivity {
19 |
20 | Button registerButton;
21 | EditText userName;
22 | EditText userEmail;
23 | EditText userPassword;
24 | EditText userPasswordAgain;
25 | private ProgressDialog progressDialog;
26 |
27 | @SuppressLint("NewApi")
28 | @Override
29 | protected void onCreate(Bundle savedInstanceState) {
30 | super.onCreate(savedInstanceState);
31 | setContentView(R.layout.activity_register);
32 | this.getActionBar().setDisplayHomeAsUpEnabled(true);
33 |
34 | registerButton = (Button) findViewById(R.id.button_i_need_register);
35 | userName = (EditText) findViewById(R.id.editText_register_userName);
36 | userEmail = (EditText) findViewById(R.id.editText_register_email);
37 | userPassword = (EditText) findViewById(R.id.editText_register_userPassword);
38 | userPasswordAgain = (EditText) findViewById(R.id.editText_register_userPassword_again);
39 |
40 | registerButton.setOnClickListener(new OnClickListener() {
41 |
42 | @Override
43 | public void onClick(View v) {
44 | if (userPassword.getText().toString()
45 | .equals(userPasswordAgain.getText().toString())) {
46 | if (!userPassword.getText().toString().isEmpty()) {
47 | if (!userName.getText().toString().isEmpty()) {
48 | if (!userEmail.getText().toString().isEmpty()) {
49 | progressDialogShow();
50 | register();
51 | } else {
52 | showError(activity
53 | .getString(R.string.error_register_email_address_null));
54 | }
55 | } else {
56 | showError(activity
57 | .getString(R.string.error_register_user_name_null));
58 | }
59 | } else {
60 | showError(activity
61 | .getString(R.string.error_register_password_null));
62 | }
63 | } else {
64 | showError(activity
65 | .getString(R.string.error_register_password_not_equals));
66 | }
67 | }
68 | });
69 | }
70 |
71 | @Override
72 | public boolean onOptionsItemSelected(MenuItem item) {
73 | if (item.getItemId() == android.R.id.home) {
74 | Intent LoginIntent = new Intent(this, LoginActivity.class);
75 | startActivity(LoginIntent);
76 | finish();
77 | return true;
78 | }
79 | return super.onOptionsItemSelected(item);
80 | }
81 |
82 | public void register() {
83 | SignUpCallback signUpCallback = new SignUpCallback() {
84 | public void done(AVException e) {
85 | progressDialogDismiss();
86 | if (e == null) {
87 | showRegisterSuccess();
88 | Intent mainIntent = new Intent(activity, MainActivity.class);
89 | startActivity(mainIntent);
90 | activity.finish();
91 | } else {
92 | switch (e.getCode()) {
93 | case 202:
94 | showError(activity
95 | .getString(R.string.error_register_user_name_repeat));
96 | break;
97 | case 203:
98 | showError(activity
99 | .getString(R.string.error_register_email_repeat));
100 | break;
101 | default:
102 | showError(activity
103 | .getString(R.string.network_error));
104 | break;
105 | }
106 | }
107 | }
108 | };
109 | String username = userName.getText().toString();
110 | String password = userPassword.getText().toString();
111 | String email = userEmail.getText().toString();
112 |
113 | AVService.signUp(username, password, email, signUpCallback);
114 | }
115 |
116 | private void progressDialogDismiss() {
117 | if (progressDialog != null)
118 | progressDialog.dismiss();
119 | }
120 |
121 | private void progressDialogShow() {
122 | progressDialog = ProgressDialog
123 | .show(activity,
124 | activity.getResources().getText(
125 | R.string.dialog_message_title),
126 | activity.getResources().getText(
127 | R.string.dialog_text_wait), true, false);
128 | }
129 |
130 | private void showRegisterSuccess() {
131 | new AlertDialog.Builder(activity)
132 | .setTitle(
133 | activity.getResources().getString(
134 | R.string.dialog_message_title))
135 | .setMessage(
136 | activity.getResources().getString(
137 | R.string.success_register_success))
138 | .setNegativeButton(android.R.string.ok,
139 | new DialogInterface.OnClickListener() {
140 | public void onClick(DialogInterface dialog,
141 | int which) {
142 | dialog.dismiss();
143 | }
144 | }).show();
145 | }
146 | }
147 |
--------------------------------------------------------------------------------
/src/com/luna/anytime/adapter/AnytimeExpandableListAdapter.java:
--------------------------------------------------------------------------------
1 | package com.luna.anytime.adapter;
2 |
3 | import java.util.ArrayList;
4 |
5 | import com.luna.anytime.R;
6 | import com.luna.anytime.data.DoingListData;
7 |
8 | import android.app.Activity;
9 | import android.view.LayoutInflater;
10 | import android.view.View;
11 | import android.view.ViewGroup;
12 | import android.widget.BaseExpandableListAdapter;
13 | import android.widget.TextView;
14 |
15 | public class AnytimeExpandableListAdapter extends BaseExpandableListAdapter {
16 |
17 | Activity ExpandableList;
18 | // 父列表数据
19 | private ArrayList groups;
20 |
21 | public AnytimeExpandableListAdapter(Activity _activity) {
22 | super();
23 | ExpandableList = _activity;
24 | groups = new ArrayList();
25 | }
26 |
27 | public void AddGroupTitle(DoingListData title) {
28 | groups.add(title);
29 | }
30 |
31 | public void setGroups(ArrayList theGrouops) {
32 | groups = theGrouops;
33 | }
34 |
35 | @Override
36 | public Object getChild(int groupPosition, int childPosition) {
37 | // TODO Auto-generated method stub
38 | return groups.get(groupPosition).doingListData.get(childPosition);
39 | }
40 |
41 | @Override
42 | public long getChildId(int groupPosition, int childPosition) {
43 | // TODO Auto-generated method stub
44 | return childPosition;
45 | }
46 |
47 | @Override
48 | public View getChildView(int groupPosition, int childPosition,
49 | boolean isLastChild, View convertView, ViewGroup parent) {
50 | LayoutInflater inflater = LayoutInflater.from(ExpandableList);
51 | convertView = inflater.inflate(R.layout.view_doing_list_child, null);
52 | TextView textView = (TextView)convertView.findViewById(R.id.textView_group_title);
53 | textView.setText(getChild(groupPosition, childPosition).toString());
54 | return convertView;
55 | }
56 |
57 | @Override
58 | public int getChildrenCount(int groupPosition) {
59 | // TODO Auto-generated method stub
60 | return groups.get(groupPosition).doingListData.size();
61 | }
62 |
63 | @Override
64 | public Object getGroup(int groupPosition) {
65 | // TODO Auto-generated method stub
66 | return groups.get(groupPosition);
67 | }
68 |
69 | @Override
70 | public int getGroupCount() {
71 | // TODO Auto-generated method stub
72 | return groups.size();
73 | }
74 |
75 | @Override
76 | public long getGroupId(int groupPosition) {
77 | // TODO Auto-generated method stub
78 | return groupPosition;
79 | }
80 |
81 | @Override
82 | public View getGroupView(int groupPosition, boolean isExpanded,
83 | View convertView, ViewGroup parent) {
84 | LayoutInflater inflater = LayoutInflater.from(ExpandableList);
85 | convertView = inflater.inflate(R.layout.view_doing_list_group, null);
86 | TextView textView = (TextView)convertView.findViewById(R.id.textView_group_title);
87 | textView.setText(getGroup(groupPosition).toString());
88 | return convertView;
89 | }
90 |
91 | @Override
92 | public boolean hasStableIds() {
93 | // TODO Auto-generated method stub
94 | return true;
95 | }
96 |
97 | @Override
98 | public boolean isChildSelectable(int arg0, int arg1) {
99 | // TODO Auto-generated method stub
100 | return true;
101 | }
102 | }
103 |
--------------------------------------------------------------------------------
/src/com/luna/anytime/adapter/AnytimeUserResponseListAdapter.java:
--------------------------------------------------------------------------------
1 | package com.luna.anytime.adapter;
2 |
3 | import java.util.List;
4 |
5 | import com.avos.avoscloud.AVObject;
6 | import com.luna.anytime.R;
7 |
8 | import android.content.Context;
9 | import android.database.DataSetObserver;
10 | import android.text.format.DateFormat;
11 | import android.view.LayoutInflater;
12 | import android.view.View;
13 | import android.view.ViewGroup;
14 | import android.widget.ListAdapter;
15 | import android.widget.TextView;
16 |
17 | public class AnytimeUserResponseListAdapter implements ListAdapter {
18 |
19 | private List mResponseList;
20 | private LayoutInflater mInflater;
21 | private Context mContext;
22 |
23 | public AnytimeUserResponseListAdapter(List responseList,
24 | Context context) {
25 | this.mResponseList = responseList;
26 | this.mContext = context;
27 | this.mInflater = LayoutInflater.from(context);
28 | }
29 |
30 | @Override
31 | public int getCount() {
32 | return mResponseList.size();
33 | }
34 |
35 | @Override
36 | public Object getItem(int position) {
37 | return null;
38 | }
39 |
40 | @Override
41 | public long getItemId(int position) {
42 | return 0;
43 | }
44 |
45 | @Override
46 | public int getItemViewType(int position) {
47 | return 0;
48 | }
49 |
50 | @Override
51 | public View getView(int position, View convertView, ViewGroup parent) {
52 | convertView = mInflater.inflate(R.layout.view_user_response, null);
53 | TextView response = (TextView) convertView
54 | .findViewById(R.id.textView_user_response);
55 | TextView responseTime = (TextView) convertView
56 | .findViewById(R.id.textView_user_response_time);
57 |
58 | response.setText(mResponseList.get(position)
59 | .getString("UserSuggestion"));
60 | responseTime.setText(DateFormat.format("yyyy-MM-dd HH:mm",
61 | mResponseList.get(position).getCreatedAt()).toString());
62 |
63 | if (mResponseList.get(position).getBoolean("IsResponseToUser")) {
64 | response.setTextColor(this.mContext.getResources().getColor(
65 | R.color.BlueColor));
66 | responseTime.setTextColor(this.mContext.getResources()
67 | .getColor(R.color.BlueColor));
68 | }
69 |
70 | return convertView;
71 | }
72 |
73 | @Override
74 | public int getViewTypeCount() {
75 | return getCount();
76 | }
77 |
78 | @Override
79 | public boolean hasStableIds() {
80 | // TODO Auto-generated method stub
81 | return false;
82 | }
83 |
84 | @Override
85 | public boolean isEmpty() {
86 | return mResponseList.isEmpty();
87 | }
88 |
89 | @Override
90 | public void registerDataSetObserver(DataSetObserver observer) {
91 |
92 | }
93 |
94 | @Override
95 | public void unregisterDataSetObserver(DataSetObserver observer) {
96 |
97 | }
98 |
99 | @Override
100 | public boolean areAllItemsEnabled() {
101 | return false;
102 | }
103 |
104 | @Override
105 | public boolean isEnabled(int position) {
106 | return false;
107 | }
108 |
109 | }
110 |
--------------------------------------------------------------------------------
/src/com/luna/anytime/data/DoingListData.java:
--------------------------------------------------------------------------------
1 | package com.luna.anytime.data;
2 |
3 | import java.util.ArrayList;
4 |
5 | public class DoingListData {
6 |
7 | public DoingListData() {
8 | }
9 |
10 | public DoingListData(String objectId, String DataTitle) {
11 | this.objectId = objectId;
12 | this.DataTitle = DataTitle;
13 | }
14 |
15 | public String objectId;
16 | public String DataTitle;
17 | public ArrayList doingListData;
18 |
19 | @Override
20 | public String toString() {
21 | return DataTitle;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------