├── .gitignore
├── LICENSE
├── Modular
├── .gitignore
├── app
│ ├── .gitignore
│ ├── build.gradle
│ ├── gradle.properties
│ ├── proguard-rules.pro
│ └── src
│ │ ├── androidTest
│ │ └── java
│ │ │ └── com
│ │ │ └── kymjs
│ │ │ └── app
│ │ │ └── ExampleInstrumentedTest.java
│ │ ├── main
│ │ ├── AndroidManifest.xml
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── kymjs
│ │ │ │ └── app
│ │ │ │ ├── AppContext.java
│ │ │ │ └── MainActivity.java
│ │ └── res
│ │ │ ├── drawable-v21
│ │ │ ├── ic_menu_camera.xml
│ │ │ ├── ic_menu_gallery.xml
│ │ │ ├── ic_menu_manage.xml
│ │ │ ├── ic_menu_send.xml
│ │ │ ├── ic_menu_share.xml
│ │ │ └── ic_menu_slideshow.xml
│ │ │ ├── drawable
│ │ │ └── side_nav_bar.xml
│ │ │ ├── layout
│ │ │ ├── activity_main.xml
│ │ │ ├── app_bar_main.xml
│ │ │ ├── content_main.xml
│ │ │ └── nav_header_main.xml
│ │ │ ├── menu
│ │ │ ├── activity_main_drawer.xml
│ │ │ └── main.xml
│ │ │ ├── mipmap-hdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-mdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── values-v21
│ │ │ └── styles.xml
│ │ │ ├── values-w820dp
│ │ │ └── dimens.xml
│ │ │ └── values
│ │ │ ├── colors.xml
│ │ │ ├── dimens.xml
│ │ │ ├── drawables.xml
│ │ │ ├── strings.xml
│ │ │ └── styles.xml
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── kymjs
│ │ └── app
│ │ └── ExampleUnitTest.java
├── apt
│ ├── .gitignore
│ ├── build.gradle
│ └── src
│ │ └── main
│ │ ├── java
│ │ └── com
│ │ │ └── kymjs
│ │ │ └── core
│ │ │ └── apt
│ │ │ ├── APTProcessor.java
│ │ │ └── RList.java
│ │ └── resources
│ │ └── META-INF
│ │ └── services
│ │ └── javax.annotation.processing.Processor
├── base-res
│ ├── .gitignore
│ ├── build.gradle
│ ├── proguard-rules.pro
│ └── src
│ │ ├── androidTest
│ │ └── java
│ │ │ └── com
│ │ │ └── kymjs
│ │ │ └── app
│ │ │ └── base_res
│ │ │ └── ExampleInstrumentedTest.java
│ │ ├── main
│ │ ├── AndroidManifest.xml
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── kymjs
│ │ │ │ └── app
│ │ │ │ └── base_res
│ │ │ │ └── utils
│ │ │ │ └── AnimationUtil.java
│ │ └── res
│ │ │ ├── layout
│ │ │ ├── baseres_activity_main.xml
│ │ │ └── baseres_toolbar.xml
│ │ │ └── values
│ │ │ ├── colors.xml
│ │ │ ├── dimens.xml
│ │ │ ├── strings.xml
│ │ │ └── styles.xml
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── kymjs
│ │ └── app
│ │ └── base_res
│ │ └── ExampleUnitTest.java
├── build.gradle
├── explorer
│ ├── .gitignore
│ ├── build.gradle
│ ├── dependency.txt
│ ├── gradle.properties
│ ├── outputs
│ │ └── jar
│ │ │ └── sharedDependency.jar
│ ├── proguard-rules.pro
│ └── src
│ │ ├── androidTest
│ │ └── java
│ │ │ └── com
│ │ │ └── kymjs
│ │ │ └── app
│ │ │ └── explorer
│ │ │ └── ExampleInstrumentedTest.java
│ │ ├── main
│ │ ├── debug
│ │ │ └── AndroidManifest.xml
│ │ ├── java
│ │ │ ├── com
│ │ │ │ └── kymjs
│ │ │ │ │ └── app
│ │ │ │ │ └── explorer
│ │ │ │ │ └── MainActivity.java
│ │ │ └── debug
│ │ │ │ └── AppContext.java
│ │ ├── release
│ │ │ └── AndroidManifest.xml
│ │ └── res
│ │ │ ├── layout
│ │ │ └── explorer_content_main.xml
│ │ │ ├── menu
│ │ │ └── explorer_main.xml
│ │ │ ├── mipmap-hdpi
│ │ │ └── explorer_ic_launcher.png
│ │ │ ├── mipmap-mdpi
│ │ │ └── explorer_ic_launcher.png
│ │ │ ├── mipmap-xhdpi
│ │ │ └── explorer_ic_launcher.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ └── explorer_ic_launcher.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ └── explorer_ic_launcher.png
│ │ │ ├── values-v21
│ │ │ └── styles.xml
│ │ │ ├── values-w820dp
│ │ │ └── dimens.xml
│ │ │ └── values
│ │ │ ├── colors.xml
│ │ │ ├── dimens.xml
│ │ │ ├── strings.xml
│ │ │ └── styles.xml
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── kymjs
│ │ └── app
│ │ └── explorer
│ │ └── ExampleUnitTest.java
├── extra_config.gradle
├── gradle.properties
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── memory-box
│ ├── .gitignore
│ ├── build.gradle
│ ├── dependency.txt
│ ├── gradle.properties
│ ├── outputs
│ │ └── jar
│ │ │ └── sharedDependency.jar
│ ├── proguard-rules.pro
│ └── src
│ │ ├── androidTest
│ │ └── java
│ │ │ └── com
│ │ │ └── kymjs
│ │ │ └── app
│ │ │ └── memory
│ │ │ └── ExampleInstrumentedTest.java
│ │ ├── main
│ │ ├── debug
│ │ │ └── AndroidManifest.xml
│ │ ├── java
│ │ │ ├── com
│ │ │ │ └── kymjs
│ │ │ │ │ └── app
│ │ │ │ │ └── memory
│ │ │ │ │ ├── database
│ │ │ │ │ ├── Dao.java
│ │ │ │ │ └── DatabaseHelper.java
│ │ │ │ │ ├── model
│ │ │ │ │ └── BoxItem.java
│ │ │ │ │ ├── module
│ │ │ │ │ ├── list
│ │ │ │ │ │ └── MainFragment.java
│ │ │ │ │ └── main
│ │ │ │ │ │ └── MainActivity.java
│ │ │ │ │ └── view
│ │ │ │ │ └── DragGridView.java
│ │ │ └── debug
│ │ │ │ └── AppContext.java
│ │ ├── release
│ │ │ └── AndroidManifest.xml
│ │ └── res
│ │ │ ├── layout
│ │ │ └── memory_fragment_main.xml
│ │ │ ├── mipmap-hdpi
│ │ │ └── memory_ic_launcher.png
│ │ │ ├── mipmap-mdpi
│ │ │ └── memory_ic_launcher.png
│ │ │ ├── mipmap-xhdpi
│ │ │ └── memory_ic_launcher.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ └── memory_ic_launcher.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ └── memory_ic_launcher.png
│ │ │ ├── values-w820dp
│ │ │ └── dimens.xml
│ │ │ └── values
│ │ │ ├── colors.xml
│ │ │ ├── dimens.xml
│ │ │ ├── strings.xml
│ │ │ └── styles.xml
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── kymjs
│ │ └── app
│ │ └── memory
│ │ └── ExampleUnitTest.java
├── router
│ ├── .gitignore
│ ├── build.gradle
│ ├── proguard-rules.pro
│ └── src
│ │ ├── androidTest
│ │ └── java
│ │ │ └── com
│ │ │ └── kymjs
│ │ │ └── router
│ │ │ └── ExampleInstrumentedTest.java
│ │ ├── main
│ │ ├── AndroidManifest.xml
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── kymjs
│ │ │ │ └── router
│ │ │ │ ├── ActivityRouter.java
│ │ │ │ ├── FragmentRouter.java
│ │ │ │ └── RouterList.java
│ │ └── res
│ │ │ └── values
│ │ │ └── strings.xml
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── kymjs
│ │ └── router
│ │ └── ExampleUnitTest.java
└── settings.gradle
├── NOTICE
└── README.md
/.gitignore:
--------------------------------------------------------------------------------
1 | tomsuite.xml
2 | **pom.xml.releaseBackup
3 | release.properties
4 | gen
5 | */seed.txt
6 | notes
7 | logs
8 | gen-external-apklibs
9 | .idea
10 | *.iml
11 | .DS_Store
12 | *.swp
13 | out
14 | .gradle
15 | /local.properties
16 | /build
17 |
18 | ###OSX###
19 |
20 | .DS_Store
21 | .AppleDouble
22 | .LSOverride
23 |
24 | # Icon must ends with two \r.
25 | Icon
26 |
27 |
28 | # Thumbnails
29 | ._*
30 |
31 | # Files that might appear on external disk
32 | .Spotlight-V100
33 | .Trashes
34 |
35 |
36 | ###Linux###
37 |
38 | *~
39 |
40 | # KDE directory preferences
41 | .directory
42 |
43 |
44 | ###Android###
45 |
46 | # Built application files
47 | *.apk
48 | *.ap_
49 |
50 | # Files for ART and Dalvik VM
51 | *.dex
52 |
53 | # Java class files
54 | *.class
55 |
56 | # Generated files
57 | bin/
58 | gen/
59 |
60 | # Gradle files
61 | .gradle/
62 | .gradletasknamecache
63 | build/
64 |
65 | # Local configuration file (sdk path, etc)
66 | local.properties
67 |
68 | # Proguard folder generated by Eclipse
69 | proguard/
70 |
71 | # Lint
72 | lint-report.html
73 | lint-report_files/
74 | lint_result.txt
75 |
76 | # Mobile Tools for Java (J2ME)
77 | .mtj.tmp/
78 |
79 | # Package Files #
80 | *.war
81 | *.ear
82 |
83 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
84 | hs_err_pid*
85 |
86 |
87 | ###IntelliJ###
88 |
89 | *.iml
90 | *.ipr
91 | *.iws
92 | .idea/
93 |
94 |
95 | ###Eclipse###
96 |
97 | *.pydevproject
98 | .metadata
99 | tmp/
100 | *.tmp
101 | *.bak
102 | *.swp
103 | *~.nib
104 | .settings/
105 | .loadpath
106 |
107 | # External tool builders
108 | .externalToolBuilders/
109 |
110 | # Locally stored "Eclipse launch configurations"
111 | *.launch
112 |
113 | # CDT-specific
114 | .cproject
115 |
116 | # PDT-specific
117 | .buildpath
118 |
119 | # sbteclipse plugin
120 | .target
121 |
122 | # TeXlipse plugin
123 | .texlipseXml version="1.0" encoding="UTF-8"?>captures
124 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 |
2 | Apache License
3 | Version 2.0, January 2004
4 | http://www.apache.org/licenses/
5 |
6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7 |
8 | 1. Definitions.
9 |
10 | "License" shall mean the terms and conditions for use, reproduction,
11 | and distribution as defined by Sections 1 through 9 of this document.
12 |
13 | "Licensor" shall mean the copyright owner or entity authorized by
14 | the copyright owner that is granting the License.
15 |
16 | "Legal Entity" shall mean the union of the acting entity and all
17 | other entities that control, are controlled by, or are under common
18 | control with that entity. For the purposes of this definition,
19 | "control" means (i) the power, direct or indirect, to cause the
20 | direction or management of such entity, whether by contract or
21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
22 | outstanding shares, or (iii) beneficial ownership of such entity.
23 |
24 | "You" (or "Your") shall mean an individual or Legal Entity
25 | exercising permissions granted by this License.
26 |
27 | "Source" form shall mean the preferred form for making modifications,
28 | including but not limited to software source code, documentation
29 | source, and configuration files.
30 |
31 | "Object" form shall mean any form resulting from mechanical
32 | transformation or translation of a Source form, including but
33 | not limited to compiled object code, generated documentation,
34 | and conversions to other media types.
35 |
36 | "Work" shall mean the work of authorship, whether in Source or
37 | Object form, made available under the License, as indicated by a
38 | copyright notice that is included in or attached to the work
39 | (an example is provided in the Appendix below).
40 |
41 | "Derivative Works" shall mean any work, whether in Source or Object
42 | form, that is based on (or derived from) the Work and for which the
43 | editorial revisions, annotations, elaborations, or other modifications
44 | represent, as a whole, an original work of authorship. For the purposes
45 | of this License, Derivative Works shall not include works that remain
46 | separable from, or merely link (or bind by name) to the interfaces of,
47 | the Work and Derivative Works thereof.
48 |
49 | "Contribution" shall mean any work of authorship, including
50 | the original version of the Work and any modifications or additions
51 | to that Work or Derivative Works thereof, that is intentionally
52 | submitted to Licensor for inclusion in the Work by the copyright owner
53 | or by an individual or Legal Entity authorized to submit on behalf of
54 | the copyright owner. For the purposes of this definition, "submitted"
55 | means any form of electronic, verbal, or written communication sent
56 | to the Licensor or its representatives, including but not limited to
57 | communication on electronic mailing lists, source code control systems,
58 | and issue tracking systems that are managed by, or on behalf of, the
59 | Licensor for the purpose of discussing and improving the Work, but
60 | excluding communication that is conspicuously marked or otherwise
61 | designated in writing by the copyright owner as "Not a Contribution."
62 |
63 | "Contributor" shall mean Licensor and any individual or Legal Entity
64 | on behalf of whom a Contribution has been received by Licensor and
65 | subsequently incorporated within the Work.
66 |
67 | 2. Grant of Copyright License. Subject to the terms and conditions of
68 | this License, each Contributor hereby grants to You a perpetual,
69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70 | copyright license to reproduce, prepare Derivative Works of,
71 | publicly display, publicly perform, sublicense, and distribute the
72 | Work and such Derivative Works in Source or Object form.
73 |
74 | 3. Grant of Patent License. Subject to the terms and conditions of
75 | this License, each Contributor hereby grants to You a perpetual,
76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77 | (except as stated in this section) patent license to make, have made,
78 | use, offer to sell, sell, import, and otherwise transfer the Work,
79 | where such license applies only to those patent claims licensable
80 | by such Contributor that are necessarily infringed by their
81 | Contribution(s) alone or by combination of their Contribution(s)
82 | with the Work to which such Contribution(s) was submitted. If You
83 | institute patent litigation against any entity (including a
84 | cross-claim or counterclaim in a lawsuit) alleging that the Work
85 | or a Contribution incorporated within the Work constitutes direct
86 | or contributory patent infringement, then any patent licenses
87 | granted to You under this License for that Work shall terminate
88 | as of the date such litigation is filed.
89 |
90 | 4. Redistribution. You may reproduce and distribute copies of the
91 | Work or Derivative Works thereof in any medium, with or without
92 | modifications, and in Source or Object form, provided that You
93 | meet the following conditions:
94 |
95 | (a) You must give any other recipients of the Work or
96 | Derivative Works a copy of this License; and
97 |
98 | (b) You must cause any modified files to carry prominent notices
99 | stating that You changed the files; and
100 |
101 | (c) You must retain, in the Source form of any Derivative Works
102 | that You distribute, all copyright, patent, trademark, and
103 | attribution notices from the Source form of the Work,
104 | excluding those notices that do not pertain to any part of
105 | the Derivative Works; and
106 |
107 | (d) If the Work includes a "NOTICE" text file as part of its
108 | distribution, then any Derivative Works that You distribute must
109 | include a readable copy of the attribution notices contained
110 | within such NOTICE file, excluding those notices that do not
111 | pertain to any part of the Derivative Works, in at least one
112 | of the following places: within a NOTICE text file distributed
113 | as part of the Derivative Works; within the Source form or
114 | documentation, if provided along with the Derivative Works; or,
115 | within a display generated by the Derivative Works, if and
116 | wherever such third-party notices normally appear. The contents
117 | of the NOTICE file are for informational purposes only and
118 | do not modify the License. You may add Your own attribution
119 | notices within Derivative Works that You distribute, alongside
120 | or as an addendum to the NOTICE text from the Work, provided
121 | that such additional attribution notices cannot be construed
122 | as modifying the License.
123 |
124 | You may add Your own copyright statement to Your modifications and
125 | may provide additional or different license terms and conditions
126 | for use, reproduction, or distribution of Your modifications, or
127 | for any such Derivative Works as a whole, provided Your use,
128 | reproduction, and distribution of the Work otherwise complies with
129 | the conditions stated in this License.
130 |
131 | 5. Submission of Contributions. Unless You explicitly state otherwise,
132 | any Contribution intentionally submitted for inclusion in the Work
133 | by You to the Licensor shall be under the terms and conditions of
134 | this License, without any additional terms or conditions.
135 | Notwithstanding the above, nothing herein shall supersede or modify
136 | the terms of any separate license agreement you may have executed
137 | with Licensor regarding such Contributions.
138 |
139 | 6. Trademarks. This License does not grant permission to use the trade
140 | names, trademarks, service marks, or product names of the Licensor,
141 | except as required for reasonable and customary use in describing the
142 | origin of the Work and reproducing the content of the NOTICE file.
143 |
144 | 7. Disclaimer of Warranty. Unless required by applicable law or
145 | agreed to in writing, Licensor provides the Work (and each
146 | Contributor provides its Contributions) on an "AS IS" BASIS,
147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148 | implied, including, without limitation, any warranties or conditions
149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150 | PARTICULAR PURPOSE. You are solely responsible for determining the
151 | appropriateness of using or redistributing the Work and assume any
152 | risks associated with Your exercise of permissions under this License.
153 |
154 | 8. Limitation of Liability. In no event and under no legal theory,
155 | whether in tort (including negligence), contract, or otherwise,
156 | unless required by applicable law (such as deliberate and grossly
157 | negligent acts) or agreed to in writing, shall any Contributor be
158 | liable to You for damages, including any direct, indirect, special,
159 | incidental, or consequential damages of any character arising as a
160 | result of this License or out of the use or inability to use the
161 | Work (including but not limited to damages for loss of goodwill,
162 | work stoppage, computer failure or malfunction, or any and all
163 | other commercial damages or losses), even if such Contributor
164 | has been advised of the possibility of such damages.
165 |
166 | 9. Accepting Warranty or Additional Liability. While redistributing
167 | the Work or Derivative Works thereof, You may choose to offer,
168 | and charge a fee for, acceptance of support, warranty, indemnity,
169 | or other liability obligations and/or rights consistent with this
170 | License. However, in accepting such obligations, You may act only
171 | on Your own behalf and on Your sole responsibility, not on behalf
172 | of any other Contributor, and only if You agree to indemnify,
173 | defend, and hold each Contributor harmless for any liability
174 | incurred by, or claims asserted against, such Contributor by reason
175 | of your accepting any such warranty or additional liability.
176 |
177 | END OF TERMS AND CONDITIONS
178 |
179 | APPENDIX: How to apply the Apache License to your work.
180 |
181 | To apply the Apache License to your work, attach the following
182 | boilerplate notice, with the fields enclosed by brackets "[]"
183 | replaced with your own identifying information. (Don't include
184 | the brackets!) The text should be enclosed in the appropriate
185 | comment syntax for the file format. We also recommend that a
186 | file or class name and description of purpose be included on the
187 | same "printed page" as the copyright notice for easier
188 | identification within third-party archives.
189 |
190 | Copyright [yyyy] [name of copyright owner]
191 |
192 | Licensed under the Apache License, Version 2.0 (the "License");
193 | you may not use this file except in compliance with the License.
194 | You may obtain a copy of the License at
195 |
196 | http://www.apache.org/licenses/LICENSE-2.0
197 |
198 | Unless required by applicable law or agreed to in writing, software
199 | distributed under the License is distributed on an "AS IS" BASIS,
200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201 | See the License for the specific language governing permissions and
202 | limitations under the License.
--------------------------------------------------------------------------------
/Modular/.gitignore:
--------------------------------------------------------------------------------
1 | tomsuite.xml
2 | **pom.xml.releaseBackup
3 | release.properties
4 | gen
5 | */seed.txt
6 | notes
7 | logs
8 | gen-external-apklibs
9 | .idea
10 | *.iml
11 | .DS_Store
12 | *.swp
13 | out
14 | .gradle
15 | /local.properties
16 | /build
17 |
18 | ###OSX###
19 |
20 | .DS_Store
21 | .AppleDouble
22 | .LSOverride
23 |
24 | # Icon must ends with two \r.
25 | Icon
26 |
27 |
28 | # Thumbnails
29 | ._*
30 |
31 | # Files that might appear on external disk
32 | .Spotlight-V100
33 | .Trashes
34 |
35 |
36 | ###Linux###
37 |
38 | *~
39 |
40 | # KDE directory preferences
41 | .directory
42 |
43 |
44 | ###Android###
45 |
46 | # Built application files
47 | *.apk
48 | *.ap_
49 |
50 | # Files for ART and Dalvik VM
51 | *.dex
52 |
53 | # Java class files
54 | *.class
55 |
56 | # Generated files
57 | bin/
58 | gen/
59 |
60 | # Gradle files
61 | .gradle/
62 | .gradletasknamecache
63 | build/
64 |
65 | # Local configuration file (sdk path, etc)
66 | local.properties
67 |
68 | # Proguard folder generated by Eclipse
69 | proguard/
70 |
71 | # Lint
72 | lint-report.html
73 | lint-report_files/
74 | lint_result.txt
75 |
76 | # Mobile Tools for Java (J2ME)
77 | .mtj.tmp/
78 |
79 | # Package Files #
80 | *.war
81 | *.ear
82 |
83 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
84 | hs_err_pid*
85 |
86 |
87 | ###IntelliJ###
88 |
89 | *.iml
90 | *.ipr
91 | *.iws
92 | .idea/
93 |
94 |
95 | ###Eclipse###
96 |
97 | *.pydevproject
98 | .metadata
99 | tmp/
100 | *.tmp
101 | *.bak
102 | *.swp
103 | *~.nib
104 | .settings/
105 | .loadpath
106 |
107 | # External tool builders
108 | .externalToolBuilders/
109 |
110 | # Locally stored "Eclipse launch configurations"
111 | *.launch
112 |
113 | # CDT-specific
114 | .cproject
115 |
116 | # PDT-specific
117 | .buildpath
118 |
119 | # sbteclipse plugin
120 | .target
121 |
122 | # TeXlipse plugin
123 | .texlipseXml version="1.0" encoding="UTF-8"?>captures
124 |
--------------------------------------------------------------------------------
/Modular/app/.gitignore:
--------------------------------------------------------------------------------
1 | tomsuite.xml
2 | **pom.xml.releaseBackup
3 | release.properties
4 | gen
5 | */seed.txt
6 | notes
7 | logs
8 | gen-external-apklibs
9 | .idea
10 | *.iml
11 | .DS_Store
12 | *.swp
13 | out
14 | .gradle
15 | /local.properties
16 | /build
17 |
18 | ###OSX###
19 |
20 | .DS_Store
21 | .AppleDouble
22 | .LSOverride
23 |
24 | # Icon must ends with two \r.
25 | Icon
26 |
27 |
28 | # Thumbnails
29 | ._*
30 |
31 | # Files that might appear on external disk
32 | .Spotlight-V100
33 | .Trashes
34 |
35 |
36 | ###Linux###
37 |
38 | *~
39 |
40 | # KDE directory preferences
41 | .directory
42 |
43 |
44 | ###Android###
45 |
46 | # Built application files
47 | *.apk
48 | *.ap_
49 |
50 | # Files for ART and Dalvik VM
51 | *.dex
52 |
53 | # Java class files
54 | *.class
55 |
56 | # Generated files
57 | bin/
58 | gen/
59 |
60 | # Gradle files
61 | .gradle/
62 | .gradletasknamecache
63 | build/
64 |
65 | # Local configuration file (sdk path, etc)
66 | local.properties
67 |
68 | # Proguard folder generated by Eclipse
69 | proguard/
70 |
71 | # Lint
72 | lint-report.html
73 | lint-report_files/
74 | lint_result.txt
75 |
76 | # Mobile Tools for Java (J2ME)
77 | .mtj.tmp/
78 |
79 | # Package Files #
80 | *.war
81 | *.ear
82 |
83 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
84 | hs_err_pid*
85 |
86 |
87 | ###IntelliJ###
88 |
89 | *.iml
90 | *.ipr
91 | *.iws
92 | .idea/
93 |
94 |
95 | ###Eclipse###
96 |
97 | *.pydevproject
98 | .metadata
99 | tmp/
100 | *.tmp
101 | *.bak
102 | *.swp
103 | *~.nib
104 | .settings/
105 | .loadpath
106 |
107 | # External tool builders
108 | .externalToolBuilders/
109 |
110 | # Locally stored "Eclipse launch configurations"
111 | *.launch
112 |
113 | # CDT-specific
114 | .cproject
115 |
116 | # PDT-specific
117 | .buildpath
118 |
119 | # sbteclipse plugin
120 | .target
121 |
122 | # TeXlipse plugin
123 | .texlipseXml version="1.0" encoding="UTF-8"?>captures
124 |
--------------------------------------------------------------------------------
/Modular/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 24
5 | buildToolsVersion "24.0.2"
6 | defaultConfig {
7 | applicationId "com.kymjs.app"
8 | minSdkVersion 14
9 | targetSdkVersion 24
10 | versionCode 1
11 | versionName "1.0"
12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
13 |
14 | if (isDebug.toBoolean()) {
15 | buildConfigField 'boolean', 'ISAPP', 'false'
16 | } else {
17 | buildConfigField 'boolean', 'ISAPP', 'true'
18 | }
19 | }
20 | buildTypes {
21 | release {
22 | minifyEnabled false
23 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
24 | }
25 | }
26 | }
27 |
28 | dependencies {
29 | compile fileTree(include: ['*.jar'], dir: 'libs')
30 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
31 | exclude group: 'com.android.support', module: 'support-annotations'
32 | })
33 | testCompile 'junit:junit:4.12'
34 | if (!isDebug.toBoolean()) {
35 | compile project(':explorer')
36 | compile project(':memory-box')
37 | } else {
38 | compile project(':router')
39 | }
40 | }
41 |
42 | sourceCompatibility = JavaVersion.VERSION_1_7
43 | targetCompatibility = JavaVersion.VERSION_1_7
--------------------------------------------------------------------------------
/Modular/app/gradle.properties:
--------------------------------------------------------------------------------
1 | isDebug=false
--------------------------------------------------------------------------------
/Modular/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/kymjs/developer/android/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/Modular/app/src/androidTest/java/com/kymjs/app/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.kymjs.app;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumentation test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.kymjs.app", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Modular/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/Modular/app/src/main/java/com/kymjs/app/AppContext.java:
--------------------------------------------------------------------------------
1 | package com.kymjs.app;
2 |
3 | import android.app.Application;
4 |
5 | import com.kymjs.common.App;
6 | import com.kymjs.common.LogUtils;
7 | import com.kymjs.crash.CustomActivityOnCrash;
8 |
9 | /**
10 | * Created by ZhangTao on 10/12/16.
11 | */
12 |
13 | public class AppContext extends Application {
14 | @Override
15 | public void onCreate() {
16 | super.onCreate();
17 | LogUtils.mLogEnable = BuildConfig.DEBUG;
18 | CustomActivityOnCrash.install(App.INSTANCE);
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Modular/app/src/main/java/com/kymjs/app/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.kymjs.app;
2 |
3 | import android.os.Bundle;
4 | import android.os.Handler;
5 | import android.os.Looper;
6 | import android.support.design.widget.NavigationView;
7 | import android.support.v4.view.GravityCompat;
8 | import android.support.v4.widget.DrawerLayout;
9 | import android.support.v7.app.ActionBarDrawerToggle;
10 | import android.support.v7.app.AppCompatActivity;
11 | import android.support.v7.widget.Toolbar;
12 | import android.view.KeyEvent;
13 | import android.view.Menu;
14 | import android.view.MenuItem;
15 | import android.view.View;
16 | import android.view.animation.Animation;
17 | import android.widget.TextView;
18 |
19 | import com.kymjs.app.base_res.utils.AnimationUtil;
20 | import com.kymjs.router.ActivityRouter;
21 | import com.kymjs.router.FragmentRouter;
22 | import com.kymjs.router.RouterList;
23 |
24 | public class MainActivity extends AppCompatActivity
25 | implements NavigationView.OnNavigationItemSelectedListener {
26 |
27 | @Override
28 | protected void onCreate(Bundle savedInstanceState) {
29 | super.onCreate(savedInstanceState);
30 | setContentView(R.layout.activity_main);
31 | Toolbar toolbar = getToolbar();
32 | setSupportActionBar(toolbar);
33 |
34 | DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
35 | ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
36 | this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
37 | toggle.syncState();
38 |
39 | NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
40 | navigationView.setNavigationItemSelectedListener(this);
41 |
42 | getSupportFragmentManager()
43 | .beginTransaction()
44 | .replace(R.id.content_main,
45 | FragmentRouter.getFragment(RouterList.MEMORY_FRAG_MAIN))
46 | .commit();
47 | }
48 |
49 | @Override
50 | public boolean onCreateOptionsMenu(Menu menu) {
51 | // Inflate the menu; this adds items to the action bar if it is present.
52 | getMenuInflater().inflate(R.menu.main, menu);
53 | return true;
54 | }
55 |
56 | @Override
57 | public boolean onOptionsItemSelected(MenuItem item) {
58 | // Handle action bar item clicks here. The action bar will
59 | // automatically handle clicks on the Home/Up button, so long
60 | // as you specify a parent activity in AndroidManifest.xml.
61 | int id = item.getItemId();
62 |
63 | //noinspection SimplifiableIfStatement
64 | if (id == R.id.action_settings) {
65 | return true;
66 | }
67 |
68 | return super.onOptionsItemSelected(item);
69 | }
70 |
71 | @Override
72 | @SuppressWarnings("StatementWithEmptyBody")
73 | public boolean onNavigationItemSelected(MenuItem item) {
74 | // Handle navigation view item clicks here.
75 | int id = item.getItemId();
76 |
77 | if (id == R.id.nav_camera) {
78 |
79 | } else if (id == R.id.nav_gallery) {
80 |
81 | } else if (id == R.id.nav_slideshow) {
82 |
83 | } else if (id == R.id.nav_manage) {
84 | ActivityRouter.startActivity(this, RouterList.EXPLORER_ATY_MAIN);
85 | } else if (id == R.id.nav_share) {
86 | ActivityRouter.startActivity(this, RouterList.MEMORY_ATY_MAIN);
87 | } else if (id == R.id.nav_send) {
88 | throw new RuntimeException("throw exception");
89 | }
90 |
91 | DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
92 | drawer.closeDrawer(GravityCompat.START);
93 | return true;
94 | }
95 |
96 | protected Toolbar getToolbar() {
97 | return (Toolbar) findViewById(R.id.toolbar);
98 | }
99 |
100 | @Override
101 | public void onBackPressed() {
102 | DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
103 | if (drawer.isDrawerOpen(GravityCompat.START)) {
104 | drawer.closeDrawer(GravityCompat.START);
105 | } else {
106 | super.onBackPressed();
107 | }
108 | }
109 |
110 | @Override
111 | public boolean onKeyDown(int keyCode, KeyEvent event) {
112 | if (BuildConfig.ISAPP) {
113 | return handleExitTip(keyCode);
114 | }
115 | return super.onKeyDown(keyCode, event);
116 | }
117 |
118 | /////////////////////////// show exit tip ////////////////////////////////////
119 |
120 | private boolean isOnKeyBacking;
121 | private Handler mMainLoopHandler = new Handler(Looper.getMainLooper());
122 | private Runnable onBackTimeRunnable = new Runnable() {
123 | @Override
124 | public void run() {
125 | isOnKeyBacking = false;
126 | cancleExit();
127 | }
128 | };
129 |
130 | private boolean handleExitTip(int keyCode) {
131 | if (keyCode == KeyEvent.KEYCODE_BACK) {
132 | if (isOnKeyBacking) {
133 | mMainLoopHandler.removeCallbacks(onBackTimeRunnable);
134 | isOnKeyBacking = false;
135 | finish();
136 | } else {
137 | isOnKeyBacking = true;
138 | showExitTip();
139 | mMainLoopHandler.postDelayed(onBackTimeRunnable, 2000);
140 | }
141 | return true;
142 | }
143 | return false;
144 | }
145 |
146 | /**
147 | * 显示Toolbar的退出tip
148 | */
149 | public void showExitTip() {
150 | TextView view = (TextView) findViewById(R.id.titlebar_text_exittip);
151 | view.setVisibility(View.VISIBLE);
152 | Animation a = AnimationUtil.getTranslateAnimation(0f, 0f, -getToolbar().getHeight(), 0f, 300);
153 | view.startAnimation(a);
154 | }
155 |
156 | /**
157 | * 取消退出
158 | */
159 | public void cancleExit() {
160 | final TextView view = (TextView) findViewById(R.id.titlebar_text_exittip);
161 | Animation a = AnimationUtil.getTranslateAnimation(0f, 0f, 0f, -getToolbar().getHeight(), 300);
162 | a.setAnimationListener(new Animation.AnimationListener() {
163 | @Override
164 | public void onAnimationStart(Animation animation) {
165 | }
166 |
167 | @Override
168 | public void onAnimationEnd(Animation animation) {
169 | view.setVisibility(View.GONE);
170 | }
171 |
172 | @Override
173 | public void onAnimationRepeat(Animation animation) {
174 | }
175 | });
176 | view.startAnimation(a);
177 | }
178 | }
179 |
--------------------------------------------------------------------------------
/Modular/app/src/main/res/drawable-v21/ic_menu_camera.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
12 |
13 |
--------------------------------------------------------------------------------
/Modular/app/src/main/res/drawable-v21/ic_menu_gallery.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/Modular/app/src/main/res/drawable-v21/ic_menu_manage.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
--------------------------------------------------------------------------------
/Modular/app/src/main/res/drawable-v21/ic_menu_send.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/Modular/app/src/main/res/drawable-v21/ic_menu_share.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/Modular/app/src/main/res/drawable-v21/ic_menu_slideshow.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/Modular/app/src/main/res/drawable/side_nav_bar.xml:
--------------------------------------------------------------------------------
1 |
3 |
9 |
--------------------------------------------------------------------------------
/Modular/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
16 |
17 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/Modular/app/src/main/res/layout/app_bar_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
15 |
16 |
22 |
23 |
24 |
25 |
35 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/Modular/app/src/main/res/layout/content_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
--------------------------------------------------------------------------------
/Modular/app/src/main/res/layout/nav_header_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
15 |
16 |
22 |
23 |
29 |
30 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/Modular/app/src/main/res/menu/activity_main_drawer.xml:
--------------------------------------------------------------------------------
1 |
2 |
37 |
--------------------------------------------------------------------------------
/Modular/app/src/main/res/menu/main.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
9 |
10 |
--------------------------------------------------------------------------------
/Modular/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kymjs/Modularity/2458dd3584e6313a7cc76d909680480e7376f62b/Modular/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Modular/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kymjs/Modularity/2458dd3584e6313a7cc76d909680480e7376f62b/Modular/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Modular/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kymjs/Modularity/2458dd3584e6313a7cc76d909680480e7376f62b/Modular/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Modular/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kymjs/Modularity/2458dd3584e6313a7cc76d909680480e7376f62b/Modular/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Modular/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kymjs/Modularity/2458dd3584e6313a7cc76d909680480e7376f62b/Modular/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Modular/app/src/main/res/values-v21/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
--------------------------------------------------------------------------------
/Modular/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/Modular/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/Modular/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 160dp
5 |
6 | 16dp
7 | 16dp
8 | 16dp
9 |
10 |
--------------------------------------------------------------------------------
/Modular/app/src/main/res/values/drawables.xml:
--------------------------------------------------------------------------------
1 |
2 | - @android:drawable/ic_menu_camera
3 | - @android:drawable/ic_menu_gallery
4 | - @android:drawable/ic_menu_slideshow
5 | - @android:drawable/ic_menu_manage
6 | - @android:drawable/ic_menu_share
7 | - @android:drawable/ic_menu_send
8 |
9 |
--------------------------------------------------------------------------------
/Modular/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | OpenSourceLab
3 |
4 | Open navigation drawer
5 | Close navigation drawer
6 |
7 | Settings
8 |
9 |
--------------------------------------------------------------------------------
/Modular/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/Modular/app/src/test/java/com/kymjs/app/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.kymjs.app;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/Modular/apt/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/Modular/apt/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'java'
2 |
3 | dependencies {
4 | compile fileTree(dir: 'libs', include: ['*.jar'])
5 | }
6 |
7 | sourceCompatibility = "1.7"
8 | targetCompatibility = "1.7"
9 |
--------------------------------------------------------------------------------
/Modular/apt/src/main/java/com/kymjs/core/apt/APTProcessor.java:
--------------------------------------------------------------------------------
1 | package com.kymjs.core.apt;
2 |
3 | import java.io.IOException;
4 | import java.io.PrintWriter;
5 | import java.io.Writer;
6 | import java.util.Set;
7 |
8 | import javax.annotation.processing.AbstractProcessor;
9 | import javax.annotation.processing.RoundEnvironment;
10 | import javax.annotation.processing.SupportedAnnotationTypes;
11 | import javax.annotation.processing.SupportedSourceVersion;
12 | import javax.lang.model.SourceVersion;
13 | import javax.lang.model.element.Element;
14 | import javax.lang.model.element.TypeElement;
15 | import javax.tools.Diagnostic;
16 | import javax.tools.JavaFileObject;
17 |
18 | /**
19 | * Created by ZhangTao on 10/24/16.
20 | */
21 |
22 | @SupportedAnnotationTypes("com.kymjs.core.apt.RList")
23 | @SupportedSourceVersion(SourceVersion.RELEASE_7)
24 | public class APTProcessor extends AbstractProcessor {
25 | public static final String CLASSNAME = "RouterList";
26 | public static final String PACKAGENAME = "com.kymjs.core.apt";
27 |
28 | @Override
29 | public boolean process(Set extends TypeElement> annotations, RoundEnvironment roundEnv) {
30 | try {
31 | JavaFileObject f = processingEnv.getFiler().createSourceFile(CLASSNAME);
32 | Writer w = f.openWriter();
33 | PrintWriter pw = new PrintWriter(w);
34 | for (TypeElement te : annotations) {
35 | pw.println("package " + PACKAGENAME + ";");
36 | pw.println("\npublic class " + CLASSNAME + " { ");
37 | for (Element element : roundEnv.getElementsAnnotatedWith(te)) {
38 | RList annotation = element.getAnnotation(RList.class);
39 | String name = annotation.name();
40 | String value = element.toString();
41 | // String packageName = element.getEnclosingElement().toString();
42 |
43 | pw.println(" public static final String " + name + " = \"" + value + "\";");
44 | }
45 | pw.println("}");
46 | pw.flush();
47 | }
48 | } catch (IOException x) {
49 | processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR,
50 | x.toString());
51 | }
52 | return true;
53 | }
54 | }
--------------------------------------------------------------------------------
/Modular/apt/src/main/java/com/kymjs/core/apt/RList.java:
--------------------------------------------------------------------------------
1 | package com.kymjs.core.apt;
2 |
3 | /**
4 | * Created by ZhangTao on 10/24/16.
5 | */
6 |
7 | import java.lang.annotation.Retention;
8 | import java.lang.annotation.RetentionPolicy;
9 |
10 | @Retention(RetentionPolicy.CLASS)
11 | public @interface RList {
12 | String name();
13 | }
14 |
--------------------------------------------------------------------------------
/Modular/apt/src/main/resources/META-INF/services/javax.annotation.processing.Processor:
--------------------------------------------------------------------------------
1 | com.kymjs.core.apt.APTProcessor
--------------------------------------------------------------------------------
/Modular/base-res/.gitignore:
--------------------------------------------------------------------------------
1 | tomsuite.xml
2 | **pom.xml.releaseBackup
3 | release.properties
4 | gen
5 | */seed.txt
6 | notes
7 | logs
8 | gen-external-apklibs
9 | .idea
10 | *.iml
11 | .DS_Store
12 | *.swp
13 | out
14 | .gradle
15 | /local.properties
16 | /build
17 |
18 | ###OSX###
19 |
20 | .DS_Store
21 | .AppleDouble
22 | .LSOverride
23 |
24 | # Icon must ends with two \r.
25 | Icon
26 |
27 |
28 | # Thumbnails
29 | ._*
30 |
31 | # Files that might appear on external disk
32 | .Spotlight-V100
33 | .Trashes
34 |
35 |
36 | ###Linux###
37 |
38 | *~
39 |
40 | # KDE directory preferences
41 | .directory
42 |
43 |
44 | ###Android###
45 |
46 | # Built application files
47 | *.apk
48 | *.ap_
49 |
50 | # Files for ART and Dalvik VM
51 | *.dex
52 |
53 | # Java class files
54 | *.class
55 |
56 | # Generated files
57 | bin/
58 | gen/
59 |
60 | # Gradle files
61 | .gradle/
62 | .gradletasknamecache
63 | build/
64 |
65 | # Local configuration file (sdk path, etc)
66 | local.properties
67 |
68 | # Proguard folder generated by Eclipse
69 | proguard/
70 |
71 | # Lint
72 | lint-report.html
73 | lint-report_files/
74 | lint_result.txt
75 |
76 | # Mobile Tools for Java (J2ME)
77 | .mtj.tmp/
78 |
79 | # Package Files #
80 | *.war
81 | *.ear
82 |
83 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
84 | hs_err_pid*
85 |
86 |
87 | ###IntelliJ###
88 |
89 | *.iml
90 | *.ipr
91 | *.iws
92 | .idea/
93 |
94 |
95 | ###Eclipse###
96 |
97 | *.pydevproject
98 | .metadata
99 | tmp/
100 | *.tmp
101 | *.bak
102 | *.swp
103 | *~.nib
104 | .settings/
105 | .loadpath
106 |
107 | # External tool builders
108 | .externalToolBuilders/
109 |
110 | # Locally stored "Eclipse launch configurations"
111 | *.launch
112 |
113 | # CDT-specific
114 | .cproject
115 |
116 | # PDT-specific
117 | .buildpath
118 |
119 | # sbteclipse plugin
120 | .target
121 |
122 | # TeXlipse plugin
123 | .texlipseXml version="1.0" encoding="UTF-8"?>captures
124 |
--------------------------------------------------------------------------------
/Modular/base-res/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion 24
5 | buildToolsVersion "24.0.2"
6 |
7 | defaultConfig {
8 | minSdkVersion 14
9 | targetSdkVersion 24
10 | versionCode 1
11 | versionName "1.0"
12 | resourcePrefix "baseres_"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | compile fileTree(dir: 'libs', include: ['*.jar'])
24 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
25 | exclude group: 'com.android.support', module: 'support-annotations'
26 | })
27 | compile 'com.android.support:appcompat-v7:24.2.1'
28 | testCompile 'junit:junit:4.12'
29 | }
30 |
31 | sourceCompatibility = JavaVersion.VERSION_1_7
32 | targetCompatibility = JavaVersion.VERSION_1_7
--------------------------------------------------------------------------------
/Modular/base-res/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/kymjs/developer/android/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/Modular/base-res/src/androidTest/java/com/kymjs/app/base_res/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.kymjs.app.base_res;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumentation test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.kymjs.app.base_res.test", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Modular/base-res/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Modular/base-res/src/main/java/com/kymjs/app/base_res/utils/AnimationUtil.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2015, 张涛.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.kymjs.app.base_res.utils;
17 |
18 | import android.view.animation.AlphaAnimation;
19 | import android.view.animation.Animation;
20 | import android.view.animation.RotateAnimation;
21 | import android.view.animation.ScaleAnimation;
22 | import android.view.animation.TranslateAnimation;
23 |
24 | /**
25 | * 动画类
26 | *
27 | * @author kymjs (https://github.com/kymjs)
28 | * @since 2015-3
29 | */
30 | public class AnimationUtil {
31 |
32 | /**
33 | * 旋转 Rotate
34 | */
35 | public static Animation getRotateAnimation(float fromDegrees,
36 | float toDegrees, long durationMillis) {
37 | RotateAnimation rotate = new RotateAnimation(fromDegrees, toDegrees,
38 | Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
39 | 0.5f);
40 | rotate.setDuration(durationMillis);
41 | rotate.setFillAfter(true);
42 | return rotate;
43 | }
44 |
45 | /**
46 | * 透明度 Alpha
47 | */
48 | public static Animation getAlphaAnimation(float fromAlpha, float toAlpha,
49 | long durationMillis) {
50 | AlphaAnimation alpha = new AlphaAnimation(fromAlpha, toAlpha);
51 | alpha.setDuration(durationMillis);
52 | alpha.setFillAfter(true);
53 | return alpha;
54 | }
55 |
56 | /**
57 | * 缩放 Scale
58 | */
59 | public static Animation getScaleAnimation(long durationMillis) {
60 | ScaleAnimation scale = new ScaleAnimation(1.0f, 1.5f, 1.0f, 1.5f,
61 | Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
62 | 0.5f);
63 | scale.setDuration(durationMillis);
64 | return scale;
65 | }
66 |
67 | /**
68 | * 缩放 Scale
69 | */
70 | public static Animation getScaleAnimation(float scaleXY, long durationMillis) {
71 | ScaleAnimation scale = new ScaleAnimation(1.0f, scaleXY, 1.0f, scaleXY,
72 | Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
73 | 0.5f);
74 | scale.setDuration(durationMillis);
75 | return scale;
76 | }
77 |
78 | /**
79 | * 位移 Translate
80 | */
81 | public static Animation getTranslateAnimation(float fromXDelta,
82 | float toXDelta, float fromYDelta, float toYDelta,
83 | long durationMillis) {
84 | TranslateAnimation translate = new TranslateAnimation(fromXDelta,
85 | toXDelta, fromYDelta, toYDelta);
86 | translate.setDuration(durationMillis);
87 | translate.setFillAfter(true);
88 | return translate;
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/Modular/base-res/src/main/res/layout/baseres_activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
11 |
12 |
17 |
18 |
30 |
31 |
--------------------------------------------------------------------------------
/Modular/base-res/src/main/res/layout/baseres_toolbar.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/Modular/base-res/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #34b0e9
4 | #303F9F
5 | #FF4081
6 |
7 | #30000000
8 |
9 |
10 | #ff00ddff
11 | #ffffbb33
12 | #ffff4444
13 | #ffaa66cc
14 |
15 |
--------------------------------------------------------------------------------
/Modular/base-res/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 0dp
4 |
5 | 37dp
6 |
7 | 55dp
8 |
9 |
--------------------------------------------------------------------------------
/Modular/base-res/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | 再次点击返回键切换到桌面
3 |
4 |
--------------------------------------------------------------------------------
/Modular/base-res/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
15 |
16 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/Modular/base-res/src/test/java/com/kymjs/app/base_res/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.kymjs.app.base_res;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/Modular/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:2.2.0'
9 |
10 | classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
11 |
12 | // NOTE: Do not place your application dependencies here; they belong
13 | // in the individual module build.gradle files
14 | }
15 | }
16 |
17 | allprojects {
18 | repositories {
19 | jcenter()
20 | }
21 | }
22 |
23 | task clean(type: Delete) {
24 | delete rootProject.buildDir
25 | }
26 |
--------------------------------------------------------------------------------
/Modular/explorer/.gitignore:
--------------------------------------------------------------------------------
1 | tomsuite.xml
2 | **pom.xml.releaseBackup
3 | release.properties
4 | gen
5 | */seed.txt
6 | notes
7 | logs
8 | gen-external-apklibs
9 | .idea
10 | *.iml
11 | .DS_Store
12 | *.swp
13 | out
14 | .gradle
15 | /local.properties
16 | /build
17 |
18 | ###OSX###
19 |
20 | .DS_Store
21 | .AppleDouble
22 | .LSOverride
23 |
24 | # Icon must ends with two \r.
25 | Icon
26 |
27 |
28 | # Thumbnails
29 | ._*
30 |
31 | # Files that might appear on external disk
32 | .Spotlight-V100
33 | .Trashes
34 |
35 |
36 | ###Linux###
37 |
38 | *~
39 |
40 | # KDE directory preferences
41 | .directory
42 |
43 |
44 | ###Android###
45 |
46 | # Built application files
47 | *.apk
48 | *.ap_
49 |
50 | # Files for ART and Dalvik VM
51 | *.dex
52 |
53 | # Java class files
54 | *.class
55 |
56 | # Generated files
57 | bin/
58 | gen/
59 |
60 | # Gradle files
61 | .gradle/
62 | .gradletasknamecache
63 | build/
64 |
65 | # Local configuration file (sdk path, etc)
66 | local.properties
67 |
68 | # Proguard folder generated by Eclipse
69 | proguard/
70 |
71 | # Lint
72 | lint-report.html
73 | lint-report_files/
74 | lint_result.txt
75 |
76 | # Mobile Tools for Java (J2ME)
77 | .mtj.tmp/
78 |
79 | # Package Files #
80 | *.war
81 | *.ear
82 |
83 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
84 | hs_err_pid*
85 |
86 |
87 | ###IntelliJ###
88 |
89 | *.iml
90 | *.ipr
91 | *.iws
92 | .idea/
93 |
94 |
95 | ###Eclipse###
96 |
97 | *.pydevproject
98 | .metadata
99 | tmp/
100 | *.tmp
101 | *.bak
102 | *.swp
103 | *~.nib
104 | .settings/
105 | .loadpath
106 |
107 | # External tool builders
108 | .externalToolBuilders/
109 |
110 | # Locally stored "Eclipse launch configurations"
111 | *.launch
112 |
113 | # CDT-specific
114 | .cproject
115 |
116 | # PDT-specific
117 | .buildpath
118 |
119 | # sbteclipse plugin
120 | .target
121 |
122 | # TeXlipse plugin
123 | .texlipseXml version="1.0" encoding="UTF-8"?>captures
124 |
--------------------------------------------------------------------------------
/Modular/explorer/build.gradle:
--------------------------------------------------------------------------------
1 | if (isDebug.toBoolean()) {
2 | apply plugin: 'com.android.application'
3 | apply from: rootDir.absolutePath + '/extra_config.gradle'
4 | } else {
5 | apply plugin: 'com.android.library'
6 | }
7 | apply plugin: 'android-apt'
8 |
9 | android {
10 | compileSdkVersion 24
11 | buildToolsVersion "24.0.2"
12 |
13 | defaultConfig {
14 | minSdkVersion 14
15 | targetSdkVersion 24
16 | versionCode 1
17 | versionName "1.0"
18 | resourcePrefix "explorer_"
19 |
20 | if (isDebug.toBoolean()) {
21 | buildConfigField 'boolean', 'ISAPP', 'true'
22 | } else {
23 | buildConfigField 'boolean', 'ISAPP', 'false'
24 | }
25 | }
26 | buildTypes {
27 | release {
28 | minifyEnabled false
29 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
30 | }
31 | }
32 |
33 | sourceSets {
34 | main {
35 | if (isDebug.toBoolean()) {
36 | manifest.srcFile 'src/main/debug/AndroidManifest.xml'
37 | } else {
38 | manifest.srcFile 'src/main/release/AndroidManifest.xml'
39 | java {
40 | exclude 'debug/**'
41 | }
42 | }
43 | }
44 | }
45 | }
46 |
47 | dependencies {
48 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
49 | exclude group: 'com.android.support', module: 'support-annotations'
50 | })
51 | testCompile 'junit:junit:4.12'
52 | compile project(':router')
53 | }
54 |
55 | sourceCompatibility = JavaVersion.VERSION_1_7
56 | targetCompatibility = JavaVersion.VERSION_1_7
57 |
--------------------------------------------------------------------------------
/Modular/explorer/dependency.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kymjs/Modularity/2458dd3584e6313a7cc76d909680480e7376f62b/Modular/explorer/dependency.txt
--------------------------------------------------------------------------------
/Modular/explorer/gradle.properties:
--------------------------------------------------------------------------------
1 | isDebug=false
--------------------------------------------------------------------------------
/Modular/explorer/outputs/jar/sharedDependency.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kymjs/Modularity/2458dd3584e6313a7cc76d909680480e7376f62b/Modular/explorer/outputs/jar/sharedDependency.jar
--------------------------------------------------------------------------------
/Modular/explorer/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/kymjs/developer/android/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/Modular/explorer/src/androidTest/java/com/kymjs/app/explorer/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.kymjs.app.explorer;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumentation test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.kymjs.explorer.test", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Modular/explorer/src/main/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
10 |
11 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/Modular/explorer/src/main/java/com/kymjs/app/explorer/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.kymjs.app.explorer;
2 |
3 | import android.os.Build;
4 | import android.os.Bundle;
5 | import android.os.Handler;
6 | import android.os.Looper;
7 | import android.support.v7.app.AppCompatActivity;
8 | import android.support.v7.widget.Toolbar;
9 | import android.view.KeyEvent;
10 | import android.view.View;
11 | import android.view.animation.Animation;
12 | import android.widget.TextView;
13 |
14 | import com.kymjs.app.base_res.utils.AnimationUtil;
15 |
16 | /**
17 | * Created by ZhangTao on 10/11/16.
18 | */
19 | public class MainActivity extends AppCompatActivity {
20 | @Override
21 | protected void onCreate(Bundle savedInstanceState) {
22 | super.onCreate(savedInstanceState);
23 | setContentView(R.layout.baseres_activity_main);
24 |
25 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
26 | getWindow().setStatusBarColor(getColor(R.color.baseres_colorPrimary));
27 | }
28 |
29 | Toolbar toolbar = getToolbar();
30 | if (toolbar != null) {
31 | setSupportActionBar(toolbar);
32 | }
33 |
34 | // getSupportFragmentManager()
35 | // .beginTransaction()
36 | // .replace(R.id.baseres_content_main,
37 | // FragmentRouter.getFragment(RouterList.FRAGMENT_MEMORYBOX_MAIN))
38 | // .commit();
39 | }
40 |
41 | protected Toolbar getToolbar() {
42 | return (Toolbar) findViewById(R.id.baseres_toolbar);
43 | }
44 |
45 | @Override
46 | public boolean onKeyDown(int keyCode, KeyEvent event) {
47 | if (BuildConfig.ISAPP) {
48 | return handleExitTip(keyCode);
49 | }
50 | return super.onKeyDown(keyCode, event);
51 | }
52 |
53 | /////////////////////////// show exit tip ////////////////////////////////////
54 |
55 | private boolean isOnKeyBacking;
56 | private Handler mMainLoopHandler = new Handler(Looper.getMainLooper());
57 | private Runnable onBackTimeRunnable = new Runnable() {
58 | @Override
59 | public void run() {
60 | isOnKeyBacking = false;
61 | cancleExit();
62 | }
63 | };
64 |
65 | private boolean handleExitTip(int keyCode) {
66 | if (keyCode == KeyEvent.KEYCODE_BACK) {
67 | if (isOnKeyBacking) {
68 | mMainLoopHandler.removeCallbacks(onBackTimeRunnable);
69 | isOnKeyBacking = false;
70 | finish();
71 | } else {
72 | isOnKeyBacking = true;
73 | showExitTip();
74 | mMainLoopHandler.postDelayed(onBackTimeRunnable, 2000);
75 | }
76 | return true;
77 | }
78 | return false;
79 | }
80 |
81 | /**
82 | * 显示Toolbar的退出tip
83 | */
84 | public void showExitTip() {
85 | TextView view = (TextView) findViewById(R.id.titlebar_text_exittip);
86 | view.setVisibility(View.VISIBLE);
87 | Animation a = AnimationUtil.getTranslateAnimation(0f, 0f, -getToolbar().getHeight(), 0f, 300);
88 | view.startAnimation(a);
89 | }
90 |
91 | /**
92 | * 取消退出
93 | */
94 | public void cancleExit() {
95 | final TextView view = (TextView) findViewById(R.id.titlebar_text_exittip);
96 | Animation a = AnimationUtil.getTranslateAnimation(0f, 0f, 0f, -getToolbar().getHeight(), 300);
97 | a.setAnimationListener(new Animation.AnimationListener() {
98 | @Override
99 | public void onAnimationStart(Animation animation) {
100 | }
101 |
102 | @Override
103 | public void onAnimationEnd(Animation animation) {
104 | view.setVisibility(View.GONE);
105 | }
106 |
107 | @Override
108 | public void onAnimationRepeat(Animation animation) {
109 | }
110 | });
111 | view.startAnimation(a);
112 | }
113 | }
114 |
--------------------------------------------------------------------------------
/Modular/explorer/src/main/java/debug/AppContext.java:
--------------------------------------------------------------------------------
1 | package debug;
2 |
3 | import android.app.Application;
4 |
5 | import com.kymjs.app.explorer.BuildConfig;
6 | import com.kymjs.common.App;
7 | import com.kymjs.common.LogUtils;
8 | import com.kymjs.crash.CustomActivityOnCrash;
9 |
10 | /**
11 | * Created by ZhangTao on 10/12/16.
12 | */
13 | public class AppContext extends Application {
14 |
15 | @Override
16 | public void onCreate() {
17 | super.onCreate();
18 | LogUtils.mLogEnable = BuildConfig.DEBUG;
19 | CustomActivityOnCrash.install(App.INSTANCE);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Modular/explorer/src/main/release/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
7 |
8 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Modular/explorer/src/main/res/layout/explorer_content_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
13 |
--------------------------------------------------------------------------------
/Modular/explorer/src/main/res/menu/explorer_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
8 |
9 |
--------------------------------------------------------------------------------
/Modular/explorer/src/main/res/mipmap-hdpi/explorer_ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kymjs/Modularity/2458dd3584e6313a7cc76d909680480e7376f62b/Modular/explorer/src/main/res/mipmap-hdpi/explorer_ic_launcher.png
--------------------------------------------------------------------------------
/Modular/explorer/src/main/res/mipmap-mdpi/explorer_ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kymjs/Modularity/2458dd3584e6313a7cc76d909680480e7376f62b/Modular/explorer/src/main/res/mipmap-mdpi/explorer_ic_launcher.png
--------------------------------------------------------------------------------
/Modular/explorer/src/main/res/mipmap-xhdpi/explorer_ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kymjs/Modularity/2458dd3584e6313a7cc76d909680480e7376f62b/Modular/explorer/src/main/res/mipmap-xhdpi/explorer_ic_launcher.png
--------------------------------------------------------------------------------
/Modular/explorer/src/main/res/mipmap-xxhdpi/explorer_ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kymjs/Modularity/2458dd3584e6313a7cc76d909680480e7376f62b/Modular/explorer/src/main/res/mipmap-xxhdpi/explorer_ic_launcher.png
--------------------------------------------------------------------------------
/Modular/explorer/src/main/res/mipmap-xxxhdpi/explorer_ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kymjs/Modularity/2458dd3584e6313a7cc76d909680480e7376f62b/Modular/explorer/src/main/res/mipmap-xxxhdpi/explorer_ic_launcher.png
--------------------------------------------------------------------------------
/Modular/explorer/src/main/res/values-v21/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
--------------------------------------------------------------------------------
/Modular/explorer/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
--------------------------------------------------------------------------------
/Modular/explorer/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/Modular/explorer/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Modular/explorer/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | explorer
3 |
4 | Settings
5 |
6 |
--------------------------------------------------------------------------------
/Modular/explorer/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/Modular/explorer/src/test/java/com/kymjs/app/explorer/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.kymjs.app.explorer;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/Modular/extra_config.gradle:
--------------------------------------------------------------------------------
1 | ext.sharedArtifactids = this.&sharedArtifactids
2 |
3 | tasks.whenTaskAdded { task ->
4 | if (task.name.equals("compileDebugJavaWithJavac")) {
5 | task.doLast {
6 | FileCollection fileCollection = task.inputs.files
7 | File file = new File(project.projectDir.absolutePath + '/dependency.txt')
8 | if (file.exists()) {
9 | file.delete()
10 | }
11 | file.createNewFile()
12 |
13 | fileCollection.files.each {
14 | if (project.name.equals('app')) {
15 | project.sharedArtifactids.each { String artifactId ->
16 | if (it.absolutePath.contains(artifactId) && !it.name.endsWith('.java')) {
17 | file.append(it.absolutePath + '\n')
18 | }
19 | }
20 | }
21 | }
22 | }
23 | }
24 | }
25 |
26 | //gradle.addListener(new TaskExecutionGraphListener() {
27 | // @Override
28 | // void graphPopulated(TaskExecutionGraph graph) {
29 | // graph.getAllTasks().each { Task task ->
30 | // println("==========$task.name")
31 | // }
32 | //
33 | // }
34 | //})
35 |
36 | task createSharedDependency(dependsOn: 'assembleDebug', type: Jar) {
37 | outputs.upToDateWhen { false }
38 | archiveName = 'sharedDependency.jar'
39 | File jarsPathFile = new File(project.projectDir.absolutePath + '/dependency.txt')
40 | if (!jarsPathFile.exists()) {
41 | jarsPathFile.createNewFile()
42 | }
43 | def lines = jarsPathFile.readLines()
44 | ConfigurableFileCollection fileCollection = files(lines)
45 | fileCollection.each { File file ->
46 | from(zipTree(file))
47 | }
48 | from(project.buildDir.absolutePath + "/intermediates/classes/debug") {
49 | include 'cn/easydone/*/*.class'
50 | exclude 'cn/easydone/*/R*.class'
51 | exclude 'cn/easydone/*/BuildConfig.class'
52 | }
53 |
54 | destinationDir = file(project.projectDir.absolutePath + "/outputs/jar")
55 | }
56 | afterEvaluate {
57 | tasks.findByName('assembleDebug').finalizedBy(createSharedDependency)
58 | }
--------------------------------------------------------------------------------
/Modular/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
--------------------------------------------------------------------------------
/Modular/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kymjs/Modularity/2458dd3584e6313a7cc76d909680480e7376f62b/Modular/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/Modular/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Dec 28 10:00:20 PST 2015
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
7 |
--------------------------------------------------------------------------------
/Modular/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/Modular/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/Modular/memory-box/.gitignore:
--------------------------------------------------------------------------------
1 | tomsuite.xml
2 | **pom.xml.releaseBackup
3 | release.properties
4 | gen
5 | */seed.txt
6 | notes
7 | logs
8 | gen-external-apklibs
9 | .idea
10 | *.iml
11 | .DS_Store
12 | *.swp
13 | out
14 | .gradle
15 | /local.properties
16 | /build
17 |
18 | ###OSX###
19 |
20 | .DS_Store
21 | .AppleDouble
22 | .LSOverride
23 |
24 | # Icon must ends with two \r.
25 | Icon
26 |
27 |
28 | # Thumbnails
29 | ._*
30 |
31 | # Files that might appear on external disk
32 | .Spotlight-V100
33 | .Trashes
34 |
35 |
36 | ###Linux###
37 |
38 | *~
39 |
40 | # KDE directory preferences
41 | .directory
42 |
43 |
44 | ###Android###
45 |
46 | # Built application files
47 | *.apk
48 | *.ap_
49 |
50 | # Files for ART and Dalvik VM
51 | *.dex
52 |
53 | # Java class files
54 | *.class
55 |
56 | # Generated files
57 | bin/
58 | gen/
59 |
60 | # Gradle files
61 | .gradle/
62 | .gradletasknamecache
63 | build/
64 |
65 | # Local configuration file (sdk path, etc)
66 | local.properties
67 |
68 | # Proguard folder generated by Eclipse
69 | proguard/
70 |
71 | # Lint
72 | lint-report.html
73 | lint-report_files/
74 | lint_result.txt
75 |
76 | # Mobile Tools for Java (J2ME)
77 | .mtj.tmp/
78 |
79 | # Package Files #
80 | *.war
81 | *.ear
82 |
83 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
84 | hs_err_pid*
85 |
86 |
87 | ###IntelliJ###
88 |
89 | *.iml
90 | *.ipr
91 | *.iws
92 | .idea/
93 |
94 |
95 | ###Eclipse###
96 |
97 | *.pydevproject
98 | .metadata
99 | tmp/
100 | *.tmp
101 | *.bak
102 | *.swp
103 | *~.nib
104 | .settings/
105 | .loadpath
106 |
107 | # External tool builders
108 | .externalToolBuilders/
109 |
110 | # Locally stored "Eclipse launch configurations"
111 | *.launch
112 |
113 | # CDT-specific
114 | .cproject
115 |
116 | # PDT-specific
117 | .buildpath
118 |
119 | # sbteclipse plugin
120 | .target
121 |
122 | # TeXlipse plugin
123 | .texlipseXml version="1.0" encoding="UTF-8"?>captures
124 |
--------------------------------------------------------------------------------
/Modular/memory-box/build.gradle:
--------------------------------------------------------------------------------
1 | if (isDebug.toBoolean()) {
2 | apply plugin: 'com.android.application'
3 | apply from: rootDir.absolutePath + '/extra_config.gradle'
4 | } else {
5 | apply plugin: 'com.android.library'
6 | }
7 |
8 | android {
9 | compileSdkVersion 24
10 | buildToolsVersion "24.0.2"
11 |
12 | defaultConfig {
13 | minSdkVersion 14
14 | targetSdkVersion 24
15 | versionCode 1
16 | versionName "1.0"
17 | resourcePrefix "memory_"
18 |
19 | if (isDebug.toBoolean()) {
20 | buildConfigField 'boolean', 'ISAPP', 'true'
21 | } else {
22 | buildConfigField 'boolean', 'ISAPP', 'false'
23 | }
24 | }
25 | buildTypes {
26 | release {
27 | minifyEnabled false
28 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
29 | }
30 | }
31 |
32 | sourceSets {
33 | main {
34 | if (isDebug.toBoolean()) {
35 | manifest.srcFile 'src/main/debug/AndroidManifest.xml'
36 | } else {
37 | manifest.srcFile 'src/main/release/AndroidManifest.xml'
38 | java {
39 | exclude 'debug/**'
40 | }
41 | }
42 | }
43 | }
44 | }
45 |
46 | dependencies {
47 | compile fileTree(dir: 'libs', include: ['*.jar'])
48 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
49 | exclude group: 'com.android.support', module: 'support-annotations'
50 | })
51 | testCompile 'junit:junit:4.12'
52 |
53 | compile project(':router')
54 | compile project(path: ':explorer')
55 | }
56 |
57 | sourceCompatibility = JavaVersion.VERSION_1_7
58 | targetCompatibility = JavaVersion.VERSION_1_7
--------------------------------------------------------------------------------
/Modular/memory-box/dependency.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kymjs/Modularity/2458dd3584e6313a7cc76d909680480e7376f62b/Modular/memory-box/dependency.txt
--------------------------------------------------------------------------------
/Modular/memory-box/gradle.properties:
--------------------------------------------------------------------------------
1 | isDebug=false
--------------------------------------------------------------------------------
/Modular/memory-box/outputs/jar/sharedDependency.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kymjs/Modularity/2458dd3584e6313a7cc76d909680480e7376f62b/Modular/memory-box/outputs/jar/sharedDependency.jar
--------------------------------------------------------------------------------
/Modular/memory-box/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/kymjs/developer/android/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/Modular/memory-box/src/androidTest/java/com/kymjs/app/memory/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.kymjs.app.memory;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumentation test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.kymjs.app.memory", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Modular/memory-box/src/main/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
13 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/Modular/memory-box/src/main/java/com/kymjs/app/memory/database/Dao.java:
--------------------------------------------------------------------------------
1 | package com.kymjs.app.memory.database;
2 |
3 | import android.database.Cursor;
4 | import android.database.sqlite.SQLiteDatabase;
5 |
6 | import com.kymjs.app.memory.model.BoxItem;
7 | import com.kymjs.common.LogUtils;
8 |
9 | import java.lang.reflect.Field;
10 | import java.util.ArrayList;
11 | import java.util.List;
12 |
13 | /**
14 | * Created by ZhangTao on 10/13/16.
15 | */
16 |
17 | public class Dao {
18 |
19 | private final DatabaseHelper dbHelper;
20 |
21 | public Dao() {
22 | super();
23 | dbHelper = new DatabaseHelper();
24 | }
25 |
26 | public DatabaseHelper getDbHelper() {
27 | return dbHelper;
28 | }
29 |
30 | /**
31 | * 保存一条数据到本地(若已存在则直接覆盖)
32 | *
33 | * @param data
34 | */
35 | public boolean save(BoxItem data) {
36 | if (data == null) {
37 | return false;
38 | }
39 | try {
40 | StringBuilder stringBuilder = new StringBuilder("replace into " + DatabaseHelper.TABLE_NAME);
41 | stringBuilder.append("(");
42 |
43 | Field[] fields = BoxItem.class.getDeclaredFields();
44 | for (Field field : fields) {
45 | stringBuilder.append(field.getName()).append(", ");
46 | }
47 | stringBuilder.deleteCharAt(stringBuilder.length() - 1);
48 | stringBuilder.append(") values(");
49 | for (Field it : fields) {
50 | stringBuilder.append("?, ");
51 | }
52 | stringBuilder.deleteCharAt(stringBuilder.length() - 1);
53 | stringBuilder.append(")");
54 |
55 | String sql = stringBuilder.toString();
56 |
57 | SQLiteDatabase sqlite = dbHelper.getWritableDatabase();
58 |
59 | String[] parameters = new String[fields.length];
60 | for (int i = 0; i < fields.length; i++) {
61 | parameters[i] = fields[i].get(data).toString();
62 | }
63 | sqlite.execSQL(sql, parameters);
64 | sqlite.close();
65 | return true;
66 | } catch (Exception e) {
67 | return false;
68 | }
69 | }
70 |
71 | /**
72 | * 查
73 | */
74 | public List query(String where) {
75 | SQLiteDatabase sqlite = dbHelper.getReadableDatabase();
76 | Cursor cursor = sqlite.rawQuery("select * from " + DatabaseHelper.TABLE_NAME + where, null);
77 | List datas = getListFromCursor(cursor);
78 | if (!cursor.isClosed()) {
79 | cursor.close();
80 | }
81 | sqlite.close();
82 | return datas;
83 | }
84 |
85 | private List getListFromCursor(Cursor cursor) {
86 | ArrayList datas = new ArrayList<>();
87 | Field[] fields = BoxItem.class.getDeclaredFields();
88 |
89 | for (cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) {
90 | BoxItem data = new BoxItem();
91 | for (Field field : fields) {
92 | if (field.getType() == int.class) {
93 | int param = cursor.getInt(cursor.getColumnIndex(field.getName()));
94 | try {
95 | field.set(data, param);
96 | } catch (IllegalAccessException e) {
97 | LogUtils.e(e.getMessage());
98 | }
99 | } else {
100 | String param = cursor.getString(cursor.getColumnIndex(field.getName()));
101 | try {
102 | field.set(data, param);
103 | } catch (IllegalAccessException e) {
104 | LogUtils.e(e.getMessage());
105 | }
106 | }
107 | }
108 |
109 | datas.add(data);
110 | }
111 | return datas;
112 | }
113 |
114 | }
115 |
--------------------------------------------------------------------------------
/Modular/memory-box/src/main/java/com/kymjs/app/memory/database/DatabaseHelper.java:
--------------------------------------------------------------------------------
1 | package com.kymjs.app.memory.database;
2 |
3 | import android.database.sqlite.SQLiteDatabase;
4 | import android.database.sqlite.SQLiteOpenHelper;
5 |
6 | import com.kymjs.common.App;
7 |
8 | /**
9 | * SQLiteOpenHelper
10 | */
11 | public class DatabaseHelper extends SQLiteOpenHelper {
12 |
13 | public static final String DATABASE_NAME = "memory_box_db";
14 |
15 | public static final String TABLE_NAME = " MEMORY_BOX ";
16 |
17 | public static final String CREATE_MSG_TABLE = " create table "
18 | + TABLE_NAME
19 | + " (id integer primary key autoincrement not null, name text, key text,"
20 | + " value text, description text, image text, position integer)";
21 |
22 |
23 | public DatabaseHelper() {
24 | super(App.INSTANCE, DATABASE_NAME, null, 1);
25 | }
26 |
27 | @Override
28 | public void onCreate(SQLiteDatabase db) {
29 | db.execSQL(CREATE_MSG_TABLE);
30 | }
31 |
32 | @Override
33 | public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/Modular/memory-box/src/main/java/com/kymjs/app/memory/model/BoxItem.java:
--------------------------------------------------------------------------------
1 | package com.kymjs.app.memory.model;
2 |
3 | import android.os.Parcel;
4 | import android.os.Parcelable;
5 |
6 | /**
7 | * Created by ZhangTao on 10/13/16.
8 | */
9 |
10 | public class BoxItem implements Parcelable, Comparable {
11 | private int id;
12 | private String name;
13 | private String key;
14 | private String value;
15 | private String description;
16 | private String image;
17 | private int position;
18 |
19 | public int getId() {
20 | return id;
21 | }
22 |
23 | public BoxItem setId(int id) {
24 | this.id = id;
25 | return this;
26 | }
27 |
28 | public String getDescription() {
29 | return description;
30 | }
31 |
32 | public BoxItem setDescription(String description) {
33 | this.description = description;
34 | return this;
35 | }
36 |
37 | public String getName() {
38 | return name;
39 | }
40 |
41 | public BoxItem setName(String name) {
42 | this.name = name;
43 | return this;
44 | }
45 |
46 | public String getKey() {
47 | return key;
48 | }
49 |
50 | public BoxItem setKey(String key) {
51 | this.key = key;
52 | return this;
53 | }
54 |
55 | public String getValue() {
56 | return value;
57 | }
58 |
59 | public BoxItem setValue(String value) {
60 | this.value = value;
61 | return this;
62 | }
63 |
64 | public String getImage() {
65 | return image;
66 | }
67 |
68 | public BoxItem setImage(String image) {
69 | this.image = image;
70 | return this;
71 | }
72 |
73 | public int getPosition() {
74 | return position;
75 | }
76 |
77 | public BoxItem setPosition(int position) {
78 | this.position = position;
79 | return this;
80 | }
81 |
82 | @Override
83 | public int describeContents() {
84 | return 0;
85 | }
86 |
87 | @Override
88 | public void writeToParcel(Parcel dest, int flags) {
89 | dest.writeInt(this.id);
90 | dest.writeString(this.name);
91 | dest.writeString(this.description);
92 | dest.writeString(this.key);
93 | dest.writeString(this.value);
94 | dest.writeString(this.image);
95 | dest.writeInt(this.position);
96 | }
97 |
98 | public BoxItem() {
99 | }
100 |
101 | protected BoxItem(Parcel in) {
102 | this.id = in.readInt();
103 | this.name = in.readString();
104 | this.description = in.readString();
105 | this.key = in.readString();
106 | this.value = in.readString();
107 | this.image = in.readString();
108 | this.position = in.readInt();
109 | }
110 |
111 | public static final Creator CREATOR = new Creator() {
112 | @Override
113 | public BoxItem createFromParcel(Parcel source) {
114 | return new BoxItem(source);
115 | }
116 |
117 | @Override
118 | public BoxItem[] newArray(int size) {
119 | return new BoxItem[size];
120 | }
121 | };
122 |
123 | @Override
124 | public int compareTo(BoxItem o) {
125 | if (o == null) {
126 | return 1;
127 | } else {
128 | return position - o.position;
129 | }
130 | }
131 | }
132 |
--------------------------------------------------------------------------------
/Modular/memory-box/src/main/java/com/kymjs/app/memory/module/list/MainFragment.java:
--------------------------------------------------------------------------------
1 | package com.kymjs.app.memory.module.list;
2 |
3 | import android.os.Bundle;
4 | import android.support.annotation.Nullable;
5 | import android.support.v4.app.Fragment;
6 | import android.view.LayoutInflater;
7 | import android.view.View;
8 | import android.view.ViewGroup;
9 |
10 | import com.kymjs.app.memory.R;
11 |
12 | /**
13 | * Created by ZhangTao on 10/12/16.
14 | */
15 |
16 | public class MainFragment extends Fragment {
17 |
18 | @Nullable
19 | @Override
20 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
21 | super.onCreateView(inflater, container, savedInstanceState);
22 | return View.inflate(getActivity(), R.layout.memory_fragment_main, null);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Modular/memory-box/src/main/java/com/kymjs/app/memory/module/main/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.kymjs.app.memory.module.main;
2 |
3 | import android.os.Build;
4 | import android.os.Bundle;
5 | import android.os.Handler;
6 | import android.os.Looper;
7 | import android.support.v7.app.AppCompatActivity;
8 | import android.support.v7.widget.Toolbar;
9 | import android.view.KeyEvent;
10 | import android.view.View;
11 | import android.view.animation.Animation;
12 | import android.widget.TextView;
13 |
14 | import com.kymjs.app.base_res.utils.AnimationUtil;
15 | import com.kymjs.app.memory.BuildConfig;
16 | import com.kymjs.app.memory.R;
17 | import com.kymjs.router.FragmentRouter;
18 | import com.kymjs.router.RouterList;
19 |
20 | public class MainActivity extends AppCompatActivity {
21 |
22 | @Override
23 | protected void onCreate(Bundle savedInstanceState) {
24 | super.onCreate(savedInstanceState);
25 | setContentView(R.layout.baseres_activity_main);
26 |
27 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
28 | getWindow().setStatusBarColor(getColor(R.color.baseres_colorPrimary));
29 | }
30 |
31 | Toolbar toolbar = getToolbar();
32 | if (toolbar != null) {
33 | setSupportActionBar(toolbar);
34 | }
35 |
36 | getSupportFragmentManager()
37 | .beginTransaction()
38 | .replace(R.id.baseres_content_main,
39 | FragmentRouter.getFragment(RouterList.MEMORY_FRAG_MAIN))
40 | .commit();
41 | }
42 |
43 | protected Toolbar getToolbar() {
44 | return (Toolbar) findViewById(R.id.baseres_toolbar);
45 | }
46 |
47 | @Override
48 | public boolean onKeyDown(int keyCode, KeyEvent event) {
49 | if (BuildConfig.ISAPP) {
50 | return handleExitTip(keyCode);
51 | }
52 | return super.onKeyDown(keyCode, event);
53 | }
54 |
55 | /////////////////////////// show exit tip ////////////////////////////////////
56 |
57 | private boolean isOnKeyBacking;
58 | private Handler mMainLoopHandler = new Handler(Looper.getMainLooper());
59 | private Runnable onBackTimeRunnable = new Runnable() {
60 | @Override
61 | public void run() {
62 | isOnKeyBacking = false;
63 | cancleExit();
64 | }
65 | };
66 |
67 | private boolean handleExitTip(int keyCode) {
68 | if (keyCode == KeyEvent.KEYCODE_BACK) {
69 | if (isOnKeyBacking) {
70 | mMainLoopHandler.removeCallbacks(onBackTimeRunnable);
71 | isOnKeyBacking = false;
72 | finish();
73 | } else {
74 | isOnKeyBacking = true;
75 | showExitTip();
76 | mMainLoopHandler.postDelayed(onBackTimeRunnable, 2000);
77 | }
78 | return true;
79 | }
80 | return false;
81 | }
82 |
83 | /**
84 | * 显示Toolbar的退出tip
85 | */
86 | public void showExitTip() {
87 | TextView view = (TextView) findViewById(R.id.titlebar_text_exittip);
88 | view.setVisibility(View.VISIBLE);
89 | Animation a = AnimationUtil.getTranslateAnimation(0f, 0f, -getToolbar().getHeight(), 0f, 300);
90 | view.startAnimation(a);
91 | }
92 |
93 | /**
94 | * 取消退出
95 | */
96 | public void cancleExit() {
97 | final TextView view = (TextView) findViewById(R.id.titlebar_text_exittip);
98 | Animation a = AnimationUtil.getTranslateAnimation(0f, 0f, 0f, -getToolbar().getHeight(), 300);
99 | a.setAnimationListener(new Animation.AnimationListener() {
100 | @Override
101 | public void onAnimationStart(Animation animation) {
102 | }
103 |
104 | @Override
105 | public void onAnimationEnd(Animation animation) {
106 | view.setVisibility(View.GONE);
107 | }
108 |
109 | @Override
110 | public void onAnimationRepeat(Animation animation) {
111 | }
112 | });
113 | view.startAnimation(a);
114 | }
115 | }
116 |
--------------------------------------------------------------------------------
/Modular/memory-box/src/main/java/com/kymjs/app/memory/view/DragGridView.java:
--------------------------------------------------------------------------------
1 | package com.kymjs.app.memory.view;
2 |
3 | import android.animation.Animator;
4 | import android.animation.AnimatorListenerAdapter;
5 | import android.animation.AnimatorSet;
6 | import android.animation.ObjectAnimator;
7 | import android.app.Activity;
8 | import android.content.Context;
9 | import android.graphics.Bitmap;
10 | import android.graphics.Canvas;
11 | import android.graphics.PixelFormat;
12 | import android.graphics.Rect;
13 | import android.os.Handler;
14 | import android.os.Vibrator;
15 | import android.util.AttributeSet;
16 | import android.view.Gravity;
17 | import android.view.MotionEvent;
18 | import android.view.View;
19 | import android.view.ViewTreeObserver;
20 | import android.view.ViewTreeObserver.OnPreDrawListener;
21 | import android.view.WindowManager;
22 | import android.view.animation.AccelerateDecelerateInterpolator;
23 | import android.widget.AdapterView;
24 | import android.widget.GridView;
25 | import android.widget.ImageView;
26 | import android.widget.ListAdapter;
27 |
28 | import java.lang.ref.WeakReference;
29 | import java.util.LinkedList;
30 | import java.util.List;
31 |
32 | /**
33 | * 感谢这篇博客的作者,http://blog.csdn.net/xiaanming/article/details/17718579
34 | * 在这个基础上解决了原作者的问题:Adapter无法使用ViewHolder优化的问题,优化了手势识别率,并添加了trashView功能,
35 | * 优化自定义控件对外扩展性,解决在上下拉环境下手势冲突问题
36 | *
37 | * @author kymjs张涛 (https://kymjs.com/)
38 | */
39 | public class DragGridView extends GridView {
40 |
41 | private long dragResponseMS = 700; // item长按响应的时间
42 | private int mDragPosition;// 正在拖拽的position
43 |
44 | private boolean isDrag = false; // 是否可以拖拽,用于控件内部逻辑实现
45 | private boolean canDrag = true; // 是否可用拖拽,主要用于外部开放设置
46 | private boolean mAnimationEnd = true;
47 |
48 | private int mDownX;
49 | private int mDownY;
50 | private int moveY;
51 |
52 | private View mStartDragItemView = null; // 刚开始拖拽的item对应的View
53 | private ImageView mDragImageView; // 用于拖拽时显示的幻影镜像
54 | private Bitmap mDragBitmap; // 幻影镜像对应的Bitmap
55 | private View mTrashView; // 删除item的垃圾桶图标
56 |
57 | private final Vibrator mVibrator; // 震动器
58 | private final int mStatusHeight;// 状态栏的高度
59 | private final WindowManager mWindowManager;
60 | private WindowManager.LayoutParams mWindowLayoutParams; // item镜像的布局参数
61 |
62 | private int mPoint2ItemTop; // 按下的点到所在item的上边缘的距离
63 | private int mPoint2ItemLeft;
64 | private int mOffset2Top; // DragGridView距离屏幕顶部的偏移量
65 | private int mOffset2Left;
66 |
67 | private int mDownScrollBorder; // DragGridView自动向下滚动的边界值
68 | private int mUpScrollBorder; // DragGridView自动向上滚动的边界值
69 |
70 | private DragGridBaseAdapter mDragAdapter;
71 | private int mNumColumns;
72 | private int mColumnWidth;
73 | private boolean mNumColumnsSet;
74 | private int mHorizontalSpacing;
75 |
76 | private static final int speed = 20; // DragGridView自动滚动的速度
77 | private static final int MOVE_OFFSET = 25;
78 | private boolean moved = false;
79 |
80 | public static final int HANDLE_START = 0x3587;
81 | public static final int HANDLE_CANCLE = 0x3588;
82 | public static final int HANDLE_FINISH = 0x3589;
83 | private OnMoveListener moveListener; // 拖拽开始与结束监听器
84 | private OnDeleteListener deleteListener; // 移动到垃圾桶时的监听器
85 |
86 | private final TouchRect moveRect = new TouchRect();
87 | private final TouchRect gridRect = new TouchRect();
88 | private final TouchRect trashRect = new TouchRect();
89 |
90 | public DragGridView(Context context) {
91 | this(context, null);
92 | }
93 |
94 | public DragGridView(Context context, AttributeSet attrs) {
95 | this(context, attrs, 0);
96 | }
97 |
98 | public DragGridView(Context context, AttributeSet attrs, int defStyle) {
99 | super(context, attrs, defStyle);
100 | mVibrator = (Vibrator) context
101 | .getSystemService(Context.VIBRATOR_SERVICE);
102 | mWindowManager = (WindowManager) context
103 | .getSystemService(Context.WINDOW_SERVICE);
104 | mStatusHeight = getStatusHeight(context); // 获取状态栏的高度
105 |
106 | if (!mNumColumnsSet) {
107 | mNumColumns = AUTO_FIT;
108 | }
109 | }
110 |
111 | /**
112 | * 获取状态栏的高度
113 | */
114 | private static int getStatusHeight(Context context) {
115 | int statusHeight;
116 | Rect localRect = new Rect();
117 |
118 | ((Activity) context).getWindow().getDecorView()
119 | .getWindowVisibleDisplayFrame(localRect);
120 | statusHeight = localRect.top;
121 | if (0 == statusHeight) {
122 | Class> localClass;
123 | try {
124 | localClass = Class.forName("com.android.internal.R$dimen");
125 | Object localObject = localClass.newInstance();
126 | int i5 = Integer.parseInt(localClass
127 | .getField("status_bar_height").get(localObject)
128 | .toString());
129 | statusHeight = context.getResources().getDimensionPixelSize(i5);
130 | } catch (Exception e) {
131 | e.printStackTrace();
132 | }
133 | }
134 | return statusHeight;
135 | }
136 |
137 | private final PostHandle mHandler = new PostHandle(this);
138 |
139 | private static final class PostHandle extends Handler {
140 |
141 | WeakReference outside;
142 |
143 | PostHandle(DragGridView activity) {
144 | outside = new WeakReference<>(activity);
145 | }
146 |
147 | @Override
148 | public void handleMessage(android.os.Message msg) {
149 | DragGridView outsideView = outside.get();
150 | if (outsideView != null && outsideView.moveListener != null) {
151 | switch (msg.what) {
152 | case HANDLE_START:
153 | outsideView.moveListener.startMove();
154 | break;
155 | case HANDLE_CANCLE:
156 | outsideView.moveListener.cancleMove();
157 | break;
158 | case HANDLE_FINISH:
159 | outsideView.moveListener.finishMove();
160 | break;
161 | }
162 | }
163 | }
164 | }
165 |
166 | // 用来处理是否为长按的Runnable
167 | private final Runnable mLongClickRunnable = new Runnable() {
168 | @Override
169 | public void run() {
170 | if (!canDrag) {
171 | return;
172 | }
173 | isDrag = true; // 设置可以拖拽
174 | moved = true;
175 | mHandler.sendEmptyMessage(HANDLE_START);
176 | mVibrator.vibrate(50); // 震动一下
177 |
178 | mStartDragItemView.setVisibility(View.INVISIBLE);// 隐藏该item
179 |
180 | createDragImage(mDragBitmap, mDownX, mDownY);
181 | mDragBitmap = null;
182 | }
183 | };
184 |
185 | /**
186 | * 若设置为AUTO_FIT,计算有多少列
187 | */
188 | @Override
189 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
190 | if (mNumColumns == AUTO_FIT) {
191 | int numFittedColumns; // 可用列
192 |
193 | if (mColumnWidth > 0) {
194 | int gridWidth = Math.max(MeasureSpec.getSize(widthMeasureSpec)
195 | - getPaddingLeft() - getPaddingRight(), 0);
196 | numFittedColumns = gridWidth / mColumnWidth;
197 | if (numFittedColumns > 0) {
198 | while (numFittedColumns != 1) {
199 | if (numFittedColumns * mColumnWidth
200 | + (numFittedColumns - 1) * mHorizontalSpacing > gridWidth) {
201 | numFittedColumns--;
202 | } else {
203 | break;
204 | }
205 | }
206 | }
207 | } else {
208 | numFittedColumns = 2;
209 | }
210 | mNumColumns = numFittedColumns;
211 | }
212 | super.onMeasure(widthMeasureSpec, heightMeasureSpec);
213 | }
214 |
215 | @Override
216 | protected void onDraw(Canvas canvas) {
217 | super.onDraw(canvas);
218 | initRecord();
219 | }
220 |
221 | /**
222 | * 初始化坐标数据
223 | */
224 | private void initRecord() {
225 | gridRect.left = this.getLeft();
226 | gridRect.right = this.getRight();
227 | gridRect.top = this.getTop();
228 | gridRect.bottom = this.getBottom();
229 | if (mTrashView != null) {
230 | trashRect.left = mTrashView.getLeft();
231 | trashRect.right = mTrashView.getRight();
232 | trashRect.bottom = mTrashView.getBottom();
233 | trashRect.top = mTrashView.getTop();
234 | }
235 | }
236 |
237 | /********************
238 | * preference method
239 | ********************/
240 |
241 | @Override
242 | public void setAdapter(ListAdapter adapter) {
243 | super.setAdapter(adapter);
244 |
245 | if (adapter instanceof DragGridBaseAdapter) {
246 | mDragAdapter = (DragGridBaseAdapter) adapter;
247 | } else {
248 | throw new IllegalStateException(
249 | "the adapter must be implements DragGridAdapter");
250 | }
251 | }
252 |
253 | @Override
254 | public void setNumColumns(int numColumns) {
255 | super.setNumColumns(numColumns);
256 | mNumColumnsSet = true;
257 | this.mNumColumns = numColumns;
258 | }
259 |
260 | @Override
261 | public void setColumnWidth(int columnWidth) {
262 | super.setColumnWidth(columnWidth);
263 | mColumnWidth = columnWidth;
264 | }
265 |
266 | @Override
267 | public void setHorizontalSpacing(int horizontalSpacing) {
268 | super.setHorizontalSpacing(horizontalSpacing);
269 | this.mHorizontalSpacing = horizontalSpacing;
270 | }
271 |
272 | /**
273 | * 设置响应拖拽的毫秒数,默认是700毫秒
274 | */
275 | public void setDragResponseMS(long dragResponseMS) {
276 | this.dragResponseMS = dragResponseMS;
277 | }
278 |
279 | public void setOnDeleteListener(OnDeleteListener l) {
280 | this.deleteListener = l;
281 | }
282 |
283 | public void setTrashView(View trashView) {
284 | this.mTrashView = trashView;
285 | }
286 |
287 | public void setDragEnable(boolean isDrag) {
288 | this.canDrag = isDrag;
289 | if (canDrag) {
290 | mHandler.removeCallbacks(mLongClickRunnable);
291 | }
292 | }
293 |
294 | /********************
295 | * touch method
296 | ********************/
297 |
298 | @Override
299 | public boolean dispatchTouchEvent(MotionEvent ev) {
300 | if (canDrag) {
301 | switch (ev.getAction()) {
302 | case MotionEvent.ACTION_DOWN:
303 | mDownX = (int) ev.getX();
304 | mDownY = (int) ev.getY();
305 | moveRect.left = mDownX - MOVE_OFFSET;
306 | moveRect.right = mDownX + MOVE_OFFSET;
307 | moveRect.top = mDownY - MOVE_OFFSET;
308 | moveRect.bottom = mDownY + MOVE_OFFSET;
309 |
310 | // 根据按下的X,Y坐标获取所点击item的position
311 | mDragPosition = pointToPosition(mDownX, mDownY);
312 |
313 | if (mDragPosition == AdapterView.INVALID_POSITION) {
314 | return super.dispatchTouchEvent(ev);
315 | }
316 |
317 | // 使用Handler延迟dragResponseMS执行mLongClickRunnable
318 | mHandler.postDelayed(mLongClickRunnable, dragResponseMS);
319 |
320 | // 根据position获取该item所对应的View
321 | mStartDragItemView = getChildAt(mDragPosition
322 | - getFirstVisiblePosition());
323 |
324 | mPoint2ItemTop = mDownY - mStartDragItemView.getTop();
325 | mPoint2ItemLeft = mDownX - mStartDragItemView.getLeft();
326 |
327 | mOffset2Top = (int) (ev.getRawY() - mDownY);
328 | mOffset2Left = (int) (ev.getRawX() - mDownX);
329 |
330 | // 获取DragGridView自动向上滚动的偏移量,小于这个值,DragGridView向下滚动
331 | mDownScrollBorder = getHeight() / 5;
332 | // 大于这个值,DragGridView向上滚动
333 | mUpScrollBorder = getHeight() * 4 / 5;
334 |
335 | // 开启mDragItemView绘图缓存
336 | mStartDragItemView.setDrawingCacheEnabled(true);
337 | // 获取mDragItemView在缓存中的Bitmap对象
338 | mDragBitmap = Bitmap.createBitmap(mStartDragItemView
339 | .getDrawingCache());
340 | // 这一步很关键,释放绘图缓存,避免出现重复的镜像
341 | mStartDragItemView.destroyDrawingCache();
342 | break;
343 | case MotionEvent.ACTION_MOVE:
344 | // 如果我们在按下的item上面移动,只要不超过item的边界我们就不移除mRunnable
345 | if (!isTouchInItem(moveRect, ev.getX(), ev.getY())) {
346 | mHandler.removeCallbacks(mLongClickRunnable);
347 | }
348 | break;
349 | case MotionEvent.ACTION_UP:
350 | mHandler.removeCallbacks(mScrollRunnable);
351 | mHandler.removeCallbacks(mLongClickRunnable);
352 | if (moved && getAdapter().getCount() > 0) {
353 | mHandler.sendEmptyMessage(HANDLE_FINISH);
354 | } else {
355 | mHandler.sendEmptyMessage(HANDLE_CANCLE);
356 | }
357 | moved = false;
358 | break;
359 | }
360 | }
361 | return super.dispatchTouchEvent(ev);
362 | }
363 |
364 | @Override
365 | public boolean onTouchEvent(MotionEvent ev) {
366 | if (isDrag && canDrag && mDragImageView != null) {
367 | switch (ev.getAction()) {
368 | case MotionEvent.ACTION_DOWN:
369 | initRecord();
370 | break;
371 | case MotionEvent.ACTION_MOVE:
372 | int moveX = (int) ev.getX();
373 | moveY = (int) ev.getY();
374 |
375 | onDragItem(moveX, moveY);// 拖动item
376 |
377 | if (mTrashView != null) {
378 | if (inTrash(moveX, moveY)) {
379 | mTrashView.setScaleX(1.7f);
380 | mTrashView.setScaleY(1.7f);
381 | } else {
382 | mTrashView.setScaleX(1f);
383 | mTrashView.setScaleY(1f);
384 | }
385 | }
386 | break;
387 | case MotionEvent.ACTION_CANCEL:
388 | case MotionEvent.ACTION_UP:
389 | onStopDrag();
390 | isDrag = false;
391 | if (deleteListener != null && inTrash(ev.getX(), ev.getY())) {
392 | deleteListener.onDelete(mDragPosition);
393 | }
394 | break;
395 | }
396 | return true;
397 | }
398 | return super.onTouchEvent(ev);
399 | }
400 |
401 | /**
402 | * 是否点击在GridView的item上面
403 | *
404 | * @param x 点击的坐标点
405 | * @param y 点击的坐标点
406 | */
407 | private boolean isTouchInItem(TouchRect moveRect, float x, float y) {
408 | // 防止手抖的处理,如果是横向在item上移动是没有影响的,
409 | // 但是纵向由于外层上下拉控件还是会有影响,具体解决请看NoteBookFragment类中的mSwipeRefreshLayout.setOnTouchListener方法
410 | return x < moveRect.right && x > moveRect.left && y < moveRect.bottom
411 | && y > moveRect.top;
412 | }
413 |
414 | /**
415 | * 创建拖动的镜像
416 | *
417 | * @param bitmap 镜像
418 | * @param downX 按下的点相对父控件的X坐标
419 | * @param downY 按下的点相对父控件的X坐标
420 | */
421 | private void createDragImage(Bitmap bitmap, int downX, int downY) {
422 | mWindowLayoutParams = new WindowManager.LayoutParams();
423 | mWindowLayoutParams.format = PixelFormat.TRANSLUCENT; // 图片之外的其他地方透明
424 |
425 | mWindowLayoutParams.gravity = Gravity.TOP | Gravity.START;
426 | mWindowLayoutParams.x = downX - mPoint2ItemLeft + mOffset2Left;
427 | mWindowLayoutParams.y = downY - mPoint2ItemTop + mOffset2Top
428 | - mStatusHeight;
429 | mWindowLayoutParams.alpha = 0.55f; // 透明度
430 |
431 | mWindowLayoutParams.width = WindowManager.LayoutParams.WRAP_CONTENT;
432 | mWindowLayoutParams.height = WindowManager.LayoutParams.WRAP_CONTENT;
433 | mWindowLayoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
434 | | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE;
435 |
436 | mDragImageView = new ImageView(getContext());
437 | mDragImageView.setImageBitmap(bitmap);
438 | mWindowManager.addView(mDragImageView, mWindowLayoutParams);
439 | }
440 |
441 | /**
442 | * 从界面上面移动拖动镜像
443 | */
444 | private void removeDragImage() {
445 | if (mDragImageView != null) {
446 | mWindowManager.removeView(mDragImageView);
447 | mDragImageView = null;
448 | }
449 | }
450 |
451 | /**
452 | * 拖动item,在里面实现了item镜像的位置更新,item的相互交换以及GridView的自行滚动
453 | */
454 | private void onDragItem(int moveX, int moveY) {
455 | mWindowLayoutParams.x = moveX - mPoint2ItemLeft + mOffset2Left;
456 | mWindowLayoutParams.y = moveY - mPoint2ItemTop + mOffset2Top
457 | - mStatusHeight;
458 | mWindowManager.updateViewLayout(mDragImageView, mWindowLayoutParams); // 更新镜像的位置
459 | onSwapItem(moveX, moveY);
460 | // GridView自动滚动
461 | mHandler.post(mScrollRunnable);
462 | }
463 |
464 | /**
465 | * 手指当前处于垃圾桶图标上
466 | *
467 | * @param x 手指坐标
468 | * @param y 手指坐标
469 | */
470 | private boolean inTrash(float x, float y) {
471 | x += gridRect.left;
472 | y += gridRect.top;
473 | if (x > trashRect.left && x < trashRect.right && y > trashRect.top
474 | && y < trashRect.bottom) {
475 | if (mHandler != null && mScrollRunnable != null) {
476 | mHandler.removeCallbacks(mScrollRunnable);
477 | }
478 | if (mDragImageView != null) {
479 | mDragImageView.setScaleX(0.6f);
480 | mDragImageView.setScaleY(0.6f);
481 | }
482 | return true;
483 | } else {
484 | if (mDragImageView != null) {
485 | mDragImageView.setScaleX(1f);
486 | mDragImageView.setScaleY(1f);
487 | }
488 | return false;
489 | }
490 | }
491 |
492 | /**
493 | * 当moveY的值大于向上滚动的边界值,触发GridView自动向上滚动 当moveY的值小于向下滚动的边界值,触发GridView自动向下滚动
494 | * 否则不进行滚动
495 | */
496 | private final Runnable mScrollRunnable = new Runnable() {
497 |
498 | @Override
499 | public void run() {
500 | int scrollY;
501 | if (getFirstVisiblePosition() == 0
502 | || getLastVisiblePosition() == getCount() - 1) {
503 | mHandler.removeCallbacks(mScrollRunnable);
504 | }
505 |
506 | if (moveY > mUpScrollBorder) {
507 | scrollY = speed;
508 | mHandler.postDelayed(mScrollRunnable, 25);
509 | } else if (moveY < mDownScrollBorder) {
510 | scrollY = -speed;
511 | mHandler.postDelayed(mScrollRunnable, 25);
512 | } else {
513 | scrollY = 0;
514 | mHandler.removeCallbacks(mScrollRunnable);
515 | }
516 |
517 | smoothScrollBy(scrollY, 10);
518 | }
519 | };
520 |
521 | /**
522 | * 交换item,并且控制item之间的显示与隐藏效果
523 | */
524 | private void onSwapItem(int moveX, int moveY) {
525 | // 获取我们手指移动到的那个item的position
526 |
527 | final int tempPosition = pointToPosition(moveX, moveY);
528 |
529 | // 假如tempPosition 改变了并且tempPosition不等于-1,则进行交换
530 |
531 | if (tempPosition != mDragPosition
532 | && tempPosition != AdapterView.INVALID_POSITION
533 | && mAnimationEnd) {
534 | mDragAdapter.reorderItems(mDragPosition, tempPosition);
535 | mDragAdapter.setHideItem(tempPosition);
536 |
537 | final ViewTreeObserver observer = getViewTreeObserver();
538 | observer.addOnPreDrawListener(new OnPreDrawListener() {
539 |
540 | @Override
541 | public boolean onPreDraw() {
542 | observer.removeOnPreDrawListener(this);
543 | animateReorder(mDragPosition, tempPosition);
544 | mDragPosition = tempPosition;
545 | return true;
546 | }
547 | });
548 |
549 | }
550 | }
551 |
552 | /**
553 | * 创建移动动画
554 | */
555 | private AnimatorSet createTranslationAnimations(View view, float startX,
556 | float endX, float startY, float endY) {
557 | ObjectAnimator animX = ObjectAnimator.ofFloat(view, "translationX",
558 | startX, endX);
559 | ObjectAnimator animY = ObjectAnimator.ofFloat(view, "translationY",
560 | startY, endY);
561 | AnimatorSet animSetXY = new AnimatorSet();
562 | animSetXY.playTogether(animX, animY);
563 | return animSetXY;
564 | }
565 |
566 | /**
567 | * item的交换动画效果
568 | */
569 | private void animateReorder(final int oldPosition, final int newPosition) {
570 | boolean isForward = newPosition > oldPosition;
571 | List resultList = new LinkedList<>();
572 | if (isForward) {
573 | for (int pos = oldPosition; pos < newPosition; pos++) {
574 | View view = getChildAt(pos - getFirstVisiblePosition());
575 | if (view == null) {
576 | continue;
577 | }
578 | if ((pos + 1) % mNumColumns == 0) {
579 | resultList.add(createTranslationAnimations(view,
580 | -view.getWidth() * (mNumColumns - 1), 0,
581 | view.getHeight(), 0));
582 | } else {
583 | resultList.add(createTranslationAnimations(view,
584 | view.getWidth(), 0, 0, 0));
585 | }
586 | }
587 | } else {
588 | for (int pos = oldPosition; pos > newPosition; pos--) {
589 | View view = getChildAt(pos - getFirstVisiblePosition());
590 | if ((pos + mNumColumns) % mNumColumns == 0) {
591 | resultList.add(createTranslationAnimations(view,
592 | view.getWidth() * (mNumColumns - 1), 0,
593 | -view.getHeight(), 0));
594 | } else {
595 | resultList.add(createTranslationAnimations(view,
596 | -view.getWidth(), 0, 0, 0));
597 | }
598 | }
599 | }
600 |
601 | AnimatorSet resultSet = new AnimatorSet();
602 | resultSet.playTogether(resultList);
603 | resultSet.setDuration(300);
604 | resultSet.setInterpolator(new AccelerateDecelerateInterpolator());
605 | resultSet.addListener(new AnimatorListenerAdapter() {
606 | @Override
607 | public void onAnimationStart(Animator animation) {
608 | mAnimationEnd = false;
609 | }
610 |
611 | @Override
612 | public void onAnimationEnd(Animator animation) {
613 | mAnimationEnd = true;
614 | }
615 | });
616 | resultSet.start();
617 | }
618 |
619 | /**
620 | * 停止拖拽我们将之前隐藏的item显示出来,并将镜像移除
621 | */
622 | private void onStopDrag() {
623 | View view = getChildAt(mDragPosition - getFirstVisiblePosition());
624 | if (view != null) {
625 | view.setVisibility(View.VISIBLE);
626 | }
627 | mDragAdapter.setHideItem(-1);
628 | removeDragImage();
629 |
630 | if (mTrashView != null) {
631 | mTrashView.setScaleX(1f);
632 | mTrashView.setScaleY(1f);
633 | }
634 | }
635 |
636 | public void setOnMoveListener(OnMoveListener l) {
637 | moveListener = l;
638 | }
639 |
640 | public interface OnMoveListener {
641 | void startMove();
642 |
643 | void finishMove();
644 |
645 | void cancleMove();
646 | }
647 |
648 | public interface OnDeleteListener {
649 | void onDelete(int position);
650 | }
651 |
652 | public interface DragGridBaseAdapter {
653 | /**
654 | * 移动时回调
655 | */
656 | void reorderItems(int oldPosition, int newPosition);
657 |
658 | /**
659 | * 隐藏时回调
660 | */
661 | void setHideItem(int hidePosition);
662 | }
663 |
664 | private class TouchRect {
665 | int top;
666 | int bottom;
667 | int left;
668 | int right;
669 | }
670 | }
--------------------------------------------------------------------------------
/Modular/memory-box/src/main/java/debug/AppContext.java:
--------------------------------------------------------------------------------
1 | package debug;
2 |
3 | import android.app.Application;
4 |
5 | import com.kymjs.app.memory.BuildConfig;
6 | import com.kymjs.common.App;
7 | import com.kymjs.common.LogUtils;
8 | import com.kymjs.crash.CustomActivityOnCrash;
9 |
10 |
11 | /**
12 | * Created by ZhangTao on 10/12/16.
13 | */
14 | public class AppContext extends Application {
15 | @Override
16 | public void onCreate() {
17 | super.onCreate();
18 | LogUtils.mLogEnable = BuildConfig.DEBUG;
19 | CustomActivityOnCrash.install(App.INSTANCE);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Modular/memory-box/src/main/release/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/Modular/memory-box/src/main/res/layout/memory_fragment_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
13 |
--------------------------------------------------------------------------------
/Modular/memory-box/src/main/res/mipmap-hdpi/memory_ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kymjs/Modularity/2458dd3584e6313a7cc76d909680480e7376f62b/Modular/memory-box/src/main/res/mipmap-hdpi/memory_ic_launcher.png
--------------------------------------------------------------------------------
/Modular/memory-box/src/main/res/mipmap-mdpi/memory_ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kymjs/Modularity/2458dd3584e6313a7cc76d909680480e7376f62b/Modular/memory-box/src/main/res/mipmap-mdpi/memory_ic_launcher.png
--------------------------------------------------------------------------------
/Modular/memory-box/src/main/res/mipmap-xhdpi/memory_ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kymjs/Modularity/2458dd3584e6313a7cc76d909680480e7376f62b/Modular/memory-box/src/main/res/mipmap-xhdpi/memory_ic_launcher.png
--------------------------------------------------------------------------------
/Modular/memory-box/src/main/res/mipmap-xxhdpi/memory_ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kymjs/Modularity/2458dd3584e6313a7cc76d909680480e7376f62b/Modular/memory-box/src/main/res/mipmap-xxhdpi/memory_ic_launcher.png
--------------------------------------------------------------------------------
/Modular/memory-box/src/main/res/mipmap-xxxhdpi/memory_ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kymjs/Modularity/2458dd3584e6313a7cc76d909680480e7376f62b/Modular/memory-box/src/main/res/mipmap-xxxhdpi/memory_ic_launcher.png
--------------------------------------------------------------------------------
/Modular/memory-box/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/Modular/memory-box/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/Modular/memory-box/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/Modular/memory-box/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | memoryBox
3 |
4 |
--------------------------------------------------------------------------------
/Modular/memory-box/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Modular/memory-box/src/test/java/com/kymjs/app/memory/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.kymjs.app.memory;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/Modular/router/.gitignore:
--------------------------------------------------------------------------------
1 | tomsuite.xml
2 | **pom.xml.releaseBackup
3 | release.properties
4 | gen
5 | */seed.txt
6 | notes
7 | logs
8 | gen-external-apklibs
9 | .idea
10 | *.iml
11 | .DS_Store
12 | *.swp
13 | out
14 | .gradle
15 | /local.properties
16 | /build
17 |
18 | ###OSX###
19 |
20 | .DS_Store
21 | .AppleDouble
22 | .LSOverride
23 |
24 | # Icon must ends with two \r.
25 | Icon
26 |
27 |
28 | # Thumbnails
29 | ._*
30 |
31 | # Files that might appear on external disk
32 | .Spotlight-V100
33 | .Trashes
34 |
35 |
36 | ###Linux###
37 |
38 | *~
39 |
40 | # KDE directory preferences
41 | .directory
42 |
43 |
44 | ###Android###
45 |
46 | # Built application files
47 | *.apk
48 | *.ap_
49 |
50 | # Files for ART and Dalvik VM
51 | *.dex
52 |
53 | # Java class files
54 | *.class
55 |
56 | # Generated files
57 | bin/
58 | gen/
59 |
60 | # Gradle files
61 | .gradle/
62 | .gradletasknamecache
63 | build/
64 |
65 | # Local configuration file (sdk path, etc)
66 | local.properties
67 |
68 | # Proguard folder generated by Eclipse
69 | proguard/
70 |
71 | # Lint
72 | lint-report.html
73 | lint-report_files/
74 | lint_result.txt
75 |
76 | # Mobile Tools for Java (J2ME)
77 | .mtj.tmp/
78 |
79 | # Package Files #
80 | *.war
81 | *.ear
82 |
83 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
84 | hs_err_pid*
85 |
86 |
87 | ###IntelliJ###
88 |
89 | *.iml
90 | *.ipr
91 | *.iws
92 | .idea/
93 |
94 |
95 | ###Eclipse###
96 |
97 | *.pydevproject
98 | .metadata
99 | tmp/
100 | *.tmp
101 | *.bak
102 | *.swp
103 | *~.nib
104 | .settings/
105 | .loadpath
106 |
107 | # External tool builders
108 | .externalToolBuilders/
109 |
110 | # Locally stored "Eclipse launch configurations"
111 | *.launch
112 |
113 | # CDT-specific
114 | .cproject
115 |
116 | # PDT-specific
117 | .buildpath
118 |
119 | # sbteclipse plugin
120 | .target
121 |
122 | # TeXlipse plugin
123 | .texlipseXml version="1.0" encoding="UTF-8"?>captures
124 |
--------------------------------------------------------------------------------
/Modular/router/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion 24
5 | buildToolsVersion "24.0.2"
6 |
7 | defaultConfig {
8 | minSdkVersion 14
9 | targetSdkVersion 24
10 | versionCode 1
11 | versionName "1.0"
12 | resourcePrefix "router_"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | compile fileTree(dir: 'libs', include: ['*.jar'])
24 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
25 | exclude group: 'com.android.support', module: 'support-annotations'
26 | })
27 | testCompile 'junit:junit:4.12'
28 |
29 | compile 'com.android.support:design:24.2.1'
30 | compile 'com.android.support:appcompat-v7:24.2.1'
31 |
32 | compile 'io.reactivex:rxandroid:1.1.0'
33 | compile 'io.reactivex:rxjava:1.1.0'
34 |
35 | compile 'com.kymjs.core:common:1.0.3'
36 | compile 'com.kymjs.core:crash:1.0.1'
37 |
38 | compile project(':base-res')
39 | }
40 |
41 | sourceCompatibility = JavaVersion.VERSION_1_7
42 | targetCompatibility = JavaVersion.VERSION_1_7
--------------------------------------------------------------------------------
/Modular/router/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/kymjs/developer/android/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/Modular/router/src/androidTest/java/com/kymjs/router/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.kymjs.router;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumentation test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.kymjs.router.test", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Modular/router/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/Modular/router/src/main/java/com/kymjs/router/ActivityRouter.java:
--------------------------------------------------------------------------------
1 | package com.kymjs.router;
2 |
3 | import android.content.Context;
4 | import android.content.Intent;
5 |
6 | /**
7 | * Created by ZhangTao on 10/12/16.
8 | */
9 |
10 | public class ActivityRouter {
11 |
12 | public static void startActivity(Context context, String action) {
13 | context.startActivity(new Intent(action));
14 | }
15 |
16 | public static void startActivity(Context context, Class clazz) {
17 | context.startActivity(getIntent(context, clazz));
18 | }
19 |
20 | public static Intent getIntent(Context context, Class clazz) {
21 | return new Intent(context, clazz);
22 | }
23 |
24 | public static void startActivityForName(Context context, String name) {
25 | try {
26 | Class clazz = Class.forName(name);
27 | startActivity(context, clazz);
28 | } catch (ClassNotFoundException e) {
29 | throw new RuntimeException(e);
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/Modular/router/src/main/java/com/kymjs/router/FragmentRouter.java:
--------------------------------------------------------------------------------
1 | package com.kymjs.router;
2 |
3 | import android.support.v4.app.Fragment;
4 |
5 | /**
6 | * Created by ZhangTao on 10/12/16.
7 | */
8 |
9 | public class FragmentRouter {
10 |
11 | public static Fragment getFragment(String name) {
12 | Fragment fragment;
13 | try {
14 | Class fragmentClass = Class.forName(name);
15 | fragment = (Fragment) fragmentClass.newInstance();
16 | } catch (Exception e) {
17 | throw new RuntimeException(e);
18 | }
19 | return fragment;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Modular/router/src/main/java/com/kymjs/router/RouterList.java:
--------------------------------------------------------------------------------
1 | package com.kymjs.router;
2 |
3 | /**
4 | * Created by ZhangTao on 10/12/16.
5 | */
6 |
7 | public class RouterList {
8 | public static final String MEMORY_ATY_MAIN = "com.kymjs.app.memory.module.main.MainActivity";
9 |
10 | public static final String EXPLORER_ATY_MAIN = "com.kymjs.app.explorer.MainActivity";
11 |
12 | public static final String MEMORY_FRAG_MAIN = "com.kymjs.app.memory.module.list.MainFragment";
13 | }
14 |
--------------------------------------------------------------------------------
/Modular/router/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/Modular/router/src/test/java/com/kymjs/router/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.kymjs.router;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/Modular/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':explorer', ':router', ':memory-box', ':base-res', ':apt'
--------------------------------------------------------------------------------
/NOTICE:
--------------------------------------------------------------------------------
1 |
2 | Copyright (c) 2016, 张涛.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | *From OasisFeng:*
2 |
3 | ## Modular App Architecture
4 |
5 | Every modular is a tiny app
6 |
7 | ## What
8 | Modules separated by certain level of isolation
9 |
10 | #### Characteristics
• Independent
• Interchangeable
11 | • Interoperable
12 |
#### The price
• Confine
• Contract
• Compatibility
13 |
14 | ## Why
15 |
16 | #### Engineering
17 | • Enforceddecouplingforhigh-cohesioncode.
• Module-independent(parallel)developmentandtesting
18 | • Flexibleintegration,deployment&upgrade
• Theinfamous"64Kmethodslimit"
19 |
20 | #### Product
21 | • Selectiveinstallation(light-weightinitialinstall)
• Hybrid-friendly(web&native,mixandmatch)
• Open to (3rd-party) extensions
22 |
23 | [http://kymjs.com/code/2016/10/18/01](http://kymjs.com/code/2016/10/18/01)
--------------------------------------------------------------------------------