diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml
new file mode 100644
index 000000000..f0d9515f5
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/bug_report.yml
@@ -0,0 +1,83 @@
+name: Bug Report/报告 bug
+description: "Create a report to help us improve, please read FAQ first./帮助我们更好地改进项目,但请先阅读常见问题与提问前必看,不要提已有的重复问题!"
+title: "[Bug] "
+labels: [kind/bug]
+body:
+- type: markdown
+ attributes:
+ value: "如果你已经知道问题所在、怎么解决,请直接 提交 Pull Request 为社区做贡献,非常感谢。\n开发者也是人,也需要工作、休息、恋爱、陪伴家人、走亲会友等,也有心情不好和身体病痛,\n往往没有额外的时间精力顾及一些小问题,请理解和支持,开源要大家参与贡献才会更美好~\n少数个人的热情终有被耗尽的一天,只有大家共同建设和繁荣社区,才能让开源可持续发展! "
+
+- type: input
+ attributes:
+ label: APIJSON Version/APIJSON 版本号
+ placeholder: |
+ e.g./例如 5.4.0 ,如果不是最新版请用最新版,复现问题再来,原则上不更新旧版,而是只维护一个最新版
+
+ validations:
+ required: true
+
+- type: input
+ attributes:
+ label: Database Type & Version/数据库类型及版本号
+ placeholder: |
+ e.g./例如 MySQL 5.7.34
+
+ validations:
+ required: true
+
+- type: textarea
+ attributes:
+ label: Environment/环境信息
+ description: |
+ e.g./例如:
+ - **JDK/基础库**: 1.8.0_17
+ - **OS/系统**: MacOS Monterey 12.6 (21G115) M1
+ value: |
+ - JDK/基础库:
+ - OS/系统:
+ render: markdown
+
+ validations:
+ required: true
+
+- type: input
+ attributes:
+ label: APIAuto Screenshots/APIAuto 请求与结果完整截屏
+ description: "Upload by copy and paste image file or url./复制图片文件或 URL 再粘贴到输入框(用 APIAuto 能静态检查出很多问题,甚至还有修复建议,不用浪费你我的时间)\n https://github.com/TommyLemon/APIAuto "
+ value:
+
+ validations:
+ required: true
+
+- type: textarea
+ attributes:
+ label: Current Behavior/问题描述
+ description: "A concise description of what you're experiencing. Must contains screenshots./\n\n**提 bug 请发请求和响应的【完整截屏】,没图的自行解决!\n开发者有限的时间和精力主要放在【维护项目源码和文档】上!\n【描述不详细】 或 【文档/常见问题 已有答案】 的问题可能会被忽略!!\n【态度 不文明/不友善】的可能会被拉黑,问题也可能不予解答!!!**\n\n请求参数 JSON 中表名、字段名、关键词及对应的值都是大小写敏感、逗号敏感、分号敏感、空格敏感、换行敏感,\n大部分情况都不允许空格和换行,表名以大写字母开头,不要想当然,请严格按照 设计规范 来调用 API \n https://github.com/Tencent/APIJSON/issues/181 "
+ render: markdown
+
+ validations:
+ required: true
+
+- type: textarea
+ attributes:
+ label: Expected Behavior/期望结果
+ description: A concise description of what you expected to happen./具体描述你期望返回什么样的结果或者达到什么样的效果?
+ render: markdown
+
+ validations:
+ required: false
+
+
+- type: textarea
+ attributes:
+ label: Any additional comments?/其它补充说明?
+ description: |
+ e.g. some background/context of how you ran into this bug./例如:一些背景或上下文信息,包括复现步骤、相关日志等
+ render: markdown
+
+ validations:
+ required: false
+
+- type: markdown
+ attributes:
+ value: "Please follow the rules to fulfil all required inputs. You can add screenshots by comment after submit this issue./\n请按要求填写所有必填项,未填完将提交不了!\n如果随意填写敷衍了事,将直接关闭 issue,问题不会得到解答!\n可以提交后再通过回复评论来补充上传截屏图片(复制粘贴文件)。\n如果是网页 bug 等与你无关的原因导致提交不了,可以改为填问卷:\n https://wj.qq.com/s2/10971431/2a09 "
diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml
new file mode 100644
index 000000000..3ba13e0ce
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/config.yml
@@ -0,0 +1 @@
+blank_issues_enabled: false
diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml
new file mode 100644
index 000000000..6f14d47b3
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/feature_request.yml
@@ -0,0 +1,17 @@
+name: Feature Request/期望新增功能
+description: Request a new feature/期望新增什么样的功能或特性,或者做哪些方面的改进?
+title: "[Feature] "
+labels: [kind/feature]
+body:
+- type: textarea
+ attributes:
+ label: Description
+ description: |
+ Please describe what this feature does./具体描述下是什么样的功能或特性,以及你为什么想要它,用在什么场景,碰到了什么痛点,有什么解决思路,尝试过哪些,效果怎样?
+
+ validations:
+ required: true
+
+- type: markdown
+ attributes:
+ value: 推荐去建议收集箱提问,也方便 统一检索和管理、投票决定优先级、更新处理进度 等: https://github.com/Tencent/APIJSON/issues/37
diff --git a/.github/ISSUE_TEMPLATE/other_issues.yml b/.github/ISSUE_TEMPLATE/other_issues.yml
new file mode 100644
index 000000000..9f9a6d0ea
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/other_issues.yml
@@ -0,0 +1,16 @@
+name: Other Issues/其它反馈
+description: For questions, suggestions, improvements and others./问题(非 bug)、建议(非新增功能) 或 其它
+title: "[xxx] "
+body:
+- type: textarea
+ attributes:
+ label: Description
+ description: |
+ Please describe the issue./请具体描述,包括是什么、为什么、如何做
+
+ validations:
+ required: true
+
+- type: markdown
+ attributes:
+ value: "Bug 反馈请使用正确的模板,用错模板将直接关闭 issue,不予解答:\n https://github.com/Tencent/APIJSON/issues/new?assignees=&labels=kind%2Fbug&template=bug_report.yml&title=%5BBug%5D+ \n有建议请去建议收集箱提问,也方便 统一检索和管理、投票决定优先级、更新处理进度 等:\n https://github.com/Tencent/APIJSON/issues/37 "
diff --git a/.gitignore b/.gitignore
index c7d58a025..a06bbd0a8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,15 +1,38 @@
.DS_Store
-APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/bin
-APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/gen
-APIJSON-Android/APIJSON-ADT/APIJSONApp/QRCodeLibrary/bin
-APIJSON-Android/APIJSON-ADT/APIJSONApp/QRCodeLibrary/gen
-APIJSON-Android/APIJSON-ADT/APIJSONApp/ZBLibrary/bin
-APIJSON-Android/APIJSON-ADT/APIJSONApp/ZBLibrary/gen
-APIJSON-Android/APIJSON-ADT/APIJSONLibrary/bin
-APIJSON-Android/APIJSON-ADT/APIJSONLibrary/gen
-APIJSON-Android/APIJSON-ADT/APIJSONTest/bin
-APIJSON-Android/APIJSON-ADT/APIJSONTest/gen
-APIJSON-Android/APIJSON-AndroidStudio/APIJSONApp/.idea
-APIJSON-JavaScript/.idea
-
-APIJSON-JavaScript/APIJSON-JS-Vue/yarn.lock
+.gradle
+yarn.lock
+*.project
+
+HELP.md
+target/
+!.mvn/wrapper/maven-wrapper.jar
+!**/src/main/**
+!**/src/test/**
+
+### STS ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+
+### IntelliJ IDEA ###
+.idea
+*.iws
+*.iml
+*.ipr
+
+### NetBeans ###
+/nbproject/private/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
+build/
+
+### VS Code ###
+.vscode/
+APIJSONORM/bin
+*.DS_Store
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/.classpath b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/.classpath
deleted file mode 100644
index 51769745b..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/.classpath
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/.project b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/.project
deleted file mode 100644
index acf18149e..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/.project
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
- APIJSONApp
-
-
-
-
-
- com.android.ide.eclipse.adt.ResourceManagerBuilder
-
-
-
-
- com.android.ide.eclipse.adt.PreCompilerBuilder
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
- com.android.ide.eclipse.adt.ApkBuilder
-
-
-
-
-
- com.android.ide.eclipse.adt.AndroidNature
- org.eclipse.jdt.core.javanature
-
-
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/AndroidManifest.xml b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/AndroidManifest.xml
deleted file mode 100755
index bfd07e31f..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/AndroidManifest.xml
+++ /dev/null
@@ -1,188 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/ic_launcher-web.png b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/ic_launcher-web.png
deleted file mode 100644
index a18cbb48c..000000000
Binary files a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/ic_launcher-web.png and /dev/null differ
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/proguard-project.txt b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/proguard-project.txt
deleted file mode 100644
index f2fe1559a..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/proguard-project.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-# To enable ProGuard in your project, edit project.properties
-# to define the proguard.config property as described in that file.
-#
-# Add project specific ProGuard rules here.
-# By default, the flags in this file are appended to flags specified
-# in ${sdk.dir}/tools/proguard/proguard-android.txt
-# You can edit the include path and order by changing the ProGuard
-# include property in project.properties.
-#
-# For more details, see
-# http://developer.android.com/guide/developing/tools/proguard.html
-
-# Add any project specific keep options here:
-
-# If your project uses WebView with JS, uncomment the following
-# and specify the fully qualified class name to the JavaScript interface
-# class:
-#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
-# public *;
-#}
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/project.properties b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/project.properties
deleted file mode 100644
index b41abd55c..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/project.properties
+++ /dev/null
@@ -1,17 +0,0 @@
-# This file is automatically generated by Android Tools.
-# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
-#
-# This file must be checked in Version Control Systems.
-#
-# To customize properties used by the Ant build system edit
-# "ant.properties", and override values to adapt the script to your
-# project structure.
-#
-# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
-#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
-
-# Project target.
-target=android-21
-android.library.reference.1=../../APIJSONLibrary
-android.library.reference.2=../QRCodeLibrary
-android.library.reference.3=../ZBLibrary
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/angel.png b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/angel.png
deleted file mode 100755
index af1faba81..000000000
Binary files a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/angel.png and /dev/null differ
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/back_black_light.png b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/back_black_light.png
deleted file mode 100644
index 2c0fdc7d0..000000000
Binary files a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/back_black_light.png and /dev/null differ
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/call_light.png b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/call_light.png
deleted file mode 100644
index c8a84f5d8..000000000
Binary files a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/call_light.png and /dev/null differ
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/comment.png b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/comment.png
deleted file mode 100644
index 0847ac466..000000000
Binary files a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/comment.png and /dev/null differ
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/commented.png b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/commented.png
deleted file mode 100644
index 26e8fd26c..000000000
Binary files a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/commented.png and /dev/null differ
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/default_head.png b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/default_head.png
deleted file mode 100755
index a18cbb48c..000000000
Binary files a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/default_head.png and /dev/null differ
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/delete.png b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/delete.png
deleted file mode 100755
index 572df98ef..000000000
Binary files a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/delete.png and /dev/null differ
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/delete_light.png b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/delete_light.png
deleted file mode 100755
index e9ce89e04..000000000
Binary files a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/delete_light.png and /dev/null differ
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/earth.png b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/earth.png
deleted file mode 100755
index e154afdbc..000000000
Binary files a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/earth.png and /dev/null differ
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/earth_light.png b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/earth_light.png
deleted file mode 100755
index 6a2bc8857..000000000
Binary files a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/earth_light.png and /dev/null differ
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/edit.png b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/edit.png
deleted file mode 100755
index eca7a2b36..000000000
Binary files a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/edit.png and /dev/null differ
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/edit_light.png b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/edit_light.png
deleted file mode 100644
index 4a939679e..000000000
Binary files a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/edit_light.png and /dev/null differ
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/edit_light_small.png b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/edit_light_small.png
deleted file mode 100644
index f09b2e4c2..000000000
Binary files a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/edit_light_small.png and /dev/null differ
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/flash_light.png b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/flash_light.png
deleted file mode 100644
index 944a6295d..000000000
Binary files a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/flash_light.png and /dev/null differ
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/ic_launcher.png b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/ic_launcher.png
deleted file mode 100644
index 54334838a..000000000
Binary files a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/ic_launcher.png and /dev/null differ
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/loading.png b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/loading.png
deleted file mode 100755
index 1c190a992..000000000
Binary files a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/loading.png and /dev/null differ
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/mail.png b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/mail.png
deleted file mode 100755
index 524cc849c..000000000
Binary files a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/mail.png and /dev/null differ
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/mail_add.png b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/mail_add.png
deleted file mode 100755
index 1f25e0cad..000000000
Binary files a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/mail_add.png and /dev/null differ
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/mail_light.png b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/mail_light.png
deleted file mode 100755
index d821bc93a..000000000
Binary files a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/mail_light.png and /dev/null differ
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/menu.png b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/menu.png
deleted file mode 100755
index 97231b91f..000000000
Binary files a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/menu.png and /dev/null differ
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/menu_light.png b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/menu_light.png
deleted file mode 100755
index 89fa0cd0e..000000000
Binary files a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/menu_light.png and /dev/null differ
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/off.png b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/off.png
deleted file mode 100644
index bc4705947..000000000
Binary files a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/off.png and /dev/null differ
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/on.png b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/on.png
deleted file mode 100644
index c0ee75750..000000000
Binary files a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/on.png and /dev/null differ
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/praise.png b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/praise.png
deleted file mode 100644
index 38051d8d6..000000000
Binary files a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/praise.png and /dev/null differ
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/praised.png b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/praised.png
deleted file mode 100644
index 594ee1212..000000000
Binary files a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/praised.png and /dev/null differ
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/qrcode.png b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/qrcode.png
deleted file mode 100644
index 296359977..000000000
Binary files a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/qrcode.png and /dev/null differ
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/search.png b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/search.png
deleted file mode 100755
index 720fc9bba..000000000
Binary files a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/search.png and /dev/null differ
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/search_light.png b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/search_light.png
deleted file mode 100755
index e6b704518..000000000
Binary files a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/search_light.png and /dev/null differ
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/send_light.png b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/send_light.png
deleted file mode 100644
index 6bdd9585f..000000000
Binary files a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/send_light.png and /dev/null differ
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/setting.png b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/setting.png
deleted file mode 100644
index 54eecded3..000000000
Binary files a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/setting.png and /dev/null differ
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/setting_light.png b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/setting_light.png
deleted file mode 100644
index 0eb78f7c7..000000000
Binary files a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/setting_light.png and /dev/null differ
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/star.png b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/star.png
deleted file mode 100644
index 7c3e1db9f..000000000
Binary files a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/star.png and /dev/null differ
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/star_light.png b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/star_light.png
deleted file mode 100644
index 7c25f3511..000000000
Binary files a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable-hdpi/star_light.png and /dev/null differ
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable/earth_selector.xml b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable/earth_selector.xml
deleted file mode 100644
index 340b51b32..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable/earth_selector.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable/gesture_left.png b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable/gesture_left.png
deleted file mode 100644
index b4f7147fd..000000000
Binary files a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable/gesture_left.png and /dev/null differ
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable/gesture_right.png b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable/gesture_right.png
deleted file mode 100644
index 903c8e744..000000000
Binary files a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable/gesture_right.png and /dev/null differ
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable/ic_launcher.png b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable/ic_launcher.png
deleted file mode 100644
index cde69bccc..000000000
Binary files a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable/ic_launcher.png and /dev/null differ
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable/mail_selector.xml b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable/mail_selector.xml
deleted file mode 100644
index 83171da5c..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable/mail_selector.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable/search_selector.xml b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable/search_selector.xml
deleted file mode 100644
index 6c31316b5..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable/search_selector.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable/setting_selector.xml b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable/setting_selector.xml
deleted file mode 100644
index 77aa8926e..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable/setting_selector.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable/splash.xml b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable/splash.xml
deleted file mode 100644
index d51815b6e..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/drawable/splash.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
- -
-
-
-
-
-
-
\ No newline at end of file
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/layout/about_activity.xml b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/layout/about_activity.xml
deleted file mode 100644
index 0f9e92613..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/layout/about_activity.xml
+++ /dev/null
@@ -1,183 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/layout/comment_container_view.xml b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/layout/comment_container_view.xml
deleted file mode 100644
index c980e6abe..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/layout/comment_container_view.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/layout/comment_item.xml b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/layout/comment_item.xml
deleted file mode 100644
index 45aae3846..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/layout/comment_item.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/layout/comment_view.xml b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/layout/comment_view.xml
deleted file mode 100644
index fe9842593..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/layout/comment_view.xml
+++ /dev/null
@@ -1,77 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/layout/login_activity.xml b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/layout/login_activity.xml
deleted file mode 100644
index d5015cbc4..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/layout/login_activity.xml
+++ /dev/null
@@ -1,105 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/layout/main_tab_activity.xml b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/layout/main_tab_activity.xml
deleted file mode 100755
index dd389d41e..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/layout/main_tab_activity.xml
+++ /dev/null
@@ -1,89 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/layout/mine_fragment.xml b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/layout/mine_fragment.xml
deleted file mode 100755
index 24fa974a6..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/layout/mine_fragment.xml
+++ /dev/null
@@ -1,115 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/layout/moment_activity.xml b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/layout/moment_activity.xml
deleted file mode 100755
index 796015941..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/layout/moment_activity.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/layout/moment_list_activity.xml b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/layout/moment_list_activity.xml
deleted file mode 100755
index ece5d9d5e..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/layout/moment_list_activity.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/layout/moment_view.xml b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/layout/moment_view.xml
deleted file mode 100644
index 4692a931d..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/layout/moment_view.xml
+++ /dev/null
@@ -1,149 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/layout/number_password_activity.xml b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/layout/number_password_activity.xml
deleted file mode 100644
index 505f9c0d6..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/layout/number_password_activity.xml
+++ /dev/null
@@ -1,87 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/layout/password_activity.xml b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/layout/password_activity.xml
deleted file mode 100644
index ce46122b3..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/layout/password_activity.xml
+++ /dev/null
@@ -1,172 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/layout/qrcode_activity.xml b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/layout/qrcode_activity.xml
deleted file mode 100644
index 2f0d6f4e7..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/layout/qrcode_activity.xml
+++ /dev/null
@@ -1,60 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/layout/scan_activity.xml b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/layout/scan_activity.xml
deleted file mode 100644
index 9999085c6..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/layout/scan_activity.xml
+++ /dev/null
@@ -1,119 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/layout/setting_activity.xml b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/layout/setting_activity.xml
deleted file mode 100644
index 5b8c9105b..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/layout/setting_activity.xml
+++ /dev/null
@@ -1,160 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/layout/user_activity.xml b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/layout/user_activity.xml
deleted file mode 100644
index 43c446f37..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/layout/user_activity.xml
+++ /dev/null
@@ -1,162 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/layout/user_list_activity.xml b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/layout/user_list_activity.xml
deleted file mode 100755
index f7c40ee50..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/layout/user_list_activity.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/layout/user_view.xml b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/layout/user_view.xml
deleted file mode 100755
index 4fa54da78..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/layout/user_view.xml
+++ /dev/null
@@ -1,48 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/layout/wallet_activity.xml b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/layout/wallet_activity.xml
deleted file mode 100755
index 626528770..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/layout/wallet_activity.xml
+++ /dev/null
@@ -1,48 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/values/dimens.xml b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/values/dimens.xml
deleted file mode 100644
index 20ed9f6ff..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/values/dimens.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
- 200dp
- 60dp
- 50dp
- 10dp
-
-
\ No newline at end of file
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/values/strings.xml b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/values/strings.xml
deleted file mode 100644
index a8627ecb8..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/values/strings.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
- 正在发布,请稍后...
- 发布失败,再试一次吧^_^
- 发布成功
- 评论失败,再试一次吧^_^
- 评论成功
- 请输入密码
- 密码不一致
-
\ No newline at end of file
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/values/styles.xml b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/values/styles.xml
deleted file mode 100755
index b928815ae..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/res/values/styles.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/activity_fragment/AboutActivity.java b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/activity_fragment/AboutActivity.java
deleted file mode 100644
index 7787051fe..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/activity_fragment/AboutActivity.java
+++ /dev/null
@@ -1,291 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package apijson.demo.client.activity_fragment;
-
-import java.io.File;
-
-import zuo.biao.library.base.BaseActivity;
-import zuo.biao.library.interfaces.OnBottomDragListener;
-import zuo.biao.library.ui.WebViewActivity;
-import zuo.biao.library.util.CommonUtil;
-import zuo.biao.library.util.DownloadUtil;
-import zuo.biao.library.util.SettingUtil;
-import android.app.Activity;
-import android.content.Context;
-import android.content.Intent;
-import android.graphics.Bitmap;
-import android.net.Uri;
-import android.os.Bundle;
-import android.util.Log;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.view.View.OnLongClickListener;
-import android.widget.ImageView;
-import android.widget.TextView;
-import apijson.demo.client.R;
-import apijson.demo.client.application.APIJSONApplication;
-import apijson.demo.client.util.Constant;
-import apijson.demo.client.util.HttpRequest;
-
-import com.google.zxing.WriterException;
-import com.zxing.encoding.EncodingHandler;
-
-/**关于界面
- * @author Lemon
- */
-public class AboutActivity extends BaseActivity implements OnClickListener, OnLongClickListener, OnBottomDragListener {
- private static final String TAG = "AboutActivity";
-
- //启动方法<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
-
- /**启动这个Activity的Intent
- * @param context
- * @return
- */
- public static Intent createIntent(Context context) {
- return new Intent(context, AboutActivity.class);
- }
-
- //启动方法>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
- @Override
- public Activity getActivity() {
- return this;
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.about_activity, this);
-
- //功能归类分区方法,必须调用<<<<<<<<<<
- initView();
- initData();
- initEvent();
- //功能归类分区方法,必须调用>>>>>>>>>>
-
- if (SettingUtil.isOnTestMode) {
- showShortToast("测试服务器\n" + HttpRequest.URL_BASE);
- }
- }
-
- //UI显示区(操作UI,但不存在数据获取或处理代码,也不存在事件监听代码)<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- private ImageView ivAboutGesture;
-
- private TextView tvAboutAppInfo;
-
- private ImageView ivAboutQRCode;
- @Override
- public void initView() {
-
- ivAboutGesture = (ImageView) findViewById(R.id.ivAboutGesture);
- ivAboutGesture.setVisibility(SettingUtil.isFirstStart ? View.VISIBLE : View.GONE);
- if (SettingUtil.isFirstStart) {
- ivAboutGesture.setImageResource(R.drawable.gesture_left);
- }
-
- tvAboutAppInfo = (TextView) findViewById(R.id.tvAboutAppInfo);
-
- ivAboutQRCode = findViewById(R.id.ivAboutQRCode, this);
- }
-
-
- //UI显示区(操作UI,但不存在数据获取或处理代码,也不存在事件监听代码)>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
-
-
-
-
-
-
-
- //Data数据区(存在数据获取或处理代码,但不存在事件监听代码)<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- @Override
- public void initData() {
-
- tvAboutAppInfo.setText(APIJSONApplication.getInstance().getAppName()
- + "\n" + APIJSONApplication.getInstance().getAppVersion());
-
- setQRCode();
- }
-
-
- private Bitmap qRCodeBitmap;
- /**显示二维码
- */
- protected void setQRCode() {
- runThread(TAG + "setQRCode", new Runnable() {
-
- @Override
- public void run() {
-
- try {
- qRCodeBitmap = EncodingHandler.createQRCode(Constant.APP_DOWNLOAD_WEBSITE
- , (int) (2 * getResources().getDimension(R.dimen.qrcode_size)));
- } catch (WriterException e) {
- e.printStackTrace();
- Log.e(TAG, "initData try {Bitmap qrcode = EncodingHandler.createQRCode(contactJson, ivContactQRCodeCode.getWidth());" +
- " >> } catch (WriterException e) {" + e.getMessage());
- }
-
- runUiThread(new Runnable() {
- @Override
- public void run() {
- ivAboutQRCode.setImageBitmap(qRCodeBitmap);
- }
- });
- }
- });
- }
-
- /**下载应用
- */
- private void downloadApp() {
- showProgressDialog("正在下载...");
- runThread(TAG + "downloadApp", new Runnable() {
- @Override
- public void run() {
- File file = DownloadUtil.downLoadFile(context, "APIJSONApp", ".apk", Constant.APP_DOWNLOAD_WEBSITE);
- dismissProgressDialog();
- DownloadUtil.openFile(context, file);
- }
- });
- }
-
- //Data数据区(存在数据获取或处理代码,但不存在事件监听代码)>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
-
-
-
-
-
- //Event事件区(只要存在事件监听代码就是)<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- @Override
- public void initEvent() {
-
- findViewById(R.id.llAboutUpdate).setOnClickListener(this);
- findViewById(R.id.llAboutShare).setOnClickListener(this);
- findViewById(R.id.llAboutComment).setOnClickListener(this);
-
- findViewById(R.id.llAboutDeveloper, this).setOnLongClickListener(this);
- findViewById(R.id.llAboutWeibo, this).setOnLongClickListener(this);
- findViewById(R.id.llAboutContactUs, this).setOnLongClickListener(this);
- }
-
- //系统自带监听方法<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- @Override
- public void onDragBottom(boolean rightToLeft) {
- if (rightToLeft) {
- toActivity(WebViewActivity.createIntent(context, "博客", Constant.APP_OFFICIAL_BLOG));
-
- ivAboutGesture.setImageResource(R.drawable.gesture_right);
- return;
- }
-
- if (SettingUtil.isFirstStart) {
- runThread(TAG + "onDragBottom", new Runnable() {
- @Override
- public void run() {
- Log.i(TAG, "onDragBottom >> SettingUtil.putBoolean(context, SettingUtil.KEY_IS_FIRST_IN, false);");
- SettingUtil.putBoolean(SettingUtil.KEY_IS_FIRST_START, false);
- }
- });
- }
-
- finish();
- }
-
- @Override
- public void onClick(View v) {
- switch (v.getId()) {
- case R.id.llAboutUpdate:
- toActivity(WebViewActivity.createIntent(context, "更新日志", Constant.UPDATE_LOG_WEBSITE));
- break;
- case R.id.llAboutShare:
- CommonUtil.shareInfo(context, getString(R.string.share_app)
- + "\n 点击链接直接下载体验APIJSON\n" + Constant.APP_DOWNLOAD_WEBSITE);
- break;
- case R.id.llAboutComment:
- showShortToast("应用未上线不能查看");
- startActivity(new Intent(Intent.ACTION_VIEW).setData(Uri.parse("market://details?id=" + getPackageName())));
- break;
-
- case R.id.llAboutDeveloper:
- toActivity(WebViewActivity.createIntent(context, "开发者", Constant.APP_DEVELOPER_WEBSITE));
- break;
- case R.id.llAboutWeibo:
- toActivity(WebViewActivity.createIntent(context, "博客", Constant.APP_OFFICIAL_BLOG));
- break;
- case R.id.llAboutContactUs:
- CommonUtil.sendEmail(context, Constant.APP_OFFICIAL_EMAIL);
- break;
-
- case R.id.ivAboutQRCode:
- downloadApp();
- break;
- default:
- break;
- }
- }
-
- @Override
- public boolean onLongClick(View v) {
- switch (v.getId()) {
- case R.id.llAboutDeveloper:
- CommonUtil.copyText(context, Constant.APP_DEVELOPER_WEBSITE);
- return true;
- case R.id.llAboutWeibo:
- CommonUtil.copyText(context, Constant.APP_OFFICIAL_BLOG);
- return true;
- case R.id.llAboutContactUs:
- CommonUtil.copyText(context, Constant.APP_OFFICIAL_EMAIL);
- return true;
- default:
- break;
- }
- return false;
- }
-
-
-
- //系统自带监听方法>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
- //Event事件区(只要存在事件监听代码就是)>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
-
-
-
-
-
- //内部类,尽量少用<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
-
-
- //内部类,尽量少用>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-}
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/activity_fragment/LoginActivity.java b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/activity_fragment/LoginActivity.java
deleted file mode 100644
index 85c83fdaf..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/activity_fragment/LoginActivity.java
+++ /dev/null
@@ -1,380 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package apijson.demo.client.activity_fragment;
-
-import zuo.biao.apijson.JSONResponse;
-import zuo.biao.library.base.BaseActivity;
-import zuo.biao.library.interfaces.OnBottomDragListener;
-import zuo.biao.library.manager.HttpManager.OnHttpResponseListener;
-import zuo.biao.library.ui.BottomMenuWindow;
-import zuo.biao.library.ui.ServerSettingActivity;
-import zuo.biao.library.ui.TextClearSuit;
-import zuo.biao.library.util.EditTextUtil;
-import zuo.biao.library.util.Log;
-import zuo.biao.library.util.SettingUtil;
-import zuo.biao.library.util.StringUtil;
-import android.annotation.SuppressLint;
-import android.app.Activity;
-import android.content.Context;
-import android.content.Intent;
-import android.os.Bundle;
-import android.view.MotionEvent;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.view.View.OnTouchListener;
-import android.widget.EditText;
-import apijson.demo.client.R;
-import apijson.demo.client.application.APIJSONApplication;
-import apijson.demo.client.manager.DataManager;
-import apijson.demo.client.model.User;
-import apijson.demo.client.util.HttpRequest;
-import apijson.demo.server.model.Login;
-
-/**登录界面
- * @author Lemon
- */
-public class LoginActivity extends BaseActivity implements OnClickListener, OnTouchListener, OnBottomDragListener{
- private static final String TAG = "LoginActivity";
-
-
- //启动方法<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- /**启动这个Activity的Intent
- * @param context
- * @return
- */
- public static Intent createIntent(Context context) {
- return new Intent(context, LoginActivity.class);
- }
-
- //启动方法>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
- @Override
- public Activity getActivity() {
- return this;
- }
-
- public static final int RESULT_LOGIN = 41;
- public static final String RESULT_LOGINED = "RESULT_LOGINED";
-
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.login_activity, this);
-
- //必须调用<<<<<<<<<<<
- initView();
- initData();
- initEvent();
- //必须调用>>>>>>>>>>
-
- }
-
-
- //UI显示区(操作UI,但不存在数据获取或处理代码,也不存在事件监听代码)<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- private EditText etLoginPhone;
- private EditText etLoginPassword;
- @Override
- public void initView() {//必须调用
- exitAnim = R.anim.bottom_push_out;//退出动画
-
- etLoginPhone = (EditText) findViewById(R.id.etLoginPhone);
- etLoginPassword = (EditText) findViewById(R.id.etLoginPassword);
-
- }
-
- private void onLoginSucceed() {
- runUiThread(new Runnable() {
-
- @Override
- public void run() {
- intent = MainTabActivity.createIntent(context);
- intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
- toActivity(intent);
- enterAnim = exitAnim = R.anim.null_anim;
- finish();
- }
- });
- }
-
- private void toPassword(int type, int requestCode) {
- toActivity(PasswordActivity.createIntent(context, type, StringUtil.getTrimedString(etLoginPhone)
- , StringUtil.getString(etLoginPassword)), requestCode);
- }
-
- private void showForget() {
- toActivity(BottomMenuWindow.createIntent(context, new String[]{"重置密码", "验证码登录"})
- .putExtra(INTENT_TITLE, "忘记密码")
- , REQUEST_TO_BOTTOM_MUNU, false);
- }
-
- //UI显示区(操作UI,但不存在数据获取或处理代码,也不存在事件监听代码)>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
-
-
-
-
-
-
-
- //data数据区(存在数据获取或处理代码,但不存在事件监听代码)<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- private String phone;
- private String password;
-
- @Override
- public void initData() {//必须调用
-
- phone = DataManager.getInstance().getLastUserPhone();
- if(StringUtil.isPhone(phone)) {
- etLoginPhone.setText("" + phone);
- etLoginPassword.requestFocus();
- }
-
- }
-
-
- private void login(int type) {
- if (EditTextUtil.isInputedCorrect(context, etLoginPhone, EditTextUtil.TYPE_PHONE) == false
- || EditTextUtil.isInputedCorrect(context, etLoginPassword, type == Login.TYPE_VERIFY
- ? EditTextUtil.TYPE_VERIFY : EditTextUtil.TYPE_PASSWORD) == false) {
- return;
- }
- EditTextUtil.hideKeyboard(context, etLoginPassword);
-
- showProgressDialog("正在登录,请稍后...");
-
-
- phone = StringUtil.getTrimedString(etLoginPhone);
- password = StringUtil.getString(etLoginPassword);
-
- //登录请求
- HttpRequest.login(phone, password, type, type, new OnHttpResponseListener() {
- @Override
- public void onHttpResponse(int requestCode, String resultJson, Exception e) {
- dismissProgressDialog();
- JSONResponse response = new JSONResponse(resultJson);
- User user = response.getObject(User.class);
-
- if (response.isSuccess() == false) {
- switch (response.getCode()) {
- case JSONResponse.CODE_NOT_FOUND:
- showShortToast("账号不存在,请先注册");
- onDragBottom(true);
- break;
- case JSONResponse.CODE_ILLEGAL_ARGUMENT:
- showShortToast("账号或密码不合法!");
- break;
- case JSONResponse.CODE_CONDITION_ERROR:
- showShortToast("账号或密码错误!");
- showForget();
- break;
- default:
- showShortToast(R.string.login_faild);
- break;
- }
- } else {
- user.setPhone(phone);
- APIJSONApplication.getInstance().saveCurrentUser(user);
- if (APIJSONApplication.getInstance().isLoggedIn() == false) {
- showShortToast((requestCode == Login.TYPE_PASSWORD ? "密码" : "验证码") + "错误");
- return;
- }
-
- onLoginSucceed();
- }
- }
- });
-
- }
-
-
- //Data数据区(存在数据获取或处理代码,但不存在事件监听代码)>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
-
-
-
-
-
-
- //Event事件区(只要存在事件监听代码就是)<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- @Override
- public void initEvent() {//必须调用
-
- tvBaseTitle.setOnTouchListener(this);
-
- findViewById(R.id.tvLoginForget).setOnClickListener(this);
- findViewById(R.id.tvLoginLogin).setOnClickListener(this);
-
- new TextClearSuit().addClearListener(etLoginPhone, findViewById(R.id.ivLoginPhoneClear));
- new TextClearSuit().addClearListener(etLoginPassword, findViewById(R.id.ivLoginPasswordClear));
- }
-
-
- @Override
- public void onDragBottom(boolean rightToLeft) {
- if (rightToLeft) {
-
- toPassword(PasswordActivity.TYPE_REGISTER, REQUEST_TO_REGISTER);
- return;
- }
-
- finish();
- }
-
- //系统自带监听方法<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
-
- @Override
- public void onClick(View v) {
- switch (v.getId()) {
- case R.id.tvLoginForget:
- showForget();
- break;
- case R.id.tvLoginLogin:
- login(Login.TYPE_PASSWORD);
- break;
- default:
- break;
- }
- }
-
-
- private long touchDownTime = 0;
- @SuppressLint("ClickableViewAccessibility")
- @Override
- public boolean onTouch(View v, MotionEvent event) {
- switch (event.getAction()) {
- case MotionEvent.ACTION_DOWN:
- if (v.getId() == R.id.tvBaseTitle) {
- touchDownTime = System.currentTimeMillis();
- Log.i(TAG, "onTouch MotionEvent.ACTION: touchDownTime=" + touchDownTime);
- return true;
- }
- case MotionEvent.ACTION_UP:
- if (v.getId() == R.id.tvBaseTitle) {
- long time = System.currentTimeMillis() - touchDownTime;
- if (time > 5000 && time < 8000) {
- toActivity(ServerSettingActivity.createIntent(context
- , SettingUtil.getServerAddress(false), SettingUtil.getServerAddress(true)
- , SettingUtil.APP_SETTING, Context.MODE_PRIVATE
- , SettingUtil.KEY_SERVER_ADDRESS_NORMAL, SettingUtil.KEY_SERVER_ADDRESS_TEST)
- , REQUEST_TO_SERVER_SETTING);
- return true;
- }
- }
- break;
- default:
- break;
- }
-
- return false;
- }
-
-
-
- //类相关监听<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
-
- @Override
- public void finish() {
- if (APIJSONApplication.getInstance().isLoggedIn() == false) {
- showShortToast("未登录,有些内容会加载不出来~");
- }
-
- setResult(RESULT_OK, new Intent().putExtra(RESULT_LOGINED, APIJSONApplication.getInstance().isLoggedIn()));
- super.finish();
- }
-
-
- public static final int REQUEST_TO_BOTTOM_MUNU = 1;
- public static final int REQUEST_TO_SERVER_SETTING = 2;
- public static final int REQUEST_TO_REGISTER = 3;
- public static final int REQUEST_TO_VERIFY = 4;
- public static final int REQUEST_TO_RESET = 5;
-
- @Override
- public void onActivityResult(int requestCode, int resultCode, Intent data) {
- super.onActivityResult(requestCode, resultCode, data);
- if (resultCode != RESULT_OK) {
- return;
- }
- switch (requestCode) {
- case REQUEST_TO_SERVER_SETTING:
- sendBroadcast(new Intent(ACTION_EXIT_APP));
- break;
- case REQUEST_TO_BOTTOM_MUNU:
- if (data != null) {
- switch (data.getIntExtra(BottomMenuWindow.RESULT_ITEM_ID, -1)) {
- case 0:
- toPassword(PasswordActivity.TYPE_RESET, REQUEST_TO_RESET);
- break;
- case 1:
- toPassword(PasswordActivity.TYPE_VERIFY, REQUEST_TO_VERIFY);
- break;
- default:
- break;
- }
- }
- break;
- case REQUEST_TO_RESET:
- case REQUEST_TO_VERIFY:
- case REQUEST_TO_REGISTER:
- if (data != null) {
- String phone = data.getStringExtra(PasswordActivity.RESULT_PHONE);
- String password = data.getStringExtra(requestCode == REQUEST_TO_VERIFY
- ? PasswordActivity.RESULT_VERIFY : PasswordActivity.RESULT_PASSWORD);
- if (StringUtil.isPhone(phone)) {
- etLoginPhone.setText(phone);
- }
- if (StringUtil.isNotEmpty(password, true)) {
- etLoginPassword.setText(password);
- }
-
- login(requestCode == REQUEST_TO_VERIFY ? Login.TYPE_VERIFY : Login.TYPE_PASSWORD);
- }
- break;
- default:
- break;
- }
- }
-
- //类相关监听>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
- //系统自带监听方法>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
- //Event事件区(只要存在事件监听代码就是)>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
-
-
-
-
-
- //内部类,尽量少用<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
-
-}
\ No newline at end of file
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/activity_fragment/MainTabActivity.java b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/activity_fragment/MainTabActivity.java
deleted file mode 100755
index ea9a618e1..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/activity_fragment/MainTabActivity.java
+++ /dev/null
@@ -1,311 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package apijson.demo.client.activity_fragment;
-
-import zuo.biao.apijson.JSONResponse;
-import zuo.biao.library.base.BaseBroadcastReceiver;
-import zuo.biao.library.interfaces.OnBottomDragListener;
-import zuo.biao.library.manager.HttpManager.OnHttpResponseListener;
-import zuo.biao.library.ui.EditTextInfoWindow;
-import zuo.biao.library.util.Log;
-import zuo.biao.library.util.SettingUtil;
-import zuo.biao.library.util.StringUtil;
-import android.app.Activity;
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.os.Bundle;
-import android.support.v4.app.Fragment;
-import android.view.KeyEvent;
-import android.view.View;
-import android.view.ViewGroup;
-import apijson.demo.client.R;
-import apijson.demo.client.application.APIJSONApplication;
-import apijson.demo.client.base.BaseBottomTabActivity;
-import apijson.demo.client.interfaces.TopBarMenuCallback;
-import apijson.demo.client.model.User;
-import apijson.demo.client.util.ActionUtil;
-import apijson.demo.client.util.HttpRequest;
-
-/**应用主页
- * @author Lemon
- * @use MainTabActivity.createIntent(...)
- */
-public class MainTabActivity extends BaseBottomTabActivity implements OnBottomDragListener {
- private static final String TAG = "MainTabActivity";
-
-
- //启动方法<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- /**启动这个Activity的Intent
- * @param context
- * @return
- */
- public static Intent createIntent(Context context) {
- return new Intent(context, MainTabActivity.class);
- }
-
-
- //启动方法>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
- @Override
- public Activity getActivity() {
- return this;
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.main_tab_activity, this);
-
- //功能归类分区方法,必须调用<<<<<<<<<<
- initView();
- initData();
- initEvent();
- //功能归类分区方法,必须调用>>>>>>>>>>
-
-
- BaseBroadcastReceiver.register(context, receiver
- , new String[]{ACTION_EXIT_APP, ActionUtil.ACTION_RELOAD_CURRENT_USER});
-
-
- if (SettingUtil.isOnTestMode) {
- showShortToast("测试服务器\n" + HttpRequest.URL_BASE);
- }
- }
-
-
-
- // UI显示区(操作UI,但不存在数据获取或处理代码,也不存在事件监听代码)<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- private ViewGroup llMainTabLeftContainer;
- private ViewGroup llMainTabRightContainer;
-
- @Override
- public void initView() {// 必须调用
- super.initView();
- exitAnim = R.anim.bottom_push_out;
-
- llMainTabLeftContainer = (ViewGroup) findViewById(R.id.llMainTabLeftContainer);
- llMainTabRightContainer = (ViewGroup) findViewById(R.id.llMainTabRightContainer);
- }
-
-
- @Override
- protected int[] getTabClickIds() {
- return new int[]{R.id.llMainTabTab0, R.id.llMainTabTab1, R.id.llMainTabTab2};
- }
-
- @Override
- protected int[][] getTabSelectIds() {
- return new int[][]{
- new int[]{R.id.ivMainTabTab0, R.id.ivMainTabTab1, R.id.ivMainTabTab2},//顶部图标
- new int[]{R.id.tvMainTabTab0, R.id.tvMainTabTab1, R.id.tvMainTabTab2}//底部文字
- };
- }
-
- @Override
- public int getFragmentContainerResId() {
- return R.id.flMainTabFragmentContainer;
- }
-
- @Override
- protected Fragment getFragment(int position) {
- switch (position) {
- case 1:
- UserListFragment fragment = UserListFragment.createInstance();
- fragment.setSearchType(EditTextInfoWindow.TYPE_NAME);
- return fragment;
- case 2:
- return MineFragment.createInstance();
- default:
- return MomentListFragment.createInstance();
- }
- }
-
- private static final String[] TAB_NAMES = {"圈子", "朋友", "我的"};
- @Override
- protected void selectTab(int position) {
- tvBaseTitle.setText(TAB_NAMES[position]);
-
- View left = null, right = null;
- if (fragments[position] instanceof TopBarMenuCallback) {
- left = ((TopBarMenuCallback) fragments[position]).getLeftMenu(context);
- right = ((TopBarMenuCallback) fragments[position]).getRightMenu(context);
- }
-
- llMainTabLeftContainer.removeAllViews();
- if (left != null) {
- llMainTabLeftContainer.addView(left);
- }
- llMainTabRightContainer.removeAllViews();
- if (right != null) {
- llMainTabRightContainer.addView(right);
- }
-
-
- verifyLogin();
- }
-
-
- // UI显示区(操作UI,但不存在数据获取或处理代码,也不存在事件监听代码)>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
-
-
-
-
-
-
-
- // Data数据区(存在数据获取或处理代码,但不存在事件监听代码)<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
-
-
-
- @Override
- public void initData() {// 必须调用
- super.initData();
-
- if (isCurrentUserCorrect() == false) {
- reloadAll();
- }
- }
-
-
- @Override
- protected void reloadAll() {
- Log.d(TAG, "reloadAll >>> ");
- HttpRequest.getUser(APIJSONApplication.getInstance().getCurrentUserId(), 0, new OnHttpResponseListener() {
-
- @Override
- public void onHttpResponse(int requestCode, String resultJson, Exception e) {
- Log.d(TAG, "reloadAll >>> HttpRequest.getUser.onHttpResponse >> saveCurrentUser >>");
- APIJSONApplication.getInstance().saveCurrentUser(new JSONResponse(resultJson).getObject(User.class));
- runUiThread(new Runnable() {
-
- @Override
- public void run() {
- sendBroadcast(new Intent(ActionUtil.ACTION_USER_CHANGED)
- .putExtra(INTENT_ID, APIJSONApplication.getInstance().getCurrentUserId())
- .putExtra(ActionUtil.INTENT_USER, APIJSONApplication.getInstance().getCurrentUser()));
- }
- });
- }
- });
- }
-
- // Data数据区(存在数据获取或处理代码,但不存在事件监听代码)>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
-
-
-
-
-
-
-
- // Event事件区(只要存在事件监听代码就是)<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- @Override
- public void initEvent() {// 必须调用
- super.initEvent();
-
- }
-
- @Override
- public void onDragBottom(boolean rightToLeft) {
- if (fragments[currentPosition] instanceof OnBottomDragListener) {
- ((OnBottomDragListener) fragments[currentPosition]).onDragBottom(rightToLeft);
- }
- }
-
-
- // 系统自带监听方法<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- //双击手机返回键退出<<<<<<<<<<<<<<<<<<<<<
- private long firstTime = 0;//第一次返回按钮计时
- @Override
- public boolean onKeyUp(int keyCode, KeyEvent event) {
- switch(keyCode){
- case KeyEvent.KEYCODE_BACK:
- long secondTime = System.currentTimeMillis();
- if(secondTime - firstTime > 2000){
- showShortToast("再按一次退出");
- firstTime = secondTime;
- } else {//完全退出
- sendBroadcast(new Intent(ACTION_EXIT_APP));
- }
- return true;
- }
-
- return super.onKeyUp(keyCode, event);
- }
- //双击手机返回键退出>>>>>>>>>>>>>>>>>>>>>
-
- // 类相关监听<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- private boolean isToExitApp = false;
- @Override
- protected void onDestroy() {
- BaseBroadcastReceiver.unregister(context, receiver);
- super.onDestroy();
- if (isToExitApp) {
- isToExitApp = false;
- moveTaskToBack(true);//应用退到后台
- System.exit(0);
- }
- }
-
- // 类相关监听>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
- // 系统自带监听方法>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
- // Event事件区(只要存在事件监听代码就是)>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
- // 内部类,尽量少用<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
-
- private BroadcastReceiver receiver = new BroadcastReceiver() {
-
- public void onReceive(Context context, Intent intent) {
- String action = intent == null ? null : intent.getAction();
- if (isAlive() == false || StringUtil.isNotEmpty(action, true) == false) {
- Log.e(TAG, "receiver.onReceive isAlive() == false" +
- " || StringUtil.isNotEmpty(action, true) == false >> return;");
- return;
- }
-
- if (ACTION_EXIT_APP.equals(action)) {
- isToExitApp = true;
- finish();
- return;
- }
-
- if (ActionUtil.ACTION_RELOAD_CURRENT_USER.equals(action)) {
- reloadAll();// fragmentManager show remove等都会崩溃
- }
- }
- };
-
- // 内部类,尽量少用>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-}
\ No newline at end of file
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/activity_fragment/MineFragment.java b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/activity_fragment/MineFragment.java
deleted file mode 100755
index ab7849bf9..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/activity_fragment/MineFragment.java
+++ /dev/null
@@ -1,407 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package apijson.demo.client.activity_fragment;
-
-import java.io.File;
-
-import zuo.biao.apijson.JSONResponse;
-import zuo.biao.apijson.StringUtil;
-import zuo.biao.library.base.BaseView.OnDataChangedListener;
-import zuo.biao.library.interfaces.OnBottomDragListener;
-import zuo.biao.library.manager.HttpManager.OnHttpResponseListener;
-import zuo.biao.library.ui.AlertDialog;
-import zuo.biao.library.ui.AlertDialog.OnDialogButtonClickListener;
-import zuo.biao.library.ui.WebViewActivity;
-import zuo.biao.library.util.CommonUtil;
-import zuo.biao.library.util.DownloadUtil;
-import zuo.biao.library.util.ImageLoaderUtil;
-import zuo.biao.library.util.Log;
-import android.annotation.SuppressLint;
-import android.app.Activity;
-import android.content.Intent;
-import android.os.Bundle;
-import android.view.Gravity;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.view.ViewGroup;
-import android.widget.ImageView;
-import android.widget.TextView;
-import apijson.demo.client.R;
-import apijson.demo.client.application.APIJSONApplication;
-import apijson.demo.client.base.BaseFragment;
-import apijson.demo.client.interfaces.TopBarMenuCallback;
-import apijson.demo.client.model.User;
-import apijson.demo.client.util.HttpRequest;
-
-/**设置fragment
- * @author Lemon
- * @use new MineFragment(),详细使用见.DemoFragmentActivity(initData方法内)
- */
-public class MineFragment extends BaseFragment implements OnClickListener, OnDialogButtonClickListener
-, OnHttpResponseListener, OnBottomDragListener, TopBarMenuCallback, OnDataChangedListener {
- private static final String TAG = "MineFragment";
-
- //与Activity通信<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- /**创建一个Fragment实例
- * @return
- */
- public static MineFragment createInstance() {
- return new MineFragment();
- }
-
- //与Activity通信>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
- //类相关初始化,必须使用<<<<<<<<<<<<<<<<
- super.onCreateView(inflater, container, savedInstanceState);
- setContentView(R.layout.mine_fragment);
- //类相关初始化,必须使用>>>>>>>>>>>>>>>>
-
- registerObserver(this);
-
- //功能归类分区方法,必须调用<<<<<<<<<<
- initView();
- initData();
- initEvent();
- //功能归类分区方法,必须调用>>>>>>>>>>
-
- return view;
- }
-
-
-
- //UI显示区(操作UI,但不存在数据获取或处理代码,也不存在事件监听代码)<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- private ImageView ivSettingHead;
- private TextView tvSettingName;
- @Override
- public void initView() {//必须调用
-
- ivSettingHead = findViewById(R.id.ivSettingHead);
- tvSettingName = findViewById(R.id.tvSettingName);
- }
-
- private User user;
- private void setUser(User user_) {
- this.user = user_;
- if (user == null) {
- user = new User();
- }
- runUiThread(new Runnable() {
-
- @Override
- public void run() {
- if (isLoggedIn) {
- ImageLoaderUtil.loadImage(ivSettingHead, user.getHead(), ImageLoaderUtil.TYPE_ROUND_CORNER);
- tvSettingName.setText(StringUtil.getTrimedString(user.getName()));
- } else {
- ivSettingHead.setImageResource(R.drawable.ic_launcher);
- tvSettingName.setText("未登录");
- }
- }
- });
- }
-
-
- private TextView leftMenu;
- @SuppressLint("InflateParams")
- @Override
- public View getLeftMenu(Activity activity) {
- if (leftMenu == null) {
- leftMenu = (TextView) LayoutInflater.from(activity).inflate(R.layout.top_right_tv, null);
- leftMenu.setGravity(Gravity.CENTER);
- leftMenu.setText("扫一扫");
- leftMenu.setOnClickListener(new OnClickListener() {
-
- @Override
- public void onClick(View v) {
- onDragBottom(false);
- }
- });
- }
- return leftMenu;
- }
-
- private TextView rightMenu;
- @SuppressLint("InflateParams")
- @Override
- public View getRightMenu(Activity activity) {
- if (rightMenu == null) {
- rightMenu = (TextView) LayoutInflater.from(activity).inflate(R.layout.top_right_tv, null);
- rightMenu.setGravity(Gravity.CENTER);
- rightMenu.setText("设置");
- rightMenu.setOnClickListener(new OnClickListener() {
-
- @Override
- public void onClick(View v) {
- onDragBottom(true);
- }
- });
- }
- return rightMenu;
- }
-
- //UI显示区(操作UI,但不存在数据获取或处理代码,也不存在事件监听代码)>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
-
-
-
-
-
-
-
- //Data数据区(存在数据获取或处理代码,但不存在事件监听代码)<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- @Override
- public void initData() {//必须调用
- super.initData();
-
- }
-
- @Override
- public void onDataChanged() {
- setUser(APIJSONApplication.getInstance().getCurrentUser());
- }
-
-
- /**下载应用
- */
- private void downloadApp() {
- showProgressDialog("正在下载...");
- runThread(TAG + "downloadApp", new Runnable() {
- @Override
- public void run() {
- final File file = DownloadUtil.downLoadFile(context, "APIJSONTest", ".apk"
- , "http://files.cnblogs.com/files/tommylemon/APIJSONTest.apk");
-
- runUiThread(new Runnable() {
-
- @Override
- public void run() {
- dismissProgressDialog();
- DownloadUtil.openFile(context, file);
- }
- });
- }
- });
- }
-
-
-
- //Data数据区(存在数据获取或处理代码,但不存在事件监听代码)>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
-
-
-
-
-
- //Event事件区(只要存在事件监听代码就是)<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- @Override
- public void initEvent() {//必须调用
-
- ivSettingHead.setOnClickListener(this);
-
- findViewById(R.id.llSettingInfo).setOnClickListener(this);
- findViewById(R.id.llSettingMoment).setOnClickListener(this);
- findViewById(R.id.llSettingWallet).setOnClickListener(this);
-
- findViewById(R.id.llSettingAbout).setOnClickListener(this);
- findViewById(R.id.llSettingTest).setOnClickListener(this);
- findViewById(R.id.llSettingLogout).setOnClickListener(this);
- }
-
-
- @Override
- public void onDragBottom(boolean rightToLeft) {
- if (isAlive() == false) {
- return;
- }
-
- if (rightToLeft) {
-
- toActivity(SettingActivity.createIntent(context));
- return;
- }
-
- startActivityForResult(ScanActivity.createIntent(context), REQUEST_TO_SCAN);
- context.overridePendingTransition(R.anim.bottom_push_in, R.anim.fade);
- }
-
-
-
- @Override
- public void onDialogButtonClick(int requestCode, boolean isPositive) {
- if (! isPositive) {
- return;
- }
-
- switch (requestCode) {
- case 0:
- HttpRequest.logout(HTTP_LOUOUT, this);
- APIJSONApplication.getInstance().logout();
-
- toActivity(MainTabActivity.createIntent(context).addFlags(
- Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK));
-
- context.finish();
- break;
- default:
- break;
- }
- }
-
-
- //系统自带监听方法<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- @Override
- public void onClick(View v) {//直接调用不会显示v被点击效果
- switch (v.getId()) {
- case R.id.llSettingAbout:
- toActivity(AboutActivity.createIntent(context));
- break;
- case R.id.llSettingTest:
- downloadApp();
- break;
- default:
- if (verifyLogin() == false) {
- return;
- }
- switch (v.getId()) {
- case R.id.ivSettingHead:
- case R.id.llSettingInfo:
- toActivity(UserActivity.createIntent(context, APIJSONApplication.getInstance().getCurrentUserId()));
- break;
- case R.id.llSettingMoment:
- toActivity(MomentListActivity.createIntent(context, APIJSONApplication.getInstance().getCurrentUserId()));
- break;
- case R.id.llSettingWallet:
- toActivity(WalletActivity.createIntent(context));
- break;
- case R.id.llSettingLogout:
- new AlertDialog(context, "退出登录", "确定退出登录?", true, 0, this).show();
- break;
- default:
- break;
- }
- break;
- }
- }
-
-
- public static final int HTTP_LOUOUT = 2;
- @Override
- public void onHttpResponse(int requestCode, String resultJson, Exception e) {
- Log.d(TAG, "onHttpResponse requestCode = " + requestCode + "; resultJson = \n" + resultJson);
- if (e != null) {
- e.printStackTrace();
- }
- switch (requestCode) {
- case HTTP_LOUOUT:
- JSONResponse response = new JSONResponse(resultJson).getJSONResponse(User.class.getSimpleName());
- boolean succeed = JSONResponse.isSuccess(response);
- Log.d(TAG, succeed ? "服务端退出成功" : "服务端退出失败");
- showShortToast(succeed ? "服务端退出成功" : "服务端退出失败");
- break;
- default:
- break;
- }
- }
-
-
-
- //类相关监听<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- private static final int REQUEST_TO_SCAN = 1;
- @Override
- public void onActivityResult(int requestCode, int resultCode, Intent data) {
- super.onActivityResult(requestCode, resultCode, data);
- if (resultCode != RESULT_OK) {
- return;
- }
- switch (requestCode) {
- case REQUEST_TO_SCAN:
- String result = data == null ? null : data.getStringExtra(ScanActivity.RESULT_QRCODE_STRING);
- if (StringUtil.isEmpty(result, true) == false) {
- if (StringUtil.isUrl(result)) {
- int index = result.indexOf("{\"User\":{");
- if (index > 0) {
- JSONResponse response = new JSONResponse(result.substring(index));
- User user = response.getObject(User.class);
- long id = user == null ? 0 : user.getId();
- if (id > 0) {
- toActivity(UserActivity.createIntent(context, id));
- break;
- }
- }
- toActivity(WebViewActivity.createIntent(context, "扫描结果", result));
- } else {
- CommonUtil.copyText(context, result);
- }
- }
- break;
- default:
- break;
- }
- }
-
-
-
- @Override
- public void onDestroy() {
- if (leftMenu != null) {
- leftMenu.destroyDrawingCache();
- leftMenu = null;
- }
- if (rightMenu != null) {
- rightMenu.destroyDrawingCache();
- rightMenu = null;
- }
-
- super.onDestroy();
- }
-
-
- //类相关监听>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
- //系统自带监听方法>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
- //Event事件区(只要存在事件监听代码就是)>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
-
-
-
-
-
-
- //内部类,尽量少用<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
-
-
- //内部类,尽量少用>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-}
\ No newline at end of file
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/activity_fragment/MomentActivity.java b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/activity_fragment/MomentActivity.java
deleted file mode 100644
index df2327958..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/activity_fragment/MomentActivity.java
+++ /dev/null
@@ -1,631 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package apijson.demo.client.activity_fragment;
-
-import java.util.List;
-
-import zuo.biao.apijson.JSONResponse;
-import zuo.biao.library.base.BaseView.OnDataChangedListener;
-import zuo.biao.library.interfaces.AdapterCallBack;
-import zuo.biao.library.interfaces.CacheCallBack;
-import zuo.biao.library.interfaces.OnBottomDragListener;
-import zuo.biao.library.manager.CacheManager;
-import zuo.biao.library.manager.HttpManager.OnHttpResponseListener;
-import zuo.biao.library.ui.AlertDialog;
-import zuo.biao.library.ui.AlertDialog.OnDialogButtonClickListener;
-import zuo.biao.library.util.CommonUtil;
-import zuo.biao.library.util.EditTextUtil;
-import zuo.biao.library.util.Log;
-import zuo.biao.library.util.SettingUtil;
-import zuo.biao.library.util.StringUtil;
-import android.app.Activity;
-import android.content.Context;
-import android.content.Intent;
-import android.os.Bundle;
-import android.os.Handler;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.widget.AdapterView;
-import android.widget.AdapterView.OnItemClickListener;
-import android.widget.AdapterView.OnItemLongClickListener;
-import android.widget.EditText;
-import apijson.demo.client.R;
-import apijson.demo.client.adapter.CommentAdapter;
-import apijson.demo.client.application.APIJSONApplication;
-import apijson.demo.client.base.BaseHttpListActivity;
-import apijson.demo.client.manager.HttpManager;
-import apijson.demo.client.model.Comment;
-import apijson.demo.client.model.CommentItem;
-import apijson.demo.client.model.MomentItem;
-import apijson.demo.client.model.User;
-import apijson.demo.client.util.CommentUtil;
-import apijson.demo.client.util.HttpRequest;
-import apijson.demo.client.view.CommentView.OnCommentClickListener;
-import apijson.demo.client.view.MomentView;
-import apijson.demo.server.model.BaseModel;
-
-/**用户列表界面fragment
- * @author Lemon
- * @use new CommentListFragment(),详细使用见.DemoFragmentActivity(initData方法内)
- * @must 查看 .HttpManager 中的@must和@warn
- * 查看 .SettingUtil 中的@must和@warn
- */
-public class MomentActivity extends BaseHttpListActivity
-implements CacheCallBack, OnHttpResponseListener, OnCommentClickListener
-, OnBottomDragListener, OnClickListener, OnDialogButtonClickListener {
- private static final String TAG = "MomentActivity";
-
- //启动方法<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- public static final String INTENT_MOMENT_ID = "INTENT_MOMENT_ID";
- public static final String INTENT_SHOW_KEYBOARD = "INTENT_SHOW_KEYBOARD";
- public static final String INTENT_TO_COMMENT_ID = "INTENT_TO_COMMENT_ID";
- public static final String INTENT_TO_USER_ID = "INTENT_TO_USER_ID";
- public static final String INTENT_TO_USER_NAME = "INTENT_TO_USER_NAME";
-
- /**启动这个Activity的Intent
- * @param context
- * @param momentId
- * @param showKeyboard
- * @return
- */
- public static Intent createIntent(Context context, long momentId, boolean showKeyboard) {
- return createIntent(context, momentId, showKeyboard, 0, 0, null);
- }
- /**启动这个Activity的Intent
- * @param context
- * @param momentId
- * @param toCommentId
- * @param toUserId
- * @param toUserName
- * @return
- */
- public static Intent createIntent(Context context, long momentId, long toCommentId, long toUserId, String toUserName) {
- return createIntent(context, momentId, toCommentId > 0, toCommentId, toUserId, toUserName);
- }
- /**启动这个Activity的Intent
- * @param context
- * @param momentId
- * @param showKeyboard
- * @param toCommentId
- * @param toUserId
- * @param toUserName
- * @return
- */
- public static Intent createIntent(Context context, long momentId, boolean showKeyboard
- , long toCommentId, long toUserId, String toUserName) {
- return new Intent(context, MomentActivity.class).
- putExtra(INTENT_MOMENT_ID, momentId).
- putExtra(INTENT_SHOW_KEYBOARD, showKeyboard).
- putExtra(INTENT_TO_COMMENT_ID, toCommentId).
- putExtra(INTENT_TO_USER_NAME, toUserName);
- }
-
-
-
- //启动方法>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
- @Override
- public Activity getActivity() {
- return this;
- }
-
- private long momentId;
- private boolean showKeyboard;
- private long toCommentId;//列表可能不包含toCommentId
- private String toUserName;
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.moment_activity, this);
-
- intent = getIntent();
- momentId = getIntent().getLongExtra(INTENT_MOMENT_ID, momentId);
- if (momentId <= 0) {
- finishWithError("动态不存在!");
- return;
- }
- showKeyboard = intent.getBooleanExtra(INTENT_SHOW_KEYBOARD, showKeyboard);
- toCommentId = intent.getLongExtra(INTENT_TO_COMMENT_ID, toCommentId);
- toUserName = intent.getStringExtra(INTENT_TO_USER_NAME);
-
-
- initCache(this);
-
- //功能归类分区方法,必须调用<<<<<<<<<<
- initView();
- initData();
- initEvent();
- //功能归类分区方法,必须调用>>>>>>>>>>
-
- lvBaseList.onRefresh();
- }
-
-
- //UI显示区(操作UI,但不存在数据获取或处理代码,也不存在事件监听代码)<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- private EditText etMomentInput;
-
- private MomentView momentView;
- @Override
- public void initView() {//必须调用
- super.initView();
-
- etMomentInput = (EditText) findViewById(R.id.etMomentInput);
-
- momentView = new MomentView(context, getResources());
- lvBaseList.addHeaderView(momentView.createView(getLayoutInflater()));
- momentView.setShowComment(false);
- }
-
- private MomentItem momentItem;
- /**
- * 内部转到UI线程
- * @param momentItem_
- */
- private void setHead(MomentItem momentItem_) {
- this.momentItem = momentItem_;
- if (momentItem == null) {
- momentItem = new MomentItem(momentId);
- }
- runUiThread(new Runnable() {
-
- @Override
- public void run() {
- momentView.bindView(momentItem);
-
- if (showKeyboard) {//在etMomentInput被绑定前调用showInput崩溃 //{
- showKeyboard = false;
-
- Comment comment = new Comment(toCommentId);
- User user = new User();
- user.setName(toUserName);
- showInput(new CommentItem().setComment(comment).setUser(user));
- }
- }
- });
- }
-
- @Override
- public void setList(final List list) {
- runThread(TAG + "setList", new Runnable() {
-
- @Override
- public void run() {
- final List list_ = CommentUtil.toDoubleLevelList(list);
-
- runUiThread(new Runnable() {
-
- @Override
- public void run() {
- setList(new AdapterCallBack() {
-
- @Override
- public CommentAdapter createAdapter() {
- return new CommentAdapter(context, MomentActivity.this);
- }
-
- @Override
- public void refreshAdapter() {
- // adapter.setShowAll(true);
- adapter.refresh(list_);
- }
- });
- }
- });
- }
- });
- }
-
-
- /**显示输入评论
- * @param toCommentItem_
- */
- public void showInput(CommentItem toCommentItem_) {
- showInput(toCommentItem_, -1, -1);
- }
- /**显示输入评论
- * @param toCommentItem_
- * @param position
- */
- public void showInput(CommentItem toCommentItem_, final int position, final int index) {
- this.toCommentItem = toCommentItem_;
- final long toCommentId = toCommentItem == null ? 0 : toCommentItem.getComment().getId();
- runUiThread(new Runnable() {
-
- @Override
- public void run() {
- if (toCommentId <= 0 || toCommentItem == null) {
- etMomentInput.setHint("评论");
- } else {
- etMomentInput.setHint("回复:" + StringUtil.getTrimedString(toCommentItem.getUser().getName()));
- }
- EditTextUtil.showKeyboard(context, etMomentInput);//, toGetWindowTokenView);
-
- if (position >= 0) {
- new Handler().postDelayed(new Runnable() {
-
- @Override
- public void run() {
- if (isAlive()) {
- lvBaseList.setSelection(position + lvBaseList.getHeaderViewsCount());
- }
- }
- }, 500);
- }
- }
- });
- }
-
- private void hideKeyboard() {
- toCommentItem = null;
- runUiThread(new Runnable() {
-
- @Override
- public void run() {
- etMomentInput.setHint("评论");
- EditTextUtil.hideKeyboard(context, etMomentInput);
- }
- });
- }
-
- //UI显示区(操作UI,但不存在数据获取或处理代码,也不存在事件监听代码)>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
-
-
-
-
-
-
-
- //Data数据区(存在数据获取或处理代码,但不存在事件监听代码)<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- @Override
- public void initData() {//必须调用
- super.initData();
-
- runThread(TAG + "initData", new Runnable() {
-
- @Override
- public void run() {
-
- if (SettingUtil.cache) {
- momentItem = CacheManager.getInstance().get(MomentItem.class, "" + momentId);
- }
- final List list = CacheManager.getInstance().getList(
- getCacheClass(), getCacheGroup(), 0, getCacheCount());
- runUiThread(new Runnable() {
-
- @Override
- public void run() {
- setHead(momentItem);
- setList(list);
- }
- });
- }
- });
-
- }
-
-
- private CommentItem toCommentItem;
- /**发送评论(回复)
- */
- public void sendComment() {
- String content = StringUtil.getTrimedString(etMomentInput);
- if (StringUtil.isNotEmpty(content, true) == false) {
- showShortToast("请先输入评论");
- return;
- }
- long toCommentId = toCommentItem == null ? 0 : toCommentItem.getId();
- long toUserId = toCommentId <= 0 ? 0 : toCommentItem.getUserId();
-
- HttpRequest.addComment(momentId, toCommentId, toUserId, content, toCommentId <= 0 ? HTTP_COMMENT : HTTP_REPLY, this);
-
- hideKeyboard();
- }
-
-
- /**删除评论
- * @param commentItem
- */
- private void deleteComment(CommentItem commentItem) {
- long id = commentItem == null ? 0 : commentItem.getId();
- if (id <= 0) {
- Log.e(TAG, "deleteComment id <= 0 >> return;");
- return;
- }
- HttpRequest.deleteComment(id, BaseModel.value(commentItem.getUserId()), HTTP_DELETE, this);
- }
-
-
-
- private boolean loadHead = true;
- @Override
- public void getListAsync(final int page) {
- if (loadHead && page <= HttpManager.PAGE_NUM_0) {
- HttpRequest.getMoment(momentId, HTTP_GET_MOMENT, MomentActivity.this);
- }
- HttpRequest.getCommentList(momentId, 0, page, -page, this);
- }
-
- @Override
- public List parseArray(String json) {
- return new JSONResponse(json).getList(CommentItem.class);
- }
-
- @Override
- public Class getCacheClass() {
- return CommentItem.class;
- }
- @Override
- public String getCacheGroup() {
- return "momentId=" + momentId;
- }
- @Override
- public String getCacheId(CommentItem data) {
- return data == null ? null : "" + data.getId();
- }
- @Override
- public int getCacheCount() {
- return 10;
- }
-
-
- //Data数据区(存在数据获取或处理代码,但不存在事件监听代码)>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
-
-
-
-
-
- //Event事件区(只要存在事件监听代码就是)<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
-
- @Override
- public void initEvent() {//必须调用
- super.initEvent();
-
- findViewById(R.id.tvMomentSend).setOnClickListener(this);
-
-
- momentView.setOnClickListener(new OnClickListener() {
-
- @Override
- public void onClick(View v) {
- switch (v.getId()) {
- case R.id.tvMomentViewContent:
- if (momentItem != null) {
- CommonUtil.copyText(context, momentItem.getMoment().getContent());
- }
- break;
- case R.id.ivMomentViewComment:
- showInput(null);
- break;
- default:
- momentView.onClick(v);
- break;
- }
- }
- });
- momentView.setOnDataChangedListener(new OnDataChangedListener() {
-
- @Override
- public void onDataChanged() {
- if (momentView.getStatus() == MomentItem.STATUS_DELETED) {
- finish();
- } else {
- setHead(momentView.getData());
- }
- }
- });
-
-
- //setOnItemClickListener会让ItemView内所有View显示onTouch background
- lvBaseList.setOnItemClickListener(new OnItemClickListener() {
-
- @Override
- public void onItemClick(AdapterView> parent, View view, int position, long id) {
- onComemntItemClick(position, false);
- }
- });
-
- lvBaseList.setOnItemLongClickListener(new OnItemLongClickListener() {
-
- @Override
- public boolean onItemLongClick(AdapterView> parent, View view, int position, long id) {
- onComemntItemClick(position, true);
- return true;
- }
- });
- }
-
- private void onComemntItemClick(int position, boolean isLong) {
- if (adapter == null){
- return;
- }
- position = position - lvBaseList.getHeaderViewsCount();
- if (position < 0 || position >= adapter.getCount()) {
- return;
- }
-
- onCommentClick(adapter.getItem(position), position, -1, isLong);
- }
-
- @Override
- public void onCommentClick(CommentItem item, int position, int index, boolean isLong) {
- if (isLong) {
- if (item == null || momentItem == null) {
- return;
- }
- if (APIJSONApplication.getInstance().isCurrentUser(momentItem.getUserId()) == false
- && APIJSONApplication.getInstance().isCurrentUser(item.getUserId()) == false) {
- showShortToast("只能删除自己的或自己的动态下的评论");
- return;
- }
- toCommentItem = item;
- new AlertDialog(context, null, "删除这条评论?", true, DIALOG_DELETE_COMMENT, MomentActivity.this).show();
- } else {
- showInput(item, position, index);
- }
- }
-
- private static final int DIALOG_DELETE_COMMENT = 1;
-
- @Override
- public void onDialogButtonClick(int requestCode, boolean isPositive) {
- if (isPositive) {
- deleteComment(toCommentItem);
- }
- }
-
- private static final int HTTP_GET_MOMENT = 1;
- private static final int HTTP_COMMENT = 2;
- private static final int HTTP_REPLY = 3;
- private static final int HTTP_DELETE = 4;
- @Override
- public void onHttpResponse(final int requestCode, final String resultJson, final Exception e) {
- runThread(TAG + "onHttpResponse", new Runnable() {
-
- @Override
- public void run() {
-
- JSONResponse response = new JSONResponse(resultJson);
- if (requestCode <= 0) {
- if (requestCode == 0 && momentItem != null) {
- setHead(momentItem.setCommentCount(response.getTotal()));
- }
- MomentActivity.super.onHttpResponse(requestCode, resultJson, e);
- return;
- }
-
- if (requestCode == HTTP_GET_MOMENT) {
- MomentItem data = JSONResponse.toObject(response, MomentItem.class);
- if (data == null || data.getId() <= 0) {
- if (JSONResponse.isSuccess(response)) {
- showShortToast("动态不存在");
- MomentActivity.super.finish();//需要动画,且不需要保存缓存
- return;
- }
- showShortToast("获取动态失败,请检查网络后重试");
- return;
- }
- setHead(data);
- return;
- }
-
- if (verifyHttpLogin(response.getCode()) == false) {
- return;
- }
-
- JSONResponse comment = response.getJSONResponse(Comment.class.getSimpleName());
- final boolean succeed = JSONResponse.isSuccess(comment);
- String operation = "操作";
- switch (requestCode) {
- case HTTP_COMMENT: // 新增评论
- operation = "评论";
- break;
- case HTTP_REPLY:// 回复
- operation = "回复";
- break;
- case HTTP_DELETE:// 删除
- operation = "删除";
- if (succeed) {//MomentItem中仍然存有Comment,可重写saveCache,单独存里面的Moment和Comment等
- CacheManager.getInstance().remove(getCacheClass(), comment == null ? "0" : "" + comment.getId());
- }
- break;
- default:
- return;
- }
- showShortToast(operation + (succeed ? "成功" : "失败,请检查网络后重试"));
-
- runUiThread(new Runnable() {
-
- @Override
- public void run() {
- if (succeed) {
- etMomentInput.setText("");
-
- loadHead = false;
- MomentActivity.super.onRefresh();
- }
- }
- });
- }
- });
- }
-
-
- @Override
- public void onDragBottom(boolean rightToLeft) {
- if (rightToLeft) {
-
- return;
- }
-
- finish();
- }
-
-
- @Override
- public void onRefresh() {
- loadHead = true;
- super.onRefresh();
- }
-
- //系统自带监听方法 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- @Override
- public void onClick(View v) {
- switch (v.getId()) {
- case R.id.tvMomentSend:
- sendComment();
- break;
- default:
- break;
- }
- }
-
- //类相关监听<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
-
- //类相关监听>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
- //系统自带监听方法>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
- //Event事件区(只要存在事件监听代码就是)>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
-
-
-
-
-
- //内部类,尽量少用<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
-
- //内部类,尽量少用>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-}
\ No newline at end of file
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/activity_fragment/MomentListActivity.java b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/activity_fragment/MomentListActivity.java
deleted file mode 100755
index 0b579666f..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/activity_fragment/MomentListActivity.java
+++ /dev/null
@@ -1,272 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package apijson.demo.client.activity_fragment;
-
-import android.app.Activity;
-import android.content.Context;
-import android.content.Intent;
-import android.os.Bundle;
-import android.view.View;
-import android.widget.ImageView;
-
-import com.alibaba.fastjson.JSONObject;
-
-import apijson.demo.client.R;
-import apijson.demo.client.application.APIJSONApplication;
-import zuo.biao.apijson.JSON;
-import zuo.biao.library.base.BaseActivity;
-import zuo.biao.library.interfaces.OnBottomDragListener;
-
-/**动态列表界面
- * @author Lemon
- * @use toActivity(MomentListActivity.createIntent(...));
- */
-public class MomentListActivity extends BaseActivity implements OnBottomDragListener {
- // private static final String TAG = "DemoFragmentActivity";
-
- //启动方法<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- public static final String INTENT_RANGE = "INTENT_RANGE";
- public static final String INTENT_SEARCH = "INTENT_SEARCH";
- public static final String INTENT_SHOW_SEARCH = "INTENT_SHOW_SEARCH";
-
- /**启动这个Activity的Intent
- * @param context
- * @return
- */
- public static Intent createIntent(Context context) {
- return createIntent(context, MomentListFragment.RANGE_USER_CIRCLE
- , APIJSONApplication.getInstance().getCurrentUserId());
- }
- /**启动这个Activity的Intent
- * @param context
- * @param userId
- * @return
- */
- public static Intent createIntent(Context context, long userId) {
- return createIntent(context, MomentListFragment.RANGE_USER, userId);
- }
- /**启动这个Activity的Intent
- * showSearch = true;
- * @param context
- * @param range
- * @param id
- * @return
- */
- public static Intent createIntent(Context context, int range, long id) {
- return createIntent(context, range, id, null, true);
- }
- /**启动这个Activity的Intent
- * showSearch = false;
- * @param context
- * @param search
- * @return
- */
- public static Intent createIntent(Context context, JSONObject search) {
- return createIntent(context, search, false);
- }
- /**启动这个Activity的Intent
- * @param context
- * @param search
- * @param showSearch
- * @return
- */
- public static Intent createIntent(Context context, JSONObject search, boolean showSearch) {
- return createIntent(context, MomentListFragment.RANGE_ALL, 0, search, showSearch);
- }
- /**启动这个Activity的Intent
- * @param context
- * @param range
- * @param id
- * @param search
- * @param showSearch
- * @return
- */
- public static Intent createIntent(Context context, int range, long id, JSONObject search, boolean showSearch) {
- return new Intent(context, MomentListActivity.class)
- .putExtra(INTENT_RANGE, range)
- .putExtra(INTENT_ID, id)
- .putExtra(INTENT_SEARCH, JSON.toJSONString(search))
- .putExtra(INTENT_SHOW_SEARCH, showSearch);
- }
-
- //启动方法>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
- @Override
- public Activity getActivity() {
- return this;
- }
-
- private int range = MomentListFragment.RANGE_ALL;
- private long id;
- private JSONObject search;
- private boolean showSearch;
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.moment_list_activity, this);
-
- range = getIntent().getIntExtra(INTENT_RANGE, range);
- id = getIntent().getLongExtra(INTENT_ID, id);
- search = JSON.parseObject(getIntent().getStringExtra(INTENT_SEARCH));
- showSearch = getIntent().getBooleanExtra(INTENT_SHOW_SEARCH, showSearch);
-
- //功能归类分区方法,必须调用<<<<<<<<<<
- initView();
- initData();
- initEvent();
- //功能归类分区方法,必须调用>>>>>>>>>>
-
- }
-
-
- //UI显示区(操作UI,但不存在数据获取或处理代码,也不存在事件监听代码)<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- private boolean isCurrentUser = false;
-
- private ImageView ivMomentListForward;
- private MomentListFragment fragment;
- @Override
- public void initView() {//必须在onCreate方法内调用
- ivMomentListForward = (ImageView) findViewById(R.id.ivMomentListForward);
- ivMomentListForward.setVisibility(showSearch ? View.VISIBLE : View.GONE);
-
- String title;
- switch (range) {
- case MomentListFragment.RANGE_ALL:
- title = "全部";
- break;
- // case MomentListFragment.RANGE_SINGLE:
- // title = "动态";
- // break;
- case MomentListFragment.RANGE_USER:
- isCurrentUser = APIJSONApplication.getInstance().isCurrentUser(id);
- title = isCurrentUser ? "我的动态" : "TA的动态";
- if (isCurrentUser) {
- ivMomentListForward.setVisibility(View.VISIBLE);
- ivMomentListForward.setImageResource(R.drawable.add);
- } else {
- ivMomentListForward.setVisibility(View.GONE);
- }
- break;
- case MomentListFragment.RANGE_USER_CIRCLE:
- title = "朋友圈";
- break;
- default:
- title = "动态";
- break;
- }
- tvBaseTitle.setText(title);
- autoSetTitle();
-
-
- fragment = MomentListFragment.createInstance(range, id, search);
- fragment.setIsAdd(isCurrentUser);
-
- fragmentManager
- .beginTransaction()
- .add(R.id.flMomentListContainer, fragment)
- .show(fragment)
- .commit();
-
- }
-
-
-
- //UI显示区(操作UI,但不存在数据获取或处理代码,也不存在事件监听代码)>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
-
-
-
-
-
-
-
- //Data数据区(存在数据获取或处理代码,但不存在事件监听代码)<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- @Override
- public void initData() {//必须在onCreate方法内调用
-
- }
-
- //Data数据区(存在数据获取或处理代码,但不存在事件监听代码)>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
-
-
-
-
-
- //Event事件区(只要存在事件监听代码就是)<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- @Override
- public void initEvent() {//必须在onCreate方法内调用
-
- }
-
-
- @Override
- public void onDragBottom(boolean rightToLeft) {
- if (rightToLeft) {
- if (showSearch) {
- fragment.onDragBottom(rightToLeft);
- }
-
- return;
- }
-
- finish();
- }
-
- //系统自带监听方法<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
-
-
- //类相关监听<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
-
-
-
-
- //类相关监听>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
- //系统自带监听方法>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
- //类相关监听>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
- //系统自带监听>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
- //Event事件区(只要存在事件监听代码就是)>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
-
-
-
-
-
- //内部类,尽量少用<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
-
-
- //内部类,尽量少用>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-}
\ No newline at end of file
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/activity_fragment/MomentListFragment.java b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/activity_fragment/MomentListFragment.java
deleted file mode 100644
index 8025b37e0..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/activity_fragment/MomentListFragment.java
+++ /dev/null
@@ -1,470 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package apijson.demo.client.activity_fragment;
-
-import java.util.List;
-
-import zuo.biao.apijson.JSON;
-import zuo.biao.apijson.JSONRequest;
-import zuo.biao.apijson.JSONResponse;
-import zuo.biao.apijson.SQL;
-import zuo.biao.apijson.StringUtil;
-import zuo.biao.library.base.BaseView.OnDataChangedListener;
-import zuo.biao.library.interfaces.AdapterCallBack;
-import zuo.biao.library.interfaces.CacheCallBack;
-import zuo.biao.library.interfaces.OnBottomDragListener;
-import zuo.biao.library.manager.HttpManager.OnHttpResponseListener;
-import zuo.biao.library.ui.EditTextInfoWindow;
-import android.annotation.SuppressLint;
-import android.app.Activity;
-import android.content.Intent;
-import android.os.Bundle;
-import android.view.Gravity;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.view.ViewGroup;
-import android.widget.AdapterView;
-import android.widget.AdapterView.OnItemClickListener;
-import android.widget.ImageView;
-import android.widget.TextView;
-import apijson.demo.client.R;
-import apijson.demo.client.adapter.MomentAdapter;
-import apijson.demo.client.application.APIJSONApplication;
-import apijson.demo.client.base.BaseHttpListFragment;
-import apijson.demo.client.interfaces.TopBarMenuCallback;
-import apijson.demo.client.model.Moment;
-import apijson.demo.client.model.MomentItem;
-import apijson.demo.client.util.CommentUtil;
-import apijson.demo.client.util.HttpRequest;
-
-import com.alibaba.fastjson.JSONObject;
-
-/**用户列表界面fragment
- * @author Lemon
- * @use new MomentListFragment(),详细使用见.DemoFragmentActivity(initData方法内)
- * @must 查看 .HttpManager 中的@must和@warn
- * 查看 .SettingUtil 中的@must和@warn
- */
-public class MomentListFragment extends BaseHttpListFragment
-implements CacheCallBack, OnHttpResponseListener, TopBarMenuCallback
-, OnBottomDragListener, OnDataChangedListener {
- private static final String TAG = "MomentListFragment";
-
- //与Activity通信<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- public static final String ARGUMENT_RANGE = "ARGUMENT_RANGE";
- public static final String ARGUMENT_SEARCH = "ARGUMENT_SEARCH";
-
- /**
- *
range = RANGE_USER_CIRCLE
- *
id = APIJSONApplication.getInstance().getCurrentUserId()
- * @return
- */
- public static MomentListFragment createInstance() {
- return createInstance(RANGE_USER_CIRCLE, APIJSONApplication.getInstance().getCurrentUserId());
- }
- /**
- * range = RANGE_USER
- * @param userId
- * @return
- */
- public static MomentListFragment createInstance(long userId) {
- return createInstance(RANGE_USER, userId);
- }
- /**
- * @param range
- * @param id
- * @return
- */
- public static MomentListFragment createInstance(int range, long id) {
- return createInstance(range, id, null);
- }
- /**
- * range = RANGE_ALL
- * @param search
- * @return
- */
- public static MomentListFragment createInstance(JSONObject search) {
- return createInstance(RANGE_ALL, 0, search);
- }
- /**
- * @param range
- * @param id
- * @param search
- * @return
- */
- public static MomentListFragment createInstance(int range, long id, JSONObject search) {
- MomentListFragment fragment = new MomentListFragment();
-
- Bundle bundle = new Bundle();
- bundle.putInt(ARGUMENT_RANGE, range);
- bundle.putLong(ARGUMENT_ID, id);
- bundle.putString(ARGUMENT_SEARCH, JSON.toJSONString(search));
-
- fragment.setArguments(bundle);
- return fragment;
- }
-
- //与Activity通信>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
- public static final int RANGE_ALL = HttpRequest.RANGE_ALL;
- public static final int RANGE_SINGLE = HttpRequest.RANGE_SINGLE;
- public static final int RANGE_USER = HttpRequest.RANGE_USER;
- public static final int RANGE_USER_FRIEND = HttpRequest.RANGE_USER_FRIEND;
- public static final int RANGE_USER_CIRCLE = HttpRequest.RANGE_USER_CIRCLE;
-
-
- private int range = RANGE_ALL;
- private long id;
- private JSONObject search;
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
- super.onCreateView(inflater, container, savedInstanceState);
-
- registerObserver(this);
-
- argument = getArguments();
- if (argument != null) {
- range = argument.getInt(ARGUMENT_RANGE, range);
- id = argument.getLong(ARGUMENT_ID, id);
- search = JSON.parseObject(argument.getString(ARGUMENT_SEARCH));
- }
-
- initCache(this);
-
- //功能归类分区方法,必须调用<<<<<<<<<<
- initView();
- initData();
- initEvent();
- //功能归类分区方法,必须调用>>>>>>>>>>
-
- lvBaseList.onRefresh();
-
- return view;
- }
-
-
- //UI显示区(操作UI,但不存在数据获取或处理代码,也不存在事件监听代码)<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- @Override
- public void initView() {//必须调用
- super.initView();
-
- }
-
- @Override
- public void setList(final List list) {
- runThread(TAG + "setList", new Runnable() {
-
- @Override
- public void run() {
- if (list != null) {
- for (MomentItem item : list) {
- if (item != null) {
- item.setCommentItemList(CommentUtil.toSingleLevelList(item.getCommentItemList()));
- }
- }
- }
-
- runUiThread(new Runnable() {
-
- @Override
- public void run() {
-
- setList(new AdapterCallBack() {
-
- @Override
- public MomentAdapter createAdapter() {
- return new MomentAdapter(context);
- }
-
- @Override
- public void refreshAdapter() {
- adapter.refresh(list);
- }
- });
- }
- });
- }
- });
- }
-
-
- private TextView leftMenu;
- @SuppressLint("InflateParams")
- @Override
- public View getLeftMenu(Activity activity) {
- if (leftMenu == null) {
- leftMenu = (TextView) LayoutInflater.from(activity).inflate(R.layout.top_right_tv, null);
- leftMenu.setGravity(Gravity.CENTER);
- leftMenu.setText("全部");//"筛选");
- leftMenu.setOnClickListener(new OnClickListener() {
-
- @Override
- public void onClick(View v) {
- onDragBottom(false);
- }
- });
- }
- return leftMenu;
- }
-
- private ImageView rightMenu;
- @SuppressLint("InflateParams")
- @Override
- public View getRightMenu(Activity activity) {
- if (rightMenu == null) {
- rightMenu = (ImageView) LayoutInflater.from(activity).inflate(R.layout.top_right_iv, null);
- rightMenu.setImageResource(R.drawable.search);
- rightMenu.setOnClickListener(new OnClickListener() {
-
- @Override
- public void onClick(View v) {
- onDragBottom(true);
- }
- });
- }
- return rightMenu;
- }
-
- //UI显示区(操作UI,但不存在数据获取或处理代码,也不存在事件监听代码)>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
-
-
-
-
-
-
-
- //Data数据区(存在数据获取或处理代码,但不存在事件监听代码)<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- @Override
- public void initData() {//必须调用
- super.initData();
-
- }
-
- private boolean isAdd = false;
- public void setIsAdd(boolean isAdd) {
- this.isAdd = isAdd;
- }
-
-
- @Override
- public void getListAsync(final int page) {
- HttpRequest.getMomentList(range, id, search, getCacheCount(), page, -page, this);
- }
-
- @Override
- public List parseArray(String json) {
- return new JSONResponse(json).getList(getCacheClass());
- }
-
- @Override
- public Class getCacheClass() {
- return MomentItem.class;
- }
- @Override
- public String getCacheGroup() {
- if (range == RANGE_ALL) {
- return search != null ? null : "range=" + range;
- }
- return range == RANGE_SINGLE || search != null ? null : "range=" + range + ";userId=" + id;
- }
- @Override
- public String getCacheId(MomentItem data) {
- return data == null ? null : "" + data.getId();
- }
- @Override
- public int getCacheCount() {
- return 4;
- }
-
-
- //Data数据区(存在数据获取或处理代码,但不存在事件监听代码)>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
-
-
-
-
-
- //Event事件区(只要存在事件监听代码就是)<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
-
- @Override
- public void initEvent() {//必须调用
- super.initEvent();
-
- lvBaseList.setOnItemClickListener(new OnItemClickListener() {
-
- @Override
- public void onItemClick(AdapterView> parent, View view, int position, long id) {
- toActivity(MomentActivity.createIntent(context, id, false));
- }
- });
- }
-
-
- @Override
- public void onDragBottom(boolean rightToLeft) {
- if (isAlive() == false) {
- return;
- }
-
- if (rightToLeft == false) {
- startActivity(MomentListActivity.createIntent(context, RANGE_ALL, 0));
- context.overridePendingTransition(R.anim.bottom_push_in, R.anim.hold);
- } else {
- if (range != RANGE_ALL && verifyLogin() == false) {
- return;
- }
-
- if (isAdd) {
- toActivity(EditTextInfoWindow.createIntent(context
- , EditTextInfoWindow.TYPE_NOTE, "发动态", "说点什么吧~"),
- REQUEST_TO_EDIT_TEXT_INFO, false);
- } else {
- showShortToast("输入为空则查看全部");
- toActivity(EditTextInfoWindow.createIntent(context
- , EditTextInfoWindow.TYPE_NAME, "关键词", null),
- REQUEST_TO_EDIT_TEXT_INFO, false);
- }
-
- }
- }
-
- @Override
- public void onDataChanged() {
- if (range == RANGE_USER_CIRCLE) {
- super.onRefresh();
- }
- }
-
- private static final int HTTP_ADD = 1;
-
- @Override
- public void onHttpResponse(int requestCode, String resultJson, Exception e) {
- JSONResponse response = new JSONResponse(resultJson);
- if ((range == RANGE_USER_CIRCLE || requestCode == HTTP_ADD) && verifyHttpLogin(response.getCode()) == false) {
- return;
- }
- switch (requestCode) {
- case HTTP_ADD:
- response = response.getJSONResponse(Moment.class.getSimpleName());
-
- if (JSONResponse.isSuccess(response) == false) {
- showShortToast("发布失败,请检查网络后重试");
- } else {
- runUiThread(new Runnable() {
-
- @Override
- public void run() {
- showShortToast("发布成功");
- lvBaseList.onRefresh();
- }
- });
- }
- break;
- default:
- super.onHttpResponse(requestCode, resultJson, e);
- break;
- }
-
- }
-
-
-
- //系统自带监听方法 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
-
-
- //类相关监听<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- public static final int REQUEST_TO_EDIT_TEXT_INFO = 1;
- @Override
- public void onActivityResult(int requestCode, int resultCode, Intent data) {
- super.onActivityResult(requestCode, resultCode, data);
- if (resultCode != RESULT_OK) {
- return;
- }
- switch (requestCode) {
- case REQUEST_TO_EDIT_TEXT_INFO:
- if (data != null) {
- String value = StringUtil.getString(data.getStringExtra(EditTextInfoWindow.RESULT_VALUE));
-
- if (isAdd) {
- HttpRequest.addMoment(value, HTTP_ADD, this);
- } else {
- String split = "";
- JSONRequest search = new JSONRequest();
- if (StringUtil.isNotEmpty(value, true)) {
- split = ":";
- search.putsSearch(HttpRequest.CONTENT, value, SQL.SEARCH_TYPE_CONTAIN_ORDER);
- }
- toActivity(MomentListActivity.createIntent(context, range, id, search, false)
- .putExtra(INTENT_TITLE, "搜索" + split + value));
- }
- }
- break;
- default:
- break;
- }
- }
-
-
- @Override
- public void onDestroy() {
- if (leftMenu != null) {
- leftMenu.destroyDrawingCache();
- leftMenu = null;
- }
- if (rightMenu != null) {
- rightMenu.destroyDrawingCache();
- rightMenu = null;
- }
-
- super.onDestroy();
- }
-
- //类相关监听>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
- //系统自带监听方法>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
- //Event事件区(只要存在事件监听代码就是)>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
-
-
-
-
-
- //内部类,尽量少用<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
-
- //内部类,尽量少用>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-}
\ No newline at end of file
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/activity_fragment/NumberPasswordActivity.java b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/activity_fragment/NumberPasswordActivity.java
deleted file mode 100644
index 80af3e746..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/activity_fragment/NumberPasswordActivity.java
+++ /dev/null
@@ -1,406 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package apijson.demo.client.activity_fragment;
-
-import zuo.biao.apijson.JSONResponse;
-import zuo.biao.library.base.BaseActivity;
-import zuo.biao.library.manager.HttpManager.OnHttpResponseListener;
-import zuo.biao.library.ui.EditTextManager;
-import zuo.biao.library.util.Log;
-import zuo.biao.library.util.StringUtil;
-import android.app.Activity;
-import android.content.Context;
-import android.content.Intent;
-import android.os.Bundle;
-import android.text.Editable;
-import android.text.TextWatcher;
-import android.view.KeyEvent;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.widget.EditText;
-import android.widget.TextView;
-import apijson.demo.client.R;
-import apijson.demo.client.util.HttpRequest;
-import apijson.demo.server.model.Privacy;
-
-/**支付密码设置界面activity
- * @author Lemon
- * @use toActivity(PasswordSettingActivity.createIntent(...));
- */
-public class NumberPasswordActivity extends BaseActivity implements OnClickListener, OnHttpResponseListener {
- private static final String TAG = "NumberPasswordActivity";
-
- //启动方法<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- public static final String INTENT_IS_TO_SETTING = "INTENT_IS_TO_SETTING";
- public static final String INTENT_USER_ID = "INTENT_USER_ID";
- public static final String INTENT_PASSWORD = "INTENT_PASSWORD";
- public static final String INTENT_REMIND = "INTENT_REMIND";
-
- public static final String RESULT_PASSWORD = "RESULT_PASSWORD";
-
- public static final String RESULT_IS_CHANGE_PASSWORD = "RESULT_IS_CHANGE_PASSWORD";
-
- /**启动这个Activity的Intent
- * 返回输入结果,isToSetting = false;
- * @param context
- * @return
- */
- public static Intent createIntent(Context context) {
- return createIntent(context, false);
- }
-
- /**启动这个Activity的Intent
- * @param context
- * @param isToSetting true-设置密码;false-返回输入结果
- * @return
- */
- public static Intent createIntent(Context context, boolean isToSetting) {
- return createIntent(context, null).putExtra(INTENT_IS_TO_SETTING, isToSetting);
- }
- /**启动这个Activity的Intent
- * @param context
- * @param password
- * @return
- */
- public static Intent createIntent(Context context, String password) {
- return createIntent(context, null, null, null);
- }
- /**启动这个Activity的Intent
- * @param context
- * @param password
- * @param title
- * @return
- */
- public static Intent createIntent(Context context, String password, String remind, String title) {
- return new Intent(context, NumberPasswordActivity.class).
- putExtra(INTENT_PASSWORD, password).
- putExtra(INTENT_REMIND, remind).
- putExtra(INTENT_TITLE, title);
- }
-
- //启动方法>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
- @Override
- public Activity getActivity() {
- return this;
- }
-
-
- private boolean isToSetting;
- private boolean isToConfirm;
- private String password;
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.number_password_activity);
-
- password = StringUtil.getNumber(getIntent().getStringExtra(INTENT_PASSWORD));
-
- isToConfirm = StringUtil.getLength(password, true) == 6;
- isToSetting = isToConfirm || getIntent().getBooleanExtra(INTENT_IS_TO_SETTING, false);
-
- //功能归类分区方法,必须调用<<<<<<<<<<
- initView();
- initData();
- initEvent();
- //功能归类分区方法,必须调用>>>>>>>>>>
-
- toInput();
- }
-
-
- //UI显示区(操作UI,但不存在数据获取或处理代码,也不存在事件监听代码)<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- public static final int PASSWORD_LENGTH = 6;
-
- private TextView tvPasswordSettingTitle;
-
- private TextView tvPasswordSettingRemind;
- private EditText etPasswordSetting;
- private TextView[] tvPasswordSettingNumbers;
-
- @Override
- public void initView() {//必须调用
-
- exitAnim = R.anim.bottom_push_out;
-
- tvPasswordSettingTitle = (TextView) findViewById(R.id.tvPasswordSettingTitle);
-
-
- //pay<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- tvPasswordSettingRemind = (TextView) findViewById(R.id.tvPasswordSettingPayRemind);
-
- etPasswordSetting = (EditText) findViewById(R.id.etPasswordSettingPay);
-
- tvPasswordSettingNumbers = new TextView[PASSWORD_LENGTH];
- tvPasswordSettingNumbers[0] = (TextView) findViewById(R.id.tvPasswordSettingPayNumber0);
- tvPasswordSettingNumbers[1] = (TextView) findViewById(R.id.tvPasswordSettingPayNumber1);
- tvPasswordSettingNumbers[2] = (TextView) findViewById(R.id.tvPasswordSettingPayNumber2);
- tvPasswordSettingNumbers[3] = (TextView) findViewById(R.id.tvPasswordSettingPayNumber3);
- tvPasswordSettingNumbers[4] = (TextView) findViewById(R.id.tvPasswordSettingPayNumber4);
- tvPasswordSettingNumbers[5] = (TextView) findViewById(R.id.tvPasswordSettingPayNumber5);
- //pay>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
- }
-
- private void toInput() {
- toInput(null, null);
- }
- private String phone;
- private String verify;
- /**
- * @param verify
- */
- private void toInput(String phone, String verify) {
- this.phone = phone;
- this.verify = verify;
- if (isToSetting == false || isToConfirm == true) {
- return;
- }
-
- Log.i(TAG, "toInput phone = " + phone
- + "\n verify = " + verify);
- if (StringUtil.isNotEmpty(phone, true) == false || StringUtil.isNotEmpty(verify, true) == false) {
- toActivity(PasswordActivity.createIntent(context, PasswordActivity.TYPE_VERIFY)
- .putExtra(INTENT_TITLE, "验证手机"), REQUEST_TO_VERIFY_PHONE);
- return;
- }
-
- EditTextManager.showKeyboard(context, etPasswordSetting);
- }
-
- private void next() {
- if (isToSetting == false || isToConfirm) {
- saveAndExit();
- } else {
- startActivityForResult(NumberPasswordActivity.createIntent(
- context, inputedString, "请再次输入以确认", ""), REQUEST_TO_PASSWORD_SETTING);
- overridePendingTransition(R.anim.bottom_push_in, R.anim.hold);
- }
- }
-
- private void saveAndExit() {
- saveAndExit(false);
- }
- private void saveAndExit(boolean isChangePassword) {
- if (isToConfirm && inputedString.equals(password) == false) {
- showShortToast(R.string.password_not_equal);
- return;
- }
-
- setResult(RESULT_OK, new Intent().
- putExtra(RESULT_PASSWORD, inputedString).
- putExtra(RESULT_IS_CHANGE_PASSWORD, isChangePassword));
- finish();
- }
-
-
- //UI显示区(操作UI,但不存在数据获取或处理代码,也不存在事件监听代码)>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
-
-
-
-
-
-
-
- //data数据区(存在数据获取或处理代码,但不存在事件监听代码)<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
-
- @Override
- public void initData() {//必须调用
-
- if (StringUtil.isNotEmpty(getIntent().getStringExtra(INTENT_TITLE), false)) {
- tvPasswordSettingTitle.setText("" + StringUtil.getCurrentString());
- }
- if (StringUtil.isNotEmpty(getIntent().getStringExtra(INTENT_REMIND), false)) {
- tvPasswordSettingRemind.setText("" + StringUtil.getCurrentString());
- }
-
- tvPasswordSettingTitle.setText(isToSetting ? "设置支付密码" : "输入支付密码");
- if (isToSetting) {
-
- } else {
- if (isToConfirm == false) {
- password = null;
- }
- }
-
- }
-
-
- //data数据区(存在数据获取或处理代码,但不存在事件监听代码)>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
-
-
-
-
-
- //listener事件监听区(只要存在事件监听代码就是)<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- private String inputedString = "";
- private int inputedLength;
- @Override
- public void initEvent() {//必须调用
-
- findViewById(R.id.llPasswordSettingPayNumberContainer).setOnClickListener(this);
-
- for (int i = 0; i < tvPasswordSettingNumbers.length; i++) {
- tvPasswordSettingNumbers[i].setOnClickListener(new OnClickListener() {
-
- @Override
- public void onClick(View v) {
- EditTextManager.showKeyboard(context, etPasswordSetting, true);
- }
- });
- }
-
- etPasswordSetting.addTextChangedListener(new TextWatcher() {
-
- @Override
- public void onTextChanged(CharSequence s, int start, int before, int count) {
- inputedString = StringUtil.getNoBlankString(s);
- inputedLength = inputedString.length();
-
- for (int i = 0; i < inputedLength; i++) {
- tvPasswordSettingNumbers[i].setText(inputedString.substring(i, i + 1));
- }
- for (int j = inputedString.length(); j < PASSWORD_LENGTH; j++) {
- tvPasswordSettingNumbers[j].setText("");
- }
-
- if (inputedLength >= PASSWORD_LENGTH) {
- next();
- }
- }
- @Override
- public void beforeTextChanged(CharSequence s, int start, int count, int after) { }
- @Override
- public void afterTextChanged(Editable s) { }
- });
- }
-
-
- private static final int HTTP_SET_PASSWORD = 1;
-
- @Override
- public void onHttpResponse(int requestCode, String resultJson, Exception e) {
- if (isAlive() == false) {
- return;
- }
- JSONResponse response = new JSONResponse(resultJson);
-
- dismissProgressDialog();
- switch (requestCode) {
- case HTTP_SET_PASSWORD:
- if (response.isSuccess()) {
- showShortToast(R.string.change_succeed);
- saveAndExit(true);
- } else {
- showShortToast(R.string.change_failed);
- }
- break;
- default:
- break;
- }
- }
-
-
- //系统自带监听方法<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
-
- @Override
- public void onClick(View v) {
- switch (v.getId()) {
- case R.id.llPasswordSettingPayNumberContainer://设置不响应,解决抢占焦点
- break;
- default:
- break;
- }
- }
-
- @Override
- public boolean onKeyUp(int keyCode, KeyEvent event) {
- if (keyCode == KeyEvent.KEYCODE_ENTER && inputedLength >= 6) {
- next();
- return true;
- }
- return super.onKeyUp(keyCode, event);
- }
-
- //类相关监听<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- private static final int REQUEST_TO_PASSWORD_SETTING = 10;
- private static final int REQUEST_TO_VERIFY_PHONE = 11;
-
- @Override
- public void onActivityResult(int requestCode, int resultCode, Intent data) {
- super.onActivityResult(requestCode, resultCode, data);
- if (resultCode != RESULT_OK) {
- enterAnim = exitAnim = R.anim.null_anim;
- finish();
- return;
- }
- switch (requestCode) {
- case REQUEST_TO_VERIFY_PHONE:
- if (data != null) {
- toInput(data.getStringExtra(PasswordActivity.RESULT_PHONE)
- , data.getStringExtra(PasswordActivity.RESULT_VERIFY));
- }
- break;
- case REQUEST_TO_PASSWORD_SETTING:
- if (data != null) {
- password = data.getStringExtra(NumberPasswordActivity.RESULT_PASSWORD);
- if (StringUtil.isNotEmpty(password, true)) {
- HttpRequest.setPassword(Privacy.PASSWORD_TYPE_PAY, password, phone, verify
- , HTTP_SET_PASSWORD, this);
- }
- }
- break;
- default:
- break;
- }
- }
-
-
-
- //类相关监听>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
- //系统自带监听方法>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
- //listener事件监听区(只要存在事件监听代码就是)>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
-
-
-
-
-
- //内部类,尽量少用<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
-
-
- //内部类,尽量少用>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-}
\ No newline at end of file
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/activity_fragment/PasswordActivity.java b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/activity_fragment/PasswordActivity.java
deleted file mode 100644
index 1a3cbe0b3..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/activity_fragment/PasswordActivity.java
+++ /dev/null
@@ -1,521 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package apijson.demo.client.activity_fragment;
-
-import static zuo.biao.apijson.JSONResponse.CODE_TIME_OUT;
-import zuo.biao.apijson.JSONResponse;
-import zuo.biao.library.base.BaseActivity;
-import zuo.biao.library.interfaces.OnBottomDragListener;
-import zuo.biao.library.manager.HttpManager.OnHttpResponseListener;
-import zuo.biao.library.ui.TextClearSuit;
-import zuo.biao.library.util.EditTextUtil;
-import zuo.biao.library.util.StringUtil;
-import android.app.Activity;
-import android.content.Context;
-import android.content.Intent;
-import android.os.Bundle;
-import android.os.CountDownTimer;
-import android.util.Log;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.widget.EditText;
-import android.widget.TextView;
-import android.widget.Toast;
-import apijson.demo.client.R;
-import apijson.demo.client.application.APIJSONApplication;
-import apijson.demo.client.model.User;
-import apijson.demo.client.model.Verify;
-import apijson.demo.client.util.HttpRequest;
-import apijson.demo.server.model.Privacy;
-
-/**注册、验证码登录、重置密码等密码相关界面
- * @author Lemon
- */
-public class PasswordActivity extends BaseActivity implements OnClickListener, OnHttpResponseListener, OnBottomDragListener {
- public static final String TAG = "PasswordActivity";
-
- //启动方法<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
-
- /**启动这个Activity的Intent
- * @param context
- * @return
- */
- public static Intent createIntent(Context context, int type) {
- return createIntent(context, type, null, null);
- }
- /**启动这个Activity的Intent
- * @param context
- * @param phone
- * @return
- */
- public static Intent createIntent(Context context, int type, String phone) {
- return createIntent(context, type, phone, null);
- }
- /**启动这个Activity的Intent
- * @param context
- * @param phone
- * @param password
- * @return
- */
- public static Intent createIntent(Context context, int type, String phone, String password) {
- return new Intent(context, PasswordActivity.class)
- .putExtra(INTENT_TYPE, type)
- .putExtra(INTENT_PHONE, phone)
- .putExtra(INTENT_PASSWORD, password);
- }
-
- //启动方法>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
- @Override
- public Activity getActivity() {
- return this;
- }
-
- public static final int TYPE_VERIFY = 0;
- public static final int TYPE_REGISTER = 1;
- public static final int TYPE_RESET = 2;
-
- private int type = TYPE_VERIFY;
- private String phone;
- private String password;
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.password_activity, this);
-
- type = getIntent().getIntExtra(INTENT_TYPE, type);
- phone = getIntent().getStringExtra(INTENT_PHONE);
- password = getIntent().getStringExtra(INTENT_PASSWORD);
-
- //必须调用<<<<<<<<<<<
- initView();
- initData();
- initEvent();
- //必须调用>>>>>>>>>>
-
- }
-
-
- //UI显示区(操作UI,但不存在数据获取或处理代码,也不存在事件监听代码) <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- private EditText etPasswordPhone;
- private View pbPasswordGettingVerify;
- private TextView btnPasswordGetVerify;
-
- private View llPasswordPassword;
- private EditText etPasswordVerify;
- private EditText etPasswordPassword0;
- private EditText etPasswordPassword1;
-
- @Override
- public void initView() {//必须调用
-
- etPasswordPhone = (EditText) findViewById(R.id.etPasswordPhone);
- pbPasswordGettingVerify = findViewById(R.id.pbPasswordGettingVerify);
- btnPasswordGetVerify = (TextView) findViewById(R.id.btnPasswordGetVerify);
-
- llPasswordPassword = findViewById(R.id.llPasswordPassword);
- etPasswordVerify = (EditText) findViewById(R.id.etPasswordVerify);
- etPasswordPassword0 = (EditText) findViewById(R.id.etPasswordPassword0);
- etPasswordPassword1 = (EditText) findViewById(R.id.etPasswordPassword1);
-
- }
-
-
- /**
- * @param isGetting
- */
- private void showVerifyGet(final boolean isGetting) {
- pbPasswordGettingVerify.setVisibility(isGetting ? View.VISIBLE : View.GONE);
- btnPasswordGetVerify.setText(isGetting ? "获取中..." : "重新获取");
- }
-
- //UI显示区(操作UI,但不存在数据获取或处理代码,也不存在事件监听代码)>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
-
-
-
-
-
-
-
- //Data数据区(存在数据获取或处理代码,但不存在事件监听代码)<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- @Override
- public void initData() {//必须调用
- switch (type) {
- case TYPE_REGISTER:
- tvBaseTitle.setText("注册");
- break;
- case TYPE_RESET:
- tvBaseTitle.setText("重置密码");
- break;
- default:
- tvBaseTitle.setText("验证手机");
- break;
- }
- autoSetTitle();
-
- llPasswordPassword.setVisibility(type == TYPE_VERIFY ? View.GONE : View.VISIBLE);
-
-
- if (StringUtil.isNotEmpty(password, true)) {
- etPasswordPassword0.setText(StringUtil.getString(password));
- }
- if (StringUtil.isPhone(phone)) {
- etPasswordPhone.setText("" + phone);
- getVerify();
- }
-
- }
-
- private TimeCount time;
- /**获取验证码
- */
- private void getVerify() {
- if (EditTextUtil.isInputedCorrect(context, etPasswordPhone, EditTextUtil.TYPE_PHONE) == false) {
- return;
- }
-
- if (type == TYPE_VERIFY) {
- etPasswordVerify.requestFocus();
- } else {
- if (StringUtil.isNotEmpty(etPasswordPassword0, true)) {
- etPasswordPassword1.requestFocus();
- } else {
- etPasswordPassword0.requestFocus();
- }
- }
-
- showVerifyGet(true);
- time = new TimeCount(60000, 1000);
-
- //判断手机号是否已经注册
- HttpRequest.checkRegister(StringUtil.getTrimedString(etPasswordPhone), HTTP_CHECK_REGISTER, this);
- }
-
- /**从服务器获取验证码
- */
- private void getVerifyFromServer(int type) {
- runUiThread(new Runnable() {
-
- @Override
- public void run() {
- showVerifyGet(true);
- }
- });
-
- HttpRequest.getVerify(type, StringUtil.getTrimedString(etPasswordPhone), HTTP_GET_VERIFY, this);
- }
-
- /**下一步
- */
- private void toNextStep() {
- if (type != TYPE_VERIFY) {
- if (EditTextUtil.isInputedCorrect(context, etPasswordPassword0, EditTextUtil.TYPE_PASSWORD) == false
- || EditTextUtil.isInputedCorrect(context, etPasswordPassword1, EditTextUtil.TYPE_PASSWORD) == false) {
- return;
- }
-
- final String password0 = StringUtil.getTrimedString(etPasswordPassword0);
- String password1 = StringUtil.getTrimedString(etPasswordPassword1);
- if (! password0.equals(password1)) {
- showShortToast("密码输入不一致,请重新输入");
- return;
- }
- }
-
- switch (type) {
- case TYPE_REGISTER:
- register();
- break;
- case TYPE_VERIFY:
- checkVerify(Verify.TYPE_LOGIN, true);
- break;
- case TYPE_RESET:
- checkVerify(Verify.TYPE_PASSWORD, true);
- break;
- }
- }
-
- /**验证验证码
- * @param type
- * @param fromServer
- */
- private boolean checkVerify(int type, boolean fromServer) {
- if (EditTextUtil.isInputedCorrect(context, etPasswordPhone, EditTextUtil.TYPE_PHONE) == false
- || EditTextUtil.isInputedCorrect(context, etPasswordVerify, EditTextUtil.TYPE_VERIFY) == false) {
- return false;
- }
-
- if (fromServer) {
- showProgressDialog();
- HttpRequest.checkVerify(type, StringUtil.getTrimedString(etPasswordPhone),
- StringUtil.getTrimedString(etPasswordVerify), HTTP_CHECK_VERIFY, this);
- }
-
- return true;
- }
-
-
- private void register() {
- if (checkVerify(Verify.TYPE_REGISTER, false) == false) {
- return;
- }
- showProgressDialog();
- HttpRequest.register(StringUtil.getTrimedString(etPasswordVerify)
- , StringUtil.getTrimedString(etPasswordPhone)
- , StringUtil.getString(etPasswordPassword0),
- "APIJSONUser", 0, HTTP_REGISTER, this); // 注册接口
- }
-
- private void setPassword() {
- showProgressDialog();
- HttpRequest.setPassword(StringUtil.getTrimedString(etPasswordVerify)
- , StringUtil.getTrimedString(etPasswordPhone)
- , StringUtil.getString(etPasswordPassword0),
- HTTP_RESET_PASSWORD, this); // 注册接口
- }
-
-
- private Intent newResult() {
- return new Intent()
- .putExtra(RESULT_PHONE, StringUtil.getTrimedString(etPasswordPhone))
- .putExtra(RESULT_VERIFY, StringUtil.getTrimedString(etPasswordVerify))
- .putExtra(RESULT_PASSWORD, StringUtil.getTrimedString(etPasswordPassword0));
- }
-
- private void saveAndExit(Intent intent) {
- setResult(RESULT_OK, intent);
- finish();
- }
-
- //Data数据区(存在数据获取或处理代码,但不存在事件监听代码)>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
-
-
-
-
-
-
-
- //Event事件区(只要存在事件监听代码就是)<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- @Override
- public void initEvent() {//必须调用
-
- findViewById(R.id.btnPasswordGetVerify).setOnClickListener(this);
-
- findViewById(R.id.btnPasswordNext).setOnClickListener(this);
-
-
- new TextClearSuit().addClearListener(etPasswordPhone, findViewById(R.id.ivPasswordPhoneClear));
- new TextClearSuit().addClearListener(etPasswordVerify, findViewById(R.id.ivPasswordVerifyClear));
- new TextClearSuit().addClearListener(etPasswordPassword0, findViewById(R.id.ivPasswordPassword0Clear));
- new TextClearSuit().addClearListener(etPasswordPassword1, findViewById(R.id.ivPasswordPassword1Clear));
-
- }
-
-
- public static final int HTTP_CHECK_REGISTER = 1;
- public static final int HTTP_CHECK_VERIFY = 2;
- public static final int HTTP_GET_VERIFY = 3;
- public static final int HTTP_REGISTER = 4;
- public static final int HTTP_RESET_PASSWORD = 5;
-
- @Override
- public void onHttpResponse(int requestCode, String resultJson, Exception e) {
- final JSONResponse response = new JSONResponse(resultJson);
- final JSONResponse response2;
-
- dismissProgressDialog();
- switch (requestCode) {
- case HTTP_CHECK_REGISTER:
- response2 = response.getJSONResponse(HttpRequest.PRIVACY_);
- Log.i(TAG, "checkPassword result = " + resultJson);
- runUiThread(new Runnable() {
- @Override
- public void run() {
- showVerifyGet(false);
- if (JSONResponse.isSuccess(response2) == false) {
- showShortToast(R.string.get_failed);
- } else if (JSONResponse.isExist(response2)) {
- if (type == TYPE_REGISTER) {
- showShortToast("手机号已经注册");
- } else {
- getVerifyFromServer(type == TYPE_VERIFY ? Verify.TYPE_LOGIN : Verify.TYPE_PASSWORD);
- }
- } else {//手机号未被注册过
- if (type == TYPE_REGISTER) {
- getVerifyFromServer(Verify.TYPE_REGISTER);
- } else {
- showShortToast("手机号未注册");
- }
- }
- }
- });
- break;
- case HTTP_CHECK_VERIFY:
- response2 = response.getJSONResponse(Verify.class.getSimpleName());
- runUiThread(new Runnable() {
- @Override
- public void run() {
- if (JSONResponse.isExist(response2)) { //验证验证码成功
- switch (type) {
- case TYPE_REGISTER:
- register();
- break;
- case TYPE_RESET:
- setPassword();
- break;
- default:
- saveAndExit(newResult());
- break;
- }
- } else {//验证码错误
- EditTextUtil.showInputedError(context, etPasswordVerify
- , response.getCode() == CODE_TIME_OUT ? "验证码已过期" : "验证码错误");
- }
- }
- });
- break;
- case HTTP_GET_VERIFY:
- final Verify verify = response.getObject(Verify.class);
- runUiThread(new Runnable() {
- @Override
- public void run() {
- showVerifyGet(false);
- if (verify == null || StringUtil.isNotEmpty(verify.getVerify(), true) == false) {
- showShortToast(R.string.get_failed);
- } else {
- Log.i(TAG, "发送成功");
- time.start();
- Toast.makeText(context, "验证码是\n" + verify.getVerify(), Toast.LENGTH_LONG).show();
- }
- }
- });
- break;
- case HTTP_REGISTER:
- User user = response.getObject(User.class);
- dismissProgressDialog();
- if (user == null || user.getId() <= 0 || JSONResponse.isSuccess(
- response.getJSONResponse(User.class.getSimpleName())) == false) {
- if (response.getCode() == CODE_TIME_OUT || response.getCode() == 412) {
- EditTextUtil.showInputedError(context, etPasswordVerify
- , response.getCode() == CODE_TIME_OUT ? "验证码已过期" : "验证码错误");
- } else {
- showShortToast("注册失败,请检查网络后重试");
- }
- } else {
- showShortToast("注册成功");
- APIJSONApplication.getInstance().saveCurrentUser(user);
-
- saveAndExit(newResult().putExtra(INTENT_ID, user.getId()));
- }
- break;
- case HTTP_RESET_PASSWORD:
- response2 = response.getJSONResponse(Privacy.class.getSimpleName());
- dismissProgressDialog();
- if (JSONResponse.isSuccess(response2) == false) {
- EditTextUtil.showInputedError(context, etPasswordVerify
- , response.getCode() == CODE_TIME_OUT ? "验证码已过期" : "验证码错误");
- } else {
- showShortToast("修改密码成功,请重新登录");
-
- saveAndExit(newResult().putExtra(INTENT_PHONE, phone));
- }
- break;
- default:
- break;
- }
- }
-
- //系统自带监听方法<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
-
- @Override
- public void onDragBottom(boolean rightToLeft) {
- if (rightToLeft) {
-
- return;
- }
-
- finish();
- }
-
- @Override
- public void onClick(View v) {
- switch (v.getId()) {
- case R.id.btnPasswordGetVerify:
- getVerify();
- break;
- case R.id.btnPasswordNext:
- toNextStep();
- break;
- default:
- break;
- }
- }
-
-
- //类相关监听<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
-
- //类相关监听>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
- //系统自带监听方法>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
- //Event事件区(只要存在事件监听代码就是)>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
-
-
-
-
-
- //内部类,尽量少用<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
-
- /**倒计时类
- */
- private class TimeCount extends CountDownTimer {
- public TimeCount(long millisInFuture, long countDownInterval) {
- super(millisInFuture, countDownInterval);//参数依次为总时长,和计时的时间间隔
- }
- @Override
- public void onFinish() {//计时完毕时触发
- btnPasswordGetVerify.setText("重新获取");
- btnPasswordGetVerify.setClickable(true);
- }
- @Override
- public void onTick(long millisUntilFinished){//计时过程显示
- btnPasswordGetVerify.setClickable(false);
- btnPasswordGetVerify.setText((millisUntilFinished / 1000) +"秒");
- }
- }
-
-
- //内部类,尽量少用>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-}
\ No newline at end of file
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/activity_fragment/QRCodeActivity.java b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/activity_fragment/QRCodeActivity.java
deleted file mode 100644
index 126c295e7..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/activity_fragment/QRCodeActivity.java
+++ /dev/null
@@ -1,248 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package apijson.demo.client.activity_fragment;
-
-import zuo.biao.apijson.JSONRequest;
-import zuo.biao.library.base.BaseActivity;
-import zuo.biao.library.interfaces.OnBottomDragListener;
-import zuo.biao.library.manager.CacheManager;
-import zuo.biao.library.util.ImageLoaderUtil;
-import zuo.biao.library.util.JSON;
-import zuo.biao.library.util.Log;
-import zuo.biao.library.util.StringUtil;
-import android.app.Activity;
-import android.content.Context;
-import android.content.Intent;
-import android.graphics.Bitmap;
-import android.os.Bundle;
-import android.view.View;
-import android.widget.ImageView;
-import android.widget.TextView;
-import apijson.demo.client.R;
-import apijson.demo.client.model.User;
-import apijson.demo.client.util.HttpRequest;
-
-import com.google.zxing.WriterException;
-import com.zxing.encoding.EncodingHandler;
-
-/**二维码界面Activity
- * @author Lemon
- */
-public class QRCodeActivity extends BaseActivity implements OnBottomDragListener {
- private static final String TAG = "QRCodeActivity";
-
- //启动方法<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
-
- /**启动这个Activity的Intent
- * @param context
- * @param userId
- * @return
- */
- public static Intent createIntent(Context context, long userId) {
- return new Intent(context, QRCodeActivity.class).
- putExtra(INTENT_ID, userId);
- }
-
- //启动方法>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
- @Override
- public Activity getActivity() {
- return this;
- }
-
- private long userId = 0;
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.qrcode_activity, this);
-
- intent = getIntent();
- userId = intent.getLongExtra(INTENT_ID, userId);
-
- //功能归类分区方法,必须调用<<<<<<<<<<
- initView();
- initData();
- initEvent();
- //功能归类分区方法,必须调用>>>>>>>>>>
-
- }
-
-
- //UI显示区(操作UI,但不存在数据获取或处理代码,也不存在事件监听代码)<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
-
- private ImageView ivQRCodeHead;
- private TextView tvQRCodeName;
-
- private ImageView ivQRCodeCode;
- private View ivQRCodeProgress;
- @Override
- public void initView() {//必须调用
- autoSetTitle();
-
- ivQRCodeHead = (ImageView) findViewById(R.id.ivQRCodeHead);
- tvQRCodeName = (TextView) findViewById(R.id.tvQRCodeName);
-
- ivQRCodeCode = (ImageView) findViewById(R.id.ivQRCodeCode);
- ivQRCodeProgress = findViewById(R.id.ivQRCodeProgress);
- }
-
-
- //UI显示区(操作UI,但不存在数据获取或处理代码,也不存在事件监听代码)>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
-
-
-
-
-
-
-
- //Data数据区(存在数据获取或处理代码,但不存在事件监听代码)<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
-
- private User user;
- @Override
- public void initData() {//必须调用
-
- ivQRCodeProgress.setVisibility(View.VISIBLE);
- runThread(TAG + "initData", new Runnable() {
-
- @Override
- public void run() {
-
- user = CacheManager.getInstance().get(User.class, "" + userId);
- if (user == null) {
- user = new User(userId);
- }
- runUiThread(new Runnable() {
- @Override
- public void run() {
- ImageLoaderUtil.loadImage(ivQRCodeHead, user.getHead());
- tvQRCodeName.setText(StringUtil.getTrimedString(user.getName()));
- }
- });
-
- setQRCode(user);
- }
- });
-
- }
-
- private Bitmap qRCodeBitmap;
- protected void setQRCode(User user) {
-// if (user == null) {
-// Log.e(TAG, "setQRCode user == null" +
-// " || StringUtil.isNotEmpty(user.getPhone(), true) == false >> return;");
-// return;
-// }
-
- try {
- //不能暴露用户隐私
- qRCodeBitmap = EncodingHandler.createQRCode(HttpRequest.URL_GET
- + JSON.toJSONString(new JSONRequest(new apijson.demo.server.model.User(userId)))
- , (int) (2 * getResources().getDimension(R.dimen.qrcode_size)));
- } catch (WriterException e) {
- e.printStackTrace();
- Log.e(TAG, "initData try {Bitmap qrcode = EncodingHandler.createQRCode(contactJson, ivQRCodeCode.getWidth());" +
- " >> } catch (WriterException e) {" + e.getMessage());
- }
-
- runUiThread(new Runnable() {
- @Override
- public void run() {
- ivQRCodeProgress.setVisibility(View.GONE);
- ivQRCodeCode.setImageBitmap(qRCodeBitmap);
- }
- });
- }
-
- //Data数据区(存在数据获取或处理代码,但不存在事件监听代码)>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
-
-
-
-
-
- //Event事件区(只要存在事件监听代码就是)<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- @Override
- public void initEvent() {//必须调用
-
- }
-
- //系统自带监听方法<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- @Override
- public void onDragBottom(boolean rightToLeft) {
- if (rightToLeft) {
-
- return;
- }
-
- finish();
- }
-
-
-
- //类相关监听<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
-
- @Override
- protected void onDestroy() {
- super.onDestroy();
-
- ivQRCodeProgress = null;
- ivQRCodeCode = null;
- user = null;
-
- if (qRCodeBitmap != null) {
- if (qRCodeBitmap.isRecycled() == false) {
- qRCodeBitmap.recycle();
- }
- qRCodeBitmap = null;
- }
- if (ivQRCodeCode != null) {
- ivQRCodeCode.setImageBitmap(null);
- ivQRCodeCode = null;
- }
- }
-
-
- //类相关监听>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
- //系统自带监听方法>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
- //Event事件区(只要存在事件监听代码就是)>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
-
-
-
-
-
- //内部类,尽量少用<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
-
-
- //内部类,尽量少用>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-}
\ No newline at end of file
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/activity_fragment/ScanActivity.java b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/activity_fragment/ScanActivity.java
deleted file mode 100644
index 5e4408181..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/activity_fragment/ScanActivity.java
+++ /dev/null
@@ -1,178 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package apijson.demo.client.activity_fragment;
-
-import zuo.biao.library.interfaces.ActivityPresenter;
-import zuo.biao.library.util.CommonUtil;
-import android.app.Activity;
-import android.content.Context;
-import android.content.Intent;
-import android.os.Bundle;
-import android.view.SurfaceView;
-import android.view.View;
-import android.view.View.OnClickListener;
-import apijson.demo.client.R;
-import apijson.demo.client.application.APIJSONApplication;
-
-import com.zxing.activity.CaptureActivity;
-import com.zxing.view.ViewfinderView;
-
-/**扫描二维码Activity
- * @author Lemon
- * @use toActivity(ScanActivity.createIntent(...));
- */
-public class ScanActivity extends CaptureActivity implements ActivityPresenter, OnClickListener {
- public static final String TAG = "ScanActivity";
-
- //启动方法<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- /**启动这个Activity的Intent
- * @param context
- * @return
- */
- public static Intent createIntent(Context context) {
- return new Intent(context, ScanActivity.class);
- }
-
- //启动方法>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
- @Override
- public Activity getActivity() {
- return this;
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.scan_activity);
- init(this, (SurfaceView) findViewById(R.id.svCameraScan), (ViewfinderView) findViewById(R.id.vfvCameraScan));
-
- //功能归类分区方法,必须调用<<<<<<<<<<
- initView();
- initData();
- initEvent();
- //功能归类分区方法,必须调用>>>>>>>>>>
-
- }
-
-
- //UI显示区(操作UI,但不存在数据获取或处理代码,也不存在事件监听代码)<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- @Override
- public void initView() {//必须调用
-
- }
-
-
-
-
-
- //UI显示区(操作UI,但不存在数据获取或处理代码,也不存在事件监听代码)>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
-
-
-
-
-
-
-
- //Data数据区(存在数据获取或处理代码,但不存在事件监听代码)<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- @Override
- public void initData() {//必须调用
-
- }
-
-
- //Data数据区(存在数据获取或处理代码,但不存在事件监听代码)>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
-
-
-
-
-
- //Event事件区(只要存在事件监听代码就是)<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- @Override
- public void initEvent() {//必须调用
-
- findViewById(R.id.ivCameraScanLight).setOnClickListener(this);
- }
-
-
- @Override
- public void onReturnClick(View v) {
- finish();
- }
- @Override
- public void onForwardClick(View v) {
- CommonUtil.toActivity(context, QRCodeActivity.createIntent(context
- , APIJSONApplication.getInstance().getCurrentUserId()));
- }
-
- //系统自带监听方法<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
-
- @Override
- public void onClick(View v) {
- switch (v.getId()) {
- case R.id.ivCameraScanLight:
- switchLight(! isOn());
- break;
- default:
- break;
- }
- }
-
-
- @Override
- public boolean isAlive() {
- return false;
- }
-
- @Override
- public boolean isRunning() {
- return false;
- }
-
- //类相关监听<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
-
- //类相关监听>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
- //系统自带监听方法>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
- //Event事件区(只要存在事件监听代码就是)>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
-
-
-
-
-
- //内部类,尽量少用<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
-
-
- //内部类,尽量少用>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-}
\ No newline at end of file
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/activity_fragment/SettingActivity.java b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/activity_fragment/SettingActivity.java
deleted file mode 100644
index d9273ac96..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/activity_fragment/SettingActivity.java
+++ /dev/null
@@ -1,257 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package apijson.demo.client.activity_fragment;
-
-import zuo.biao.library.base.BaseActivity;
-import zuo.biao.library.interfaces.OnBottomDragListener;
-import zuo.biao.library.util.Log;
-import zuo.biao.library.util.SettingUtil;
-import android.app.Activity;
-import android.content.Context;
-import android.content.Intent;
-import android.os.Bundle;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.widget.ImageView;
-import apijson.demo.client.R;
-
-/**设置界面Activity
- * @author Lemon
- * @use toActivity(SettingActivity.createIntent(...));
- */
-public class SettingActivity extends BaseActivity implements OnBottomDragListener {
- private static final String TAG = "SettingActivity";
-
- //启动方法<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- /**启动这个Activity的Intent
- * @param context
- * @return
- */
- public static Intent createIntent(Context context) {
- return new Intent(context, SettingActivity.class);
- }
-
- //启动方法>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
- @Override
- public Activity getActivity() {
- return this;
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.setting_activity, this);
-
- //功能归类分区方法,必须调用<<<<<<<<<<
- initView();
- initData();
- initEvent();
- //功能归类分区方法,必须调用>>>>>>>>>>
-
- }
-
-
- //UI显示区(操作UI,但不存在数据获取或处理代码,也不存在事件监听代码)<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- private ImageView[] ivSettings;
- @Override
- public void initView() {//必须调用
-
- ivSettings = new ImageView[7];
- ivSettings[0] = (ImageView) findViewById(R.id.ivSettingCache);
- ivSettings[1] = (ImageView) findViewById(R.id.ivSettingPreload);
-
- ivSettings[2] = (ImageView) findViewById(R.id.ivSettingVoice);
- ivSettings[3] = (ImageView) findViewById(R.id.ivSettingVibrate);
- ivSettings[4] = (ImageView) findViewById(R.id.ivSettingNoDisturb);
-
- ivSettings[5] = (ImageView) findViewById(R.id.ivSettingTestMode);
- ivSettings[6] = (ImageView) findViewById(R.id.ivSettingFirstStart);
-
- }
-
- private boolean[] settings;
- private int[] switchResIds = new int[]{R.drawable.off, R.drawable.on};
- /**设置开关
- * @param which
- * @param isToOn
- */
- private void setSwitch(int which, boolean isToOn) {
- if (ivSettings == null || which < 0 || which >= ivSettings.length) {
- Log.e(TAG, "ivSettings == null || which < 0 || which >= ivSettings.length >> reutrn;");
- return;
- }
-
- ivSettings[which].setImageResource(switchResIds[isToOn ? 1 : 0]);
- settings[which] = isToOn;
- }
-
-
-
-
-
- //UI显示区(操作UI,但不存在数据获取或处理代码,也不存在事件监听代码)>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
-
-
-
-
-
-
-
- //Data数据区(存在数据获取或处理代码,但不存在事件监听代码)<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
-
- @Override
- public void initData() {//必须调用
-
- showProgressDialog(R.string.loading);
-
- runThread(TAG + "initData", new Runnable() {
-
- @Override
- public void run() {
-
- settings = SettingUtil.getAllBooleans(context);
- runUiThread(new Runnable() {
-
- @Override
- public void run() {
- dismissProgressDialog();
- if (settings == null || settings.length <= 0) {
- finish();
- return;
- }
- for (int i = 0; i < settings.length; i++) {
- setSwitch(i, settings[i]);
- }
- }
- });
- }
- });
-
-
- }
-
-
-
- //Data数据区(存在数据获取或处理代码,但不存在事件监听代码)>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
-
-
-
-
-
- //Event事件区(只要存在事件监听代码就是)<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- @Override
- public void initEvent() {//必须调用
-
- for (int i = 0; i < ivSettings.length; i++) {
- final int which = i;
- ivSettings[which].setOnClickListener(new OnClickListener() {
-
- @Override
- public void onClick(View v) {
- isSettingChanged = true;
- setSwitch(which, ! settings[which]);
- }
- });
- }
- }
-
- @Override
- public void onDragBottom(boolean rightToLeft) {
- if (rightToLeft) {
- SettingUtil.restoreDefault();
- initData();
- return;
- }
-
- finish();
- }
-
- //系统自带监听方法<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
-
-
- //类相关监听<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
-
- private boolean isSettingChanged = false;
- @Override
- public void finish() {
- if (isSettingChanged) {
- showProgressDialog("正在保存设置,请稍后...");
- runThread(TAG, new Runnable() {
-
- @Override
- public void run() {
-
- SettingUtil.putAllBoolean(settings);
- isSettingChanged = false;
- runUiThread(new Runnable() {
-
- @Override
- public void run() {
- SettingActivity.this.finish();
- }
- });
- }
- });
- return;
- }
-
- super.finish();
- }
-
- @Override
- protected void onDestroy() {
- super.onDestroy();
-
- ivSettings = null;
- settings = null;
- }
-
-
-
- //类相关监听>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
- //系统自带监听方法>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
- //Event事件区(只要存在事件监听代码就是)>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
-
-
-
-
-
- //内部类,尽量少用<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
-
-
- //内部类,尽量少用>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-}
\ No newline at end of file
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/activity_fragment/SplashActivity.java b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/activity_fragment/SplashActivity.java
deleted file mode 100755
index 678c76270..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/activity_fragment/SplashActivity.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package apijson.demo.client.activity_fragment;
-
-import android.app.Activity;
-import android.os.Bundle;
-import android.os.Handler;
-import apijson.demo.client.R;
-
-/**闪屏activity,保证点击桌面应用图标后无延时响应
- * @author Lemon
- */
-public class SplashActivity extends Activity {
-
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
-
- new Handler().postDelayed(new Runnable() {
-
- @Override
- public void run() {
- startActivity(MainTabActivity.createIntent(SplashActivity.this));
- finish();
- }
- }, 500);
- }
-
- @Override
- public void finish() {
- super.finish();
- overridePendingTransition(R.anim.fade, R.anim.hold);
- }
-
- @Override
- public void onBackPressed() {
- //super.onBackPressed();
- }
-
-}
\ No newline at end of file
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/activity_fragment/UserActivity.java b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/activity_fragment/UserActivity.java
deleted file mode 100644
index 6f3f89ea3..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/activity_fragment/UserActivity.java
+++ /dev/null
@@ -1,682 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package apijson.demo.client.activity_fragment;
-
-import android.annotation.SuppressLint;
-import android.app.Activity;
-import android.content.Context;
-import android.content.Intent;
-import android.os.Bundle;
-import android.view.MotionEvent;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.view.View.OnTouchListener;
-import android.view.ViewGroup;
-import android.widget.GridView;
-import android.widget.TextView;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import apijson.demo.client.R;
-import apijson.demo.client.base.BaseActivity;
-import apijson.demo.client.model.Moment;
-import apijson.demo.client.model.User;
-import apijson.demo.client.util.ActionUtil;
-import apijson.demo.client.util.HttpRequest;
-import apijson.demo.client.util.MenuUtil;
-import apijson.demo.client.view.UserView;
-import apijson.demo.server.model.Privacy;
-import zuo.biao.apijson.JSONRequest;
-import zuo.biao.apijson.JSONResponse;
-import zuo.biao.library.base.BaseView.OnDataChangedListener;
-import zuo.biao.library.interfaces.OnBottomDragListener;
-import zuo.biao.library.manager.CacheManager;
-import zuo.biao.library.manager.HttpManager.OnHttpResponseListener;
-import zuo.biao.library.model.Entry;
-import zuo.biao.library.ui.AlertDialog;
-import zuo.biao.library.ui.AlertDialog.OnDialogButtonClickListener;
-import zuo.biao.library.ui.BottomMenuView;
-import zuo.biao.library.ui.BottomMenuView.OnBottomMenuItemClickListener;
-import zuo.biao.library.ui.BottomMenuWindow;
-import zuo.biao.library.ui.CutPictureActivity;
-import zuo.biao.library.ui.EditTextInfoActivity;
-import zuo.biao.library.ui.EditTextInfoWindow;
-import zuo.biao.library.ui.GridAdapter;
-import zuo.biao.library.ui.SelectPictureActivity;
-import zuo.biao.library.ui.WebViewActivity;
-import zuo.biao.library.util.CommonUtil;
-import zuo.biao.library.util.DataKeeper;
-import zuo.biao.library.util.JSON;
-import zuo.biao.library.util.Log;
-import zuo.biao.library.util.StringUtil;
-
-/**联系人资料界面
- * @author Lemon
- */
-public class UserActivity extends BaseActivity implements OnClickListener, OnBottomDragListener
-, OnBottomMenuItemClickListener, OnHttpResponseListener, OnDialogButtonClickListener, OnDataChangedListener {
- public static final String TAG = "UserActivity";
-
- public static final String INTENT_IS_ON_EDIT_MODE = "INTENT_IS_ON_EDIT_MODE";
-
- /**获取启动UserActivity的intent
- * @param context
- * @param id
- * @return
- */
- public static Intent createIntent(Context context, long id) {
- return new Intent(context, UserActivity.class).putExtra(INTENT_ID, id);
- }
-
-
- @Override
- public Activity getActivity() {
- return this;
- }
-
- private long id = 0;
- private boolean isOnEditMode = false;
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.user_activity, this);
-
- registerObserver(this);
-
- intent = getIntent();
- id = intent.getLongExtra(INTENT_ID, id);
- isOnEditMode = intent.getBooleanExtra(INTENT_IS_ON_EDIT_MODE, isOnEditMode);
-
- id = getIntent().getLongExtra(INTENT_ID, id);
- if (id <= 0) {
- finishWithError("用户不存在!");
- return;
- }
-
- if (isOnEditMode && isCurrentUser(id) == false) {
- Log.e(TAG, "只能修改自己的个人资料");
- isOnEditMode = false;
- }
-
- //功能归类分区方法,必须调用<<<<<<<<<<
- initView();
- initData();
- initEvent();
- //功能归类分区方法,必须调用>>>>>>>>>>
-
- }
-
-
- //UI显示区(操作UI,但不存在数据获取或处理代码,也不存在事件监听代码)<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- // private BaseViewLayout bvlUser;//方式一
- // private UserViewLayout uvlUser;//方式二
-
- private ViewGroup llUserBusinessCardContainer;//方式三
- private UserView userView;
-
- private View llUserMoment;
- private GridView gvUserMoment;
-
- private TextView tvUserRemark;
- private TextView tvUserPhone;
-
- private ViewGroup llUserBottomMenuContainer;
- private BottomMenuView bottomMenuView;
- @Override
- public void initView() {//必须调用
-
- //添加用户名片,这些方式都可<<<<<<<<<<<<<<<<<<<<<<
- // //方式一
- // bvlUser = (BaseViewLayout) findViewById(R.id.bvlUser);
- // bvlUser.createView(new UserView(context, getResources()));
- //
- // //方式二
- // uvlUser = (UserViewLayout) findViewById(R.id.uvlUser);
-
- //方式三
- llUserBusinessCardContainer = (ViewGroup) findViewById(R.id.llUserBusinessCardContainer);
- llUserBusinessCardContainer.removeAllViews();
-
- userView = new UserView(context, getResources());
- llUserBusinessCardContainer.addView(userView.createView(getLayoutInflater()));
- //添加用户名片,这些方式都可>>>>>>>>>>>>>>>>>>>>>>>
-
-
- llUserMoment = findViewById(R.id.llUserMoment);
- gvUserMoment = (GridView) findViewById(R.id.gvUserMoment);
-
- tvUserRemark = (TextView) findViewById(R.id.tvUserRemark);
- tvUserPhone = (TextView) findViewById(R.id.tvUserPhone);
-
- llUserMoment.setVisibility(isOnEditMode ? View.GONE : View.VISIBLE);
- if (isOnEditMode == false) {
- //添加底部菜单<<<<<<<<<<<<<<<<<<<<<<
- llUserBottomMenuContainer = (ViewGroup) findViewById(R.id.llUserBottomMenuContainer);
- llUserBottomMenuContainer.removeAllViews();
-
- bottomMenuView = new BottomMenuView(context, getResources(), REQUEST_TO_BOTTOM_MENU);
- llUserBottomMenuContainer.addView(bottomMenuView.createView(getLayoutInflater()));
- //添加底部菜单>>>>>>>>>>>>>>>>>>>>>>>
- }
-
- }
-
- private User user;
- private List momentList;
- private GridAdapter adapter;
- /**显示用户
- * @param user_
- */
- private void setUser(User user_) {
- setUser(user_, momentList);
- }
- /**显示用户
- * @param user_
- * @param momentList_
- */
- private void setUser(User user_, List momentList_) {
- if (user_ == null) {
- Log.w(TAG, "setUser user_ == null >> user = new User();");
- user_ = new User();
- }
- this.user = user_;
- this.momentList = momentList_;
- if (momentList == null) {
- momentList = new ArrayList<>();
- }
- final List> list = new ArrayList<>();
- for (Moment moment : momentList) {
- list.add(new Entry(moment.getFirstPicture()));
- }
-
- runUiThread(new Runnable() {
-
- @Override
- public void run() {
- // bvlUser.bindView(user);//方式一
- // uvlUser.bindView(user);//方式二
- userView.bindView(user);//方式三
-
- tvUserRemark.setText(StringUtil.getTrimedString(user.getHead()));
-
- if (adapter == null) {
- adapter = new GridAdapter(context);
- adapter.setHasName(false);
- gvUserMoment.setAdapter(adapter);
- }
- adapter.refresh(list);
- }
- });
- }
-
-
- private Privacy privacy;
- /**显示用户隐私信息
- * @param privacy
- */
- private void setPrivacy(Privacy privacy_) {
- if (privacy_ == null) {
- Log.w(TAG, "setUser user_ == null >> user = new User();");
- privacy_ = new Privacy();
- }
- this.privacy = privacy_;
- runUiThread(new Runnable() {
-
- @Override
- public void run() {
- tvUserPhone.setText(StringUtil.getTrimedString(privacy.getPhone()));
- }
- });
- }
-
- /**裁剪图片
- * @param path
- */
- private void cutPicture(String path) {
- if (StringUtil.isFilePath(path) == false) {
- Log.e(TAG, "cutPicture StringUtil.isFilePath(path) == false >> showShortToast(找不到图片);return;");
- showShortToast("找不到图片");
- return;
- }
-
- toActivity(CutPictureActivity.createIntent(context, path
- , DataKeeper.imagePath, "photo" + System.currentTimeMillis(), 200)
- , REQUEST_TO_CUT_PICTURE);
- }
-
-
- //UI显示区(操作UI,但不存在数据获取或处理代码,也不存在事件监听代码)>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
-
-
-
-
-
-
-
- //Data数据区(存在数据获取或处理代码,但不存在事件监听代码)<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
-
- @Override
- public void initData() {//必须调用
- super.initData();
-
- if (isCurrentUserCorrect() == false) {//解决不能在未登录情况下查看
- onDataChanged();
- }
- }
-
- @Override
- public void onDataChanged() {
- tvBaseTitle.setText(isOnEditMode ? "编辑资料" : (isCurrentUser(id) ? "我的资料" : "详细资料"));
-
- if (bottomMenuView != null) {
- bottomMenuView.bindView(MenuUtil.getMenuList(MenuUtil.USER, id, ! User.isFriend(currentUser, id)));
- }
-
- runThread(TAG + "onDataChanged", new Runnable() {
-
- @Override
- public void run() {
- //先加载缓存数据,比网络请求快很多
- user = CacheManager.getInstance().get(User.class, "" + id);
- if (isOnEditMode == false) {
- momentList = CacheManager.getInstance().getList(Moment.class, "userId=" + id, 0, 3);
- }
- runUiThread(new Runnable() {
-
- @Override
- public void run() {
- setUser(user, momentList);
- setPrivacy(null);
- }
- });
-
- HttpRequest.getUser(id, ! isOnEditMode, HTTP_GET, UserActivity.this);
- HttpRequest.getPrivacy(id, HTTP_GET_PRIVACY, UserActivity.this);
- }
- });
-
- }
-
-
- private User getUser() {
- if (user == null) {
- user = new User(id);
- }
- return user;
- }
-
- private void putUser() {
- showProgressDialog("正在上传...");
- user = getUser();
- apijson.demo.server.model.User userRequest = new apijson.demo.server.model.User(user.getId());
- userRequest.setName(user.getName());
- userRequest.setSex(user.getSex());
- userRequest.setTag(user.getTag());
- userRequest.setHead(user.getHead());
- // userRequest.setStarred(user.getStarred());
-
- HttpRequest.put(new JSONRequest(userRequest).setTag(User.class.getSimpleName())
- , HTTP_PUT, this);
- }
-
- //Data数据区(存在数据获取或处理代码,但不存在事件监听代码)>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
-
-
-
-
-
- //Event事件区(只要存在事件监听代码就是)<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- @Override
- public void initEvent() {//必须调用
-
- llUserMoment.setOnClickListener(this);
- gvUserMoment.setOnTouchListener(new OnTouchListener() {
-
- @SuppressLint("ClickableViewAccessibility")
- @Override
- public boolean onTouch(View v, MotionEvent event) {
- llUserMoment.onTouchEvent(event);
- return false;
- }
- });
-
-
- if (isOnEditMode) {
- findViewById(R.id.llUserRemark).setOnClickListener(this);
- findViewById(R.id.llUserPhone).setOnClickListener(this);
-
- userView.setOnDataChangedListener(new OnDataChangedListener() {
-
- @Override
- public void onDataChanged() {
- user = userView.getData();
- isDataChanged = true;
- }
- });
- }
- userView.setOnClickListener(new OnClickListener() {
-
- @Override
- public void onClick(View v) {
- if (user == null) {
- return;
- }
- switch (v.getId()) {
- case R.id.ivUserViewHead:
- if (isOnEditMode) {
- toActivity(SelectPictureActivity.createIntent(context), REQUEST_TO_SELECT_PICTURE, false);
- } else {
- toActivity(WebViewActivity.createIntent(context, user.getHead(), user.getHead()));
- }
- break;
- case R.id.tvUserViewName:
- if (isOnEditMode) {
- toActivity(EditTextInfoWindow.createIntent(context, "名字", user.getName())
- , REQUEST_TO_EDIT_TEXT_INFO_NAME, false);
- } else {
- CommonUtil.copyText(context, user.getName());
- }
- break;
- default:
- switch (v.getId()) {
- case R.id.tvUserViewSex:
- if (isOnEditMode) {
- user.setSex(user.getSex() == User.SEX_FEMALE ? User.SEX_MAIL : User.SEX_FEMALE);
- }
- break;
- case R.id.tvUserViewTag:
- if (isOnEditMode) {
- toActivity(EditTextInfoWindow.createIntent(context
- , "标签", user.getTag()), REQUEST_TO_EDIT_TEXT_INFO_TAG, false);
- } else {
- CommonUtil.copyText(context, user.getTag());
- }
- break;
- default:
- return;
- }
- if (isOnEditMode) {
- userView.bindView(user);
- isDataChanged = true;
- }
- break;
- }
- }
- });
-
- if (bottomMenuView != null) {
- bottomMenuView.setOnMenuItemClickListener(this);//底部菜单点击监听
- }
- }
-
- @Override
- public void onBottomMenuItemClick(int intentCode) {
- if (user == null) {
- Log.e(TAG, "onBottomMenuItemClick user == null >> return;");
- return;
- }
- if (verifyLogin() == false) {
- return;
- }
- switch (intentCode) {
- case MenuUtil.INTENT_CODE_EDIT:
- toActivity(UserActivity.createIntent(context, id).putExtra(UserActivity.INTENT_IS_ON_EDIT_MODE, true));
- break;
- case MenuUtil.INTENT_CODE_ADD:
- HttpRequest.setIsFriend(id, true, HTTP_ADD, this);
- break;
- case MenuUtil.INTENT_CODE_DELETE:
- HttpRequest.setIsFriend(id, false, HTTP_DELETE, this);
- break;
- case MenuUtil.INTENT_CODE_QRCODE:
- toActivity(QRCodeActivity.createIntent(context, id));
- break;
- case MenuUtil.INTENT_CODE_SEND:
- CommonUtil.shareInfo(context, JSON.toJSONString(user));
- break;
- default:
- break;
- }
- }
-
- //对应HttpRequest.getUser(id, 0, UserActivity.this); <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- protected static final int HTTP_GET = 1;
- protected static final int HTTP_GET_PRIVACY = 5;
- protected static final int HTTP_ADD = 2;
- protected static final int HTTP_DELETE = 3;
- protected static final int HTTP_PUT = 4;
-
- @Override
- public void onHttpResponse(int requestCode, String resultJson, Exception e) {
- JSONResponse response = new JSONResponse(resultJson);
- JSONResponse response2 = response.getJSONResponse(User.class.getSimpleName());
- boolean isSucceed = JSONResponse.isSuccess(response2);
-
- dismissProgressDialog();
- switch (requestCode) {
- case HTTP_GET:
- User user = response.getObject(User.class);
- if (user == null || user.getId() <= 0) {
- if (JSONResponse.isSuccess(response)) {
- showShortToast("用户已注销");
- super.finish();//需要动画,且不需要保存缓存
- return;
- }
- showShortToast(R.string.get_failed);
- }
- setUser(user, response.getList(Moment.class.getSimpleName() + "[]", Moment.class));
- break;
- case HTTP_GET_PRIVACY:
- setPrivacy(response.getObject(Privacy.class));
- break;
- case HTTP_ADD:
- case HTTP_DELETE:
- if (verifyHttpLogin(response.getCode()) == false) {
- return;
- }
- if (isSucceed) {
- showShortToast(requestCode == HTTP_ADD ? R.string.add_succeed : R.string.delete_succeed);
- sendBroadcast(new Intent(ActionUtil.ACTION_RELOAD_CURRENT_USER));
- } else {
- showShortToast(requestCode == HTTP_ADD ? R.string.add_failed : R.string.delete_failed);
- }
- break;
- case HTTP_PUT:
- if (verifyHttpLogin(response.getCode()) == false) {
- return;
- }
- if (isSucceed) {
- isDataChanged = false;
- sendBroadcast(new Intent(ActionUtil.ACTION_RELOAD_CURRENT_USER));
- }
- showShortToast(isSucceed ? "提交成功" : "提交失败,请检查网络后重试");
- break;
- default:
- break;
- }
- }
- //对应HttpRequest.getUser(id, 0, UserActivity.this); >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
-
- //系统自带监听方法<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- @Override
- public void onDragBottom(boolean rightToLeft) {
- if (rightToLeft) {
-
- return;
- }
-
- finish();
- }
-
- @Override
- public void onClick(View v) {
- switch (v.getId()) {
- case R.id.llUserMoment:
- toActivity(MomentListActivity.createIntent(context, id));
- break;
- case R.id.llUserRemark:
- toActivity(EditTextInfoActivity.createIntent(context, EditTextInfoActivity.TYPE_WEBSITE, "备注"
- , StringUtil.getTrimedString(tvUserRemark)), REQUEST_TO_EDIT_TEXT_INFO_REMARK);
- break;
- case R.id.llUserPhone:
- toActivity(EditTextInfoWindow.createIntent(context, EditTextInfoWindow.TYPE_PHONE
- , "手机", privacy.getPhone()), REQUEST_TO_EDIT_TEXT_INFO_PHONE, false);
- break;
- default:
- break;
- }
- }
-
- public static final int DIALOG_PUT_USER = 1;
- @Override
- public void onDialogButtonClick(int requestCode, boolean isPositive) {
- if (isPositive == false) {
- if (requestCode == DIALOG_PUT_USER) {
- isDataChanged = false;
- finish();
- }
- return;
- }
-
- switch (requestCode) {
- case DIALOG_PUT_USER:
- putUser();
- break;
- default:
- break;
- }
- }
-
-
- //类相关监听<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- private static final int REQUEST_TO_BOTTOM_MENU = 1;
- private static final int REQUEST_TO_SELECT_PICTURE = 2;
- private static final int REQUEST_TO_CUT_PICTURE = 3;
- private static final int REQUEST_TO_EDIT_TEXT_INFO_NAME = 5;
- private static final int REQUEST_TO_EDIT_TEXT_INFO_PHONE = 6;
- private static final int REQUEST_TO_EDIT_TEXT_INFO_REMARK = 7;
- private static final int REQUEST_TO_EDIT_TEXT_INFO_TAG = 8;
-
- @Override
- public void onActivityResult(int requestCode, int resultCode, Intent data) {
- super.onActivityResult(requestCode, resultCode, data);
- if (resultCode != RESULT_OK) {
- return;
- }
- switch (requestCode) {
- case REQUEST_TO_BOTTOM_MENU:
- if (data != null) {
- onBottomMenuItemClick(data.getIntExtra(BottomMenuWindow.RESULT_ITEM_ID, -1));
- }
- break;
- case REQUEST_TO_EDIT_TEXT_INFO_NAME:
- case REQUEST_TO_EDIT_TEXT_INFO_PHONE:
- case REQUEST_TO_EDIT_TEXT_INFO_REMARK:
- case REQUEST_TO_EDIT_TEXT_INFO_TAG:
- if (data == null) {
- break;
- }
- user = getUser();
- String value = data.getStringExtra(EditTextInfoActivity.RESULT_VALUE);
- switch (requestCode) {
- case REQUEST_TO_EDIT_TEXT_INFO_NAME:
- user.setName(value);
- break;
- case REQUEST_TO_EDIT_TEXT_INFO_PHONE:
- privacy.setPhone(value);
- break;
- case REQUEST_TO_EDIT_TEXT_INFO_REMARK:
- user.setHead(value);
- break;
- case REQUEST_TO_EDIT_TEXT_INFO_TAG:
- user.setTag(value);
- break;
- default:
- return;
- }
- isDataChanged = true;
- setUser(user);
- break;
- case REQUEST_TO_SELECT_PICTURE:
- if (data != null) {
- cutPicture(data.getStringExtra(SelectPictureActivity.RESULT_PICTURE_PATH));
- }
- break;
- case REQUEST_TO_CUT_PICTURE:
- if (data != null) {
- isDataChanged = true;
-
- user = getUser();
- user.setHead(data.getStringExtra(CutPictureActivity.RESULT_PICTURE_PATH));
- setUser(user);
- }
- break;
- }
- }
-
-
- private boolean isDataChanged = false;
- @Override
- public void finish() {
- user = getUser();
- user.setHead(StringUtil.getTrimedString(tvUserRemark));
- if (isOnEditMode && isDataChanged) {
- new AlertDialog(context, "", "资料已改变,需要保存吗?", true, DIALOG_PUT_USER, this).show();
- return;
- }
- if (user != null) {
- CacheManager.getInstance().save(User.class, user, "" + user.getId(), "range=" + 0);//更新缓存
- }
-
- super.finish();
- }
-
-
- //类相关监听>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
- //系统自带监听方法>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
- //Event事件区(只要存在事件监听代码就是)>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
-
-
-
-
-
- //内部类,尽量少用<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
-
- //内部类,尽量少用>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-}
\ No newline at end of file
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/activity_fragment/UserListActivity.java b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/activity_fragment/UserListActivity.java
deleted file mode 100644
index 18210643f..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/activity_fragment/UserListActivity.java
+++ /dev/null
@@ -1,272 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package apijson.demo.client.activity_fragment;
-
-import android.app.Activity;
-import android.content.Context;
-import android.content.Intent;
-import android.os.Bundle;
-import android.view.View;
-
-import com.alibaba.fastjson.JSONObject;
-
-import java.io.Serializable;
-import java.util.List;
-
-import apijson.demo.client.R;
-import apijson.demo.client.application.APIJSONApplication;
-import zuo.biao.apijson.JSON;
-import zuo.biao.library.base.BaseActivity;
-import zuo.biao.library.interfaces.OnBottomDragListener;
-
-/**用户列表界面
- * @author Lemon
- * @use toActivity(UserListActivity.createIntent(...));
- */
-public class UserListActivity extends BaseActivity implements OnBottomDragListener {
- // private static final String TAG = "DemoFragmentActivity";
-
- //启动方法<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- public static final String INTENT_RANGE = "INTENT_RANGE";
- public static final String INTENT_SEARCH = "INTENT_SEARCH";
- public static final String INTENT_SHOW_SEARCH = "INTENT_SHOW_SEARCH";
- public static final String INTENT_ID_LIST = "INTENT_ID_LIST";
-
- /**启动这个Activity的Intent
- * @param context
- * @return
- */
- public static Intent createIntent(Context context) {
- return createIntent(context, UserListFragment.RANGE_USER_CIRCLE
- , APIJSONApplication.getInstance().getCurrentUserId());
- }
- /**启动这个Activity的Intent
- * @param context
- * @param userId
- * @return
- */
- public static Intent createIntent(Context context, long userId) {
- return createIntent(context, UserListFragment.RANGE_USER, userId);
- }
- /**启动这个Activity的Intent
- * showSearch = true;
- * @param context
- * @param range
- * @param id
- * @return
- */
- public static Intent createIntent(Context context, int range, long id) {
- return createIntent(context, range, id, null, true);
- }
- /**启动这个Activity的Intent
- * showSearch = false;
- * @param context
- * @param search
- * @return
- */
- public static Intent createIntent(Context context, JSONObject search) {
- return createIntent(context, search, false);
- }
- /**启动这个Activity的Intent
- * @param context
- * @param search
- * @param showSearch
- * @return
- */
- public static Intent createIntent(Context context, JSONObject search, boolean showSearch) {
- return createIntent(context, UserListFragment.RANGE_ALL, 0, search, showSearch);
- }
- /**启动这个Activity的Intent
- * @param context
- * @param range
- * @param id
- * @param search
- * @param showSearch
- * @return
- */
- public static Intent createIntent(Context context, int range, long id, JSONObject search, boolean showSearch) {
- return new Intent(context, UserListActivity.class)
- .putExtra(INTENT_RANGE, range)
- .putExtra(INTENT_ID, id)
- .putExtra(INTENT_SEARCH, JSON.toJSONString(search))
- .putExtra(INTENT_SHOW_SEARCH, showSearch);
- }
- /**启动这个Activity的Intent
- * @param context
- * @param idList
- * @return
- */
- public static Intent createIntent(Context context, List idList) {
- return new Intent(context, UserListActivity.class)
- .putExtra(INTENT_ID_LIST, (Serializable) idList);
- }
-
- //启动方法>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
- @Override
- public Activity getActivity() {
- return this;
- }
-
- private int range = UserListFragment.RANGE_ALL;
- private long id;
- private String search;
- private boolean showSearch;
- private List idList;
- @SuppressWarnings("unchecked")
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.user_list_activity, this);
-
- range = getIntent().getIntExtra(INTENT_RANGE, range);
- id = getIntent().getLongExtra(INTENT_ID, id);
- search = getIntent().getStringExtra(INTENT_SEARCH);
- showSearch = getIntent().getBooleanExtra(INTENT_SHOW_SEARCH, showSearch);
- idList = (List) getIntent().getSerializableExtra(INTENT_ID_LIST);
-
- //功能归类分区方法,必须调用<<<<<<<<<<
- initView();
- initData();
- initEvent();
- //功能归类分区方法,必须调用>>>>>>>>>>
-
- }
-
-
- //UI显示区(操作UI,但不存在数据获取或处理代码,也不存在事件监听代码)<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- private UserListFragment fragment;
- @Override
- public void initView() {//必须在onCreate方法内调用
- String title;
- switch (range) {
- case UserListFragment.RANGE_ALL:
- title = "全部";
- break;
- case UserListFragment.RANGE_USER:
- title = APIJSONApplication.getInstance().isCurrentUser(id) ? "我的动态" : "TA的动态";
- break;
- case UserListFragment.RANGE_USER_CIRCLE:
- title = "朋友圈";
- break;
- default:
- title = "动态";
- break;
- }
- tvBaseTitle.setText(title);
- autoSetTitle();
-
- findViewById(R.id.ivUserListForward).setVisibility(showSearch ? View.VISIBLE : View.GONE);
-
-
- fragment = idList != null ? UserListFragment.createInstance(idList)
- : UserListFragment.createInstance(range, id, JSON.parseObject(search));
-
- fragmentManager
- .beginTransaction()
- .add(R.id.flUserListContainer, fragment)
- .show(fragment)
- .commit();
- }
-
-
-
- //UI显示区(操作UI,但不存在数据获取或处理代码,也不存在事件监听代码)>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
-
-
-
-
-
-
-
- //Data数据区(存在数据获取或处理代码,但不存在事件监听代码)<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- @Override
- public void initData() {//必须在onCreate方法内调用
-
- }
-
- //Data数据区(存在数据获取或处理代码,但不存在事件监听代码)>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
-
-
-
-
-
- //Event事件区(只要存在事件监听代码就是)<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- @Override
- public void initEvent() {//必须在onCreate方法内调用
-
- }
-
-
- @Override
- public void onDragBottom(boolean rightToLeft) {
- if (rightToLeft) {
- if (showSearch) {
- fragment.onDragBottom(rightToLeft);
- }
-
- return;
- }
-
- finish();
- }
-
- //系统自带监听方法<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
-
-
- //类相关监听<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
-
-
-
-
- //类相关监听>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
- //系统自带监听方法>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
- //类相关监听>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
- //系统自带监听>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
- //Event事件区(只要存在事件监听代码就是)>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
-
-
-
-
-
- //内部类,尽量少用<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
-
-
- //内部类,尽量少用>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-}
\ No newline at end of file
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/activity_fragment/UserListFragment.java b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/activity_fragment/UserListFragment.java
deleted file mode 100755
index 056c07ce7..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/activity_fragment/UserListFragment.java
+++ /dev/null
@@ -1,449 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package apijson.demo.client.activity_fragment;
-
-import android.annotation.SuppressLint;
-import android.app.Activity;
-import android.content.Intent;
-import android.os.Bundle;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.view.ViewGroup;
-import android.widget.AdapterView;
-import android.widget.AdapterView.OnItemClickListener;
-import android.widget.ImageView;
-
-import com.alibaba.fastjson.JSONObject;
-
-import java.io.Serializable;
-import java.util.List;
-
-import apijson.demo.client.R;
-import apijson.demo.client.adapter.UserAdapter;
-import apijson.demo.client.application.APIJSONApplication;
-import apijson.demo.client.base.BaseHttpListFragment;
-import apijson.demo.client.interfaces.TopBarMenuCallback;
-import apijson.demo.client.model.User;
-import apijson.demo.client.util.HttpRequest;
-import zuo.biao.apijson.JSON;
-import zuo.biao.apijson.JSONRequest;
-import zuo.biao.apijson.JSONResponse;
-import zuo.biao.apijson.StringUtil;
-import zuo.biao.library.base.BaseView.OnDataChangedListener;
-import zuo.biao.library.interfaces.AdapterCallBack;
-import zuo.biao.library.interfaces.CacheCallBack;
-import zuo.biao.library.interfaces.OnBottomDragListener;
-import zuo.biao.library.manager.HttpManager.OnHttpResponseListener;
-import zuo.biao.library.ui.EditTextInfoWindow;
-
-/**用户列表界面fragment
- * @author Lemon
- * @use new UserListFragment(),详细使用见.DemoFragmentActivity(initData方法内)
- * @must 查看 .HttpManager 中的@must和@warn
- * 查看 .SettingUtil 中的@must和@warn
- */
-public class UserListFragment extends BaseHttpListFragment
-implements CacheCallBack, OnHttpResponseListener, OnBottomDragListener
-, TopBarMenuCallback, OnDataChangedListener {
- // private static final String TAG = "UserListFragment";
-
- //与Activity通信<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- public static final String ARGUMENT_RANGE = "ARGUMENT_RANGE";
- public static final String ARGUMENT_SEARCH = "ARGUMENT_SEARCH";
- public static final String ARGUMENT_ID_LIST = "ARGUMENT_ID_LIST";
-
- /**
- *
range = RANGE_USER_FRIEND
- *
id = APIJSONApplication.getInstance().getCurrentUserId()
- * @return
- */
- public static UserListFragment createInstance() {
- return createInstance(RANGE_USER_FRIEND, APIJSONApplication.getInstance().getCurrentUserId());
- }
- /**
- * range = RANGE_USER
- * @param userId
- * @return
- */
- public static UserListFragment createInstance(long userId) {
- return createInstance(RANGE_USER, userId);
- }
- /**
- * @param range
- * @param id
- * @return
- */
- public static UserListFragment createInstance(int range, long id) {
- return createInstance(range, id, null);
- }
- /**
- * range = RANGE_ALL
- * @param search
- * @return
- */
- public static UserListFragment createInstance(JSONObject search) {
- return createInstance(RANGE_ALL, 0, search);
- }
- /**
- * @param range
- * @param id
- * @param search
- * @return
- */
- public static UserListFragment createInstance(int range, long id, JSONObject search) {
- UserListFragment fragment = new UserListFragment();
-
- Bundle bundle = new Bundle();
- bundle.putInt(ARGUMENT_RANGE, range);
- bundle.putLong(ARGUMENT_ID, id);
- bundle.putString(ARGUMENT_SEARCH, JSON.toJSONString(search));
-
- fragment.setArguments(bundle);
- return fragment;
- }
- /**
- * @param idList
- * @return
- */
- public static UserListFragment createInstance(List idList) {
- UserListFragment fragment = new UserListFragment();
-
- Bundle bundle = new Bundle();
- bundle.putSerializable(ARGUMENT_ID_LIST, (Serializable) idList);
-
- fragment.setArguments(bundle);
- return fragment;
- }
-
- //与Activity通信>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
- public static final int RANGE_ALL = HttpRequest.RANGE_ALL;
- public static final int RANGE_USER = HttpRequest.RANGE_USER;
- public static final int RANGE_USER_FRIEND = HttpRequest.RANGE_USER_FRIEND;
- public static final int RANGE_USER_CIRCLE = HttpRequest.RANGE_USER_CIRCLE;
- public static final int RANGE_MOMENT = HttpRequest.RANGE_MOMENT;
- public static final int RANGE_COMMENT = HttpRequest.RANGE_COMMENT;
-
-
- private int range = RANGE_ALL;
- private long id = 0;
- private JSONObject search;
- private List idList;
- @SuppressWarnings("unchecked")
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
- super.onCreateView(inflater, container, savedInstanceState);
-
- registerObserver(this);
-
- argument = getArguments();
- if (argument != null) {
- idList = (List) argument.getSerializable(ARGUMENT_ID_LIST);
- if (idList == null) {
- range = argument.getInt(ARGUMENT_RANGE, range);
- id = argument.getLong(ARGUMENT_ID, id);
- search = JSON.parseObject(argument.getString(ARGUMENT_SEARCH));//JSONObject can't be serializabled
- }
- }
-
- initCache(this);
-
- //功能归类分区方法,必须调用<<<<<<<<<<
- initView();
- initData();
- initEvent();
- //功能归类分区方法,必须调用>>>>>>>>>>
-
- lvBaseList.onRefresh();
-
- return view;
- }
-
-
- //UI显示区(操作UI,但不存在数据获取或处理代码,也不存在事件监听代码)<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- @Override
- public void initView() {//必须调用
- super.initView();
-
- }
-
- @Override
- public void setList(final List list) {
- setList(new AdapterCallBack() {
-
- @Override
- public UserAdapter createAdapter() {
- return new UserAdapter(context);
- }
-
- @Override
- public void refreshAdapter() {
- adapter.refresh(list);
- }
- });
- }
-
-
- private ImageView leftMenu;
- @SuppressLint("InflateParams")
- @Override
- public View getLeftMenu(Activity activity) {
- if (leftMenu == null) {
- leftMenu = (ImageView) LayoutInflater.from(activity).inflate(R.layout.top_right_iv, null);
- leftMenu.setImageResource(R.drawable.add);
- leftMenu.setOnClickListener(new OnClickListener() {
-
- @Override
- public void onClick(View v) {
- onDragBottom(false);
- }
- });
- }
- return leftMenu;
- }
-
- private ImageView rightMenu;
- @SuppressLint("InflateParams")
- @Override
- public View getRightMenu(Activity activity) {
- if (rightMenu == null) {
- rightMenu = (ImageView) LayoutInflater.from(activity).inflate(R.layout.top_right_iv, null);
- rightMenu.setImageResource(R.drawable.search);
- rightMenu.setOnClickListener(new OnClickListener() {
-
- @Override
- public void onClick(View v) {
- onDragBottom(true);
- }
- });
- }
- return rightMenu;
- }
-
- //UI显示区(操作UI,但不存在数据获取或处理代码,也不存在事件监听代码)>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
-
-
-
-
-
-
-
- //Data数据区(存在数据获取或处理代码,但不存在事件监听代码)<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- @Override
- public void initData() {//必须调用
- super.initData();
-
- }
-
- @Override
- public void getListAsync(final int page) {
- HttpRequest.getUserList(range, id, search, idList, getCacheCount(), page, -page, this);
- }
-
- @Override
- public List parseArray(String json) {
- return new JSONResponse(json).getList(getCacheClass().getSimpleName() + "[]", getCacheClass());
- }
-
- @Override
- public Class getCacheClass() {
- return User.class;
- }
- @Override
- public String getCacheGroup() {
- if (search != null || idList != null) {
- return null;
- }
- if (range == RANGE_ALL) {
- return "range=" + range;
- }
- return range == RANGE_USER || range == RANGE_MOMENT || range == RANGE_COMMENT
- ? null : "range=" + range + ";userId=" + id;
- }
- @Override
- public String getCacheId(User data) {
- return data == null ? null : "" + data.getId();
- }
- @Override
- public int getCacheCount() {
- return 10;
- }
-
- public int searchType = 0;
- public void setSearchType(int searchType) {
- this.searchType = searchType;
- }
-
- //Data数据区(存在数据获取或处理代码,但不存在事件监听代码)>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
-
-
-
-
-
- //Event事件区(只要存在事件监听代码就是)<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
-
- @Override
- public void initEvent() {//必须调用
- super.initEvent();
-
- lvBaseList.setOnItemClickListener(new OnItemClickListener() {
-
- @Override
- public void onItemClick(AdapterView> parent, View view, int position, long id) {
- toActivity(UserActivity.createIntent(context, id));
- }
- });
- }
-
- @Override
- public void onDragBottom(boolean rightToLeft) {
- if (isAlive() == false) {
- return;
- }
-
- if (rightToLeft == false) {
- startActivity(UserListActivity.createIntent(context, RANGE_ALL, 0).putExtra(INTENT_TITLE, "添加"));
- context.overridePendingTransition(R.anim.bottom_push_in, R.anim.hold);
- } else {
- if (range != RANGE_ALL && verifyLogin() == false) {
- return;
- }
-
- showShortToast("输入为空则查看全部");
- if (searchType <= 0) {
- searchType = EditTextInfoWindow.TYPE_PHONE;
- }
-// if (searchType == EditTextInfoWindow.TYPE_NAME) {
- toActivity(EditTextInfoWindow.createIntent(context
- , EditTextInfoWindow.TYPE_NAME, "姓名", null),
- REQUEST_TO_EDIT_TEXT_INFO_SEARCH, false);
-// } else {
-// toActivity(EditTextInfoWindow.createIntent(context
-// , EditTextInfoWindow.TYPE_PHONE, "手机号", null),
-// REQUEST_TO_EDIT_TEXT_INFO_ADD, false);
-// }
- }
-
- }
-
-
- @Override
- public void onDataChanged() {
- if (range == RANGE_USER_FRIEND) {
- super.onRefresh();
- }
- }
-
-
- @Override
- public void onHttpResponse(int requestCode, String resultJson, Exception e) {
- JSONResponse response = new JSONResponse(resultJson);
- if ((range == RANGE_USER_FRIEND) && verifyHttpLogin(response.getCode()) == false) {
- return;
- }
- super.onHttpResponse(requestCode, resultJson, e);
- }
-
- //系统自带监听方法 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
-
-
- //类相关监听<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- public static final int REQUEST_TO_EDIT_TEXT_INFO_SEARCH = 1;
- public static final int REQUEST_TO_EDIT_TEXT_INFO_ADD = 2;
- @Override
- public void onActivityResult(int requestCode, int resultCode, Intent data) {
- super.onActivityResult(requestCode, resultCode, data);
- if (resultCode != RESULT_OK) {
- return;
- }
- switch (requestCode) {
- case REQUEST_TO_EDIT_TEXT_INFO_SEARCH:
- case REQUEST_TO_EDIT_TEXT_INFO_ADD:
- if (data != null) {
- boolean isSearch = requestCode == REQUEST_TO_EDIT_TEXT_INFO_SEARCH;
- String value = StringUtil.getString(data.getStringExtra(EditTextInfoWindow.RESULT_VALUE));
- String split = "";
- JSONRequest search = new JSONRequest();
- if (StringUtil.isNotEmpty(value, true)) {
- split = ":";
- if (isSearch) {
- search.putsSearch(HttpRequest.NAME, value);
- } else {
- search.puts(HttpRequest.PHONE, value);
- }
- }
- intent = isSearch
- ? UserListActivity.createIntent(context, range, id, search, false)
- : UserListActivity.createIntent(context, search, false);
- toActivity(intent.putExtra(INTENT_TITLE, "搜索" + split + value));
- }
- break;
- default:
- break;
- }
- }
-
-
- @Override
- public void onDestroy() {
- if (leftMenu != null) {
- leftMenu.destroyDrawingCache();
- leftMenu = null;
- }
- if (rightMenu != null) {
- rightMenu.destroyDrawingCache();
- rightMenu = null;
- }
-
- super.onDestroy();
- }
-
- //类相关监听>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
- //系统自带监听方法>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
- //Event事件区(只要存在事件监听代码就是)>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
-
-
-
-
-
- //内部类,尽量少用<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
-
- //内部类,尽量少用>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-}
\ No newline at end of file
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/activity_fragment/WalletActivity.java b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/activity_fragment/WalletActivity.java
deleted file mode 100644
index 5588e365a..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/activity_fragment/WalletActivity.java
+++ /dev/null
@@ -1,296 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package apijson.demo.client.activity_fragment;
-
-import zuo.biao.apijson.JSONResponse;
-import zuo.biao.library.interfaces.OnBottomDragListener;
-import zuo.biao.library.manager.HttpManager.OnHttpResponseListener;
-import zuo.biao.library.ui.EditTextInfoActivity;
-import zuo.biao.library.ui.EditTextInfoWindow;
-import zuo.biao.library.util.StringUtil;
-import android.app.Activity;
-import android.content.Context;
-import android.content.Intent;
-import android.os.Bundle;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.widget.TextView;
-import apijson.demo.client.R;
-import apijson.demo.client.base.BaseActivity;
-import apijson.demo.client.util.HttpRequest;
-import apijson.demo.server.model.Privacy;
-
-/**钱包界面
- * @author Lemon
- * @use toActivity(WalletActivity.createIntent(...));
- */
-public class WalletActivity extends BaseActivity implements OnClickListener, OnBottomDragListener
-, OnHttpResponseListener {
- private static final String TAG = "WalletActivity";
-
- //启动方法<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- /**启动这个Activity的Intent
- * @param context
- * @return
- */
- public static Intent createIntent(Context context) {
- return new Intent(context, WalletActivity.class);
- }
-
- //启动方法>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
- @Override
- public Activity getActivity() {
- return this;
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.wallet_activity, this);
-
- //功能归类分区方法,必须调用<<<<<<<<<<
- initView();
- initData();
- initEvent();
- //功能归类分区方法,必须调用>>>>>>>>>>
-
- }
-
-
- //UI显示区(操作UI,但不存在数据获取或处理代码,也不存在事件监听代码)<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- private TextView tvWalletCount;
- @Override
- public void initView() {//必须调用
- autoSetTitle();
-
- tvWalletCount = (TextView) findViewById(R.id.tvWalletCount);
- }
-
-
- private Privacy privacy;
- public void setWallet(Privacy privacy_) {
- this.privacy = privacy_;
- runUiThread(new Runnable() {
-
- @Override
- public void run() {
- dismissProgressDialog();
- tvBaseTitle.setText(getTitleName());
- if (privacy == null) {
- privacy = new Privacy();
- }
- tvWalletCount.setText(StringUtil.getPrice(privacy.getBalance(), StringUtil.PRICE_FORMAT_PREFIX));
- }
- });
- }
-
- //UI显示区(操作UI,但不存在数据获取或处理代码,也不存在事件监听代码)>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
-
-
-
-
-
-
-
- //Data数据区(存在数据获取或处理代码,但不存在事件监听代码)<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- @Override
- public void initData() {//必须调用
-
- showProgressDialog(getTitleName());
- HttpRequest.getPrivacy(HTTP_GET, this);
- }
-
- public String getTitleName() {
- return isSucceed || isShowingProgress() ? "钱包" : "有点问题,点击重试";
- }
-
- //Data数据区(存在数据获取或处理代码,但不存在事件监听代码)>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
-
-
-
-
-
- //Event事件区(只要存在事件监听代码就是)<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- @Override
- public void initEvent() {//必须调用
-
- findViewById(R.id.tvWalletRecharge).setOnClickListener(this);
- findViewById(R.id.tvWalletWithdraw).setOnClickListener(this);
- }
-
- @Override
- public void onDragBottom(boolean rightToLeft) {
- if (rightToLeft) {
-
- return;
- }
-
- finish();
- }
-
-
- private static final int HTTP_GET = 1;
- private static final int HTTP_RECHARGE = 2;
- private static final int HTTP_WITHDRAW = 3;
-
- private boolean isSucceed = true;
- @Override
- public void onHttpResponse(final int requestCode, final String resultJson, Exception e) {
- runThread(TAG + "onHttpResponse", new Runnable() {
-
- @Override
- public void run() {
-
- JSONResponse response = new JSONResponse(resultJson);
- if (verifyHttpLogin(response.getCode()) == false) {
- return;
- }
-
- isSucceed = JSONResponse.isSuccess(response);
-
- dismissProgressDialog();
- switch (requestCode) {
- case HTTP_RECHARGE:
- case HTTP_WITHDRAW:
- if (response.getCode() == JSONResponse.CODE_CONDITION_ERROR) {
- showShortToast("密码错误!");
- } else if (requestCode == HTTP_WITHDRAW && response.getCode() == JSONResponse.CODE_OUT_OF_RANGE) {
- showShortToast("余额不足!");
- } else {
- showShortToast((requestCode == HTTP_RECHARGE ? "充值" : "提现")
- + getString(isSucceed ? R.string.succeed : R.string.failed));
- if (isSucceed) {
- initData();
- }
- }
- break;
- case HTTP_GET:
- if (isSucceed) {
- setWallet(response.getObject(Privacy.class));
- } else {
- showShortToast(R.string.get_failed);
- }
- break;
- default:
- break;
- }
- }
- });
- }
-
- //系统自带监听<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
-
- @Override
- public void onClick(View v) {
- switch (v.getId()) {
- case R.id.tvWalletRecharge:
- toActivity(EditTextInfoWindow.createIntent(context, EditTextInfoWindow.TYPE_DECIMAL, "充值", null)
- , REQUEST_RECHARGE, false);
- break;
- case R.id.tvWalletWithdraw:
- toActivity(EditTextInfoWindow.createIntent(context, EditTextInfoWindow.TYPE_DECIMAL, "提现", null)
- , REQUEST_WITHDRAW, false);
- break;
- default:
- break;
- }
- }
-
-
-
-
- //类相关监听<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
-
- private static final int REQUEST_RECHARGE = 1;
- private static final int REQUEST_WITHDRAW = 2;
- private static final int REQUEST_PASSWORD = 3;
-
- private boolean isRecharge;
- private double change;
- @Override
- public void onActivityResult(int requestCode, int resultCode, Intent data) {
- super.onActivityResult(requestCode, resultCode, data);
- if (resultCode != RESULT_OK) {
- return;
- }
- switch (requestCode) {
- case REQUEST_RECHARGE:
- case REQUEST_WITHDRAW:
- if (data == null) {
- break;
- }
- String value = data.getStringExtra(EditTextInfoActivity.RESULT_VALUE);
- try {
- this.change = Double.valueOf(value);
- } catch (Exception e) {
- showShortToast("输入值不是数字!");
- }
- if (change <= 0 || change > 10000) {
- showShortToast("输入值必须为0-10000间的数字!");
- } else {
- startActivityForResult(NumberPasswordActivity.createIntent(context), REQUEST_PASSWORD);
- overridePendingTransition(R.anim.bottom_push_in, R.anim.fade);
- this.isRecharge = requestCode == REQUEST_RECHARGE;
- }
- break;
- case REQUEST_PASSWORD:
- String password = data == null ? null : data.getStringExtra(EditTextInfoActivity.RESULT_PASSWORD);
- password = StringUtil.getString(password);
- if (password.isEmpty() == false) {
- showProgressDialog();
- HttpRequest.changeBalance(isRecharge ? change : -change, password
- , isRecharge ? HTTP_RECHARGE : HTTP_WITHDRAW, this);
- }
- break;
- }
-
- }
-
-
- //类相关监听>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
- //系统自带监听>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
- //Event事件区(只要存在事件监听代码就是)>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
-
-
-
-
-
- //内部类,尽量少用<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
-
-
- //内部类,尽量少用>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-}
\ No newline at end of file
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/activity_fragment/package-info.java b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/activity_fragment/package-info.java
deleted file mode 100755
index 55988b69b..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/activity_fragment/package-info.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-/**
- * Activity、Fragment所在包
- * 因为Activity和Fragment(结构、生命周期等)很相似,且有时会相互改写,所以放在同一个包下便于管理
- */
-/**
- * @author Lemon
- *
- */
-package apijson.demo.client.activity_fragment;
\ No newline at end of file
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/adapter/CommentAdapter.java b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/adapter/CommentAdapter.java
deleted file mode 100644
index c1da62be9..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/adapter/CommentAdapter.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package apijson.demo.client.adapter;
-
-import android.app.Activity;
-import android.view.ViewGroup;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import apijson.demo.client.model.CommentItem;
-import apijson.demo.client.view.CommentView;
-import apijson.demo.client.view.CommentView.OnCommentClickListener;
-import apijson.demo.client.view.CommentView.OnShowAllListener;
-import zuo.biao.library.base.BaseViewAdapter;
-
-/**评论列表
- * @author Lemon
- */
-public class CommentAdapter extends BaseViewAdapter {
-
-
- private OnCommentClickListener onCommentClickListener;
-
- public CommentAdapter(Activity context, OnCommentClickListener onCommentClickListener) {
- super(context);
- this.onCommentClickListener = onCommentClickListener;
- }
-
- @Override
- public long getItemId(int position) {
- return getItem(position).getId();
- }
-
- private boolean showAll = false;
-
- public void setShowAll(boolean showAll) {
- this.showAll = showAll;
- }
-
- @Override
- public synchronized void refresh(List list) {
- showAllMap.clear();
- super.refresh(list);
- }
-
- @Override
- public CommentView createView(int position, ViewGroup parent) {
- return new CommentView(context, resources)
- .setOnCommentClickListener(onCommentClickListener)
- .setOnShowAllListener(new OnShowAllListener() {
- @Override
- public void onShowAll(int position, CommentView bv, boolean show) {
- showAllMap.put(position, show);
- bindView(position, bv);
- }
- });
- }
-
- private Map showAllMap = new HashMap<>();
-
- @Override
- public void bindView(int position, CommentView bv) {
- //true : showAllMap.get(position)怎么搞都崩溃
- bv.setShowAll(showAll ? Boolean.valueOf(true) : showAllMap.get(position));
- super.bindView(position, bv);
- }
-
-}
\ No newline at end of file
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/adapter/MomentAdapter.java b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/adapter/MomentAdapter.java
deleted file mode 100644
index 264d91398..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/adapter/MomentAdapter.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package apijson.demo.client.adapter;
-
-import android.app.Activity;
-import android.view.ViewGroup;
-
-import apijson.demo.client.model.MomentItem;
-import apijson.demo.client.view.MomentView;
-import zuo.biao.library.base.BaseView.OnDataChangedListener;
-import zuo.biao.library.base.BaseViewAdapter;
-
-/**adapter模板
- * @author Lemon
- * @use new MomentAdapter(),具体参考.DemoActivity(setList方法内)
- */
-public class MomentAdapter extends BaseViewAdapter {
- // private static final String TAG = "MomentAdapter";
-
-
- public MomentAdapter(Activity context) {
- super(context);
- }
-
- @Override
- public MomentView createView(int position, ViewGroup parent) {
- final MomentView itemView = new MomentView(context, resources);
- itemView.setOnDataChangedListener(new OnDataChangedListener() {
-
- @Override
- public void onDataChanged() {
- if (list == null) {
- return;
- }
- MomentItem data = itemView.getData();
- if (data == null) {
- if (itemView.getPosition() >= 0 && itemView.getPosition() < list.size()) {
- list.remove(itemView.getPosition());
- notifyDataSetChanged();
- }
- } else {
- list.set(itemView.getPosition(), data);
- itemView.bindView(data);
- }
- }
- });
- return itemView;
- }
-
- @Override
- public long getItemId(int position) {
- return getItem(position).getId();
- }
-
-}
\ No newline at end of file
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/adapter/UserAdapter.java b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/adapter/UserAdapter.java
deleted file mode 100755
index fb426b154..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/adapter/UserAdapter.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package apijson.demo.client.adapter;
-
-import zuo.biao.library.base.BaseViewAdapter;
-import android.app.Activity;
-import android.view.ViewGroup;
-import apijson.demo.client.model.User;
-import apijson.demo.client.view.UserView;
-
-/**用户adapter
- * @author Lemon
- */
-public class UserAdapter extends BaseViewAdapter {
- // private static final String TAG = "UserAdapter";
-
- public UserAdapter(Activity context) {
- super(context);
- }
-
- @Override
- public UserView createView(int position, ViewGroup parent) {
- return new UserView(context, resources);
- }
-
- @Override
- public long getItemId(int position) {
- return getItem(position).getId();
- }
-}
\ No newline at end of file
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/application/APIJSONApplication.java b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/application/APIJSONApplication.java
deleted file mode 100755
index 9bd686d1f..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/application/APIJSONApplication.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package apijson.demo.client.application;
-
-import zuo.biao.library.base.BaseApplication;
-import zuo.biao.library.util.StringUtil;
-import android.util.Log;
-import apijson.demo.client.manager.DataManager;
-import apijson.demo.client.model.User;
-
-/**Application
- * @author Lemon
- */
-public class APIJSONApplication extends BaseApplication {
- private static final String TAG = "APIJSONApplication";
-
- private static APIJSONApplication context;
- public static APIJSONApplication getInstance() {
- return context;
- }
-
- @Override
- public void onCreate() {
- super.onCreate();
- context = this;
-
- }
-
-
- /**获取当前用户id
- * @return
- */
- public long getCurrentUserId() {
- currentUser = getCurrentUser();
- Log.d(TAG, "getCurrentUserId currentUserId = " + (currentUser == null ? "null" : currentUser.getId()));
- return currentUser == null ? 0 : currentUser.getId();
- }
- /**获取当前用户phone
- * @return
- */
- public String getCurrentUserPhone() {
- currentUser = getCurrentUser();
- return currentUser == null ? null : currentUser.getPhone();
- }
-
-
- private static User currentUser = null;
- public User getCurrentUser() {
- if (currentUser == null) {
- currentUser = DataManager.getInstance().getCurrentUser();
- }
- return currentUser;
- }
-
- public void saveCurrentUser(User user) {
- if (user == null) {
- Log.e(TAG, "saveCurrentUser currentUser == null >> return;");
- return;
- }
- if (user.getId() <= 0 && StringUtil.isNotEmpty(user.getName(), true) == false) {
- Log.e(TAG, "saveCurrentUser user.getId() <= 0" +
- " && StringUtil.isNotEmpty(user.getName(), true) == false >> return;");
- return;
- }
-
- if (currentUser != null && user.getId().equals(currentUser.getId())
- && StringUtil.isNotEmpty(user.getPhone(), true) == false) {
- user.setPhone(currentUser.getPhone());
- }
- currentUser = user;
- DataManager.getInstance().saveCurrentUser(currentUser);
- }
-
- public void logout() {
- currentUser = null;
- DataManager.getInstance().saveCurrentUser(currentUser);
- }
-
- /**判断是否为当前用户
- * @param userId
- * @return
- */
- public boolean isCurrentUser(long userId) {
- return DataManager.getInstance().isCurrentUser(userId);
- }
-
- public boolean isLoggedIn() {
- return getCurrentUserId() > 0;
- }
-
-
-
-}
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/base/BaseActivity.java b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/base/BaseActivity.java
deleted file mode 100644
index df04738e7..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/base/BaseActivity.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package apijson.demo.client.base;
-
-import zuo.biao.apijson.JSONResponse;
-import zuo.biao.library.base.BaseBroadcastReceiver;
-import zuo.biao.library.base.BaseView.OnDataChangedListener;
-import zuo.biao.library.util.Log;
-import zuo.biao.library.util.StringUtil;
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.os.Bundle;
-import apijson.demo.client.R;
-import apijson.demo.client.activity_fragment.LoginActivity;
-import apijson.demo.client.application.APIJSONApplication;
-import apijson.demo.client.model.User;
-import apijson.demo.client.util.ActionUtil;
-
-public abstract class BaseActivity extends zuo.biao.library.base.BaseActivity {
- private static final String TAG = "BaseActivity";
-
-
- protected User currentUser;
- protected long currentUserId;
- protected boolean isLoggedIn;
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
-
- setCurrentUser();
-
- }
-
- private void setCurrentUser() {
- currentUser = APIJSONApplication.getInstance().getCurrentUser();
- currentUserId = currentUser == null ? 0 : currentUser.getId();
- isLoggedIn = isCurrentUserCorrect();
- }
-
- protected boolean verifyHttpLogin(int code) {
- if (isAlive() == false) {
- return true;
- }
- if (code == JSONResponse.CODE_NOT_LOGGED_IN) {
- APIJSONApplication.getInstance().logout();
- setCurrentUser();
- }
- return verifyLogin();
- }
- protected static boolean isCurrentUser(long userId) {
- return APIJSONApplication.getInstance().isCurrentUser(userId);
- }
- /**未登录会toLoginActivity();
- * @return isLoggedIn
- */
- protected boolean verifyLogin() {
- if (isLoggedIn == false) {
- showShortToast("请先登录");
- toLoginActivity();
- }
- return isLoggedIn;
- }
- protected void toLoginActivity() {
- startActivity(LoginActivity.createIntent(context));
- context.overridePendingTransition(R.anim.bottom_push_in, R.anim.hold);
- }
-
- @Override
- public void initData() {
- loadAfterCorrect();
- }
-
-
- private boolean isDataChanged = false;
- /**
- */
- protected void invalidate() {
- if (isRunning() == false) {
- isDataChanged = true;
- Log.w(TAG, "onDataChanged isRunning() == false >> return;");
- return;
- }
- isDataChanged = false;
-
- setCurrentUser();
- loadAfterCorrect();
- }
-
- @Override
- public void onResume() {
- super.onResume();
- if (isDataChanged) {
- if (onDataChangedListener != null) {
- Log.d(TAG, "onResume isDataChanged >> onDataChangedListener.onDataChanged();");
- onDataChangedListener.onDataChanged();
- }
- }
- }
-
- /**
- * @param runnable
- */
- protected void loadAfterCorrect() {
- if (isCurrentUserCorrect() == false) {//请求currentUser都统一交给MainTabActivity,避免同时多次相同请求
- Log.e(TAG, "loadAfterCorrect isCurrentUserCorrect() == false >> return;");
- return;
- }
- if (onDataChangedListener != null) {
- onDataChangedListener.onDataChanged();
- }
- }
-
-
- /**
- * @return
- */
- public boolean isCurrentUserCorrect() {
- return isUserCorrect(currentUser);
- }
- /**
- * @param user
- * @return
- */
- public boolean isUserCorrect(User user) {
- return user != null && user.getId() > 0;
- }
-
-
- @Override
- protected void onDestroy() {
- unregisterObserver();
- super.onDestroy();
- }
-
- private OnDataChangedListener onDataChangedListener;
- protected void registerObserver(OnDataChangedListener onDataChangedListener) {
- this.onDataChangedListener = onDataChangedListener;
- BaseBroadcastReceiver.register(context, receiver, ActionUtil.ACTION_USER_CHANGED);
- }
- protected void unregisterObserver() {
- onDataChangedListener = null;
- BaseBroadcastReceiver.unregister(context, receiver);
- }
-
- private BroadcastReceiver receiver = new BroadcastReceiver() {
-
- public void onReceive(Context context, Intent intent) {
- String action = intent == null ? null : intent.getAction();
- if (isAlive() == false || StringUtil.isNotEmpty(action, true) == false) {
- Log.e(TAG, "receiver.onReceive isAlive() == false" +
- " || StringUtil.isNotEmpty(action, true) == false >> return;");
- return;
- }
-
- if (ActionUtil.ACTION_USER_CHANGED.equals(action)) {
- if (isCurrentUser(intent.getLongExtra(INTENT_ID, 0))) {
- invalidate();
- }
- }
- }
- };
-
-}
\ No newline at end of file
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/base/BaseBottomTabActivity.java b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/base/BaseBottomTabActivity.java
deleted file mode 100644
index c4f2a86f2..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/base/BaseBottomTabActivity.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package apijson.demo.client.base;
-
-import zuo.biao.apijson.JSONResponse;
-import zuo.biao.library.base.BaseBroadcastReceiver;
-import zuo.biao.library.base.BaseView.OnDataChangedListener;
-import zuo.biao.library.util.Log;
-import zuo.biao.library.util.StringUtil;
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.os.Bundle;
-import apijson.demo.client.R;
-import apijson.demo.client.activity_fragment.LoginActivity;
-import apijson.demo.client.application.APIJSONApplication;
-import apijson.demo.client.model.User;
-import apijson.demo.client.util.ActionUtil;
-
-public abstract class BaseBottomTabActivity extends zuo.biao.library.base.BaseBottomTabActivity {
- private static final String TAG = "BaseBottomTabActivity";
-
-
- protected User currentUser;
- protected long currentUserId;
- protected boolean isLoggedIn;
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
-
- setCurrentUser();
-
- }
-
- private void setCurrentUser() {
- currentUser = APIJSONApplication.getInstance().getCurrentUser();
- currentUserId = currentUser == null ? 0 : currentUser.getId();
- isLoggedIn = isCurrentUserCorrect();
- }
-
- protected boolean verifyHttpLogin(int code) {
- if (isAlive() == false) {
- return true;
- }
- if (code == JSONResponse.CODE_NOT_LOGGED_IN) {
- APIJSONApplication.getInstance().logout();
- setCurrentUser();
- }
- return verifyLogin();
- }
- protected static boolean isCurrentUser(long userId) {
- return APIJSONApplication.getInstance().isCurrentUser(userId);
- }
- /**未登录会toLoginActivity();
- * @return isLoggedIn
- */
- protected boolean verifyLogin() {
- if (isLoggedIn == false) {
- showShortToast("请先登录");
- toLoginActivity();
- }
- return isLoggedIn;
- }
- protected void toLoginActivity() {
- startActivity(LoginActivity.createIntent(context));
- context.overridePendingTransition(R.anim.bottom_push_in, R.anim.hold);
- }
-
- @Override
- public void initData() {
- super.initData();
- loadAfterCorrect();
- }
-
-
- private boolean isDataChanged = false;
- /**
- */
- protected void invalidate() {
- if (isRunning() == false) {
- isDataChanged = true;
- Log.w(TAG, "onDataChanged isRunning() == false >> return;");
- return;
- }
- isDataChanged = false;
-
- setCurrentUser();
- loadAfterCorrect();
- }
-
- @Override
- public void onResume() {
- super.onResume();
- if (isDataChanged) {
- if (onDataChangedListener != null) {
- Log.d(TAG, "onResume isDataChanged >> onDataChangedListener.onDataChanged();");
- onDataChangedListener.onDataChanged();
- }
- }
- }
-
- /**
- * @param runnable
- */
- protected void loadAfterCorrect() {
- if (isCurrentUserCorrect() == false) {//请求currentUser都统一交给MainTabActivity,避免同时多次相同请求
- Log.e(TAG, "loadAfterCorrect isCurrentUserCorrect() == false >> return;");
- return;
- }
- if (onDataChangedListener != null) {
- onDataChangedListener.onDataChanged();
- }
- }
-
-
- /**
- * @return
- */
- public boolean isCurrentUserCorrect() {
- return isUserCorrect(currentUser);
- }
- /**
- * @param user
- * @return
- */
- public boolean isUserCorrect(User user) {
- return user != null && user.getId() > 0;
- }
-
-
- @Override
- protected void onDestroy() {
- unregisterObserver();
- super.onDestroy();
- }
-
- private OnDataChangedListener onDataChangedListener;
- protected void registerObserver(OnDataChangedListener onDataChangedListener) {
- this.onDataChangedListener = onDataChangedListener;
- BaseBroadcastReceiver.register(context, receiver, ActionUtil.ACTION_USER_CHANGED);
- }
- protected void unregisterObserver() {
- onDataChangedListener = null;
- BaseBroadcastReceiver.unregister(context, receiver);
- }
-
- private BroadcastReceiver receiver = new BroadcastReceiver() {
-
- public void onReceive(Context context, Intent intent) {
- String action = intent == null ? null : intent.getAction();
- if (isAlive() == false || StringUtil.isNotEmpty(action, true) == false) {
- Log.e(TAG, "receiver.onReceive isAlive() == false" +
- " || StringUtil.isNotEmpty(action, true) == false >> return;");
- return;
- }
-
- if (ActionUtil.ACTION_USER_CHANGED.equals(action)) {
- if (isCurrentUser(intent.getLongExtra(INTENT_ID, 0))) {
- invalidate();
- }
- }
- }
- };
-
-}
\ No newline at end of file
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/base/BaseFragment.java b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/base/BaseFragment.java
deleted file mode 100644
index bfbe974f7..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/base/BaseFragment.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package apijson.demo.client.base;
-
-import zuo.biao.apijson.JSONResponse;
-import zuo.biao.library.base.BaseBroadcastReceiver;
-import zuo.biao.library.base.BaseView.OnDataChangedListener;
-import zuo.biao.library.util.Log;
-import zuo.biao.library.util.StringUtil;
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.os.Bundle;
-import android.support.annotation.Nullable;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import apijson.demo.client.R;
-import apijson.demo.client.activity_fragment.LoginActivity;
-import apijson.demo.client.application.APIJSONApplication;
-import apijson.demo.client.model.User;
-import apijson.demo.client.util.ActionUtil;
-
-public abstract class BaseFragment extends zuo.biao.library.base.BaseFragment {
- private static final String TAG = "BaseFragment";
-
-
- protected User currentUser;
- protected long currentUserId;
- protected boolean isLoggedIn;
- @Override
- @Nullable
- public View onCreateView(LayoutInflater inflater,
- @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
- super.onCreateView(inflater, container, savedInstanceState);
-
- setCurrentUser();
-
- return view;
- }
-
- private void setCurrentUser() {
- currentUser = APIJSONApplication.getInstance().getCurrentUser();
- currentUserId = currentUser == null ? 0 : currentUser.getId();
- isLoggedIn = isCurrentUserCorrect();
- }
-
- protected boolean verifyHttpLogin(int code) {
- if (isAlive() == false) {
- return true;
- }
- if (code == JSONResponse.CODE_NOT_LOGGED_IN) {
- APIJSONApplication.getInstance().logout();
- setCurrentUser();
- }
- return verifyLogin();
- }
- protected static boolean isCurrentUser(long userId) {
- return APIJSONApplication.getInstance().isCurrentUser(userId);
- }
- /**未登录会toLoginActivity();
- * @return isLoggedIn
- */
- protected boolean verifyLogin() {
- if (isLoggedIn == false) {
- showShortToast("请先登录");
- toLoginActivity();
- }
- return isLoggedIn;
- }
- protected void toLoginActivity() {
- startActivity(LoginActivity.createIntent(context));
- context.overridePendingTransition(R.anim.bottom_push_in, R.anim.hold);
- }
-
- @Override
- public void initData() {
- loadAfterCorrect();
- }
-
-
- private boolean isDataChanged = false;
- /**
- */
- protected void invalidate() {
- if (isRunning() == false) {
- isDataChanged = true;
- Log.w(TAG, "onDataChanged isRunning() == false >> return;");
- return;
- }
- isDataChanged = false;
-
- setCurrentUser();
- loadAfterCorrect();
- }
-
- @Override
- public void onResume() {
- super.onResume();
- if (isDataChanged) {
- if (onDataChangedListener != null) {
- Log.d(TAG, "onResume isDataChanged >> onDataChangedListener.onDataChanged();");
- onDataChangedListener.onDataChanged();
- }
- }
- }
-
- /**
- * @param runnable
- */
- protected void loadAfterCorrect() {
- if (isCurrentUserCorrect() == false) {//请求currentUser都统一交给MainTabActivity,避免同时多次相同请求
- Log.e(TAG, "loadAfterCorrect isCurrentUserCorrect() == false >> return;");
- return;
- }
- if (onDataChangedListener != null) {
- onDataChangedListener.onDataChanged();
- }
- }
-
-
- /**
- * @return
- */
- public boolean isCurrentUserCorrect() {
- return isUserCorrect(currentUser);
- }
- /**
- * @param user
- * @return
- */
- public boolean isUserCorrect(User user) {
- return user != null && user.getId() > 0;
- }
-
-
- @Override
- public void onDestroy() {
- unregisterObserver();
- super.onDestroy();
- }
-
- private OnDataChangedListener onDataChangedListener;
- protected void registerObserver(OnDataChangedListener onDataChangedListener) {
- this.onDataChangedListener = onDataChangedListener;
- BaseBroadcastReceiver.register(context, receiver, ActionUtil.ACTION_USER_CHANGED);
- }
- protected void unregisterObserver() {
- onDataChangedListener = null;
- BaseBroadcastReceiver.unregister(context, receiver);
- }
-
- private BroadcastReceiver receiver = new BroadcastReceiver() {
-
- public void onReceive(Context context, Intent intent) {
- String action = intent == null ? null : intent.getAction();
- if (isAlive() == false || StringUtil.isNotEmpty(action, true) == false) {
- Log.e(TAG, "receiver.onReceive isAlive() == false" +
- " || StringUtil.isNotEmpty(action, true) == false >> return;");
- return;
- }
-
- if (ActionUtil.ACTION_USER_CHANGED.equals(action)) {
- if (isCurrentUser(intent.getLongExtra(INTENT_ID, 0))) {
- invalidate();
- }
- }
- }
- };
-
-}
\ No newline at end of file
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/base/BaseHttpListActivity.java b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/base/BaseHttpListActivity.java
deleted file mode 100644
index b90a6074f..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/base/BaseHttpListActivity.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package apijson.demo.client.base;
-
-import zuo.biao.apijson.JSONResponse;
-import zuo.biao.library.base.BaseBroadcastReceiver;
-import zuo.biao.library.base.BaseView.OnDataChangedListener;
-import zuo.biao.library.util.Log;
-import zuo.biao.library.util.StringUtil;
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.os.Bundle;
-import android.widget.BaseAdapter;
-import apijson.demo.client.R;
-import apijson.demo.client.activity_fragment.LoginActivity;
-import apijson.demo.client.application.APIJSONApplication;
-import apijson.demo.client.model.User;
-import apijson.demo.client.util.ActionUtil;
-
-public abstract class BaseHttpListActivity
-extends zuo.biao.library.base.BaseHttpListActivity {
- private static final String TAG = "BaseHttpListFragment";
-
-
- protected User currentUser;
- protected long currentUserId;
- protected boolean isLoggedIn;
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
-
- setCurrentUser();
-
- }
-
- private void setCurrentUser() {
- currentUser = APIJSONApplication.getInstance().getCurrentUser();
- currentUserId = currentUser == null ? 0 : currentUser.getId();
- isLoggedIn = isCurrentUserCorrect();
- }
-
- protected boolean verifyHttpLogin(int code) {
- if (isAlive() == false) {
- return true;
- }
- if (code == JSONResponse.CODE_NOT_LOGGED_IN) {
- APIJSONApplication.getInstance().logout();
- setCurrentUser();
- }
- return verifyLogin();
- }
- protected static boolean isCurrentUser(long userId) {
- return APIJSONApplication.getInstance().isCurrentUser(userId);
- }
- /**未登录会toLoginActivity();
- * @return isLoggedIn
- */
- protected boolean verifyLogin() {
- if (isLoggedIn == false) {
- showShortToast("请先登录");
- toLoginActivity();
- }
- return isLoggedIn;
- }
- protected void toLoginActivity() {
- startActivity(LoginActivity.createIntent(context));
- context.overridePendingTransition(R.anim.bottom_push_in, R.anim.hold);
- }
-
- @Override
- public void initData() {
- super.initData();
- loadAfterCorrect();
- }
-
-
- private boolean isDataChanged = false;
- /**
- */
- protected void invalidate() {
- if (isRunning() == false) {
- isDataChanged = true;
- Log.w(TAG, "onDataChanged isRunning() == false >> return;");
- return;
- }
- isDataChanged = false;
-
- setCurrentUser();
- loadAfterCorrect();
- }
-
- @Override
- public void onResume() {
- super.onResume();
- if (isDataChanged) {
- if (onDataChangedListener != null) {
- Log.d(TAG, "onResume isDataChanged >> onDataChangedListener.onDataChanged();");
- onDataChangedListener.onDataChanged();
- }
- }
- }
-
- /**
- * @param runnable
- */
- protected void loadAfterCorrect() {
- if (isCurrentUserCorrect() == false) {//请求currentUser都统一交给MainTabActivity,避免同时多次相同请求
- Log.e(TAG, "loadAfterCorrect isCurrentUserCorrect() == false >> return;");
- return;
- }
- if (onDataChangedListener != null) {
- onDataChangedListener.onDataChanged();
- }
- }
-
-
- /**
- * @return
- */
- public boolean isCurrentUserCorrect() {
- return isUserCorrect(currentUser);
- }
- /**
- * @param user
- * @return
- */
- public boolean isUserCorrect(User user) {
- return user != null && user.getId() > 0;
- }
-
-
- @Override
- protected void onDestroy() {
- unregisterObserver();
- super.onDestroy();
- }
-
- private OnDataChangedListener onDataChangedListener;
- protected void registerObserver(OnDataChangedListener onDataChangedListener) {
- this.onDataChangedListener = onDataChangedListener;
- BaseBroadcastReceiver.register(context, receiver, ActionUtil.ACTION_USER_CHANGED);
- }
- protected void unregisterObserver() {
- onDataChangedListener = null;
- BaseBroadcastReceiver.unregister(context, receiver);
- }
-
- private BroadcastReceiver receiver = new BroadcastReceiver() {
-
- public void onReceive(Context context, Intent intent) {
- String action = intent == null ? null : intent.getAction();
- if (isAlive() == false || StringUtil.isNotEmpty(action, true) == false) {
- Log.e(TAG, "receiver.onReceive isAlive() == false" +
- " || StringUtil.isNotEmpty(action, true) == false >> return;");
- return;
- }
-
- if (ActionUtil.ACTION_USER_CHANGED.equals(action)) {
- if (isCurrentUser(intent.getLongExtra(INTENT_ID, 0))) {
- invalidate();
- }
- }
- }
- };
-
-}
\ No newline at end of file
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/base/BaseHttpListFragment.java b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/base/BaseHttpListFragment.java
deleted file mode 100644
index 4e2b70db8..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/base/BaseHttpListFragment.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package apijson.demo.client.base;
-
-import zuo.biao.apijson.JSONResponse;
-import zuo.biao.library.base.BaseBroadcastReceiver;
-import zuo.biao.library.base.BaseView.OnDataChangedListener;
-import zuo.biao.library.util.Log;
-import zuo.biao.library.util.StringUtil;
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.os.Bundle;
-import android.support.annotation.Nullable;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.BaseAdapter;
-import apijson.demo.client.R;
-import apijson.demo.client.activity_fragment.LoginActivity;
-import apijson.demo.client.application.APIJSONApplication;
-import apijson.demo.client.model.User;
-import apijson.demo.client.util.ActionUtil;
-
-public abstract class BaseHttpListFragment
-extends zuo.biao.library.base.BaseHttpListFragment {
- private static final String TAG = "BaseHttpListFragment";
-
-
- protected User currentUser;
- protected long currentUserId;
- protected boolean isLoggedIn;
- @Override
- @Nullable
- public View onCreateView(LayoutInflater inflater,
- @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
- super.onCreateView(inflater, container, savedInstanceState);
-
- setCurrentUser();
-
- return view;
- }
-
- private void setCurrentUser() {
- currentUser = APIJSONApplication.getInstance().getCurrentUser();
- currentUserId = currentUser == null ? 0 : currentUser.getId();
- isLoggedIn = isCurrentUserCorrect();
- }
-
- protected static boolean isCurrentUser(long userId) {
- return APIJSONApplication.getInstance().isCurrentUser(userId);
- }
-
- protected boolean verifyHttpLogin(int code) {
- if (isAlive() == false) {
- return true;
- }
- if (code == JSONResponse.CODE_NOT_LOGGED_IN) {
- APIJSONApplication.getInstance().logout();
- setCurrentUser();
- }
- return verifyLogin();
- }
- /**未登录会toLoginActivity();
- * @return isLoggedIn
- */
- protected boolean verifyLogin() {
- if (isLoggedIn == false) {
- showShortToast("请先登录");
- toLoginActivity();
- }
- return isLoggedIn;
- }
- protected void toLoginActivity() {
- startActivity(LoginActivity.createIntent(context));
- context.overridePendingTransition(R.anim.bottom_push_in, R.anim.hold);
- }
-
- @Override
- public void initData() {
- super.initData();
- loadAfterCorrect();
- }
-
-
- private boolean isDataChanged = false;
- /**
- */
- protected void invalidate() {
- if (isRunning() == false) {
- isDataChanged = true;
- Log.w(TAG, "onDataChanged isRunning() == false >> return;");
- return;
- }
- isDataChanged = false;
-
- setCurrentUser();
- loadAfterCorrect();
- }
-
- @Override
- public void onResume() {
- super.onResume();
- if (isDataChanged) {
- if (onDataChangedListener != null) {
- Log.d(TAG, "onResume isDataChanged >> onDataChangedListener.onDataChanged();");
- onDataChangedListener.onDataChanged();
- }
- }
- }
-
- /**
- * @param runnable
- */
- protected void loadAfterCorrect() {
- if (isCurrentUserCorrect() == false) {//请求currentUser都统一交给MainTabActivity,避免同时多次相同请求
- Log.e(TAG, "loadAfterCorrect isCurrentUserCorrect() == false >> return;");
- return;
- }
- if (onDataChangedListener != null) {
- onDataChangedListener.onDataChanged();
- }
- }
-
-
- /**
- * @return
- */
- public boolean isCurrentUserCorrect() {
- return isUserCorrect(currentUser);
- }
- /**
- * @param user
- * @return
- */
- public boolean isUserCorrect(User user) {
- return user != null && user.getId() > 0;
- }
-
-
- @Override
- public void onDestroy() {
- unregisterObserver();
- super.onDestroy();
- }
-
- private OnDataChangedListener onDataChangedListener;
- protected void registerObserver(OnDataChangedListener onDataChangedListener) {
- this.onDataChangedListener = onDataChangedListener;
- BaseBroadcastReceiver.register(context, receiver, ActionUtil.ACTION_USER_CHANGED);
- }
- protected void unregisterObserver() {
- onDataChangedListener = null;
- BaseBroadcastReceiver.unregister(context, receiver);
- }
-
- private BroadcastReceiver receiver = new BroadcastReceiver() {
-
- public void onReceive(Context context, Intent intent) {
- String action = intent == null ? null : intent.getAction();
- if (isAlive() == false || StringUtil.isNotEmpty(action, true) == false) {
- Log.e(TAG, "receiver.onReceive isAlive() == false" +
- " || StringUtil.isNotEmpty(action, true) == false >> return;");
- return;
- }
-
- if (ActionUtil.ACTION_USER_CHANGED.equals(action)) {
- if (isCurrentUser(intent.getLongExtra(INTENT_ID, 0))) {
- invalidate();
- }
- }
- }
- };
-
-}
\ No newline at end of file
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/base/BaseListActivity.java b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/base/BaseListActivity.java
deleted file mode 100644
index 3314a6a3f..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/base/BaseListActivity.java
+++ /dev/null
@@ -1,180 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package apijson.demo.client.base;
-
-import zuo.biao.apijson.JSONResponse;
-import zuo.biao.library.base.BaseBroadcastReceiver;
-import zuo.biao.library.base.BaseView.OnDataChangedListener;
-import zuo.biao.library.util.Log;
-import zuo.biao.library.util.StringUtil;
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.os.Bundle;
-import android.widget.AbsListView;
-import android.widget.BaseAdapter;
-import apijson.demo.client.R;
-import apijson.demo.client.activity_fragment.LoginActivity;
-import apijson.demo.client.application.APIJSONApplication;
-import apijson.demo.client.model.User;
-import apijson.demo.client.util.ActionUtil;
-
-public abstract class BaseListActivity
-extends zuo.biao.library.base.BaseListActivity {
- private static final String TAG = "BaseActivity";
-
-
- protected User currentUser;
- protected long currentUserId;
- protected boolean isLoggedIn;
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
-
- setCurrentUser();
-
- }
-
- private void setCurrentUser() {
- currentUser = APIJSONApplication.getInstance().getCurrentUser();
- currentUserId = currentUser == null ? 0 : currentUser.getId();
- isLoggedIn = isCurrentUserCorrect();
- }
-
- protected boolean verifyHttpLogin(int code) {
- if (isAlive() == false) {
- return true;
- }
- if (code == JSONResponse.CODE_NOT_LOGGED_IN) {
- APIJSONApplication.getInstance().logout();
- setCurrentUser();
- }
- return verifyLogin();
- }
- protected static boolean isCurrentUser(long userId) {
- return APIJSONApplication.getInstance().isCurrentUser(userId);
- }
- /**未登录会toLoginActivity();
- * @return isLoggedIn
- */
- protected boolean verifyLogin() {
- if (isLoggedIn == false) {
- showShortToast("请先登录");
- toLoginActivity();
- }
- return isLoggedIn;
- }
- protected void toLoginActivity() {
- startActivity(LoginActivity.createIntent(context));
- context.overridePendingTransition(R.anim.bottom_push_in, R.anim.hold);
- }
-
- @Override
- public void initData() {
- super.initData();
- loadAfterCorrect();
- }
-
-
- private boolean isDataChanged = false;
- /**
- */
- protected void invalidate() {
- if (isRunning() == false) {
- isDataChanged = true;
- Log.w(TAG, "onDataChanged isRunning() == false >> return;");
- return;
- }
- isDataChanged = false;
-
- setCurrentUser();
- loadAfterCorrect();
- }
-
- @Override
- public void onResume() {
- super.onResume();
- if (isDataChanged) {
- if (onDataChangedListener != null) {
- Log.d(TAG, "onResume isDataChanged >> onDataChangedListener.onDataChanged();");
- onDataChangedListener.onDataChanged();
- }
- }
- }
-
- /**
- * @param runnable
- */
- protected void loadAfterCorrect() {
- if (isCurrentUserCorrect() == false) {//请求currentUser都统一交给MainTabActivity,避免同时多次相同请求
- Log.e(TAG, "loadAfterCorrect isCurrentUserCorrect() == false >> return;");
- return;
- }
- if (onDataChangedListener != null) {
- onDataChangedListener.onDataChanged();
- }
- }
-
-
- /**
- * @return
- */
- public boolean isCurrentUserCorrect() {
- return isUserCorrect(currentUser);
- }
- /**
- * @param user
- * @return
- */
- public boolean isUserCorrect(User user) {
- return user != null && user.getId() > 0;
- }
-
-
- @Override
- protected void onDestroy() {
- unregisterObserver();
- super.onDestroy();
- }
-
- private OnDataChangedListener onDataChangedListener;
- protected void registerObserver(OnDataChangedListener onDataChangedListener) {
- this.onDataChangedListener = onDataChangedListener;
- BaseBroadcastReceiver.register(context, receiver, ActionUtil.ACTION_USER_CHANGED);
- }
- protected void unregisterObserver() {
- onDataChangedListener = null;
- BaseBroadcastReceiver.unregister(context, receiver);
- }
-
- private BroadcastReceiver receiver = new BroadcastReceiver() {
-
- public void onReceive(Context context, Intent intent) {
- String action = intent == null ? null : intent.getAction();
- if (isAlive() == false || StringUtil.isNotEmpty(action, true) == false) {
- Log.e(TAG, "receiver.onReceive isAlive() == false" +
- " || StringUtil.isNotEmpty(action, true) == false >> return;");
- return;
- }
-
- if (ActionUtil.ACTION_USER_CHANGED.equals(action)) {
- if (isCurrentUser(intent.getLongExtra(INTENT_ID, 0))) {
- invalidate();
- }
- }
- }
- };
-
-}
\ No newline at end of file
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/base/BaseListFragment.java b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/base/BaseListFragment.java
deleted file mode 100644
index 69b047fe0..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/base/BaseListFragment.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package apijson.demo.client.base;
-
-import zuo.biao.apijson.JSONResponse;
-import zuo.biao.library.base.BaseBroadcastReceiver;
-import zuo.biao.library.base.BaseView.OnDataChangedListener;
-import zuo.biao.library.util.Log;
-import zuo.biao.library.util.StringUtil;
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.os.Bundle;
-import android.support.annotation.Nullable;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.AbsListView;
-import android.widget.BaseAdapter;
-import apijson.demo.client.R;
-import apijson.demo.client.activity_fragment.LoginActivity;
-import apijson.demo.client.application.APIJSONApplication;
-import apijson.demo.client.model.User;
-import apijson.demo.client.util.ActionUtil;
-
-public abstract class BaseListFragment
-extends zuo.biao.library.base.BaseListFragment {
- protected static final String TAG = "BaseListFragment";
-
-
- protected User currentUser;
- protected long currentUserId;
- protected boolean isLoggedIn;
- @Override
- @Nullable
- public View onCreateView(LayoutInflater inflater,
- @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
- super.onCreateView(inflater, container, savedInstanceState);
-
- setCurrentUser();
-
- return view;
- }
-
- private void setCurrentUser() {
- currentUser = APIJSONApplication.getInstance().getCurrentUser();
- currentUserId = currentUser == null ? 0 : currentUser.getId();
- isLoggedIn = isCurrentUserCorrect();
- }
-
- protected boolean verifyHttpLogin(int code) {
- if (isAlive() == false) {
- return true;
- }
- if (code == JSONResponse.CODE_NOT_LOGGED_IN) {
- APIJSONApplication.getInstance().logout();
- setCurrentUser();
- }
- return verifyLogin();
- }
- protected static boolean isCurrentUser(long userId) {
- return APIJSONApplication.getInstance().isCurrentUser(userId);
- }
- /**未登录会toLoginActivity();
- * @return isLoggedIn
- */
- protected boolean verifyLogin() {
- if (isLoggedIn == false) {
- showShortToast("请先登录");
- toLoginActivity();
- }
- return isLoggedIn;
- }
- protected void toLoginActivity() {
- startActivity(LoginActivity.createIntent(context));
- context.overridePendingTransition(R.anim.bottom_push_in, R.anim.hold);
- }
-
- @Override
- public void initData() {
- super.initData();
- loadAfterCorrect();
- }
-
-
- private boolean isDataChanged = false;
- /**
- */
- protected void invalidate() {
- if (isRunning() == false) {
- isDataChanged = true;
- Log.w(TAG, "onDataChanged isRunning() == false >> return;");
- return;
- }
- isDataChanged = false;
-
- setCurrentUser();
- loadAfterCorrect();
- }
-
- @Override
- public void onResume() {
- super.onResume();
- if (isDataChanged) {
- if (onDataChangedListener != null) {
- Log.d(TAG, "onResume isDataChanged >> onDataChangedListener.onDataChanged();");
- onDataChangedListener.onDataChanged();
- }
- }
- }
-
- /**
- * @param runnable
- */
- protected void loadAfterCorrect() {
- if (isCurrentUserCorrect() == false) {//请求currentUser都统一交给MainTabActivity,避免同时多次相同请求
- Log.e(TAG, "loadAfterCorrect isCurrentUserCorrect() == false >> return;");
- return;
- }
- if (onDataChangedListener != null) {
- onDataChangedListener.onDataChanged();
- }
- }
-
-
- /**
- * @return
- */
- public boolean isCurrentUserCorrect() {
- return isUserCorrect(currentUser);
- }
- /**
- * @param user
- * @return
- */
- public boolean isUserCorrect(User user) {
- return user != null && user.getId() > 0;
- }
-
-
- @Override
- public void onDestroy() {
- unregisterObserver();
- super.onDestroy();
- }
-
- private OnDataChangedListener onDataChangedListener;
- protected void registerObserver(OnDataChangedListener onDataChangedListener) {
- this.onDataChangedListener = onDataChangedListener;
- BaseBroadcastReceiver.register(context, receiver, ActionUtil.ACTION_USER_CHANGED);
- }
- protected void unregisterObserver() {
- onDataChangedListener = null;
- BaseBroadcastReceiver.unregister(context, receiver);
- }
-
- private BroadcastReceiver receiver = new BroadcastReceiver() {
-
- public void onReceive(Context context, Intent intent) {
- String action = intent == null ? null : intent.getAction();
- if (isAlive() == false || StringUtil.isNotEmpty(action, true) == false) {
- Log.e(TAG, "receiver.onReceive isAlive() == false" +
- " || StringUtil.isNotEmpty(action, true) == false >> return;");
- return;
- }
-
- if (ActionUtil.ACTION_USER_CHANGED.equals(action)) {
- if (isCurrentUser(intent.getLongExtra(INTENT_ID, 0))) {
- invalidate();
- }
- }
- }
- };
-
-}
\ No newline at end of file
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/interfaces/OnTopBarClickListener.java b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/interfaces/OnTopBarClickListener.java
deleted file mode 100644
index f62f2d372..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/interfaces/OnTopBarClickListener.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package apijson.demo.client.interfaces;
-
-import android.view.View;
-
-public interface OnTopBarClickListener {
- /**
- * @param v
- */
- void onReturnClick(View v);
-
- /**
- * @param v
- */
- void onTitleClick(View v);
-
- /**
- * @param v
- */
- void onForwardClick(View v);
-}
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/interfaces/TopBarMenuCallback.java b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/interfaces/TopBarMenuCallback.java
deleted file mode 100644
index 072b6a6b2..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/interfaces/TopBarMenuCallback.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package apijson.demo.client.interfaces;
-
-import android.app.Activity;
-import android.view.View;
-
-public interface TopBarMenuCallback {
- /**
- * @param activity
- */
- View getLeftMenu(Activity activity);
-
- /**
- * @param activity
- */
- View getRightMenu(Activity activity);
-}
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/manager/DataManager.java b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/manager/DataManager.java
deleted file mode 100755
index 93c2e5a25..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/manager/DataManager.java
+++ /dev/null
@@ -1,198 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package apijson.demo.client.manager;
-
-import android.content.Context;
-import android.content.SharedPreferences;
-
-import apijson.demo.client.application.APIJSONApplication;
-import apijson.demo.client.model.User;
-import zuo.biao.library.util.JSON;
-import zuo.biao.library.util.Log;
-import zuo.biao.library.util.StringUtil;
-
-/**数据工具类
- * @author Lemon
- */
-public class DataManager {
- private final String TAG = "DataManager";
-
- private Context context;
- private DataManager(Context context) {
- this.context = context;
- }
-
- private static DataManager instance = new DataManager(APIJSONApplication.getInstance());
- public static DataManager getInstance() {
- return instance;
- }
-
- //用户 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- private String PATH_USER = "PATH_USER";
-
- public final String KEY_USER = "KEY_USER";
- public final String KEY_USER_ID = "KEY_USER_ID";
- public final String KEY_USER_NAME = "KEY_USER_NAME";
- public final String KEY_USER_PHONE = "KEY_USER_PHONE";
-
- public final String KEY_CURRENT_USER_ID = "KEY_CURRENT_USER_ID";
- public final String KEY_LAST_USER_ID = "KEY_LAST_USER_ID";
-
-
- /**判断是否为当前用户
- * @param userId
- * @return
- */
- public boolean isCurrentUser(long userId) {
- return userId > 0 && userId == getCurrentUserId();
- }
-
- /**获取当前用户id
- * @return
- */
- public long getCurrentUserId() {
- User user = getCurrentUser();
- return user == null ? 0 : user.getId();
- }
-
- /**获取当前用户的手机号
- * @return
- */
- public String getCurrentUserPhone() {
- User user = getCurrentUser();
- return user == null ? "" : user.getPhone();
- }
- /**获取当前用户
- * @return
- */
- public User getCurrentUser() {
- SharedPreferences sdf = context.getSharedPreferences(PATH_USER, Context.MODE_PRIVATE);
- return sdf == null ? null : getUser(sdf.getLong(KEY_CURRENT_USER_ID, 0));
- }
-
-
- /**获取最后一次登录的用户的手机号
- * @return
- */
- public String getLastUserPhone() {
- User user = getLastUser();
- return user == null ? "" : user.getPhone();
- }
-
- /**获取最后一次登录的用户
- * @return
- */
- public User getLastUser() {
- SharedPreferences sdf = context.getSharedPreferences(PATH_USER, Context.MODE_PRIVATE);
- return sdf == null ? null : getUser(sdf.getLong(KEY_LAST_USER_ID, 0));
- }
-
- /**获取用户
- * @param userId
- * @return
- */
- public User getUser(long userId) {
- SharedPreferences sdf = context.getSharedPreferences(PATH_USER, Context.MODE_PRIVATE);
- if (sdf == null) {
- Log.e(TAG, "get sdf == null >> return;");
- return null;
- }
- Log.i(TAG, "getUser userId = " + userId);
- return JSON.parseObject(sdf.getString(StringUtil.getTrimedString(userId), null), User.class);
- }
-
-
- /**保存当前用户,只在登录或注销时调用
- * @param user user == null >> user = new User();
- */
- public void saveCurrentUser(User user) {
- SharedPreferences sdf = context.getSharedPreferences(PATH_USER, Context.MODE_PRIVATE);
- if (sdf == null) {
- Log.e(TAG, "saveUser sdf == null >> return;");
- return;
- }
- SharedPreferences.Editor editor = sdf.edit();
- if (user != null) {
- editor.remove(KEY_LAST_USER_ID).putLong(KEY_LAST_USER_ID, user.getId());
- }
- editor.remove(KEY_CURRENT_USER_ID).putLong(KEY_CURRENT_USER_ID, user == null ? 0 : user.getId());
- editor.commit();
-
- saveUser(sdf, user);
- }
-
- /**保存用户
- * @param user
- */
- public void saveUser(User user) {
- saveUser(context.getSharedPreferences(PATH_USER, Context.MODE_PRIVATE), user);
- }
- /**保存用户
- * @param sdf
- * @param user
- */
- public void saveUser(SharedPreferences sdf, User user) {
- if (sdf == null || user == null) {
- Log.e(TAG, "saveUser sdf == null || user == null >> return;");
- return;
- }
- String key = StringUtil.getTrimedString(user.getId());
- Log.i(TAG, "saveUser key = user.getId() = " + user.getId());
- sdf.edit().remove(key).putString(key, JSON.toJSONString(user)).commit();
- }
-
- /**删除用户
- * @param sdf
- * @param userId
- */
- public void removeUser(SharedPreferences sdf, long userId) {
- if (sdf == null) {
- Log.e(TAG, "removeUser sdf == null >> return;");
- return;
- }
- sdf.edit().remove(StringUtil.getTrimedString(userId)).commit();
- }
-
- /**设置当前用户手机号
- * @param phone
- */
- public void setCurrentUserPhone(String phone) {
- User user = getCurrentUser();
- if (user == null) {
- user = new User();
- }
- user.setPhone(phone);
- saveUser(user);
- }
-
- /**设置当前用户姓名
- * @param name
- */
- public void setCurrentUserName(String name) {
- User user = getCurrentUser();
- if (user == null) {
- user = new User();
- }
- user.setName(name);
- saveUser(user);
- }
-
- //用户 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
-
-}
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/manager/HttpManager.java b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/manager/HttpManager.java
deleted file mode 100644
index 4752a0447..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/manager/HttpManager.java
+++ /dev/null
@@ -1,276 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-
-package apijson.demo.client.manager;
-
-import java.io.IOException;
-import java.net.CookieHandler;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.TimeUnit;
-
-import org.json.JSONException;
-
-import zuo.biao.apijson.StringUtil;
-import zuo.biao.library.manager.HttpManager.OnHttpResponseListener;
-import zuo.biao.library.util.Log;
-import android.content.Context;
-import android.os.AsyncTask;
-import android.text.TextUtils;
-import apijson.demo.client.application.APIJSONApplication;
-
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONObject;
-import com.squareup.okhttp.MediaType;
-import com.squareup.okhttp.OkHttpClient;
-import com.squareup.okhttp.Request;
-import com.squareup.okhttp.RequestBody;
-import com.squareup.okhttp.Response;
-
-/**HTTP请求管理类
- * @author Lemon
- * @use HttpManager.getInstance().get(...)或HttpManager.getInstance().post(...) > 在回调方法onHttpRequestSuccess和onHttpRequestError处理HTTP请求结果
- * @must 解决getToken,getResponseCode,getResponseData中的TODO
- */
-public class HttpManager {
- private static final String TAG = "HttpManager";
-
-
- private Context context;
- private static HttpManager instance;// 单例
- private HttpManager(Context context) {
- this.context = context;
-
- }
-
- public static HttpManager getInstance() {
- if (instance == null) {
- synchronized (HttpManager.class) {
- if (instance == null) {
- instance = new HttpManager(APIJSONApplication.getInstance());
- }
- }
- }
- return instance;
- }
-
-
-
- /**
- * 列表首页页码。有些服务器设置为1,即列表页码从1开始
- */
- public static final int PAGE_NUM_0 = 0;
-
- public static final String KEY_TOKEN = "token";
- public static final String KEY_COOKIE = "cookie";
-
-
- public static final MediaType TYPE_JSON = MediaType.parse("application/json; charset=utf-8");
-
- /**POST请求
- * @param url_ 接口url
- * @param request 请求
- * @param requestCode
- * 请求码,类似onActivityResult中请求码,当同一activity中以实现接口方式发起多个网络请求时,请求结束后都会回调
- * {@link OnHttpResponseListener#onHttpResponse(int, String, Exception)}
- * 在发起请求的类中可以用requestCode来区分各个请求
- * @param listener
- */
- public void post(final String url_, final com.alibaba.fastjson.JSONObject request
- , final int requestCode, final OnHttpResponseListener listener) {
- new AsyncTask() {
-
- String result;
- @Override
- protected Exception doInBackground(Void... params) {
-
- try {
- String url = StringUtil.getNoBlankString(url_);
-
- OkHttpClient client = getHttpClient(url);
- if (client == null) {
- return new Exception(TAG + ".post AsyncTask.doInBackground client == null >> return;");
- }
- String body = JSON.toJSONString(request);
- Log.d(TAG, "\n\n<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n post url = " + url_ + "\n request = \n" + body);
-
- RequestBody requestBody = RequestBody.create(TYPE_JSON, body);
-
- result = getResponseJson(client, new Request.Builder()
- .addHeader(KEY_TOKEN, getToken(url)).url(https://github.com/StringUtil.getNoBlankString(url))
- .post(requestBody).build());
- Log.d(TAG, "\n post result = \n" + result + "\n >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n\n");
- } catch (Exception e) {
- Log.e(TAG, "post AsyncTask.doInBackground try { result = getResponseJson(..." +
- "} catch (Exception e) {\n" + e.getMessage());
- return e;
- }
-
- return null;
- }
-
- @Override
- protected void onPostExecute(Exception exception) {
- super.onPostExecute(exception);
- listener.onHttpResponse(requestCode, result, exception);
- }
-
- }.execute();
- }
-
-
- //httpGet/httpPost 内调用方法 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- /**
- * @param url
- * @return
- */
- private OkHttpClient getHttpClient(String url) {
- Log.i(TAG, "getHttpClient url = " + url);
- if (StringUtil.isNotEmpty(url, true) == false) {
- Log.e(TAG, "getHttpClient StringUtil.isNotEmpty(url, true) == false >> return null;");
- return null;
- }
-
- OkHttpClient client = new OkHttpClient();
- client.setCookieHandler(new HttpHead());
- client.setConnectTimeout(15, TimeUnit.SECONDS);
- client.setWriteTimeout(10, TimeUnit.SECONDS);
- client.setReadTimeout(10, TimeUnit.SECONDS);
-
- return client;
- }
-
- /**
- * @param tag
- * @must demo_***改为服务器设定值
- * @return
- */
- public String getToken(String tag) {
- return context.getSharedPreferences(KEY_TOKEN, Context.MODE_PRIVATE).getString(KEY_TOKEN + tag, "");
- }
- /**
- * @param tag
- * @param value
- */
- public void saveToken(String tag, String value) {
- context.getSharedPreferences(KEY_TOKEN, Context.MODE_PRIVATE)
- .edit()
- .remove(KEY_TOKEN + tag)
- .putString(KEY_TOKEN + tag, value)
- .commit();
- }
-
-
- /**
- * @return
- */
- public String getCookie() {
- return context.getSharedPreferences(KEY_COOKIE, Context.MODE_PRIVATE).getString(KEY_COOKIE, "");
- }
- /**
- * @param value
- */
- public void saveCookie(String value) {
- context.getSharedPreferences(KEY_COOKIE, Context.MODE_PRIVATE)
- .edit()
- .remove(KEY_COOKIE)
- .putString(KEY_COOKIE, value)
- .commit();
- }
-
-
- /**
- * @param client
- * @param request
- * @return
- * @throws Exception
- */
- private String getResponseJson(OkHttpClient client, Request request) throws Exception {
- if (client == null || request == null) {
- Log.e(TAG, "getResponseJson client == null || request == null >> return null;");
- return null;
- }
- Response response = client.newCall(request).execute();
- return response.isSuccessful() ? response.body().string() : null;
- }
-
- /**从object中获取key对应的值
- * *获取如果T是基本类型容易崩溃,所以需要try-catch
- * @param json
- * @param key
- * @return
- * @throws JSONException
- */
- public T getValue(String json, String key) throws JSONException {
- return getValue(JSON.parseObject(json), key);
- }
- /**从object中获取key对应的值
- * *获取如果T是基本类型容易崩溃,所以需要try-catch
- * @param object
- * @param key
- * @return
- * @throws JSONException
- */
- @SuppressWarnings("unchecked")
- public T getValue(JSONObject object, String key) throws JSONException {
- return (T) object.get(key);
- }
-
- //httpGet/httpPost 内调用方法 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
-
- /**http请求头
- */
- public class HttpHead extends CookieHandler {
- public HttpHead() {
- }
-
- @Override
- public Map> get(URI uri, Map> requestHeaders) throws IOException {
- String cookie = getCookie();
- Map> map = new HashMap>();
- map.putAll(requestHeaders);
- if (!TextUtils.isEmpty(cookie)) {
- List cList = new ArrayList();
- cList.add(cookie);
- map.put("Cookie", cList);
- }
- return map;
- }
-
- @Override
- public void put(URI uri, Map> responseHeaders) throws IOException {
- List list = responseHeaders.get("Set-Cookie");
- if (list != null) {
- for (int i = 0; i < list.size(); i++) {
- String cookie = list.get(i);
- if (cookie.startsWith("JSESSIONID")) {
- saveCookie(list.get(i));
- break;
- }
- }
- }
- }
-
- }
-
-
-}
\ No newline at end of file
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/model/Comment.java b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/model/Comment.java
deleted file mode 100644
index e269e3237..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/model/Comment.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package apijson.demo.client.model;
-
-/**评论类
- * @author Lemon
- */
-public class Comment extends apijson.demo.server.model.Comment {
- private static final long serialVersionUID = -1011007127735372824L;
-
- public Comment() {
- super();
- }
- public Comment(long id) {
- this();
- setId(id);
- }
- public Comment(String content) {
- this();
- setContent(content);
- }
-
- @Override
- public Long getId() {
- return value(super.getId());
- }
- @Override
- public Long getDate() {
- return value(super.getDate());
- }
- @Override
- public Long getMomentId() {
- return value(super.getMomentId());
- }
- @Override
- public Long getToId() {
- return value(super.getToId());
- }
- @Override
- public Long getUserId() {
- return value(super.getUserId());
- }
-
-}
\ No newline at end of file
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/model/CommentItem.java b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/model/CommentItem.java
deleted file mode 100644
index 8cb163811..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/model/CommentItem.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package apijson.demo.client.model;
-
-import java.util.List;
-
-import android.support.annotation.NonNull;
-import apijson.demo.server.model.BaseModel;
-
-public class CommentItem extends BaseModel {
- private static final long serialVersionUID = -1011007127735372824L;
-
- private Comment comment;
- private User user;
- private User toUser;
- private List childList;
-
- public CommentItem() {
- super();
- }
- public CommentItem(Comment comment) {
- this();
- setComment(comment);
- }
-
- @NonNull
- public Comment getComment() {
- if (comment == null) {
- comment = new Comment();
- }
- return comment;
- }
- public CommentItem setComment(Comment comment) {
- this.comment = comment;
- return this;
- }
-
- @NonNull
- public User getUser() {
- if (user == null) {
- user = new User(getComment().getUserId());
- }
- return user;
- }
- public CommentItem setUser(User user) {
- this.user = user;
- return this;
- }
- @NonNull
- public User getToUser() {
- if (toUser == null) {
- toUser = new User();
- }
- return toUser;
- }
- public CommentItem setToUser(User toUser) {
- this.toUser = toUser;
- return this;
- }
-
- public List getChildList() {
- return childList;
- }
- public CommentItem setChildList(List childList) {
- this.childList = childList;
- return this;
- }
-
-
- @Override
- public Long getId() {
- return getComment().getId();
- }
- public Long getToId() {
- return getComment().getToId();
- }
- @Override
- public Long getDate() {
- return getComment().getDate();
- }
-
- public Long getUserId() {
- return getUser().getId();
- }
-
-}
\ No newline at end of file
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/model/Login.java b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/model/Login.java
deleted file mode 100644
index 93f56a693..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/model/Login.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package apijson.demo.client.model;
-
-/**登录类
- * @author Lemon
- */
-@SuppressWarnings("serial")
-public class Login extends apijson.demo.server.model.Login {
-
- public Login() {
- super();
- }
- public Login(long userId) {
- this();
- setUserId(userId);
- }
-
- @Override
- public Long getUserId() {
- Long userId = super.getUserId();
- return userId == null ? 0 : userId;
- }
-// @Override
-// public Boolean getType() {
-// Boolean type = super.getType();
-// return type == null ? false : type;
-// }
- @Override
- public Integer getType() {
- Integer type = super.getType();
- return type == null ? 0 : type;
- }
-
-}
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/model/Moment.java b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/model/Moment.java
deleted file mode 100644
index 94c1547b1..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/model/Moment.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package apijson.demo.client.model;
-
-/**作品类
- * @author Lemon
- */
-public class Moment extends apijson.demo.server.model.Moment {
- private static final long serialVersionUID = -7821648714756673170L;
-
- public Moment() {
- super();
- }
- public Moment(long id) {
- super(id);
- }
-
- @Override
- public Long getDate() {
- return value(super.getDate());
- }
- @Override
- public Long getId() {
- return value(super.getId());
- }
- @Override
- public Long getUserId() {
- return value(super.getUserId());
- }
-
- public String getFirstPicture() {
- return get(getPictureList(), 0);
- }
-
-}
\ No newline at end of file
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/model/MomentItem.java b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/model/MomentItem.java
deleted file mode 100644
index e0923e2cd..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/model/MomentItem.java
+++ /dev/null
@@ -1,247 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package apijson.demo.client.model;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import android.support.annotation.NonNull;
-import apijson.demo.client.application.APIJSONApplication;
-import apijson.demo.server.model.BaseModel;
-
-public class MomentItem extends BaseModel {
- private static final long serialVersionUID = -7437225320551780084L;
-
- public static final int STATUS_NORMAL = 0;
- public static final int STATUS_PUBLISHING = 1;
- public static final int STATUS_DELETING = 2;
- public static final int STATUS_DELETED = 3;
-
- private int status;
- private User user;
- private Moment moment;
- private List userList;//点赞的用户列表
- private List commentItemList;
-
- public MomentItem() {
- super();
- }
- public MomentItem(long id) {
- this();
- setId(id);
- }
-
- @Override
- public Long getId() {
- return getMomentId();
- }
- @Override
- public MomentItem setId(Long id) {
- return setMomentId(id);
- }
-
- public Long getUserId() {
- return getUser().getId();
- }
-
- public int getMyStatus() {
- return status;
- }
- public void setMyStatus(int status) {//status莫名其妙变成状态码status 200
- this.status = status;
- }
- public String getStatusString() {
- return getStatusString(getMyStatus());
- }
- public static String getStatusString(int status) {
- switch (status) {
- case STATUS_PUBLISHING:
- return "正在发布...";
- case STATUS_DELETING:
- return "正在删除...";
- default:
- return "删除";
- }
- }
-
- /**if (user == null) >> user = new User();
- * @return
- */
- @NonNull
- public User getUser() {
- if (user == null) {
- user = new User(getMoment().getUserId());
- }
- return user;
- }
-
- public MomentItem setUser(User user) {
- this.user = user;
- return this;
- }
-
- public long getMomentId() {
- return getMoment().getId();
- }
-
- public MomentItem setMomentId(long id) {
- getMoment().setId(id);
- return this;
- }
- /**if (moment == null) >> moment = new Moment();
- * @return
- */
- @NonNull
- public Moment getMoment() {
- if (moment == null) {
- moment = new Moment();
- }
- return moment;
- }
- public MomentItem setMoment(Moment moment) {
- this.moment = moment;
- return this;
- }
-
- @NonNull
- public List getUserList() {
- if (userList == null) {
- userList = new ArrayList();
-// List list = getPraiseUserIdList();
-// if (list != null) {
-// User u;
-// for (Long id : list) {
-// u = new User(id);
-// u.setName("" + id);
-// userList.add(u);
-// }
-// }
- }
- return userList;
- }
- public MomentItem setUserList(List userList) {
- this.userList = userList;
- return this;
- }
-
- @NonNull
- public List getCommentItemList() {
- if (commentItemList == null) {
- commentItemList = new ArrayList<>();
- }
- return commentItemList;
- }
- public MomentItem setCommentItemList(List commentItemList) {
- this.commentItemList = commentItemList;
- return this;
- }
-
- public List getPraiseUserIdList() {
- return getMoment().getPraiseUserIdList();
- }
-
-
- private Boolean isPraised;
- public boolean getIsPraised() {
- return getIsPraised(APIJSONApplication.getInstance().getCurrentUserId());
- }
- public boolean getIsPraised(final long userId) {
- if (userId <= 0) {
- isPraised = false;
- } else if (isPraised == null) {
- isPraised = isContain(getPraiseUserIdList(), userId);
- }
- return value(isPraised);
- }
- public MomentItem setIsPraised(boolean isPraised) {
- this.isPraised = isPraised;
-
- User currentUser = APIJSONApplication.getInstance().getCurrentUser();
- long userId = currentUser == null ? 0 : currentUser.getId();
-
- List list = getPraiseUserIdList();
- if (list == null) {
- list = new ArrayList<>();
- }
- if (userList == null) {
- userList = new ArrayList();
- }
- if (isPraised == false) {
- list.remove(userId);
- if (userList.isEmpty() == false) {
- User[] users = userList.toArray(new User[]{});
- for (User user : users) {
- if (user != null && user.getId() == userId) {
- userList.remove(user);
- break;
- }
- }
- }
- } else {
- if (list.contains(userId) == false) {
- list.add(userId);
- userList.add(currentUser);
- }
- }
- getMoment().setPraiseUserIdList(list);
-
- setPraiseCount(praiseCount + (isPraised ? 1 : -1));
-
- return this;
- }
- private int praiseCount;
- public int getPraiseCount() {
- return praiseCount;
- }
- public void setPraiseCount(int praiseCount) {
- int idCount = count(getPraiseUserIdList());
- if (praiseCount < idCount) {
- praiseCount = idCount;
- }
- this.praiseCount = praiseCount;
- }
-
- private Boolean isCommented;
- public boolean getIsCommented() {
- return getIsCommented(APIJSONApplication.getInstance().getCurrentUserId());
- }
- public boolean getIsCommented(final long userId) {
- if (userId <= 0) {
- isCommented = false;
- } else if (isCommented == null) {
- isCommented = false;
- List commentItemList = getCommentItemList();
- if (commentItemList != null) {
- for (CommentItem comment : commentItemList) {
- if (comment != null && comment.getComment().getUserId() == userId) {
- isCommented = true;
- break;
- }
- }
- }
- }
- return value(isCommented);
- }
-
- private int commentCount;
- public int getCommentCount() {
- return commentCount;
- }
- public MomentItem setCommentCount(int commentCount) {
- this.commentCount = commentCount;
- return this;
- }
-
-}
\ No newline at end of file
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/model/User.java b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/model/User.java
deleted file mode 100755
index 4088dd8cb..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/model/User.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package apijson.demo.client.model;
-
-import apijson.demo.client.application.APIJSONApplication;
-
-/**用户类
- * @author Lemon
- */
-public class User extends apijson.demo.server.model.User {
- private static final long serialVersionUID = 1L;
-
- private String phone;//为了方便写在这里,登录成功是存入
-
- public User() {
- super();
- }
- public User(long id) {
- super(id);
- }
-
- public String getPhone() {
- return phone;
- }
- public User setPhone(String phone) {
- this.phone = phone;
- return this;
- }
-
-
- @Override
- public Long getId() {
- return value(super.getId());
- }
- @Override
- public Long getDate() {
- return value(super.getDate());
- }
- @Override
- public Integer getSex() {
- return value(super.getSex());
- }
-
-
-
- /**判断是否为当前用户的朋友
- * @return
- */
- public boolean isFriend() {
- return isFriend(APIJSONApplication.getInstance().getCurrentUserId());
- }
- /**判断是否为朋友,双方friendIdList都必须包含对方id
- * @param user
- * @return
- */
- public boolean isFriend(User user) {
- return isFriend(this, user);
- }
- /**判断是否为朋友,双方friendIdList都必须包含对方id
- * @param user0
- * @param user1
- * @return
- */
- public static boolean isFriend(User user0, User user1) {
- return user0 != null && user1 != null && isFriend(user0, user1.getId()) && isFriend(user1, user0.getId());
- }
- /**判断是否为当前用户的朋友,仅从单方的friendIdList判断
- * @param id
- * @return
- */
- public boolean isFriend(long id) {
- return isFriend(this, id);
- }
- /**判断是否为朋友,仅从单方的friendIdList判断
- * @param user0
- * @param id1
- * @return
- */
- public static boolean isFriend(User user0, long id1) {
- //id
- if (id1 <= 0) {
- return false;
- }
- long id0 = user0 == null ? 0 : user0.getId();
- if (id0 <= 0) {
- return false;
- }
-
- //friendIdList
- return isContain(user0.getContactIdList(), id1);
- }
-
-}
\ No newline at end of file
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/model/Verify.java b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/model/Verify.java
deleted file mode 100644
index 0d72b828b..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/model/Verify.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package apijson.demo.client.model;
-
-/**验证码类
- * @author Lemon
- */
-public class Verify extends apijson.demo.server.model.Verify {
- private static final long serialVersionUID = 4298571449155754300L;
-
- public Verify() {
- super();
- }
-
- public Verify(int type, String phone) {
- super(type, phone);
- }
-
-
- @Override
- public Long getId() {
- return value(super.getId());
- }
-
-}
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/model/package-info.java b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/model/package-info.java
deleted file mode 100644
index 9fc5cb348..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/model/package-info.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-/**
- * 继承服务端给的model,并使有对应基本类型(int,long,double,boolean,char等)的变量返回值不为null.
- * 一般可重写父类对应的get方法。例如:
- @Override
- public Long getId() {
- return value(super.getId());
- }
- */
-/**
- * @author Lemon
- *
- */
-package apijson.demo.client.model;
\ No newline at end of file
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/util/ActionUtil.java b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/util/ActionUtil.java
deleted file mode 100644
index 2b98da62c..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/util/ActionUtil.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package apijson.demo.client.util;
-
-public class ActionUtil {
-
- public static final String INTENT_USER = "INTENT_USER";
-
- public static final String ACTION_USER_CHANGED = "ACTION_USER_CHANGED";
- public static final String ACTION_RELOAD_CURRENT_USER = "ACTION_RELOAD_CURRENT_USER";
-
-
-}
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/util/CommentUtil.java b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/util/CommentUtil.java
deleted file mode 100644
index 51ce4ad25..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/util/CommentUtil.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package apijson.demo.client.util;
-
-import java.util.ArrayList;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-import apijson.demo.client.model.CommentItem;
-
-/**评论工具类
- * @author Lemon
- */
-public class CommentUtil {
-
- /**单层列表
- * @param list
- * @return
- */
- public static List toSingleLevelList(List list) {
- if (list == null || list.isEmpty()) {
- return list;
- }
-
- //parent和child分类
- Map parentMap = new LinkedHashMap<>();//added
- long id;
- long toId;
- for (CommentItem item : list) {
- id = item == null ? 0 : item.getId();
- if (id <= 0) {
- continue;
- }
- parentMap.put(id, item);
- }
-
- CommentItem parent;
- for (final CommentItem item : new ArrayList<>(parentMap.values())) {
- parent = null;
- toId = item.getToId();
- if (toId > 0) {
- parent = parentMap.get(toId);
- if (parent == null) {
- parentMap.remove(item.getId());
- continue;
- }
- }
- if (parent != null) {
- item.setToUser(parent.getUser());
- parentMap.put(item.getId(), item);
- }
- }
-
- return new ArrayList<>(parentMap.values());
- }
-
- /**双层(父子二级)列表
- * @param list
- * @return
- */
- public static List toDoubleLevelList(List list) {
- if (list == null || list.isEmpty()) {
- return list;
- }
-
- //parent和child分类
- Map parentMap = new LinkedHashMap<>();//added
- Map allChildMap = new LinkedHashMap<>();
- long id;
- long toId;
- for (CommentItem item : list) {
- id = item == null ? 0 : item.getId();
- if (id <= 0) {
- continue;
- }
- item.setChildList(null);//避免重复添加child
-
- toId = item.getToId();
- if (toId <= 0) {//parent
- parentMap.put(id, item);
- } else {//child
- allChildMap.put(id, item);
- }
- }
-
- //child放到parent的childList中
- boolean isFirst;
- CommentItem parent;
- List childList;
- for (final CommentItem child : allChildMap.values()) {
- toId = child.getToId();
- isFirst = true;
- while (parentMap.containsKey(toId) == false) {//根据父评论一步步找到一级父评论
- parent = toId <= 0 ? null : allChildMap.get(toId);
- if (parent == null) {
- break;
- }
- if (isFirst) {
- isFirst = false;
- child.setToUser(parent.getUser());
- }
-
- toId = parent.getToId();//父评论的父评论的id
- }
-
- parent = parentMap.get(toId);
- if (parent == null) {
- continue;
- }
- if (toId == child.getToId()) {
- child.setToUser(parent.getUser());
- }
-
- childList = parent.getChildList();
- if (childList == null) {
- childList = new ArrayList<>();
- }
- childList.add(child);
-
- parent.setChildList(childList);
- parentMap.put(toId, parent);
- }
-
- return new ArrayList<>(parentMap.values());
- }
-
-}
\ No newline at end of file
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/util/Constant.java b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/util/Constant.java
deleted file mode 100755
index 1ec0529f5..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/util/Constant.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package apijson.demo.client.util;
-
-
-/**常量工具类
- * @author Lemon
- * @warn TODO 修改里面所有常量
- */
-public class Constant {
-
- public static final String APP_OFFICIAL_WEBSITE = "https://github.com/TommyLemon/APIJSON";
- public static final String APP_OFFICIAL_WEIBO = "weibo.com/5225556360";
- public static final String APP_OFFICIAL_BLOG = "http://my.oschina.net/u/2437072";
- public static final String APP_OFFICIAL_EMAIL = "tommylemon@qq.com";
- public static final String APP_DOWNLOAD_WEBSITE = "http://files.cnblogs.com/files/tommylemon/APIJSONApp.apk";
-
- public static final String APP_DEVELOPER_WEBSITE = "https://github.com/TommyLemon";
-
- public static final String UPDATE_LOG_WEBSITE = "github.com/TommyLemon/APIJSON/commits/master";
-
-}
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/util/HttpRequest.java b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/util/HttpRequest.java
deleted file mode 100755
index 8571b79ee..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/util/HttpRequest.java
+++ /dev/null
@@ -1,720 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package apijson.demo.client.util;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import zuo.biao.apijson.JSONObject;
-import zuo.biao.apijson.JSONRequest;
-import zuo.biao.apijson.JSONResponse;
-import zuo.biao.apijson.RequestRole;
-import zuo.biao.library.manager.HttpManager.OnHttpResponseListener;
-import zuo.biao.library.util.Log;
-import zuo.biao.library.util.SettingUtil;
-import android.os.Handler;
-import apijson.demo.client.application.APIJSONApplication;
-import apijson.demo.client.manager.HttpManager;
-import apijson.demo.client.model.CommentItem;
-import apijson.demo.server.model.Comment;
-import apijson.demo.server.model.Moment;
-import apijson.demo.server.model.Privacy;
-import apijson.demo.server.model.User;
-import apijson.demo.server.model.Verify;
-
-/**HTTP请求工具类
- * @author Lemon
- * @use 添加请求方法xxxMethod >> HttpRequest.xxxMethod(...)
- * @must 所有请求的url、请求方法(GET, POST等)、请求参数(key-value方式,必要key一定要加,没提供的key不要加,value要符合指定范围)
- * 都要符合后端给的接口文档
- */
-public class HttpRequest {
- private static final String TAG = "HttpRequest";
-
- private static APIJSONApplication application;
- /**基础URL,这里服务器设置可切换*/
- public static String URL_BASE;
- static {
- application = APIJSONApplication.getInstance();
- URL_BASE = SettingUtil.getCurrentServerAddress();
- }
-
- public static final String URL_HEAD = URL_BASE + "head/";
- public static final String URL_GET = URL_BASE + "get/";
- public static final String URL_POST = URL_BASE + "post/";
- public static final String URL_HEADS = URL_BASE + "heads/";
- public static final String URL_GETS = URL_BASE + "gets/";
- public static final String URL_PUT = URL_BASE + "put/";
- public static final String URL_DELETE = URL_BASE + "delete/";
-
- /**
- * @param request
- * @param requestCode
- * @param listener
- */
- public static void head(JSONObject request, int requestCode, OnHttpResponseListener listener) {
- HttpManager.getInstance().post(URL_HEAD, request, requestCode, listener);
- }
- /**
- * @param request
- * @param requestCode
- * @param listener
- */
- public static void get(JSONObject request, int requestCode, OnHttpResponseListener listener) {
- HttpManager.getInstance().post(URL_GET, request, requestCode, listener);
- }
- /**
- * @param request
- * @param requestCode
- * @param listener
- * @must request最外层有tag,部分请求还要currentUserId和对应的password
- */
- public static void post(JSONObject request, int requestCode, OnHttpResponseListener listener) {
- HttpManager.getInstance().post(URL_POST, request, requestCode, listener);
- }
- /**用POST方法HEAD数据,request和response都非明文,浏览器看不到,用于对安全性要求高的HEAD请求
- * @param request
- * @param requestCode
- * @param listener
- * @must request最外层有tag,部分请求还要currentUserId和对应的password
- */
- public static void heads(JSONObject request, int requestCode, OnHttpResponseListener listener) {
- HttpManager.getInstance().post(URL_HEADS, request, requestCode, listener);
- }
- /**用POST方法GET数据,request和response都非明文,浏览器看不到,用于对安全性要求高的GET请求
- * @param request
- * @param requestCode
- * @param listener
- * @must request最外层有tag,部分请求还要currentUserId和对应的password
- */
- public static void gets(JSONObject request, int requestCode, OnHttpResponseListener listener) {
- HttpManager.getInstance().post(URL_GETS, request, requestCode, listener);
- }
- /**
- * @param request
- * @param requestCode
- * @param listener
- * @must request最外层有tag,部分请求还要currentUserId和对应的password
- */
- public static void put(JSONObject request, int requestCode, OnHttpResponseListener listener) {
- HttpManager.getInstance().post(URL_PUT, request, requestCode, listener);
- }
- /**
- * @param request
- * @param requestCode
- * @param listener
- * @must request最外层有tag,部分请求还要currentUserId和对应的password
- */
- public static void delete(JSONObject request, int requestCode, OnHttpResponseListener listener) {
- HttpManager.getInstance().post(URL_DELETE, request, requestCode, listener);
- }
-
-
-
-
-
-
-
-
-
-
- //加 _ 表示class名,避免VERIFY不知道是 Verify 还是 verify 这种冲突
- public static final String USER_;
- public static final String PRIVACY_;
- public static final String MOMENT_;
- public static final String COMMENT_;
- public static final String VERIFY_;
- static {
- USER_ = User.class.getSimpleName();
- PRIVACY_ = Privacy.class.getSimpleName();
- MOMENT_ = Moment.class.getSimpleName();
- COMMENT_ = Comment.class.getSimpleName();
- VERIFY_ = Verify.class.getSimpleName();
- }
-
-
- //user<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- public static final String TOTAL = JSONResponse.KEY_TOTAL;
-
- public static final String RANGE = "range";
-
- public static final String ID = "id";
- public static final String USER_ID = "userId";
-
- public static final String NAME = "name";
- public static final String PHONE = "phone";
- public static final String PASSWORD = "password";
- public static final String LOGIN_PASSWORD = "loginPassword";
- public static final String PAY_PASSWORD = "payPassword";
- public static final String OLD_PASSWORD = "oldPassword";
- public static final String VERIFY = "verify";
-
- public static final String SEX = "sex";
- public static final String TYPE = "type";
- public static final String CONTENT = "content";
-
-
-
-
- public static final String DATE_UP = "date+";//同 "date ASC"
- public static final String DATE_DOWN = "date-";//同 "date DESC"
-
- public static final String ID_AT = ID + "@";
- public static final String USER_ID_AT = USER_ID + "@";
- public static final String MOMENT_ID_AT = "momentId@";
- public static final String COMMENT_ID_AT = "commentId@";
-
- public static final String ID_IN = ID + "{}";
- public static final String USER_ID_IN = USER_ID + "{}";
- public static final String MOMENT_ID_IN = "momentId{}";
- public static final String COMMENT_ID_IN = "commentId{}";
-
- public static final String NAME_SEARCH = NAME + "$";
- public static final String PHONE_SEARCH = PHONE + "$";
- public static final String CONTENT_SEARCH = CONTENT + "$";
-
-
-
- public static final String COLUMNS_USER_SIMPLE = "id,name";
- public static final String COLUMNS_USER = "id,sex,name,head";
-
-
- //account<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- /**注册
- * @param phone
- * @param password
- * @param name
- * @param sex
- * @param requestCode
- * @param listener
- */
- public static void register(String verify, String phone, String password, String name, int sex
- , int requestCode, OnHttpResponseListener listener) {
- JSONObject request = new JSONRequest(new Privacy(phone, password));
- request.puts(new User().setName(name).setSex(sex));
- request.puts(VERIFY, verify);
- HttpManager.getInstance().post(URL_BASE + "register", request, requestCode, listener);
- }
-
- /**
- * @param phone
- * @param requestCode
- * @param listener
- */
- public static void checkRegister(String phone, int requestCode, OnHttpResponseListener listener) {
- head(new JSONRequest(new Privacy().setPhone(phone)), requestCode, listener);
- }
-
- /**登录
- * @param phone
- * @param password
- * @param requestCode
- * @param listener
- */
- public static void login(String phone, String password, int type, int requestCode, OnHttpResponseListener listener) {
- JSONRequest request = new JSONRequest();
- request.put(TYPE, type);
- request.put(PHONE, phone);
- request.put(PASSWORD, password);
- HttpManager.getInstance().post(URL_BASE + "login/", request, requestCode, listener);
- }
- /**退出登录
- * @param requestCode
- * @param listener
- */
- public static void logout(int requestCode, OnHttpResponseListener listener) {
- HttpManager.getInstance().post(URL_BASE + "logout/", new JSONRequest(), requestCode, listener);
- //不能在传到服务器之前销毁session
- new Handler().postDelayed(new Runnable() {
-
- @Override
- public void run() {
- HttpManager.getInstance().saveCookie(null);
- }
- }, 500);
- }
-
- /**重置登录密码
- * @param verify
- * @param phone
- * @param password
- * @param requestCode
- * @param listener
- */
- public static void setPassword(String verify, String phone, String password
- , int requestCode, OnHttpResponseListener listener) {
- setPassword(verify, phone, password, Privacy.PASSWORD_TYPE_LOGIN, requestCode, listener);
- }
- /**重置密码
- * @param verify
- * @param phone
- * @param password
- * @param type
- * @param requestCode
- * @param listener
- */
- public static void setPassword(String verify, String phone, String password, int type
- , int requestCode, OnHttpResponseListener listener) {
- JSONRequest request = new JSONRequest();
- request.put(VERIFY, verify);
- Privacy privacy = new Privacy().setPhone(phone);
- if (type == Privacy.PASSWORD_TYPE_LOGIN) {
- privacy.setPassword(password);
- } else {
- privacy.setPayPassword(password);
- }
- request.put(privacy);
-
- HttpManager.getInstance().post(URL_BASE + "put/password", request, requestCode, listener);
- }
-
-
-
- /**获取验证码
- * @param type
- * @param phone
- * @param requestCode
- * @param listener
- */
- public static void getVerify(int type, String phone, int requestCode, OnHttpResponseListener listener) {
- HttpManager.getInstance().post(URL_BASE + "post/verify/"
- , new JSONRequest(PHONE, phone).puts(TYPE, type).setTag(VERIFY_)
- , requestCode, listener);
- }
- /**校验验证码
- * @param type
- * @param phone
- * @param verify
- * @param requestCode
- * @param listener
- */
- public static void checkVerify(int type, String phone, String verify, int requestCode, OnHttpResponseListener listener) {
- JSONRequest request = new JSONRequest();
- request.put(TYPE, type);
- request.put(PHONE, phone);
- request.put(VERIFY, verify);
-
- HttpManager.getInstance().post(URL_BASE + "heads/verify"
- , request.setTag(VERIFY_)
- , requestCode, listener);
- }
-
-
- /**设置密码
- * @param type
- * @param password 只需要phone和verify,不需要old password
- * @param phone
- * @param verify
- * @param requestCode
- * @param listener
- */
- public static void setPassword(int type, String password, String phone, String verify
- , int requestCode, OnHttpResponseListener listener) {
- Privacy privacy = new Privacy(phone, password);
- JSONRequest request = new JSONRequest(privacy);
- request.put(VERIFY, verify);
-
- put(request.setTag(PRIVACY_), requestCode, listener);
- }
-
- //account>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
- //User<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- /**获取用户
- * @param id
- * @param requestCode
- * @param listener
- */
- public static void getUser(long id, int requestCode, OnHttpResponseListener listener) {
- getUser(id, false, requestCode, listener);
- }
- /**获取用户
- * @param id
- * @param withMomentList
- * @param requestCode
- * @param listener
- */
- public static void getUser(long id, boolean withMomentList, int requestCode, OnHttpResponseListener listener) {
- JSONRequest request = new JSONRequest(new User(id));
- if (withMomentList) {
- request.putsAll(new JSONRequest(MOMENT_
- , new JSONRequest(USER_ID, id).setColumn("pictureList").setOrder(DATE_DOWN))
- .toArray(3, 0, MOMENT_));
- }
- get(request, requestCode, listener);
- }
- /**添加联系人
- * @param id
- * @param requestCode
- * @param listener
- */
- public static void setIsFriend(long id, boolean isFriend, int requestCode, OnHttpResponseListener listener) {
- User user = application.getCurrentUser();
- if (user == null) {
- user = new User();
- }
- List list = new ArrayList();
- list.add(id);
- JSONObject userObject = new JSONObject(new User(user.getId()));
- userObject.put("contactIdList" + (isFriend ? "+" : "-"), list);
- put(new JSONRequest(USER_, userObject).setTag(USER_), requestCode, listener);
- }
-
- public static final int RANGE_ALL = 0;
- public static final int RANGE_SINGLE = 1;
- public static final int RANGE_USER = 2;
- public static final int RANGE_USER_FRIEND = 3;
- public static final int RANGE_USER_CIRCLE = 4;//RANGE_USER + RANGE_USER_FRIEND
- public static final int RANGE_MOMENT = 5;
- public static final int RANGE_COMMENT = 6;
-
- /**获取用户列表
- * @param range
- * @param id
- * @param search
- * @param idList
- * @param count
- * @param page
- * @param requestCode
- * @param listener
- */
- public static void getUserList(int range, long id, com.alibaba.fastjson.JSONObject search, List idList
- , int count, int page, int requestCode, OnHttpResponseListener listener) {
- JSONRequest request = new JSONRequest();
-
- JSONRequest userItem = new JSONRequest();
- if (idList != null) {
- userItem.put(ID_IN, idList);
- } else {
- apijson.demo.client.model.User currentUser = application.getCurrentUser();
- if (currentUser == null) {
- currentUser = new apijson.demo.client.model.User();
- }
- switch (range) {
- case RANGE_ALL://1.首推注册时间长的(也可以是级别高的);2.给男性用户首推女性用户
- userItem.put("id!", currentUser.getId()); //排除当前用户
- userItem.setOrder(DATE_UP, (currentUser.getSex() == 0 ? "sex-" : ""));
- break;
- case RANGE_SINGLE:
- case RANGE_USER:
- userItem.put(ID, id);
- break;
- case RANGE_USER_FRIEND:
- case RANGE_USER_CIRCLE:
- if (application.isCurrentUser(id) == false) {
- Log.e(TAG, "只允许查看当前用户的!");
- return;
- }
- List list = currentUser.getContactIdList();
- if (list == null) {//不能放在range == RANGE_USER_CIRCLE里面,为null不会当成查询条件!
- list = new ArrayList();
- }
- if (range == RANGE_USER_CIRCLE) {
- list.add(currentUser.getId());
- } else {//问题可能在于登录状态错误
- list.remove(currentUser.getId());//避免误添加
- }
- userItem.put(ID_IN, list);
- userItem.setOrder("name+");
- break;
- case RANGE_MOMENT:
- JSONObject moment = new JSONObject(new Moment(id));
- moment.setColumn("praiseUserIdList");
- request.put(MOMENT_, moment);
- userItem.put(ID_IN+"@", "Moment/praiseUserIdList");
- break;
- case RANGE_COMMENT:
- JSONObject comment = new JSONObject(new Comment(id));
- comment.setColumn(USER_ID);
- request.put(COMMENT_, comment);
- userItem.put(ID_AT, "Comment/userId");
- break;
- default:
- break;
- }
- userItem.putsAll(search);
- }
-
- JSONRequest listRequest = new JSONRequest(USER_, userItem);
- listRequest = listRequest.toArray(count, page, USER_);
- request.putsAll(listRequest);
- get(request, requestCode, listener);
- }
-
- //User>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
-
- //Moment<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- /**获取作品
- * @param id
- * @param requestCode
- * @param listener
- */
- public static void getMoment(long id, int requestCode, OnHttpResponseListener listener) {
- JSONRequest request = new JSONRequest(new Moment(id));
- request.put(USER_, new JSONRequest(ID_AT, "/Moment/userId").setColumn(COLUMNS_USER));
- //praise <<<<<<<<<<<<<<<<<<
- JSONRequest userItem = new JSONRequest();
- userItem.put(USER_, new JSONRequest(ID_IN+"@", "Moment/praiseUserIdList")
- .setColumn(COLUMNS_USER_SIMPLE));
-
- userItem.setQuery(JSONRequest.QUERY_ALL);//同时获取Table和total
- request.putsAll(userItem.toArray(10, 0, USER_));
- request.put("praiseCount@", "/User[]/total");//获取Table的总数total
- //praise >>>>>>>>>>>>>>>>>>
-
- get(request, requestCode, listener);
- }
-
- /**获取动态列表
- * @param range
- * @param id
- * @param search
- * @param count
- * @param page
- * @param requestCode
- * @param listener
- */
- public static void getMomentList(int range, long id, com.alibaba.fastjson.JSONObject search
- , int count, int page, int requestCode, OnHttpResponseListener listener) {
- JSONRequest request = new JSONRequest();
-
- JSONRequest moment = new JSONRequest();
- switch (range) {
- case RANGE_ALL:
- //do noting
- break;
- case RANGE_SINGLE:
- moment.put(ID, id);
- break;
- case RANGE_USER:
- moment.put(USER_ID, id);
- break;
- case RANGE_USER_FRIEND:
- case RANGE_USER_CIRCLE:
- if (application.isCurrentUser(id) == false) {
- Log.e(TAG, "只允许查看当前用户的!");
- return;
- }
- apijson.demo.client.model.User currentUser = application.getCurrentUser();
- if (currentUser == null) {
- currentUser = new apijson.demo.client.model.User();
- }
- List list = currentUser.getContactIdList();
- if (list == null) {
- list = new ArrayList();
- }
- if (range == RANGE_USER_CIRCLE) {
- list.add(currentUser.getId());
- }
- moment.put(USER_ID_IN, list);
- // moment.setRole(range == RANGE_USER_FRIEND ? RequestRole.CONTACT.name() : RequestRole.CIRCLE.name());
- break;
- default:
- break;
- }
- moment.setOrder(DATE_DOWN);
- moment.putsAll(search);
-
- request.put(MOMENT_, moment);
- request.put(USER_, new JSONRequest(ID_AT, "/Moment/userId").setColumn(COLUMNS_USER));
-
- //praise <<<<<<<<<<<<<<<<<<
- JSONRequest userItem = new JSONRequest();
- userItem.put(USER_, new JSONRequest(ID_IN+"@", "[]/Moment/praiseUserIdList")
- .setColumn(COLUMNS_USER_SIMPLE));
-
- // userItem.setQuery(JSONRequest.QUERY_ALL);
- request.putsAll(userItem.toArray(10, 0, USER_));
- // request.put("praiseCount@", "/User[]/total");
- //praise >>>>>>>>>>>>>>>>>>
-
- //comment <<<<<<<<<<<<<<<<<<
- JSONRequest commentItem = new JSONRequest();
- commentItem.put(COMMENT_, new JSONRequest(MOMENT_ID_AT, "[]/Moment/id").setOrder(DATE_UP));
- commentItem.put(USER_, new JSONRequest(ID_AT, "/Comment/userId")
- .setColumn(COLUMNS_USER_SIMPLE));
-
- // commentItem.setQuery(JSONRequest.QUERY_ALL);
- request.putsAll(commentItem.toArray(6, 0, CommentItem.class.getSimpleName()));
- // request.put("commentCount@", "/CommentItem[]/total");
- //comment >>>>>>>>>>>>>>>>>>
-
- get(request.toArray(count, page), requestCode, listener);
- }
-
- /**赞动态
- * @param id
- * @param toPraise
- * @param requestCode
- * @param listener
- */
- public static void praiseMoment(long id, boolean toPraise, int requestCode, OnHttpResponseListener listener) {
- JSONObject data = new JSONObject(new Moment(id));
- List list = new ArrayList();
- list.add(application.getCurrentUserId());
- data.puts("praiseUserIdList" + (toPraise ? "+" : "-"), list);
-
- put(new JSONRequest(MOMENT_, data).setTag(MOMENT_), requestCode, listener);
- }
-
- /**新增动态
- * @param content
- * @param requestCode
- * @param listener
- */
- public static void addMoment(String content, int requestCode, OnHttpResponseListener listener) {
- List list = new ArrayList();
- list.add("http://static.oschina.net/uploads/user/1218/2437072_100.jpg?t=1461076033000");
- list.add("http://common.cnblogs.com/images/icon_weibo_24.png");
-
- post(new JSONRequest(
- new Moment()
- .setUserId(application.getCurrentUserId())
- .setContent(content)
- .setPictureList(list)
- ).setTag(MOMENT_)
- , requestCode, listener);
- }
-
- /**删除动态
- * @param id
- * @param requestCode
- * @param listener
- */
- public static void deleteMoment(Long id, int requestCode, OnHttpResponseListener listener) {
- delete(new JSONRequest(new Moment(id)).setTag(MOMENT_), requestCode, listener);
- }
-
-
- //Moment>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
-
- //Comment<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- /**获取评论列表
- * @param momentId
- * @param count
- * @param page
- * @param requestCode
- * @param listener
- */
- public static void getCommentList(long momentId, int count, int page
- , int requestCode, OnHttpResponseListener listener) {
- JSONRequest request = new JSONRequest();
- JSONObject comment = new JSONObject(new Comment().setMomentId(momentId));
- request.put(COMMENT_, comment.setOrder("toId+", DATE_UP));
- request.put(USER_, new JSONRequest(ID_AT, "/Comment/userId").setColumn(COLUMNS_USER));
-
- // if (page == 0) {
- // request.setQuery(JSONRequest.QUERY_ALL);
- // }
- request = request.toArray(count, page);
- // if (page == 0) {
- // request.putPath(TOTAL, "[]", TOTAL);
- // }
-
- get(request, requestCode, listener);
- }
-
- /**
- * @param momentId
- * @param toCommentId
- * @param toUserId 不能省,可能同一toCommentId下回复不同的人
- * @param content
- * @param requestCode
- * @param listener
- */
- public static void addComment(long momentId, long toCommentId, long toUserId, String content
- , int requestCode, OnHttpResponseListener listener) {
- Comment comment = new Comment()
- .setToId(toCommentId)
- .setUserId(application.getCurrentUserId())
- .setMomentId(momentId)
- .setContent(content);
-
- post(new JSONRequest(comment).setTag(COMMENT_), requestCode, listener);
- }
- /**
- * @param id
- * @param userId
- * @param requestCode
- * @param listener
- */
- public static void deleteComment(long id, long userId, int requestCode, OnHttpResponseListener listener) {
- delete(new JSONRequest(
- COMMENT_, new JSONObject(
- new Comment(id)
- ).setRole(application.isCurrentUser(userId) ? RequestRole.OWNER.name() : RequestRole.ADMIN.name())
- ).setTag(COMMENT_)
- , requestCode, listener);
- }
-
- //Comment>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-
-
- //Money<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- /**获取当前用户隐私信息
- * @param requestCode
- * @param listener
- */
- public static void getPrivacy(int requestCode, OnHttpResponseListener listener) {
- gets(new JSONRequest(
- new Privacy(application.getCurrentUserId())
- ).setTag(PRIVACY_), requestCode, listener);
- }
- /**获取圈子内用户隐私信息
- * @param id
- * @param requestCode
- * @param listener
- */
- public static void getPrivacy(long id, int requestCode, OnHttpResponseListener listener) {
- gets(new JSONRequest(
- PRIVACY_, new JSONObject(new Privacy(id)).setRole(RequestRole.CIRCLE.name())
- ).setTag("Privacy-CIRCLE"), requestCode, listener);
- }
-
- /**修改余额
- * @param change
- * @param payPassword
- * @param requestCode
- * @param listener
- */
- public static void changeBalance(double change, String payPassword, int requestCode, OnHttpResponseListener listener) {
- JSONObject privacy = new JSONObject(
- new Privacy(application.getCurrentUserId()).setPayPassword(payPassword)
- );
- privacy.puts("balance+", change);
- JSONRequest request = new JSONRequest(PRIVACY_, privacy);
-
- HttpManager.getInstance().post(URL_BASE + "put/balance", request.setTag(PRIVACY_), requestCode, listener);
- }
-
-
- //Money>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-
-}
\ No newline at end of file
diff --git a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/util/MenuUtil.java b/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/util/MenuUtil.java
deleted file mode 100644
index 67ce8c1d7..000000000
--- a/APIJSON-Android/APIJSON-ADT/APIJSONApp/APIJSONApp/src/apijson/demo/client/util/MenuUtil.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.*/
-
-package apijson.demo.client.util;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import zuo.biao.library.model.Menu;
-import apijson.demo.client.R;
-import apijson.demo.client.application.APIJSONApplication;
-
-/**底部菜单工具类
- * @author Lemon
- */
-public class MenuUtil {
-
- public static final String NAME_SEND_MESSAGE = "发信息";//信息记录显示在通话记录左边
- public static final String NAME_CALL = "呼叫";//信息记录显示在通话记录左边
- public static final String NAME_SEND = "发送";
- public static final String NAME_QRCODE = "二维码";
- public static final String NAME_ADD = "添加";
- public static final String NAME_EDIT = "编辑";
- public static final String NAME_EDIT_ALL = "编辑所有";
- public static final String NAME_DELETE = "删除";
- public static final String NAME_SEND_EMAIL = "发邮件";
-
- public static final int INTENT_CODE_SEND_MESSAGE = 1;//信息记录显示在通话记录左边
- public static final int INTENT_CODE_CALL = 2;//信息记录显示在通话记录左边
- public static final int INTENT_CODE_SEND = 3;
- public static final int INTENT_CODE_QRCODE = 4;
- // public static final int INTENT_CODE_SETTING = 5;
- public static final int INTENT_CODE_ADD = 6;
- public static final int INTENT_CODE_EDIT = 7;
- public static final int INTENT_CODE_EDIT_ALL = 8;
- public static final int INTENT_CODE_DELETE = 9;
- public static final int INTENT_CODE_SEND_EMAIL = 10;
-
- public static Menu FSB_SEND_MESSAGE = new Menu(NAME_SEND_MESSAGE, R.drawable.mail_light, INTENT_CODE_SEND_MESSAGE);
- public static Menu FSB_CALL = new Menu(NAME_CALL, R.drawable.call_light, INTENT_CODE_CALL);
- public static Menu FSB_SEND = new Menu(NAME_SEND, R.drawable.send_light, INTENT_CODE_SEND);
- public static Menu FSB_QRCODE = new Menu(NAME_QRCODE, R.drawable.qrcode, INTENT_CODE_QRCODE);
- // public static Menu FSB_SETTING = new Menu(NAME_SETTING, R.drawable.setting_light, INTENT_CODE_SETTING);
- public static Menu FSB_ADD = new Menu(NAME_ADD, R.drawable.add_light, INTENT_CODE_ADD);
- public static Menu FSB_EDIT = new Menu(NAME_EDIT, R.drawable.edit_light, INTENT_CODE_EDIT);
- public static Menu FSB_EDIT_ALL = new Menu(NAME_EDIT_ALL, R.drawable.edit_light, INTENT_CODE_EDIT_ALL);
- public static Menu FSB_DELETE = new Menu(NAME_DELETE, R.drawable.delete_light, INTENT_CODE_DELETE);
- public static Menu FSB_SEND_EMAIL = new Menu(NAME_SEND_EMAIL, R.drawable.mail_light, INTENT_CODE_SEND_EMAIL);
-
- public static final int CONTACT_LIST_FRAGMENT_MULTI = 1;
-
- public static final int USER = 1;
- public static List