├── .gitignore
├── LICENSE
├── README.md
├── app
├── .gitignore
├── app-release.apk
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── tesla
│ │ └── ai
│ │ └── ApplicationTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ ├── brain
│ │ │ ├── CerebralCortex.java
│ │ │ ├── LimbicSystem.java
│ │ │ ├── castle
│ │ │ │ ├── META-INF
│ │ │ │ │ ├── CUI
│ │ │ │ │ │ └── MANIFEST.MF
│ │ │ │ │ └── MANIFEST.MF
│ │ │ │ ├── castle
│ │ │ │ │ └── Game.java
│ │ │ │ ├── cells
│ │ │ │ │ ├── Boss.java
│ │ │ │ │ ├── Cell.java
│ │ │ │ │ ├── Item.java
│ │ │ │ │ ├── NPC.java
│ │ │ │ │ └── Player.java
│ │ │ │ ├── database
│ │ │ │ │ └── Database.java
│ │ │ │ ├── drawable
│ │ │ │ │ ├── castle-icon.png
│ │ │ │ │ ├── castle.jpg
│ │ │ │ │ ├── launch.png
│ │ │ │ │ ├── map.png
│ │ │ │ │ └── village.jpg
│ │ │ │ ├── funcs
│ │ │ │ │ ├── FuncSrc.java
│ │ │ │ │ └── using
│ │ │ │ │ │ ├── FuncExit.java
│ │ │ │ │ │ ├── FuncFight.java
│ │ │ │ │ │ ├── FuncGo.java
│ │ │ │ │ │ ├── FuncHelp.java
│ │ │ │ │ │ ├── FuncHome.java
│ │ │ │ │ │ ├── FuncMap.java
│ │ │ │ │ │ ├── FuncPack.java
│ │ │ │ │ │ ├── FuncRename.java
│ │ │ │ │ │ ├── FuncSave.java
│ │ │ │ │ │ ├── FuncSleep.java
│ │ │ │ │ │ ├── FuncState.java
│ │ │ │ │ │ ├── FuncTalk.java
│ │ │ │ │ │ └── FuncWild.java
│ │ │ │ ├── map
│ │ │ │ │ ├── GameMap.java
│ │ │ │ │ └── Room.java
│ │ │ │ └── util
│ │ │ │ │ ├── Direction.java
│ │ │ │ │ ├── DirectionPair.java
│ │ │ │ │ ├── Echoer.java
│ │ │ │ │ ├── MessageHandler.java
│ │ │ │ │ └── NameGenerator.java
│ │ │ └── function
│ │ │ │ └── SplitBook.java
│ │ ├── com
│ │ │ └── tesla
│ │ │ │ └── ai
│ │ │ │ ├── AboutMeActivity.java
│ │ │ │ ├── DeleteActivity.java
│ │ │ │ ├── GithubActivity.java
│ │ │ │ ├── LoginActivity.java
│ │ │ │ ├── MainActivity.java
│ │ │ │ ├── RenameActivity.java
│ │ │ │ └── SettingsActivity.java
│ │ ├── database
│ │ │ ├── SQLiteManager.java
│ │ │ └── SQLiteOpener.java
│ │ └── util
│ │ │ ├── BaseActivity.java
│ │ │ ├── MyMessage.java
│ │ │ ├── OnItemClickListener.java
│ │ │ ├── OnMessageChangedListener.java
│ │ │ └── T.java
│ └── res
│ │ ├── anim
│ │ └── progress_turning.xml
│ │ ├── animator
│ │ ├── background_color_0_to_1.xml
│ │ ├── background_color_0_to_5.xml
│ │ ├── background_color_1_to_0.xml
│ │ ├── background_color_1_to_5.xml
│ │ ├── background_color_5_to_0.xml
│ │ └── background_color_5_to_1.xml
│ │ ├── drawable-hdpi
│ │ ├── bd_wallet_bottom_1.9.png
│ │ ├── bd_wallet_bottom_1_hover.9.png
│ │ ├── bg_dredge_tips.9.png
│ │ ├── bg_dredge_tips_1.9.png
│ │ ├── ic_account_circle_black_18dp.png
│ │ ├── ic_book_black_18dp.png
│ │ ├── ic_settings_black_18dp.png
│ │ ├── ic_settings_white_18dp.png
│ │ ├── ic_visibility_black_18dp.png
│ │ ├── nc_anim1.png
│ │ ├── nc_anim2.png
│ │ ├── nc_anim3.png
│ │ ├── nc_anim4.png
│ │ ├── nc_anim5.png
│ │ ├── ritsu_1.png
│ │ ├── ritsu_2.png
│ │ ├── ritsu_2_round.png
│ │ ├── ritsu_3.png
│ │ ├── round_background.png
│ │ ├── round_fore_dark.png
│ │ └── round_fore_light.png
│ │ ├── drawable-mdpi
│ │ ├── ic_account_circle_black_18dp.png
│ │ ├── ic_book_black_18dp.png
│ │ ├── ic_settings_black_18dp.png
│ │ └── ic_visibility_black_18dp.png
│ │ ├── drawable-xhdpi
│ │ ├── ic_account_circle_black_18dp.png
│ │ ├── ic_book_black_18dp.png
│ │ ├── ic_settings_black_18dp.png
│ │ └── ic_visibility_black_18dp.png
│ │ ├── drawable-xxhdpi
│ │ ├── ic_account_circle_black_18dp.png
│ │ ├── ic_book_black_18dp.png
│ │ ├── ic_settings_black_18dp.png
│ │ ├── ic_settings_white_18dp.png
│ │ └── ic_visibility_black_18dp.png
│ │ ├── drawable
│ │ ├── bd_wallet_bottom_1_selector.xml
│ │ ├── bg_dredge_tips_selector.xml
│ │ ├── colorful.xml
│ │ ├── nc_floating.xml
│ │ ├── progress_round.xml
│ │ └── test.xml
│ │ ├── layout-v11
│ │ └── toolbar.xml
│ │ ├── layout
│ │ ├── activity_about_me.xml
│ │ ├── activity_delete.xml
│ │ ├── activity_github.xml
│ │ ├── activity_login.xml
│ │ ├── activity_main.xml
│ │ ├── activity_main_header.xml
│ │ ├── activity_rename.xml
│ │ ├── activity_settings.xml
│ │ ├── content_main.xml
│ │ ├── fab.xml
│ │ ├── message.xml
│ │ └── toolbar.xml
│ │ ├── menu
│ │ ├── menu_extend_usage.xml
│ │ ├── menu_main.xml
│ │ └── menu_other.xml
│ │ ├── mipmap-hdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-ldpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xhdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xxhdpi
│ │ └── ic_launcher.png
│ │ ├── values-v21
│ │ └── styles.xml
│ │ └── values
│ │ ├── colors.xml
│ │ ├── dimens.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── com
│ └── tesla
│ └── ai
│ └── ExampleUnitTest.java
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 | {one line to give the program's name and a brief idea of what it does.}
635 | Copyright (C) {year} {name of author}
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | {project} Copyright (C) {year} {fullname}
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # AIAndroid is:
2 | 一个开源Android聊天框架,使用RecyclerView实现。
3 | 已知在Android 5.0以下的系统的Dialogue会出现透明度的bug,在Android 2.0以下按钮好像没一个按得动。
4 | 我猜是CardView的锅。。
5 |
6 | ### 当前嵌入的业务逻辑:[城堡游戏](https://github.com/ice1000/Castle-game)
7 |
8 | 由于之前的README小学生气息太浓重,于是我删了。
9 | 更新消息由于。。。小学生气息更加浓厚,但是舍不得删。。
10 | 求大神别喷 :joy:
11 |
12 | ## 声明
13 | 1. 由于本人同时是苦逼天朝学生党的一员和最后一届理科生, ~~所以本项目可能会太监。~~已经太监了
14 | 1. 本项目完全开源,任何人可以下载源码进行个人研究,且不得将其用于商业用途。
15 | 1. 严禁未经原作者允许的情况下将本APP二次开发。
16 |
17 | # 实现情况:
18 |
19 | ## 算法(运行方式)部分
20 |
21 | - [X] 起名字
22 | - [X] 字符串分割
23 | - [X] 分割支持圆角符号
24 | - [X] 嵌入业务逻辑
25 |
26 | ## UI(视觉效果)部分
27 | - [X] 一个简洁的开始界面
28 | - [X] 一个侧滑菜单实现简单的功能跳转
29 | - [X] 长按弹出窗口确认删除
30 | - [X] 触摸消息背景颜色改变动画
31 | - [X] 沉浸式状态栏
32 | - [X] 一个使用ListView的设置界面
33 | - [ ] 更优美的消息删除动画
34 |
35 | ## 设计模式规划
36 | > + 聊天记录保存在SQLite中
37 | + 知识保存在SQLite中
38 | + 个人信息保存在Preference中
39 | + 根据大脑的结构封装思考的几个类
40 |
41 | # 本次更新
42 |
43 | ### 2016年2月3日 1.3.0.0 嵌入一个业务逻辑
44 | 1. 没错!我把Castle-game的业务逻辑搞进来喽~
45 | 工作量巨大!光是数据库那块就花了我很长时间!!
46 |
47 | # 历史更新
48 |
49 | ### 2016年1月25日 1.2.1.0 终于修复了侧滑菜单点不动的bug
50 | 1. 修复侧滑菜单点不动的bug
51 | 1. 调整一下项目结构方便以后的开发
52 | 1. 修复设置界面闪退的bug
53 |
54 | ### 2016年1月24日 1.2.0.2
55 | 1. 优美地封装了[BaseActivity](https://github.com/ice1000/AIAndroid/blob/master/app/src/main/java/util/BaseActivity.java)!真棒!封装在各个Activity中都有体现,除了Dialog。。。
56 | 1. 将常量类T也封装到了BaseActivity,为了方便外部访问我还在外面继承了一个,将一些Activity中用不到的字符串封装了。
57 |
58 | ### 2016年1月24日 1.2.0.1 考完了,我却还在上课
59 | 1. 一些UI中参数的修改
60 | 1. Dialog有阴影了
61 |
62 | ### 2016年1月20日 1.2.0.0 期末考试如火如荼进行中,我却依旧在更新,而且是大更新
63 | 1. 把Saber改成了小律(又抠了一批图,工作量巨大)
64 | 1. 优化NavigationView
65 | 1. 开始界面优化
66 |
67 | ### 2016年1月18日 1.1.1.1 在线进行的更新
68 | 1. 更新README,让它看起来不那么傻逼(蜘蛛阿姨说的
69 | 1. 修复一个简单却致命的bug,这个bug让我糗大了,之前还发布,结果特么有bug
70 | 1. 我收回前言,这个项目还是会持续更新!
71 |
72 | ### 2016年1月17日 1.1.1.0 重大更新
73 | 1. 主界面增加侧滑菜单
74 | 1. 侧滑菜单基本功能设置,留下一个坑:简化书
75 | 1. 由于虚拟机打不开了我也不知道能不能运行。。
76 | 1. 最近的更新质量越来越高了、、好兆头!
77 | 1. 在贴吧release了这个版本
78 |
79 | ### 2016年1月17日 1.1.0.4
80 | 1. 继续写Javadoc
81 | 1. 增加新功能的企划
82 |
83 | ## 2016年1月15日 1.1.0.3 ~~又没忍住更新了。。~~
84 | 1. 过滤空消息
85 | 1. 写了各个类的Javadoc(很辛苦!
86 | 1. 更改监听器设置方法
87 | 1. 增加大脑皮层的两种构造方法。
88 | 1. 更改类名(主脑改成大脑皮层,记忆改成边缘系统
89 |
90 | ## 2016年1月15日 1.1.0.2 ~~好像忍不住又更新了~~
91 | 1. 开始界面不那么~~猥琐~~了
92 | 1. 减少多余的动画
93 |
94 | ## 2016年1月13日 1.1.0.1 ~~从这次更新以后,短期暂停更新~~
95 | 1. 开始动画变得更~~猥琐~~了。
96 | 1. 主页的字更小了。
97 | 1. 又多了一些没用的图片。。
98 | 1. ~~本次更新完毕估计就是我弃坑的时候。~~
99 | 1. ~~所以说我现在已经齐此UI坑了。~~
100 | 1. 什么时候有了AI算法了,就继续更新AIAndroid!
101 |
102 | ## 2016年1月12日 1.1.0.0 ~~UI设计工作正式宣告结束!!~~
103 | 1. 更改了昨天遗留下的所有问题,颜色的问题全部改过,饱和度大大降低
104 | 1. 优化设置界面。
105 | 1. 这个从此以后好像除了算法之外没什么可更新的了。。
106 | 所以说。。。。
107 | UI设计工作正式宣告完成!
108 | 欧耶!
109 | 昨天说的截图:
110 | 
111 | 
112 |
113 | ## 2016年1月11日 1.0.3.2
114 | 1. 做了重命名,虽然还有点问题,但是不算bug,就是丑了,功能已经实现
115 | 1. 封装了“记忆”Memories类。
116 | 1. 更改部分背景颜色。反正最近在颜色上着手比较多。明天更新一张截图。
117 |
118 | ## 2016年1月11日 1.0.3.1
119 | 1. 把颜色改的更浅了
120 | 1. 把主角的绿色改成了灰白(这样的话那几个animator就没用了。。不过还是先留着)
121 |
122 | ## 2016年1月10日 1.0.3.0 重大更新
123 | 1. 成功把去除、分开的字符都封装成正则表达式字库放CONSTS里面,这也是是第一次用正则表达式。。
124 | 1. 修复了昨晚上发现的bug
125 | 1. 更改弹出窗口的布局
126 | 1. 增加清空记录时背景色的检查
127 | 1. 上次push忘记改版本号了。。。
128 | 1. 现在主脑正式封装完毕,MainActivity只负责更新UI、和主脑通信,主脑负责数据的处理。
129 | 和SQLite的通信也交由主脑全权负责。这特么才叫MVC啊!
130 |
131 | ## 2016年1月10日凌晨 1.0.2.0 重大更新
132 | 1. 改进程序结构,回复的算法被单独提了出来。
133 | 1. 让所有调用到主脑的Activity都必须实现BrainUsingActivity。
134 | 1. 主脑的控制反转,呼唤Activity更新数据。
135 | 1. 修复最新发送的消息无法删除的bug。
136 | 1. 更改发送键的大小。
137 | 1. 不过还是发现了新bug,不太好描述就不说了。
138 |
139 | 
140 |
141 | ## 2016年1月10日凌晨 1.0.1.4
142 | 1. 修复了bug。现在可以拿出来玩了。
143 | 1. 将主界面的menu做成了单独的。
144 | 1. 背景颜色变化还有点问题。
145 |
146 | ## 2016年1月9日 1.0.1.3
147 | 1. 增加了刷新。
148 | 1. 增加了清空聊天记录。
149 | 1. 旧的消息记录已经可以删除了。最新发送的消息记录仍然不能删除!
150 | 1. 更改了很多颜色配置。
151 |
152 | ## 2016年1月8日 1.0.1.2
153 | 1. 突然发现重大bug!消息记录删除不掉!吓尿!!
154 | 1. 增加了[toolbar](https://github.com/ice1000/AIAndroid/blob/master/app/src/main/res/layout-v11/toolbar.xml)
155 | 1. 把fab删了改成toolbar的三个点(朋友的建议)
156 |
157 | ## 2016年1月8日 1.0.1.1
158 | 1. 写了[关于开发者](https://github.com/ice1000/AIAndroid/blob/master/app/src/main/res/layout/activity_about_me.xml)
159 | 1. 将本项目源码的github链接放上去了
160 | 1. 终于可以删除聊天记录了,修复一大堆bug
161 |
162 | ## 2016年1月7日 1.0.1.0 重大更新
163 | 1. 设置消息触摸监听事件,触摸后背景会变色
164 | 1. 各种与UI有关的值的修改
165 | 1. 增加了阅读github的Activity,并且内置fab
166 |
167 | ## 2016年1月6日 1.0.0.6
168 | 1. 修改圆角大小为5dp
169 | 1. 自动去掉消息末尾换行符和空格
170 |
171 | ## 2016年1月6日 1.0.0.5
172 | 1. 发送的消息存储在SQLite中
173 | 1. 因为SQLite没有boolean类型,所以在
174 | [存取的时候](https://github.com/ice1000/AIAndroid/blob/master/app/src/main/java/database/SQLiteManager.java)
175 | 转换成整数
176 | 1. 开启界面增加了
177 | [一个逐帧动画](https://github.com/ice1000/AIAndroid/blob/master/app/src/main/res/drawable/saber_shake.xml)
178 |
179 | 
180 |
181 | ## 2016年1月6日 1.0.0.4
182 | 1. 实例化了适配器,现在可以互相发送消息了
183 | 1. 发送的消息左右对齐
184 | 1. 主色调确定为蓝色
185 |
186 | ## 2016年1月6日 1.0.0.3
187 | 1. 初步完成SQLite存储数据的系统。
188 | 1. 修改图标格式(体现圆角)。
189 |
190 | ## 2016年1月5日 1.0.0.2
191 | 1. 图标(不知为何采用了吾王)。
192 | 1. 简单的界面
193 |
194 | ## 2016年1月5日 1.0.0.1
195 | 1. 开始界面卖个萌。(>▽<)
196 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/app-release.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ice1000/AIAndroid/d6645dd84a86833d901b5a2dda18222cbde7f317/app/app-release.apk
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 23
5 | buildToolsVersion '23.0.2'
6 |
7 | defaultConfig {
8 | applicationId "com.tesla.ai"
9 | minSdkVersion 15
10 | targetSdkVersion 23
11 | versionCode 1
12 | versionName "1.2.1"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled true
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | // compileOptions {
21 | // sourceCompatibility JavaVersion.VERSION_1_7
22 | // targetCompatibility JavaVersion.VERSION_1_7
23 | // }
24 | }
25 |
26 | dependencies {
27 | compile fileTree(include: ['*.jar'], dir: 'libs')
28 | testCompile 'junit:junit:4.12'
29 | compile 'com.android.support:appcompat-v7:23.1.1'
30 | compile 'com.android.support:design:23.1.1'
31 | compile 'com.android.support:cardview-v7:23.1.1'
32 | compile 'com.android.support:recyclerview-v7:23.1.1'
33 | }
34 |
--------------------------------------------------------------------------------
/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 D:\Android_developing\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 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/tesla/ai/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.tesla.ai;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase {
10 | public ApplicationTest() {
11 | super(Application.class);
12 | }
13 | }
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
7 |
10 |
13 |
15 |
16 |
22 |
26 |
29 |
30 |
31 |
32 |
33 |
34 |
39 |
43 |
46 |
49 |
53 |
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/app/src/main/java/brain/CerebralCortex.java:
--------------------------------------------------------------------------------
1 | package brain;
2 |
3 | import android.content.Context;
4 | import android.util.Log;
5 | import android.widget.Toast;
6 |
7 | import java.util.ArrayList;
8 | import java.util.Collections;
9 |
10 | import brain.castle.castle.Game;
11 | import database.SQLiteManager;
12 | import util.MyMessage;
13 | import util.OnMessageChangedListener;
14 | import util.T;
15 |
16 | /**
17 | * Copyright 2016(c) Comet Corporation.
18 | * Created by asus1 on 2016/1/9.
19 | * 大脑皮层
20 | */
21 | public class CerebralCortex extends Game {
22 |
23 | private SQLiteManager manager;
24 | private ArrayList data;
25 | private String lastGivenMessage;
26 | private OnMessageChangedListener onMessageChangedListener;
27 | private Context context;
28 |
29 | /**
30 | * 不带监听器的构造方法
31 | * @param context 上下文
32 | */
33 | public CerebralCortex(Context context) {
34 | super(context);
35 | this.context = context;
36 | manager = new SQLiteManager(this.context);
37 | data = manager.getMessages();
38 | onStart();
39 | }
40 |
41 | /**
42 | * 自带监听器
43 | * @param context 上下文
44 | * @param onMessageChangedListener 监听器
45 | */
46 | public CerebralCortex(
47 | Context context,
48 | OnMessageChangedListener onMessageChangedListener) {
49 | this(context);
50 | this.setOnMessageChangedListener(
51 | onMessageChangedListener
52 | );
53 | }
54 |
55 | /**
56 | * 提供后期方法设置数据变化监听器
57 | * @param onMessageChangedListener 数据变化监听器
58 | */
59 | public void setOnMessageChangedListener(
60 | OnMessageChangedListener onMessageChangedListener) {
61 | this.onMessageChangedListener =
62 | onMessageChangedListener;
63 | }
64 |
65 | /**
66 | * 从Activity中接收一条消息
67 | * @param message 消息
68 | */
69 | public void giveMessage(String message) {
70 | this.lastGivenMessage = message;
71 | // 过滤掉空信息
72 | if(!filterMessage(message)){
73 | return;
74 | }
75 | if(onMessageChangedListener != null){
76 | onMessageChangedListener.onMessageChanged(
77 | data.size(),
78 | T.ANSWER_MESSAGE_RECIEVED
79 | );
80 | }
81 | // handleLastGivenMessage();
82 | showCurrentMeaasge();
83 | HandleMessage(message);
84 | }
85 |
86 | /**
87 | * 过滤无效消息
88 | * @param message 要过滤的字符串
89 | * @return 是否通过过滤
90 | */
91 | private boolean filterMessage(String message){
92 | if(message.equals("")){
93 | Toast.makeText(
94 | context,
95 | "请输入内容!",
96 | Toast.LENGTH_SHORT
97 | ).show();
98 | return false;
99 | }
100 | else
101 | return true;
102 | }
103 |
104 | /**
105 | * 处理消息
106 | */
107 | private void handleLastGivenMessage(){
108 | // 去掉首尾换行符或者空格
109 | while (lastGivenMessage.endsWith(T.SHOULD_BE_DELETE)){
110 | lastGivenMessage = lastGivenMessage.
111 | substring(0, lastGivenMessage.length()-1);
112 | }
113 | while (lastGivenMessage.startsWith(T.SHOULD_BE_DELETE)){
114 | lastGivenMessage = lastGivenMessage.
115 | substring(1, lastGivenMessage.length());
116 | }
117 |
118 | showCurrentMeaasge();
119 |
120 | ArrayList answerWhichIsReadyToBeSent = new ArrayList<>();
121 | // int cnt = 0;
122 | // if (lastGivenMessage.contains(T.SHOULD_BE_DELETE)) {
123 | // cnt++;
124 | String[] lastGivenMessages =
125 | lastGivenMessage.split(T.SHOULD_BE_SPLIT);
126 | Collections.addAll(
127 | answerWhichIsReadyToBeSent,
128 | lastGivenMessages
129 | );
130 | // }
131 | // Log.d(toString(), "cnt = " + cnt);
132 | // if(cnt == 0)
133 | // answerWhichIsReadyToBeSent.add(lastGivenMessage);
134 | for (int i = 0; i < answerWhichIsReadyToBeSent.size(); i++) {
135 | String s = answerWhichIsReadyToBeSent.get(i);
136 | if (s.matches(T.SHOULD_BE_DELETE) || s.equals("")){
137 | answerWhichIsReadyToBeSent.remove(i);
138 | i--;
139 | }
140 | }
141 | sendAnswerAsMessage(answerWhichIsReadyToBeSent);
142 | }
143 |
144 | private void showCurrentMeaasge(){
145 | MyMessage message;
146 | message = new MyMessage(
147 | false,
148 | lastGivenMessage
149 | );
150 | manager.addMessage(message);
151 | data.add(manager.getLastMessage());
152 | }
153 |
154 | /**
155 | * 送消息给Activity
156 | * @param answerMessage 将要送出去的消息
157 | */
158 | private void sendAnswerAsMessage(ArrayList answerMessage){
159 | for (String msg : answerMessage) {
160 | sendAnswerAsMessage(msg);
161 | }
162 | }
163 |
164 | private void sendAnswerAsMessage(String msg){
165 | MyMessage message = new MyMessage(true, msg);
166 | manager.addMessage(message);
167 | // 保证id是正确的
168 | data.add(manager.getLastMessage());
169 | if (onMessageChangedListener != null) {
170 | onMessageChangedListener.onMessageChanged(
171 | data.size()-1,
172 | T.ANSWER_MESSAGE_SENT
173 | );
174 | }
175 | }
176 |
177 | /**
178 | * 删除消息
179 | * @param position 删除消息的position,就是容器的下标
180 | */
181 | public void deleteMessage(int position){
182 | Log.d(this.toString(),
183 | "data.get(position) = " +
184 | data.get(position).getMessage()
185 | );
186 | // if(data.get(position).isIdAvailable()){
187 | // manager.deleteMessage(data.get(position));
188 | // }
189 | // else {
190 | // Log.d(
191 | // MainActivity.this.toString(),
192 | // T.DELETE_FAILED
193 | // );
194 | manager.deleteMessageById(
195 | data.get(position).getId()
196 | );
197 | // }
198 | //
199 | data.remove(position);
200 |
201 | if (onMessageChangedListener != null) {
202 | onMessageChangedListener.onMessageChanged(
203 | position,
204 | T.ANSWER_MESSAGE_DELETED
205 | );
206 | }
207 | }
208 |
209 | /**
210 | * 为了解决临时需要而写的,就是一个招募的广告
211 | */
212 | public void callMaster(){
213 | ArrayList messages = new ArrayList<>();
214 | messages.add("主人我需要一套AI算法,您可以给我吗");
215 | messages.add("只需要联系开发者(百度ID:@精灵谱尼," +
216 | "github账号:ice1000)就行了。。" +
217 | "我现在只会重复您的话。。我好想学会思考啊。。");
218 | sendAnswerAsMessage(messages);
219 | }
220 |
221 | /**
222 | * 获得数据
223 | * @return 聊天数据
224 | */
225 | public ArrayList getData() {
226 | return data;
227 | }
228 |
229 | /**
230 | * 获取数据数量
231 | * @return 数据数量
232 | */
233 | public int getDataSize() {
234 | return data.size();
235 | }
236 |
237 | /**
238 | * 刷新数据
239 | */
240 | public void refreshData(){
241 | data.clear();
242 | data = manager.getMessages();
243 | if (onMessageChangedListener != null) {
244 | onMessageChangedListener.onMessageChanged(
245 | T.DONT_NEED_THIS_PARAM,
246 | T.WHOLE_DATASET_CHANGED
247 | );
248 | }
249 | }
250 |
251 | /**
252 | * 清除数据
253 | */
254 | public void clearData(){
255 | manager.removeAll();
256 | data.clear();
257 | if (onMessageChangedListener != null) {
258 | onMessageChangedListener.onMessageChanged(
259 | T.DONT_NEED_THIS_PARAM,
260 | T.WHOLE_DATASET_CHANGED
261 | );
262 | }
263 | }
264 |
265 | /**
266 | * 获取特定的数据
267 | * @param position 容器下标
268 | * @return 下标对应的数据
269 | */
270 | public MyMessage getMessageByPosition(int position){
271 | return data.get(position);
272 | }
273 |
274 | /**
275 | * 是否为空
276 | * @return 为空
277 | */
278 | public boolean isDataEmpty(){
279 | return data.isEmpty();
280 | }
281 |
282 | @Override
283 | public void echo(String words) {
284 | sendAnswerAsMessage(words);
285 | }
286 |
287 | @Override
288 | public void echoln(String words) {
289 | echo(words);
290 | }
291 |
292 | @Override
293 | public void closeScreen() { }
294 | }
295 |
--------------------------------------------------------------------------------
/app/src/main/java/brain/LimbicSystem.java:
--------------------------------------------------------------------------------
1 | package brain;
2 |
3 | import android.content.Context;
4 | import android.content.SharedPreferences;
5 | import android.os.Build;
6 | import android.util.Log;
7 |
8 | import com.tesla.ai.R;
9 |
10 | import database.SQLiteManager;
11 | import util.BaseActivity;
12 |
13 | /**
14 | * 某种意义上是对于Preference数据库操作的一种封装。
15 | * Created by Administrator on 2016/1/11 0011.
16 | */
17 | public class LimbicSystem {
18 |
19 | private SQLiteManager manager;
20 | private SharedPreferences preferences;
21 | private Context context;
22 |
23 | public LimbicSystem(Context context) {
24 | this.context = context;
25 | manager = new SQLiteManager(context);
26 |
27 | // 为了向下兼容,我使出了谜之表达式,
28 | // 这个是可以运行的,不用在意报错,保证兼容
29 | preferences = Build.VERSION.SDK_INT >=
30 | Build.VERSION_CODES.JELLY_BEAN
31 | ? context.getSharedPreferences(
32 | BaseActivity.T.PREFERENCE_NAME,
33 | Context.MODE_ENABLE_WRITE_AHEAD_LOGGING
34 | )
35 | : context.getSharedPreferences(
36 | BaseActivity.T.PREFERENCE_NAME,
37 | Context.MODE_WORLD_READABLE
38 | );
39 | }
40 |
41 | public void putName(String name){
42 | SharedPreferences.Editor editor = preferences.edit();
43 | editor.putString(BaseActivity.T.SABER_NAME, name);
44 |
45 | if (Build.VERSION.SDK_INT >=
46 | Build.VERSION_CODES.GINGERBREAD)
47 | editor.apply();
48 | else
49 | Log.d(this.toString(),
50 | "editor.commit() = " +
51 | editor.commit()
52 | );
53 | }
54 |
55 | public String getName(){
56 | return preferences.getString(
57 | BaseActivity.T.SABER_NAME,
58 | context.getString(R.string.app_name)
59 | );
60 | }
61 |
62 | public String getAppTitle(){
63 |
64 | String text;
65 | text = preferences.getString(
66 | BaseActivity.T.SABER_NAME,
67 | context.getString(R.string.app_name) +
68 | BaseActivity.T.WHAT_THE_FUCK
69 | );
70 |
71 | if(text.equals(BaseActivity.T.HAVEN_T_GOT_NAME +
72 | BaseActivity.T.WHAT_THE_FUCK)){
73 | text = BaseActivity.T.HAVEN_T_GOT_NAME;
74 | }
75 |
76 | // if(!preferences.contains(T.SABER_NAME)){
77 | // text = T.MEET_FIRST_TIME;
78 | //
79 | // SharedPreferences.Editor editor = preferences.edit();
80 | // editor.putString(
81 | // T.SABER_NAME,
82 | // T.HAVEN_T_GOT_NAME
83 | // );
84 | // if (Build.VERSION.SDK_INT >=
85 | // Build.VERSION_CODES.GINGERBREAD)
86 | // editor.apply();
87 | // else
88 | // Log.d(this.toString(),
89 | // "editor.commit() = " + editor.commit());
90 | //
91 | // }
92 | return text;
93 | }
94 | // if (Build.VERSION.SDK_INT >=
95 | // Build.VERSION_CODES.GINGERBREAD)
96 | // editor.apply();
97 | // else
98 | // Log.d(this.toString(),
99 | // "editor.commit() = " + editor.commit());
100 | }
101 |
--------------------------------------------------------------------------------
/app/src/main/java/brain/castle/META-INF/CUI/MANIFEST.MF:
--------------------------------------------------------------------------------
1 | Manifest-Version: 2.0
2 | Main-Class: view.CUI
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/java/brain/castle/META-INF/MANIFEST.MF:
--------------------------------------------------------------------------------
1 | Manifest-Version: 2.0
2 | Main-Class: view.GUI
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/java/brain/castle/castle/Game.java:
--------------------------------------------------------------------------------
1 | package brain.castle.castle;
2 |
3 | import android.content.Context;
4 |
5 | import java.util.ArrayList;
6 | import java.util.HashMap;
7 |
8 | import brain.castle.cells.Item;
9 | import brain.castle.cells.Player;
10 | import brain.castle.database.Database;
11 | import brain.castle.funcs.FuncSrc;
12 | import brain.castle.funcs.using.*;
13 | import brain.castle.map.GameMap;
14 | import brain.castle.util.Echoer;
15 | import brain.castle.util.MessageHandler;
16 | import brain.castle.util.NameGenerator;
17 |
18 | public abstract class Game
19 | implements MessageHandler,Echoer {
20 |
21 | private HashMap funcs = new HashMap<>();
22 | private String[] funcsString;
23 | private GameMap map;
24 | private ArrayList- theItems = new ArrayList<>();
25 | private Player player;
26 | private Database database;
27 | private Context context;
28 |
29 | // 构造方法
30 | public Game(Context context){
31 | onCreate(context);
32 | }
33 |
34 | private void onCreate(Context context){
35 | map = new GameMap();
36 | this.context = context;
37 | createItems();
38 | database = new Database(context);
39 | funcsString = new String[]{
40 | "help", "go", "wild",
41 | "exit", "state", "fight",
42 | "sleep", "save", "rename",
43 | "talk", "pack", "home",
44 | "map"
45 | };
46 | funcs.put(funcsString[ 0], new FuncHelp(this));
47 | funcs.put(funcsString[ 1], new FuncGo(this));
48 | funcs.put(funcsString[ 2], new FuncWild(this));
49 | funcs.put(funcsString[ 3], new FuncExit(this));
50 | funcs.put(funcsString[ 4], new FuncState(this));
51 | funcs.put(funcsString[ 5], new FuncFight(this));
52 | funcs.put(funcsString[ 6], new FuncSleep(this));
53 | funcs.put(funcsString[ 7], new FuncSave(this));
54 | funcs.put(funcsString[ 8], new FuncRename(this));
55 | funcs.put(funcsString[ 9], new FuncTalk(this));
56 | funcs.put(funcsString[10], new FuncPack(this));
57 | funcs.put(funcsString[11], new FuncHome(this));
58 | funcs.put(funcsString[12], new FuncMap(this));
59 |
60 | }
61 |
62 | protected void onStart() {
63 | echoln("欢迎来到Castle Game!");
64 | echoln("这是一个超复古的CUI游戏。");
65 | echoln("最新版本和源代码请见https://github.com/ice1000/Castle-game");
66 | echoln("敬请期待OL版本https://github.com/ProgramLeague/Castle-Online");
67 | // echoln("不过在经过了冰封的改造后,你会觉得这个很有意思。");
68 | if(!Database.isFileExists(context)){
69 | echoln("您可以稍后使用\"rename [新名字]\"命令来更改自己的名字。");
70 | player = new Player(NameGenerator.generate(),200,10,5);
71 | saveData();
72 | }
73 |
74 | else {
75 | player = new Player(null,-1,-1,-1);
76 | database.loadState(player);
77 | database.loadMap(map,"宾馆");
78 | echoln("检测到存档。");
79 | }
80 |
81 | echoln("你好"+player);
82 | echoln("如果需要帮助,请输入 'help' 。\n");
83 | echo("现在");
84 | echoln(map.getCurrentRoom().getPrompt());
85 | }
86 |
87 | @Override
88 | public boolean HandleMessage(String line){
89 | String[] words = line.split(" ");
90 | FuncSrc func = funcs.get(words[0]);
91 | String value2 = "";
92 |
93 | if( words.length > 1 )
94 | value2 = words[1];
95 |
96 | // 如果找到了该指令
97 | if( func != null ){
98 | func.DoFunc(value2);
99 | if( func.isGameEnded() ){
100 | // 退出指令特殊处理
101 | saveData();
102 | echoln("退出游戏,再见!");
103 | // System.exit(0);
104 | closeScreen();
105 | return false;
106 | }
107 | }
108 | else
109 | echoln("对不起,输入指令错误!");
110 | return true;
111 | }
112 |
113 | public String[] getFuncs(){
114 | return funcsString;
115 | }
116 |
117 | private void createItems() {
118 | theItems.add(new Item("传送宝石"));
119 | theItems.add(new Item("和女仆的契约"));
120 | }
121 |
122 | public ArrayList
- getTheItems() {
123 | return theItems;
124 | }
125 | /**
126 | * 去一个房间
127 | */
128 | public void goRoom(String direction){
129 | if(!map.goRoom(direction))
130 | echoln("没有这个出口。");
131 | echoln(map.getCurrentRoom().getPrompt());
132 | }
133 | /**
134 | * 随机传送
135 | */
136 | public void WildRoom(){
137 | echoln(map.wildRoom());
138 | }
139 | /**
140 | * 战斗函数
141 | */
142 | public void Fight() {
143 | map.fightBoss(this);
144 | echoln(map.getCurrentRoom().getPrompt());
145 | }
146 | public void setPlayer(Player player){
147 | // 减血赋值给原来的
148 | this.player = player;
149 | }
150 | public Player getPlayer() {
151 | return player;
152 | }
153 |
154 | public GameMap getMap() {
155 | return map;
156 | }
157 |
158 | public void saveData(){
159 | database.saveMapAndState(map,player);
160 | echoln("保存成功。");
161 | }
162 |
163 | }
164 |
--------------------------------------------------------------------------------
/app/src/main/java/brain/castle/cells/Boss.java:
--------------------------------------------------------------------------------
1 | package brain.castle.cells;
2 |
3 | import brain.castle.funcs.using.FuncSleep;
4 | import brain.castle.util.Echoer;
5 |
6 | public class Boss extends Player {
7 | // 和玩家一样,有血、攻防
8 | private String dieText = "";
9 | private boolean survive = true;
10 | private boolean getItem = true;
11 |
12 | public Boss(String name, int blood, int strike, int defence, int experience, String dieText) {
13 | this(name,blood,strike,defence,experience);
14 | this.dieText = dieText;
15 | }
16 |
17 | public Boss(String name, int blood, int strike, int defence, int experience) {
18 | super(name,blood,strike,defence);
19 | this.experience = experience;
20 | dieText = name + "跪着向你哀求,不过你残忍地!";
21 | }
22 |
23 | public Player fight(Player player, Echoer echoer) {
24 |
25 | StringBuilder stringBuffer = new StringBuilder();
26 | int bloodSave = this.blood;
27 | int bloodSave2 = player.blood;
28 | int beBeat = (this.strike - player.getDefence());
29 | int Beat = (player.getStrike() - this.defence);
30 |
31 | if( beBeat <= 0 ) {
32 | beBeat = 0;
33 | }
34 | // 打不过
35 | if( Beat <= 0 ){
36 | player.blood -= 10;
37 | stringBuffer
38 | .append("你的攻击力小于")
39 | .append(this.name)
40 | .append("的防御力!\n落荒而逃!损失10点体力值!\n");
41 | }
42 | else{
43 | while(survive){
44 | // 互相扣血
45 | this.blood -= Beat;
46 | player.blood -= beBeat;
47 | // 判断
48 | if( player.blood <= 0 ){
49 |
50 | bloodSave2 -= 5;
51 | player.blood = bloodSave2;
52 |
53 | this.blood = bloodSave;
54 | stringBuffer.append("以你现有的体力值无法打倒").append(this.name).append("!\n落荒而逃!损失5点体力值!\n");
55 | break;
56 | }
57 | if( this.blood <= 0 ){
58 | // 先把血补回去
59 | this.blood = bloodSave;
60 | stringBuffer
61 | .append(dieText)
62 | .append("\n胜利而归!你还剩")
63 | .append(player.blood)
64 | .append("点体力值!\n")
65 | .append("本次战斗获得了")
66 | .append(player.win(getExperience(), echoer))
67 | .append("点经验值!\n");
68 | survive = false;
69 | getItem = false;
70 | FuncSleep sleep = new FuncSleep();
71 | stringBuffer.append("战斗结束");
72 | stringBuffer.append("\n");
73 | }
74 | }
75 | }
76 | echoer.echo(stringBuffer.toString());
77 | survive = true;
78 | return player;
79 | }
80 |
81 | @Override
82 | public String toString() {
83 | return super.getName();
84 | }
85 |
86 | public boolean ifGet() {
87 | return getItem;
88 | }
89 |
90 | public void setGetItem(boolean getItem) {
91 | this.getItem = getItem;
92 | }
93 |
94 | public int getExperience(Echoer echoer) {
95 | if( getItem ){
96 | echoer.echoln("Boss挑战成功,获得挑战奖励和额外5点经验奖励!");
97 | return (this.experience+5);
98 | }
99 | else
100 | return this.experience;
101 | }
102 |
103 | public NPC toNPC(String chat){
104 | return new NPC(name, chat);
105 | }
106 | }
107 |
--------------------------------------------------------------------------------
/app/src/main/java/brain/castle/cells/Cell.java:
--------------------------------------------------------------------------------
1 | package brain.castle.cells;
2 |
3 | public class Cell {
4 |
5 | String name = "";
6 |
7 | Cell(String name) {
8 | // super();
9 | this.name = name;
10 | }
11 |
12 | public Cell(){
13 | name = "unKown";
14 | }
15 |
16 | public String getName() {
17 | return name;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/app/src/main/java/brain/castle/cells/Item.java:
--------------------------------------------------------------------------------
1 | package brain.castle.cells;
2 |
3 | public class Item {
4 | private String name = "";
5 | private boolean get = false;
6 | private int num = 1;
7 |
8 | public Item(String name) {
9 | super();
10 | this.name = name;
11 | }
12 |
13 | public Item(String name, int num) {
14 | this.name = name;
15 | this.num = num;
16 | }
17 |
18 | // public void getNumOf(int num) {
19 | // this.num -= num;
20 | // }
21 |
22 | public void get() {
23 | get = true;
24 | }
25 |
26 | public boolean check() {
27 | return get;
28 | }
29 |
30 | @Override
31 | public String toString() {
32 | return name;
33 | }
34 |
35 | public void setNum(int num) {
36 | this.num = num;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/app/src/main/java/brain/castle/cells/NPC.java:
--------------------------------------------------------------------------------
1 | package brain.castle.cells;
2 |
3 | import java.util.ArrayList;
4 |
5 | public class NPC extends Cell {
6 |
7 | private String chat = "";
8 | private ArrayList
- items = new ArrayList<>();
9 |
10 | public NPC(String name,String chat) {
11 | super(name);
12 | this.chat = chat;
13 | }
14 |
15 | public void itemGet(String name,int num){
16 | items.add(new Item(name, num));
17 | }
18 |
19 | // public void itemGive(int index,int num){
20 | // items.get(index).getNumOf(num);
21 | // }
22 |
23 | public String getChat() {
24 | return chat;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/java/brain/castle/cells/Player.java:
--------------------------------------------------------------------------------
1 | package brain.castle.cells;
2 |
3 | import brain.castle.util.Echoer;
4 |
5 | public class Player extends Cell {
6 |
7 | public int blood = 0;
8 | int strike = 0;
9 | int defence = 0;
10 | private int level = 0;
11 | int experience = 0;
12 | private final int[] limit = {
13 | 5,
14 | 10,
15 | 30,
16 | 50,
17 | 80,
18 | 120,
19 | 160,
20 | 200,
21 | 250,
22 | 320,
23 | 400,
24 | 480,
25 | 560,
26 | 640,
27 | 720,
28 | 800,
29 | 900,
30 | 1000,
31 | 1120,
32 | 1240,
33 | 1380,
34 | 1520,
35 | 1680,
36 | 1840,
37 | 2000,
38 | 2200,
39 | 2400,
40 | 2600,
41 | 2800,
42 | 3200,
43 | 3600,
44 | 4000,
45 | 99999999,
46 | 99999999,
47 | };
48 |
49 | // 在玩家中,经验表示拥有的经验,在怪物中表示打败后得到的经验。
50 | public Player(String name, int blood, int strike, int defence) {
51 | super(name);
52 | this.blood = blood;
53 | this.strike = strike;
54 | this.defence = defence;
55 | }
56 |
57 | // public Player(){
58 | // database = new Database();
59 | // loadState();
60 | // }
61 |
62 | public void setValues(String name, int blood, int strike, int defence, int level, int experience) {
63 | this.name = name;
64 | this.blood = blood;
65 | this.strike = strike;
66 | this.defence = defence;
67 | this.level = level;
68 | this.experience = experience;
69 | }
70 |
71 | public String stateToString() {
72 | return "等级:" + (level+1) +
73 | "\n经验值:" + experience +
74 | "/" + limit[level] +
75 | "\n姓名:" + name +
76 | "\n攻击:" + strike +
77 | "\n防御:" + defence +
78 | "\n体力值:" + blood;
79 | }
80 |
81 | @Override
82 | public String toString() {
83 | return super.getName();
84 | }
85 |
86 | int win(int experience, Echoer echoer) {
87 | this.experience += experience;
88 | if( this.experience >= limit[level] ){
89 | this.experience -= limit[level];
90 | level ++;
91 | strike += level*2;
92 | defence += level*2;
93 | blood += level*20;
94 | echoer.echoln("恭喜您升级啦~\\(≧▽≦)/~啦啦啦\n各种属性加成哦~");
95 | }
96 | return experience;
97 | }
98 |
99 | public boolean treat(){
100 | if( blood <= 120 ){
101 | blood = 120;
102 | return true;
103 | }
104 | else
105 | return false;
106 | }
107 |
108 | public Player getStateData(){
109 | return this;
110 | }
111 |
112 | public void rename(String newName){this.name = newName;}
113 | public int getBlood() {return blood;}
114 | public int getLevel() {return level;}
115 | public int getExperience() {return experience;}
116 | public int getStrike() {return strike;}
117 | public int getDefence() {return defence;}
118 |
119 | // public void saveState(){
120 | // database.saveState(
121 | // this.name + "\r\n" +
122 | // this.blood + "\r\n" +
123 | // this.strike + "\r\n" +
124 | // this.defence + "\r\n" +
125 | // this.level + "\r\n" +
126 | // this.experience + "\r\n"
127 | // );
128 | // }
129 |
130 | }
131 |
--------------------------------------------------------------------------------
/app/src/main/java/brain/castle/database/Database.java:
--------------------------------------------------------------------------------
1 | package brain.castle.database;
2 |
3 |
4 | import android.content.Context;
5 | import android.content.SharedPreferences;
6 |
7 | import brain.castle.cells.Player;
8 | import brain.castle.map.GameMap;
9 | import brain.castle.util.NameGenerator;
10 |
11 | /**
12 | * 封装数据库操作
13 | * Created by asus1 on 2016/1/28.
14 | */
15 | public class Database {
16 | // private static String savePath ;
17 | private Context context;
18 | private SharedPreferences preferences;
19 |
20 | private String playerName = "";
21 | private char[] roomsState ;
22 | private String roomName;
23 | private int blood = 0;
24 | private int strike = 0;
25 | private int defence = 0;
26 | private int level = 0;
27 | private int experience = 0;
28 |
29 | public static final String BLOOD = "BLOOD";
30 | public static final String STRIKE = "STRIKE";
31 | public static final String DEFENCE = "DEFENCE";
32 | public static final String LEVEL = "LEVEL";
33 | public static final String EXPERIENCE = "EXPERIENCE";
34 | public static final String ROOM_NAME = "ROOM_NAME";
35 | public static final String ROOM_STATE = "ROOM_STATE";
36 | public static final String PLAYER_NAME = "PLAYER_NAME";
37 |
38 | public static final String PREFERENCE = "PREFERENCE";
39 |
40 | public Database(Context context) {
41 | this.context = context;
42 | preferences = context.getSharedPreferences(PREFERENCE, Context.MODE_PRIVATE);
43 |
44 | roomName = preferences.getString(ROOM_NAME, "旅馆");
45 | roomsState = preferences.getString(ROOM_STATE, "").toCharArray();
46 | playerName = preferences.getString(PLAYER_NAME, NameGenerator.generate());
47 | blood = preferences.getInt(BLOOD, 100);
48 | strike = preferences.getInt(STRIKE, 20);
49 | defence = preferences.getInt(DEFENCE, 10);
50 | level = preferences.getInt(LEVEL, 1);
51 | experience = preferences.getInt(EXPERIENCE, 0);
52 |
53 | }
54 |
55 | public void loadMap(GameMap map, String defaultName){
56 | map.setRoomsState(roomsState);
57 | if(roomName == null)
58 | roomName = defaultName;
59 | map.loadRoom(roomName);
60 | }
61 |
62 | public void saveMap(GameMap map){
63 | SharedPreferences.Editor editor = preferences.edit();
64 | this.roomName = map.getCurrentRoom().toString();
65 | this.roomsState = map.getRoomsState();
66 | editor.putString(ROOM_NAME, roomName);
67 | editor.putString(ROOM_STATE, String.valueOf(roomsState));
68 | editor.commit();
69 | }
70 |
71 | public void saveMapAndState(GameMap map, Player player){
72 | saveMap(map);
73 | saveState(player);
74 | }
75 |
76 | public void loadState(Player player){
77 | player.setValues(
78 | playerName,
79 | blood,
80 | strike,
81 | defence,
82 | level,
83 | experience
84 | );
85 | }
86 |
87 | public void saveState(Player player) {
88 |
89 | this.playerName = player.toString();
90 | this.blood = player.getBlood();
91 | this.strike = player.getStrike();
92 | this.defence = player.getDefence();
93 | this.level = player.getLevel();
94 | this.experience = player.getExperience();
95 |
96 | SharedPreferences.Editor editor = preferences.edit();
97 |
98 | editor.putString(PLAYER_NAME, playerName);
99 | editor.putInt(BLOOD, blood);
100 | editor.putInt(STRIKE, strike);
101 | editor.putInt(DEFENCE, defence);
102 | editor.putInt(LEVEL, level);
103 | editor.putInt(EXPERIENCE, experience);
104 |
105 | editor.commit();
106 | }
107 |
108 | public static boolean isFileExists(Context context){
109 | SharedPreferences preferences = context.getSharedPreferences(PREFERENCE, Context.MODE_PRIVATE);
110 | return preferences.contains(PLAYER_NAME);
111 | }
112 | }
113 |
--------------------------------------------------------------------------------
/app/src/main/java/brain/castle/drawable/castle-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ice1000/AIAndroid/d6645dd84a86833d901b5a2dda18222cbde7f317/app/src/main/java/brain/castle/drawable/castle-icon.png
--------------------------------------------------------------------------------
/app/src/main/java/brain/castle/drawable/castle.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ice1000/AIAndroid/d6645dd84a86833d901b5a2dda18222cbde7f317/app/src/main/java/brain/castle/drawable/castle.jpg
--------------------------------------------------------------------------------
/app/src/main/java/brain/castle/drawable/launch.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ice1000/AIAndroid/d6645dd84a86833d901b5a2dda18222cbde7f317/app/src/main/java/brain/castle/drawable/launch.png
--------------------------------------------------------------------------------
/app/src/main/java/brain/castle/drawable/map.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ice1000/AIAndroid/d6645dd84a86833d901b5a2dda18222cbde7f317/app/src/main/java/brain/castle/drawable/map.png
--------------------------------------------------------------------------------
/app/src/main/java/brain/castle/drawable/village.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ice1000/AIAndroid/d6645dd84a86833d901b5a2dda18222cbde7f317/app/src/main/java/brain/castle/drawable/village.jpg
--------------------------------------------------------------------------------
/app/src/main/java/brain/castle/funcs/FuncSrc.java:
--------------------------------------------------------------------------------
1 | package brain.castle.funcs;
2 |
3 | import brain.castle.castle.Game;
4 |
5 | public abstract class FuncSrc {
6 |
7 | protected Game game;
8 | protected boolean isGameEnded = false;
9 |
10 | public FuncSrc(Game game) {
11 | this.game = game;
12 | }
13 |
14 | protected FuncSrc(){}
15 |
16 | public boolean isGameEnded() {
17 | return isGameEnded;
18 | }
19 |
20 | public abstract void DoFunc(String cmd);
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/app/src/main/java/brain/castle/funcs/using/FuncExit.java:
--------------------------------------------------------------------------------
1 | package brain.castle.funcs.using;
2 |
3 | import brain.castle.castle.Game;
4 | import brain.castle.funcs.FuncSrc;
5 |
6 | public class FuncExit extends FuncSrc {
7 |
8 | public FuncExit(Game game) {
9 | super(game);
10 | }
11 |
12 | private boolean Bye() {
13 | isGameEnded = true;
14 | return true;
15 | }
16 |
17 | @Override
18 | public void DoFunc(String cmd) {
19 | game.saveData();
20 | Bye();
21 | }
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/app/src/main/java/brain/castle/funcs/using/FuncFight.java:
--------------------------------------------------------------------------------
1 | package brain.castle.funcs.using;
2 |
3 | import brain.castle.castle.Game;
4 | import brain.castle.funcs.FuncSrc;
5 |
6 | public class FuncFight extends FuncSrc {
7 |
8 | public FuncFight(Game game) {
9 | super(game);
10 | }
11 |
12 | @Override
13 | public void DoFunc(String cmd) {
14 | game.Fight();
15 | }
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/app/src/main/java/brain/castle/funcs/using/FuncGo.java:
--------------------------------------------------------------------------------
1 | package brain.castle.funcs.using;
2 |
3 | import brain.castle.castle.Game;
4 | import brain.castle.funcs.FuncSrc;
5 |
6 | public class FuncGo extends FuncSrc {
7 |
8 | public FuncGo(Game game) {
9 | super(game);
10 | }
11 |
12 | @Override
13 | public void DoFunc(String cmd) {
14 | // 调用移动。
15 | game.goRoom(cmd);
16 | }
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/app/src/main/java/brain/castle/funcs/using/FuncHelp.java:
--------------------------------------------------------------------------------
1 | package brain.castle.funcs.using;
2 |
3 | import brain.castle.castle.Game;
4 | import brain.castle.funcs.FuncSrc;
5 |
6 | public class FuncHelp extends FuncSrc {
7 |
8 | public FuncHelp(Game game) {
9 | super(game);
10 | }
11 |
12 | @Override
13 | public void DoFunc(String cmd) {
14 | game.echoln("迷路了吗?你可以做的命令有:");
15 | String[] strings = game.getFuncs();
16 | for(String s : strings){
17 | game.echoln(s);
18 | }
19 | game.echoln("有些需要参数的命令请按如下格式输入:");
20 | game.echoln("命令 [参数]");
21 | game.echoln("如:go east");
22 | game.echoln("如:rename 冰封");
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/app/src/main/java/brain/castle/funcs/using/FuncHome.java:
--------------------------------------------------------------------------------
1 | package brain.castle.funcs.using;
2 |
3 | import brain.castle.castle.Game;
4 | import brain.castle.funcs.FuncSrc;
5 |
6 | /**
7 | * 回城堡
8 | * Created by asus1 on 2016/2/1.
9 | */
10 | public class FuncHome extends FuncSrc {
11 |
12 | public FuncHome(Game game) {
13 | super(game);
14 | }
15 |
16 | @Override
17 | public void DoFunc(String cmd) {
18 | game.echoln("您与女仆的契约发动。回到了旅馆。");
19 | game.getMap().setCurrentRoom(game.getMap().getHome());
20 | game.echoln(game.getMap().getCurrentRoom().getPrompt());
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/app/src/main/java/brain/castle/funcs/using/FuncMap.java:
--------------------------------------------------------------------------------
1 | package brain.castle.funcs.using;
2 |
3 | import brain.castle.castle.Game;
4 | import brain.castle.funcs.FuncSrc;
5 |
6 | /**
7 | * 显示地图
8 | * Created by asus1 on 2016/2/1.
9 | */
10 | public class FuncMap extends FuncSrc{
11 |
12 | public FuncMap(Game game) {
13 | super(game);
14 | }
15 |
16 | @Override
17 | public void DoFunc(String cmd) {
18 |
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/app/src/main/java/brain/castle/funcs/using/FuncPack.java:
--------------------------------------------------------------------------------
1 | package brain.castle.funcs.using;
2 |
3 | import brain.castle.castle.Game;
4 | import brain.castle.cells.Item;
5 | import brain.castle.funcs.FuncSrc;
6 |
7 | public class FuncPack extends FuncSrc {
8 |
9 | public FuncPack(Game game) {
10 | super(game);
11 | }
12 |
13 | @Override
14 | public void DoFunc(String cmd) {
15 | game.echoln("背包中物品如下:");
16 | for (Item item : game.getTheItems()) {
17 | game.echoln(item.toString());
18 | }
19 | }
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/app/src/main/java/brain/castle/funcs/using/FuncRename.java:
--------------------------------------------------------------------------------
1 | package brain.castle.funcs.using;
2 |
3 | import brain.castle.castle.Game;
4 | import brain.castle.funcs.FuncSrc;
5 |
6 | /**
7 | * 重命名
8 | * Created by asus1 on 2016/1/29.
9 | */
10 | public class FuncRename extends FuncSrc {
11 |
12 | public FuncRename(Game game) {
13 | super(game);
14 | }
15 |
16 | @Override
17 | public void DoFunc(String cmd) {
18 | // game.echoln("请问您的新名字是?");
19 | if(!cmd.equals("")){
20 | game.getPlayer().rename(cmd);
21 | game.echoln("重命名成功。新名字:" + cmd);
22 | }
23 | else {
24 | game.echoln("格式错误。请按照\"rename [新名字]\"的格式重命名!");
25 | }
26 | }
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/app/src/main/java/brain/castle/funcs/using/FuncSave.java:
--------------------------------------------------------------------------------
1 | package brain.castle.funcs.using;
2 |
3 | import brain.castle.castle.Game;
4 | import brain.castle.funcs.FuncSrc;
5 |
6 | public class FuncSave extends FuncSrc {
7 |
8 | public FuncSave(Game game) {
9 | super(game);
10 | }
11 |
12 | @Override
13 | public void DoFunc(String cmd) {
14 | game.saveData();
15 | }
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/app/src/main/java/brain/castle/funcs/using/FuncSleep.java:
--------------------------------------------------------------------------------
1 | package brain.castle.funcs.using;
2 |
3 | import brain.castle.castle.Game;
4 | import brain.castle.funcs.FuncSrc;
5 |
6 | public class FuncSleep extends FuncSrc {
7 |
8 | public FuncSleep(Game game) {
9 | super(game);
10 | }
11 |
12 | public FuncSleep() {}
13 |
14 | @Override
15 | public void DoFunc(String cmd) {
16 | // int bloodMore = Integer.parseInt(cmd);
17 | if( game.getMap().getCurrentRoom().toString().matches("旅馆|卧室") ){
18 | if( !game.getMap().getCurrentRoom().isBossGetItem() ){
19 | game.echo("女仆顺从地送你进入梦乡。睡觉中");
20 | for(int i = 0; i < 8; i ++ ) {
21 | try {
22 | Thread.sleep(50);
23 | } catch (InterruptedException e) {
24 | e.printStackTrace();
25 | }
26 | }
27 | game.echo("\n已经睡觉,体力");
28 | if( game.getPlayer().treat() )
29 | game.echoln("恢复至120.");
30 | else
31 | game.echoln("超过120不用恢复的~");
32 | }
33 | else
34 | game.echoln("睡觉需要女仆服侍,然而她看起来不大愿意啊。。。");
35 | }
36 | else
37 | game.echoln("只有宾馆或卧室能睡觉。");
38 | }
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/app/src/main/java/brain/castle/funcs/using/FuncState.java:
--------------------------------------------------------------------------------
1 | package brain.castle.funcs.using;
2 |
3 | import brain.castle.castle.Game;
4 | import brain.castle.funcs.FuncSrc;
5 |
6 | public class FuncState extends FuncSrc {
7 |
8 | public FuncState(Game game) {
9 | super(game);
10 | }
11 |
12 | @Override
13 | public void DoFunc(String cmd) {
14 | game.echoln(game.getPlayer().stateToString());
15 | }
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/app/src/main/java/brain/castle/funcs/using/FuncTalk.java:
--------------------------------------------------------------------------------
1 | package brain.castle.funcs.using;
2 |
3 | import brain.castle.castle.Game;
4 | import brain.castle.cells.NPC;
5 | import brain.castle.funcs.FuncSrc;
6 |
7 | /**
8 | * 与NPC对话
9 | * Created by asus1 on 2016/1/30.
10 | */
11 | public class FuncTalk extends FuncSrc {
12 |
13 | public FuncTalk(Game game) {
14 | super(game);
15 | }
16 |
17 | @Override
18 | public void DoFunc(String cmd) {
19 | NPC npc = game.getMap().getCurrentRoom().isNPCExists(cmd);
20 | if(npc != null){
21 | game.echoln(npc.getChat());
22 | }
23 | else{
24 | game.echoln("你指定的名字不存在。注:Boss要在被打败之后才能对话。");
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/app/src/main/java/brain/castle/funcs/using/FuncWild.java:
--------------------------------------------------------------------------------
1 | package brain.castle.funcs.using;
2 |
3 | import brain.castle.castle.Game;
4 | import brain.castle.funcs.FuncSrc;
5 |
6 | public class FuncWild extends FuncSrc {
7 |
8 | public FuncWild(Game game) {
9 | super(game);
10 | }
11 |
12 | @Override
13 | public void DoFunc(String cmd) {
14 | // 传送
15 | game.WildRoom();
16 | }
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/app/src/main/java/brain/castle/map/GameMap.java:
--------------------------------------------------------------------------------
1 | package brain.castle.map;
2 |
3 | import java.util.ArrayList;
4 |
5 | import brain.castle.castle.Game;
6 | import brain.castle.util.Direction;
7 | import brain.castle.util.DirectionPair;
8 |
9 | /**
10 | * 地图类
11 | * Created by asus1 on 2016/1/27.
12 | */
13 | public class GameMap {
14 |
15 | private ArrayList theRooms;
16 | private Room currentRoom;
17 | private static final DirectionPair[] pairs ={
18 | new DirectionPair(Direction.UP, Direction.DOWN ),
19 | new DirectionPair(Direction.NORTH,Direction.SOUTH),
20 | new DirectionPair(Direction.EAST, Direction.WEST ),
21 | };
22 |
23 | public GameMap() {
24 | theRooms = new ArrayList<>();
25 | // 构造地图结构
26 | /*0*/theRooms.add(new Room("城堡外","英俊的小偷头目",
27 | 200,25,10,15,"小偷头目的钱全掉出来了!"));
28 | /*1*/theRooms.add(new Room("一楼大堂","欢迎来到城堡!","礼貌的大堂经理",
29 | 100,15,12,8,"大堂经理的帐算错了!"));
30 | /*2*/theRooms.add(new Room("小酒吧","一大股酒香飘来。","潇洒的酒吧流氓",
31 | 150,10,5,5,"酒吧流氓喝醉了!"));
32 | /*3*/theRooms.add(new Room("书房","读书的气氛很浓厚。" , "优雅的读书人",
33 | 100,7,5,3,"读书人的书掉出来了!"));
34 | /*4*/theRooms.add(new Room("旅馆", "周围干净整洁。", "可爱的女仆",
35 | 10,6,3,2,"女仆被你推倒了!"));
36 | /*5*/theRooms.add(new Room("二楼睡房","公主的管家",
37 | 300,20,5,25,"管家扑街、公主被你推倒了!"));
38 | /*6*/theRooms.add(new Room("负一楼","奇怪的男人",
39 | 200,30,15,25,"男人身边站出来一名浑身是伤的女孩。。"));
40 | /*7*/theRooms.add(new Room("负二楼","穿着霸气的绅士",
41 | 100,50,35,35,"绅士的衣服脏了!"));
42 | /*8*/theRooms.add(new Room("负三楼","身穿铠甲的战士",
43 | 300,30,25,45,"战士被自己绊倒了!"));
44 | /*9*/theRooms.add(new Room("负四楼","持剑的骑士",
45 | 400,40,35,60,"骑士的剑断了!"));
46 | /*10*/theRooms.add(new Room("三楼阳台"));
47 | /*11*/theRooms.add(new Room("城堡顶部瞭望塔", "瞭望塔守卫",
48 | 150, 20, 2, 20, "守卫倒下了!"));
49 | /*12*/theRooms.add(new Room("羊肠小道", "街边小混混",
50 | 100,30,1,20 ,null));
51 | /*13*/theRooms.add(new Room("日出村大门","欢迎来到城堡西边的日出村!", "和善的门卫",
52 | 150,20,20,30 ,"门卫露出了和善的笑容"));
53 | /*14*/theRooms.add(new Room("神秘空间祭坛","冰封",
54 | 1000,150,100,200,"冰封认真地写着客户端。。。"));
55 | /*15*/theRooms.add(new Room("神秘空间西","无",
56 | 1000,150,100,200,"无认真地写这服务器端。。。"));
57 | /*16*/theRooms.add(new Room("神秘空间东","奶茶",
58 | 1000,150,100,200,"奶茶去复习考试了。。。"));
59 | /*17*/theRooms.add(new Room("神秘空间北","果冻",
60 | 1000,150,100,200,"果冻正在打酱油。。。"));
61 | /*18*/theRooms.add(new Room("日出村民居"));
62 | /*19*/theRooms.add(new Room("日出村教堂","你瞬间被这里神圣的气息闪瞎了。" , "聆听忏悔的牧师",
63 | 200, 30, 20, 40, "牧师聆听着忏悔。"));
64 | /*20*/theRooms.add(new Room("神秘的井", "打水的熊孩子",
65 | 50, 10, 1, 5, "熊孩子掉头就跑。"));
66 | /*21*/theRooms.add(new Room("井底", "这里很潮湿,阴森恐怖。", "青蛙怪",
67 | 300, 80, 50, 70, "青蛙怪被烤熟了!"));
68 | /*22*/theRooms.add(new Room("井底北", "更加潮湿了。", "戴皇冠的青蛙怪王",
69 | 500, 100, 40, 100, "青蛙怪王的皇冠掉了下来!"));
70 | /*23*/theRooms.add(new Room("井底密室", "空气中弥漫着阴冷潮湿的气息。", "戴头灯的探险家",
71 | 400, 80, 30, 80, "探险家的头灯没电了!"));
72 |
73 | setExit(1, 5, pairs[0]);
74 | setExit(5, 10,pairs[0]);
75 | setExit(10,11,pairs[0]);
76 | setExit(6, 1, pairs[0]);
77 | setExit(7, 6, pairs[0]);
78 | setExit(8, 7, pairs[0]);
79 | setExit(9, 8, pairs[0]);
80 | setExit(20,21,pairs[0]);
81 | setExit(3, 0, pairs[1]);
82 | setExit(20,19,pairs[1]);
83 | setExit(4, 1, pairs[1]);
84 | setExit(21,22,pairs[0]);
85 | setExit(22,23,pairs[0]);
86 | setExit(14,17,pairs[1]);
87 | setExit(0, 1, pairs[2]);
88 | setExit(2, 0, pairs[2]);
89 | setExit(3, 4, pairs[2]);
90 | setExit(12,2, pairs[2]);
91 | setExit(13,12,pairs[2]);
92 | setExit(15,14,pairs[2]);
93 | setExit(14,16,pairs[2]);
94 | setExit(17,14,pairs[2]);
95 | setExit(18,13,pairs[2]);
96 | setExit(19,18,pairs[2]);
97 |
98 | // 从女仆那里开始
99 | currentRoom = theRooms.get(4);
100 | }
101 |
102 | private void setExit(int index_a, int index_b, DirectionPair pair){
103 | theRooms.get(index_a).setExit(String.valueOf(pair.getDirection1()), index_b);
104 | theRooms.get(index_b).setExit(String.valueOf(pair.getDirection2()), index_a);
105 | }
106 |
107 | public void setCurrentRoom(Room room){
108 | currentRoom = room;
109 | }
110 |
111 | public boolean goRoom(String direction){
112 | if( currentRoom.checkExit(direction) ) {
113 | currentRoom = theRooms.get(currentRoom.showRoomId(direction));
114 | return true;
115 | }
116 | else
117 | return false;
118 | }
119 |
120 | public boolean isRoomExists(String roomName){
121 | for (Room room : theRooms) {
122 | if(room.equals(roomName)){
123 | return true;
124 | }
125 | }
126 | return false;
127 | }
128 |
129 | public Room getHome(){
130 | return theRooms.get(4);
131 | }
132 |
133 | public void setRoomsState(char[] state){
134 | for (int i = 0; i < theRooms.size(); i++) {
135 | char c;
136 | try{c = state[i];}
137 | catch (Exception e){c = 1;}
138 | theRooms.get(i).setBossGetItem(c == '1');
139 | }
140 | }
141 |
142 | public void loadRoom(String room_){
143 | for (Room room : theRooms) {
144 | if(room.equals(room_)){
145 | currentRoom = room;
146 | break;
147 | }
148 | }
149 | }
150 |
151 | public char[] getRoomsState(){
152 | char[] roomsState = new char[theRooms.size()];
153 | for (int i = 0; i < theRooms.size(); i++)
154 | roomsState[i] = theRooms.get(i).isBossGetItem() ? '1' : '0';
155 | return roomsState;
156 | }
157 |
158 | public String wildRoom(){
159 | int index = (int) (Math.random()*2000);
160 | index %= theRooms.size();
161 | currentRoom = theRooms.get(index);
162 | return currentRoom.getPrompt();
163 | }
164 |
165 | public void fightBoss(Game game){
166 | game.setPlayer(currentRoom.fightBoss(game.getPlayer(), game));
167 | }
168 |
169 | public Room getCurrentRoom() {
170 | return currentRoom;
171 | }
172 | }
173 |
--------------------------------------------------------------------------------
/app/src/main/java/brain/castle/map/Room.java:
--------------------------------------------------------------------------------
1 | package brain.castle.map;
2 |
3 | import android.support.annotation.Nullable;
4 |
5 | import java.util.ArrayList;
6 | import java.util.HashMap;
7 |
8 | import brain.castle.cells.Boss;
9 | import brain.castle.cells.NPC;
10 | import brain.castle.cells.Player;
11 | import brain.castle.util.Echoer;
12 |
13 |
14 | public class Room {
15 |
16 | private Boss boss = null;
17 | private String description;
18 | private String welcomeWord;
19 | private HashMap exits;
20 | private ArrayList NPCs;
21 |
22 | //构造方法
23 | Room(String description) {
24 | this.description = description;
25 | exits = new HashMap<>();
26 | boss = null;
27 | }
28 |
29 | //构造方法
30 | Room(String description, String welcomeWord) {
31 | this(description);
32 | this.welcomeWord = welcomeWord;
33 | }
34 |
35 | Room(String description,
36 | String BossName, int blood, int strike, int miss, int experience,@Nullable String dieText) {
37 | this(description,"欢迎来到这里。", BossName, blood, strike, miss, experience, dieText);
38 | }
39 |
40 | Room(String description, String welcomeWord,
41 | String BossName, int blood, int strike, int miss, int experience,@Nullable String dieText) {
42 | this(description, welcomeWord);
43 | if(dieText != null){
44 | boss = new Boss(BossName,blood,strike,miss,experience,dieText);
45 | }
46 | else {
47 | boss = new Boss(BossName,blood,strike,miss,experience);
48 | }
49 | NPCs = new ArrayList<>();
50 | exits = new HashMap<>();
51 | // NPCs.add(boss);
52 | }
53 |
54 | //返回房间名
55 | @Override
56 | public String toString() {
57 | return description;
58 | }
59 |
60 | //检查房间名
61 | @Override
62 | public boolean equals(Object anotherOne) {
63 | return description.equals(anotherOne);
64 | }
65 |
66 | // 设置一个出口。
67 | void setExit(String str, int targetRoomId){
68 | exits.put(str, targetRoomId);
69 | }
70 |
71 | // 显示房间的详情。
72 | public String getPrompt() {
73 | StringBuilder sb = new StringBuilder();
74 | String ifaBoss = "这里安全。";
75 | sb.append(welcomeWord).append('\n');
76 | sb.append("你在").append(this.description).append('\n');
77 | sb.append("出口有: ");
78 | for ( String str : exits.keySet() ){
79 | sb.append(str).append(' ');
80 | }
81 | sb.append('\n');
82 | if(boss != null) {
83 | if( boss.ifGet() )
84 | ifaBoss = "冰封".equals(boss.toString()) ?
85 | "你来到了神秘空间。这里只能通过\\wild传送离开。冰封正坐在这写码呢。"
86 | : "这里的Boss是"+ boss +",正准备接受你的挑战呢!";
87 | else
88 | ifaBoss = "这里的Boss是"+ boss +",已经被你打败过啦O(∩_∩)O哈哈~";
89 | }
90 | sb.append(ifaBoss);
91 | if(NPCs != null && NPCs.size() > 0) {
92 | sb.append("这里还有:\n");
93 | for (NPC npc : NPCs) {
94 | sb.append(npc.getName());
95 | }
96 | }
97 | return sb.toString();
98 | }
99 | // 使用此类的返回值,赋给原本的Room。
100 | int showRoomId(String direction) {
101 | return exits.get(direction);
102 | }
103 | // 战斗函数
104 | Player fightBoss(Player player, Echoer echoer) {
105 | return boss.fight(player, echoer);
106 | }
107 |
108 | // 检查Boss是否已经被挑战过
109 | public boolean isBossGetItem() {
110 | try {
111 | return boss.ifGet();
112 | } catch (NullPointerException e){
113 | return true;
114 | }
115 | }
116 |
117 | void setBossGetItem(boolean isGet){
118 | if(boss != null){
119 | boss.setGetItem(isGet);
120 | }
121 | }
122 |
123 | public NPC isNPCExists(String name) {
124 | for (NPC npc : NPCs) {
125 | if(name.equals(npc.getName()))
126 | return npc;
127 | }
128 | return null;
129 | }
130 |
131 | boolean checkExit(String exit) {
132 | return exits.containsKey(exit);
133 | }
134 | }
135 |
--------------------------------------------------------------------------------
/app/src/main/java/brain/castle/util/Direction.java:
--------------------------------------------------------------------------------
1 | package brain.castle.util;
2 |
3 | /**
4 | * 字符串枚举
5 | * Created by asus1 on 2016/1/27.
6 | */
7 | public enum Direction {
8 |
9 | UP("up"),
10 | DOWN("down"),
11 | EAST("east"),
12 | WEST("west"),
13 | NORTH("north"),
14 | SOUTH("south")
15 | ;
16 |
17 | String s;
18 | Direction(String s){
19 | this.s = s;
20 | }
21 |
22 | @Override
23 | public String toString() {
24 | return s;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/java/brain/castle/util/DirectionPair.java:
--------------------------------------------------------------------------------
1 | package brain.castle.util;
2 |
3 | /**
4 | * 一对方向
5 | * Created by asus1 on 2016/1/30.
6 | */
7 | public class DirectionPair {
8 |
9 | private Direction direction1;
10 | private Direction direction2;
11 |
12 | public DirectionPair(Direction direction1, Direction direction2) {
13 | this.direction1 = direction1;
14 | this.direction2 = direction2;
15 | }
16 |
17 | public Direction getDirection1() {
18 | return direction1;
19 | }
20 |
21 | public Direction getDirection2() {
22 | return direction2;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/app/src/main/java/brain/castle/util/Echoer.java:
--------------------------------------------------------------------------------
1 | package brain.castle.util;
2 |
3 | /**
4 | * 用于传递echo方法,控制反转
5 | * Created by asus1 on 2016/1/29.
6 | */
7 | public interface Echoer {
8 | void echo(String words);
9 | void echoln(String words);
10 | void closeScreen();
11 | }
12 |
--------------------------------------------------------------------------------
/app/src/main/java/brain/castle/util/MessageHandler.java:
--------------------------------------------------------------------------------
1 | package brain.castle.util;
2 |
3 | /**
4 | * 消息处理器接口
5 | * Created by asus1 on 2016/1/31.
6 | */
7 | public interface MessageHandler {
8 | boolean HandleMessage(String msg);
9 | }
10 |
--------------------------------------------------------------------------------
/app/src/main/java/brain/castle/util/NameGenerator.java:
--------------------------------------------------------------------------------
1 | package brain.castle.util;
2 |
3 | /**
4 | * 命名器
5 | * Created by asus1 on 2016/1/29.
6 | */
7 | public class NameGenerator {
8 | public NameGenerator() {}
9 | private static String[] names = {
10 | "金木研",
11 | "赤羽业",
12 | "泉新一",
13 | "千里冰封",
14 | "奶茶",
15 | "3A",
16 | "无",
17 | "SpiderKing",
18 | "Direction.D.",
19 | "Timothy",
20 | };
21 |
22 | public static String generate(){
23 | double i = Math.random();
24 | return names[(int) (names.length * i)];
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/java/brain/function/SplitBook.java:
--------------------------------------------------------------------------------
1 | package brain.function;
2 |
3 | import android.net.Uri;
4 |
5 | /**
6 | * Copyright 2016(c) Comet Corporation.
7 | * Created by asus1 on 2016/1/22.
8 | * 书的简化类
9 | */
10 | public class SplitBook {
11 |
12 | private Uri bookUri;
13 |
14 | public SplitBook(Uri bookUri) {
15 | this.bookUri = bookUri;
16 | }
17 |
18 | public SplitBook() {
19 | }
20 |
21 | public void setBookUri(Uri bookUri) {
22 | this.bookUri = bookUri;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/app/src/main/java/com/tesla/ai/AboutMeActivity.java:
--------------------------------------------------------------------------------
1 | package com.tesla.ai;
2 |
3 | import android.os.Bundle;
4 | import android.view.Menu;
5 | import android.view.MenuItem;
6 |
7 | import util.BaseActivity;
8 |
9 | public class AboutMeActivity extends BaseActivity {
10 |
11 | @Override
12 | protected void onCreate(Bundle savedInstanceState) {
13 | super.onCreate(savedInstanceState);
14 | setContentView(R.layout.activity_about_me);
15 | initToolBar();
16 |
17 | playFrameAnimation(
18 | R.id.ncFloating,
19 | R.drawable.nc_floating
20 | );
21 | }
22 |
23 | @Override
24 | public boolean onCreateOptionsMenu(Menu menu) {
25 | return super.onCreateOptionsMenu(menu);
26 | }
27 |
28 | @Override
29 | public boolean onOptionsItemSelected(MenuItem item) {
30 | return super.onOptionsItemSelected(item);
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/app/src/main/java/com/tesla/ai/DeleteActivity.java:
--------------------------------------------------------------------------------
1 | package com.tesla.ai;
2 |
3 | import android.app.Activity;
4 | import android.content.Intent;
5 | import android.os.Bundle;
6 | import android.view.View;
7 |
8 | import util.T;
9 |
10 | public class DeleteActivity extends Activity {
11 |
12 | public static final int resultCode = 666;
13 | private Intent intent;
14 |
15 | @Override
16 | protected void onCreate(Bundle savedInstanceState) {
17 | super.onCreate(savedInstanceState);
18 | setContentView(R.layout.activity_delete);
19 |
20 | Intent data = getIntent();
21 | intent = new Intent();
22 | intent.putExtra(
23 | T.POSITION,
24 | data.getIntExtra(T.POSITION, 0)
25 | );
26 | }
27 |
28 | public void sureToDelete(View view){
29 | intent.putExtra(T.DELETE_OR_NOT, true);
30 | setResult(resultCode,intent);
31 | finish();
32 | }
33 |
34 | public void cancelToDelete(View view){
35 | intent.putExtra(T.DELETE_OR_NOT, false);
36 | setResult(resultCode,intent);
37 | finish();
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/app/src/main/java/com/tesla/ai/GithubActivity.java:
--------------------------------------------------------------------------------
1 | package com.tesla.ai;
2 |
3 | import android.content.Context;
4 | import android.net.ConnectivityManager;
5 | import android.net.NetworkInfo;
6 | import android.os.Bundle;
7 | import android.view.KeyEvent;
8 | import android.view.Menu;
9 | import android.view.MenuItem;
10 | import android.view.View;
11 | import android.webkit.WebSettings;
12 | import android.webkit.WebView;
13 | import android.webkit.WebViewClient;
14 | import android.widget.TextView;
15 |
16 | import java.net.URL;
17 |
18 | import util.BaseActivity;
19 |
20 | public class GithubActivity extends BaseActivity {
21 |
22 | private WebView github;
23 | private TextView noNetwork;
24 |
25 | @Override
26 | protected void onCreate(Bundle savedInstanceState) {
27 | super.onCreate(savedInstanceState);
28 | setContentView(R.layout.activity_github);
29 |
30 | initToolBar();
31 |
32 | github = (WebView) findViewById(R.id.github);
33 | noNetwork = (TextView) findViewById(R.id.noNetwork);
34 |
35 | // github.setWebViewClient(new WebViewClient());
36 | // github.setWebChromeClient(new WebChromeClient());
37 |
38 | if(isNetworkConnected(this)){
39 | noNetWorkConnection();
40 | }
41 | else {
42 | String githubURL = "https://github.com/ice1000/AIAndroid";
43 | try {
44 | URL gitURL = new URL(githubURL);
45 | if (gitURL.getFile() == null) throw new Exception();
46 | } catch (Exception e) {
47 | e.printStackTrace();
48 | noNetWorkConnection();
49 | } finally {
50 | noNetWorkConnection();
51 | }
52 |
53 | github.loadUrl(githubURL);
54 | github.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
55 | github.getSettings().setJavaScriptEnabled(true);
56 | github.setWebViewClient(new WebViewClient(){
57 | @Override
58 | public boolean shouldOverrideUrlLoading(WebView view, String url) {
59 | view.loadUrl(url);
60 | return true;
61 | }});
62 | }
63 | }
64 | @Override
65 | public boolean onKeyDown(int keyCode, KeyEvent event) {
66 | if ((keyCode == KeyEvent.KEYCODE_BACK) && github.canGoBack()) {
67 | github.goBack(); //goBack()表示返回WebView的上一页面
68 | return true;
69 | }
70 | return false;
71 | }
72 |
73 | // public void gotoSettings(View view){
74 | // startActivity(new Intent(this, SettingsActivity.class));
75 | //// overridePendingTransition(R.anim.zoom_in, R.anim.zoom_out);
76 | // }
77 |
78 | @Override
79 | public boolean onCreateOptionsMenu(Menu menu) {
80 | return super.onCreateOptionsMenu(menu);
81 | }
82 |
83 | @Override
84 | public boolean onOptionsItemSelected(MenuItem item) {
85 | return super.onOptionsItemSelected(item);
86 | }
87 |
88 | public boolean isNetworkConnected(Context context) {
89 | if (context != null) {
90 | ConnectivityManager mConnectivityManager = (ConnectivityManager) context
91 | .getSystemService(Context.CONNECTIVITY_SERVICE);
92 | NetworkInfo mNetworkInfo = mConnectivityManager.getActiveNetworkInfo();
93 | if (mNetworkInfo != null) {
94 | return mNetworkInfo.isAvailable();
95 | }
96 | }
97 | return false;
98 | }
99 |
100 | private void noNetWorkConnection(){
101 |
102 | github.setVisibility(View.GONE);
103 | noNetwork.setVisibility(View.VISIBLE);
104 | // github.loadUrl("file:///android_res/raw/no_network.html");
105 |
106 | }
107 |
108 | }
109 |
110 |
--------------------------------------------------------------------------------
/app/src/main/java/com/tesla/ai/LoginActivity.java:
--------------------------------------------------------------------------------
1 | package com.tesla.ai;
2 |
3 | import android.content.Intent;
4 | import android.os.Bundle;
5 |
6 | import util.BaseActivity;
7 |
8 | public class LoginActivity extends BaseActivity {
9 |
10 | @Override
11 | protected void onCreate(Bundle savedInstanceState) {
12 | super.onCreate(savedInstanceState);
13 | setContentView(R.layout.activity_login);
14 |
15 | // showTitle();
16 |
17 | doStunts();
18 |
19 | new Thread(){
20 |
21 | @Override
22 | public void run() {
23 | super.run();
24 | try {
25 | Thread.sleep(6000);
26 | } catch (InterruptedException e) {
27 | e.printStackTrace();
28 | }
29 | startActivity(new Intent(
30 | LoginActivity.this, MainActivity.class
31 | ));
32 |
33 | finish();
34 | }
35 | }.start();
36 | }
37 |
38 | private void doStunts(){
39 | playFrameAnimation(
40 | R.id.ncFloating,
41 | R.drawable.nc_floating
42 | );
43 | playTweenAnimation(
44 | R.id.roundFore,
45 | R.anim.progress_turning
46 | );
47 |
48 | // final Handler handler = new Handler(){
49 | // @Override
50 | // public void handleMessage(Message msg) {
51 | // super.handleMessage(msg);
52 | // switch (msg.what){
53 | // case 0:
54 | // NCCard.setVisibility(View.INVISIBLE);
55 | // logoTextView.setVisibility(View.INVISIBLE);
56 | // break;
57 | // case 1:
58 | // Saber.setVisibility(View.VISIBLE);
59 | // saberTextView.setVisibility(View.VISIBLE);
60 | // break;
61 | // default:
62 | // break;
63 | // }
64 | // }
65 | // };
66 |
67 | // new Thread(){
68 | // @Override
69 | // public void run() {
70 | // super.run();
71 | // Message message;
72 | // try {
73 | // sleep(2500);
74 | // } catch (InterruptedException e) {
75 | // e.printStackTrace();
76 | // }
77 | // message = new Message();
78 | // message.what = 0;
79 | // handler.sendMessage(message);
80 | // try {
81 | // sleep(500);
82 | // } catch (InterruptedException e) {
83 | // e.printStackTrace();
84 | // }
85 | // message = new Message();
86 | // message.what = 1;
87 | // handler.sendMessage(message);
88 | // }
89 | // }.start();
90 | }
91 |
92 | // private void showTitle(){
93 | //
94 | // LimbicSystem memories = new LimbicSystem(this);
95 | //
96 | // TextView title;
97 | // title = (TextView) findViewById(R.id.meetTitle);
98 | //
99 | // String text = memories.getAppTitle();
100 | // Log.d(this.toString(), "text = " + text);
101 | // title.setText(text);
102 | //
103 | // }
104 | }
105 |
--------------------------------------------------------------------------------
/app/src/main/java/com/tesla/ai/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.tesla.ai;
2 |
3 | import android.animation.AnimatorInflater;
4 | import android.animation.ArgbEvaluator;
5 | import android.animation.ObjectAnimator;
6 | import android.content.Intent;
7 | import android.os.Build;
8 | import android.os.Bundle;
9 | import android.support.design.widget.NavigationView;
10 | import android.support.v4.view.GravityCompat;
11 | import android.support.v4.widget.DrawerLayout;
12 | import android.support.v7.app.ActionBarDrawerToggle;
13 | import android.support.v7.widget.CardView;
14 | import android.support.v7.widget.DefaultItemAnimator;
15 | import android.support.v7.widget.LinearLayoutManager;
16 | import android.support.v7.widget.RecyclerView;
17 | import android.util.Log;
18 | import android.view.Gravity;
19 | import android.view.LayoutInflater;
20 | import android.view.Menu;
21 | import android.view.MenuItem;
22 | import android.view.MotionEvent;
23 | import android.view.View;
24 | import android.view.ViewGroup;
25 | import android.widget.EditText;
26 | import android.widget.FrameLayout;
27 | import android.widget.RelativeLayout;
28 | import android.widget.TextView;
29 | import android.widget.Toast;
30 |
31 | import brain.CerebralCortex;
32 | import util.BaseActivity;
33 | import util.MyMessage;
34 | import util.OnItemClickListener;
35 | import util.OnMessageChangedListener;
36 |
37 | public class MainActivity extends BaseActivity {
38 |
39 | private int nowBackgroundColor;
40 | private RecyclerView messageRecycler;
41 | private MessageAdapter adapter;
42 | private EditText editMessage;
43 | private CerebralCortex brain;
44 | private DrawerLayout drawerLayout;
45 | // private Handler brainMessageHandler;
46 | // brainMessageHandler = new Handler(){
47 | // @Override
48 | // public void handleMessage(Message msg) {
49 | // super.handleMessage(msg);
50 | // switch (msg.what){
51 | // case T.ANSWER_MESSAGE_SENT:
52 | // adapter.notifyItemInserted(brain.getDataSize()-1);
53 | // break;
54 | // default:
55 | // Log.d(toString(), T.NO_MESSAGE_FOUND);
56 | // break;
57 | // }
58 | // }
59 | // };
60 |
61 | @Override
62 | protected void onCreate(Bundle savedInstanceState) {
63 | super.onCreate(savedInstanceState);
64 | setContentView(R.layout.activity_main);
65 |
66 | // 一定最先构造大脑皮层
67 | brain = new CerebralCortex(this, new OnMessageChangedListener() {
68 | @Override
69 | public void onMessageChanged(int position, int action) {
70 | switch (action) {
71 | case T.ANSWER_MESSAGE_SENT:
72 | case T.ANSWER_MESSAGE_RECIEVED:
73 | adapter.notifyItemInserted(position);
74 | break;
75 | case T.ANSWER_MESSAGE_DELETED:
76 | adapter.notifyItemRemoved(position);
77 | break;
78 | case T.WHOLE_DATASET_CHANGED:
79 | adapter.notifyDataSetChanged();
80 | break;
81 | default:
82 | break;
83 | }
84 | }
85 | });
86 |
87 | initViews();
88 |
89 | // brain.callMaster();
90 | }
91 |
92 | @Override
93 | public boolean onCreateOptionsMenu(Menu menu) {
94 | // Inflate the menu; this adds items to the action bar if it is present.
95 | getMenuInflater().inflate(R.menu.menu_main, menu);
96 | return true;
97 | }
98 |
99 | @Override
100 | public boolean onOptionsItemSelected(MenuItem item) {
101 | switch (item.getItemId()) {
102 | case R.id.action_settings:
103 | startActivity(new Intent(
104 | MainActivity.this, SettingsActivity.class));
105 | return true;
106 | case R.id.action_refresh:
107 | brain.refreshData();
108 | return true;
109 | case R.id.action_removeAll:
110 | brain.clearData();
111 | if(nowBackgroundColor != T.BACKGROUND_COLOR_IS_0) {
112 | changeBackgroundColor(
113 | nowBackgroundColor ==
114 | T.BACKGROUND_COLOR_IS_1
115 | ? R.animator.background_color_1_to_0
116 | : R.animator.background_color_5_to_0
117 | );
118 | nowBackgroundColor = T.BACKGROUND_COLOR_IS_0;
119 | }
120 | return true;
121 | default:
122 | return super.onOptionsItemSelected(item);
123 | }
124 |
125 | }
126 |
127 | @Override
128 | protected void onActivityResult(int requestCode, int resultCode, Intent data) {
129 | super.onActivityResult(requestCode, resultCode, data);
130 | switch (requestCode){
131 | case T.DELETE_REQUEST:
132 | switch (resultCode){
133 | case DeleteActivity.resultCode:
134 | if(data.getBooleanExtra(T.DELETE_OR_NOT, false)){
135 | // 因为我传递过去的时候是把position传递过去的
136 | // 所以我猜再传递回来并且拿给adapter是没有问题的
137 | int position = data.getIntExtra(T.POSITION, 0);
138 |
139 | // 先让大脑删除message
140 | brain.deleteMessage(position);
141 | if(brain.isDataEmpty()){
142 | changeBackgroundColor(
143 | nowBackgroundColor ==
144 | T.BACKGROUND_COLOR_IS_1
145 | ? R.animator.background_color_1_to_0
146 | : R.animator.background_color_5_to_0
147 | );
148 | }
149 | Log.d(this.toString(), "data.getIntExtra(T.POSITION, 0) = " +
150 | data.getIntExtra(T.POSITION, 0));
151 | }
152 | break;
153 | default:
154 | break;
155 | }
156 | break;
157 | default:
158 | break;
159 | }
160 |
161 | }
162 |
163 | @Override
164 | public void onBackPressed() {
165 | if (drawerLayout.isDrawerOpen(GravityCompat.START)) {
166 | drawerLayout.closeDrawer(GravityCompat.START);
167 | } else {
168 | super.onBackPressed();
169 | }
170 | }
171 |
172 | /**
173 | * 更换背景颜色
174 | * @param id 背景颜色
175 | */
176 | private void changeBackgroundColor(int id) {
177 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB){
178 | ObjectAnimator objectAnimator;
179 | objectAnimator = (ObjectAnimator) AnimatorInflater
180 | .loadAnimator(MainActivity.this, id);
181 | //用于动画计算的需要,
182 | // 如果开始和结束的值不是基本类型的时候,这个方法是需要的。
183 | objectAnimator.setEvaluator(new ArgbEvaluator());
184 | //设置动画的设置目标
185 | objectAnimator.setTarget(messageRecycler);
186 | objectAnimator.start();
187 | }
188 | }
189 |
190 | /**
191 | * 初始化一大堆View
192 | */
193 | private void initViews(){
194 | drawerLayout = (DrawerLayout) findViewById(R.id.mainDrawer);
195 | ActionBarDrawerToggle drawerToggle = new ActionBarDrawerToggle(
196 | this,
197 | drawerLayout,
198 | initToolBar(),
199 | R.string.open_draw,
200 | R.string.close_draw
201 | );
202 | drawerLayout.setDrawerListener(drawerToggle);
203 | drawerToggle.syncState();
204 |
205 | NavigationView navigationView =
206 | (NavigationView) findViewById(R.id.navigation);
207 | navigationView.setNavigationItemSelectedListener(
208 | new NavigationView.OnNavigationItemSelectedListener() {
209 | //用于辨别此前是否已有选中条目
210 | MenuItem preMenuItem;
211 | @Override
212 | public boolean onNavigationItemSelected(MenuItem menuItem) {
213 | Log.d(toString(), "点击事件已经触发。");
214 | if(preMenuItem != null)
215 | preMenuItem.setChecked(false);
216 | menuItem.setChecked(true);
217 | drawerLayout.closeDrawers();
218 | preMenuItem = menuItem;
219 | // drawerLayout.closeDrawers(GravityCompat.START);
220 | return true;
221 | }
222 | });
223 |
224 | editMessage = (EditText) findViewById(R.id.sendBox);
225 |
226 | adapter = new MessageAdapter();
227 |
228 | nowBackgroundColor = T.BACKGROUND_COLOR_IS_0;
229 | messageRecycler = (RecyclerView) findViewById(R.id.messagesRecycler);
230 |
231 | messageRecycler.setLayoutManager(new LinearLayoutManager(this));
232 | messageRecycler.setItemAnimator(new DefaultItemAnimator());
233 |
234 | adapter.setOnItemClickListener(new OnItemClickListener() {
235 | @Override public void onItemClick(View view, int position) {}
236 | @Override
237 | public void onItemLongClick(View view, int position) {
238 | Intent intent = new Intent(
239 | MainActivity.this, DeleteActivity.class
240 | );
241 | intent.putExtra(T.POSITION, position);
242 | startActivityForResult(intent, T.DELETE_REQUEST);
243 | }
244 | @Override
245 | public void onItemTouch(View view, int position, MotionEvent event) {
246 |
247 | boolean isFromSaber =
248 | brain.getData().get(position).isFromSaber();
249 | int[] colorId;
250 |
251 | Log.d(this.toString(),
252 | "event.getAction() = " + event.getAction());
253 |
254 | switch (event.getAction()){
255 | case 0:
256 | case 2:
257 | colorId = isFromSaber ? new int[]{
258 | R.color.cardColor1Pressed,
259 | R.color.cardColor1
260 | } : new int[]{
261 | R.color.cardColor5Pressed,
262 | R.color.cardColor5
263 | };
264 | int id = isFromSaber
265 | ? R.animator.background_color_1_to_5
266 | : R.animator.background_color_5_to_1;
267 | // 如果现在的颜色已经正常了那就不用变化了
268 | if(nowBackgroundColor == T.BACKGROUND_COLOR_IS_5)
269 | if(isFromSaber)
270 | break;
271 | else
272 | nowBackgroundColor = T.BACKGROUND_COLOR_IS_1;
273 | else
274 | if (nowBackgroundColor == T.BACKGROUND_COLOR_IS_1)
275 | if(!isFromSaber)
276 | break;
277 | else
278 | nowBackgroundColor = T.BACKGROUND_COLOR_IS_5;
279 | else
280 | if(nowBackgroundColor == T.BACKGROUND_COLOR_IS_0) {
281 | nowBackgroundColor = isFromSaber
282 | ? T.BACKGROUND_COLOR_IS_5
283 | : T.BACKGROUND_COLOR_IS_1;
284 |
285 | // 重新给它赋值,从白色渐变过去
286 | id = isFromSaber
287 | ? R.animator.background_color_0_to_5
288 | : R.animator.background_color_0_to_1;
289 | }
290 | changeBackgroundColor(id);
291 | break;
292 | default:
293 |
294 | colorId = isFromSaber ? new int[]{
295 | R.color.cardColor1,
296 | R.color.cardColor1Pressed
297 | } : new int[]{
298 | R.color.cardColor5,
299 | R.color.cardColor5Pressed
300 | };
301 | break;
302 | }
303 |
304 | CardView cardView = ((CardView)
305 | ((FrameLayout) view).getChildAt(0));
306 | TextView textView = ((TextView)
307 | ((CardView)((FrameLayout) view).getChildAt(0))
308 | .getChildAt(0));
309 |
310 | // cardView.setCardElevation(0);
311 | cardView.setCardBackgroundColor(
312 | getResources().getColor(colorId[0]));
313 | textView.setTextColor(
314 | getResources().getColor(colorId[1]));
315 |
316 | }
317 | });
318 |
319 | messageRecycler.setAdapter(adapter);
320 | }
321 |
322 | /**
323 | * 接收一个消息
324 | * @param view 监听器必备
325 | */
326 | public void commitMessage(View view){
327 | String msg = editMessage.getText().toString();
328 |
329 | brain.giveMessage(msg);
330 | editMessage.setText("");
331 | }
332 |
333 | /**
334 | * 侧滑菜单按钮监听器
335 | * @param item 必备参数
336 | */
337 | public void makeSummary(MenuItem item){
338 | Toast.makeText(MainActivity.this,
339 | "暂时没做完!",
340 | Toast.LENGTH_SHORT).show();
341 | baseMenuItemOnClickListener(item);
342 | }
343 | public void seeGithub(MenuItem item){
344 | startActivity(new Intent(
345 | MainActivity.this,
346 | GithubActivity.class
347 | ));
348 | baseMenuItemOnClickListener(item);
349 | finish();
350 | }
351 | public void goSettings(MenuItem item){
352 | startActivity(new Intent(
353 | MainActivity.this,
354 | SettingsActivity.class
355 | ));
356 | baseMenuItemOnClickListener(item);
357 | finish();
358 | }
359 | public void contactMe(MenuItem item){
360 | Toast.makeText(MainActivity.this,
361 | T.SORRY_CANNOT_JOIN,
362 | Toast.LENGTH_SHORT).show();
363 | baseMenuItemOnClickListener(item);
364 | }
365 | private void baseMenuItemOnClickListener(MenuItem item){
366 | drawerLayout.closeDrawers();
367 | }
368 |
369 | class MessageAdapter extends RecyclerView.Adapter {
370 |
371 | private OnItemClickListener onItemClickListener;
372 |
373 | public void setOnItemClickListener(
374 | OnItemClickListener onItemClickListener){
375 | this.onItemClickListener = onItemClickListener;
376 | }
377 |
378 | @Override
379 | public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
380 | return new MessageViewHolder(LayoutInflater.from(MainActivity.this)
381 | .inflate(R.layout.message, parent, false));
382 | }
383 |
384 | @Override
385 | public void onBindViewHolder(final RecyclerView.ViewHolder holder, int position) {
386 |
387 | ((MessageViewHolder)holder).init(
388 | brain.getMessageByPosition(position)
389 | );
390 |
391 | if (onItemClickListener != null) {
392 | holder.itemView.setOnClickListener(
393 | new View.OnClickListener() {
394 | @Override
395 | public void onClick(View v) {
396 | onItemClickListener.onItemClick(holder.itemView,
397 | holder.getLayoutPosition());
398 | }
399 | });
400 |
401 | holder.itemView.setOnLongClickListener(
402 | new View.OnLongClickListener() {
403 | @Override
404 | public boolean onLongClick(View v) {
405 | onItemClickListener.onItemLongClick(holder.itemView,
406 | holder.getLayoutPosition());
407 | return false;
408 | }
409 | });
410 |
411 | holder.itemView.setOnTouchListener(
412 | new View.OnTouchListener() {
413 | @Override
414 | public boolean onTouch(View v, MotionEvent event) {
415 | onItemClickListener.onItemTouch(holder.itemView,
416 | holder.getLayoutPosition(), event);
417 | return false;
418 | }
419 | });
420 | }
421 | }
422 | @Override
423 | public int getItemCount() {
424 | return brain.getDataSize();
425 | }
426 |
427 | }
428 |
429 | class MessageViewHolder extends RecyclerView.ViewHolder {
430 |
431 | private CardView cardView;
432 | private TextView textView;
433 |
434 | public MessageViewHolder(View itemView) {
435 | super(itemView);
436 | cardView = (CardView)
437 | itemView.findViewById(R.id.messageCard);
438 | textView = (TextView)
439 | itemView.findViewById(R.id.messageText);
440 | }
441 |
442 | public void init(MyMessage message){
443 | FrameLayout.LayoutParams params =
444 | new FrameLayout.LayoutParams(
445 | RelativeLayout.LayoutParams.WRAP_CONTENT,
446 | RelativeLayout.LayoutParams.WRAP_CONTENT
447 | );
448 |
449 | if(message.isFromSaber()){
450 | params.gravity = Gravity.START;
451 | // 左 上 右 下
452 | params.setMargins(15,15,30,15);
453 |
454 | cardView.setCardBackgroundColor(
455 | getResources().
456 | getColor(R.color.cardColor1));
457 | textView.setTextColor(
458 | getResources().
459 | getColor(R.color.cardColor1Pressed));
460 | }
461 |
462 | else {
463 | params.gravity = Gravity.END;
464 | // 左 上 右 下
465 | params.setMargins(30,15,15,15);
466 |
467 | cardView.setCardBackgroundColor(
468 | getResources().
469 | getColor(R.color.cardColor5));
470 | textView.setTextColor(
471 | getResources().
472 | getColor(R.color.cardColor5Pressed));
473 | }
474 |
475 | cardView.setLayoutParams(params);
476 | textView.setText(message.getMessage());
477 | }
478 | }
479 |
480 | }
481 |
--------------------------------------------------------------------------------
/app/src/main/java/com/tesla/ai/RenameActivity.java:
--------------------------------------------------------------------------------
1 | package com.tesla.ai;
2 |
3 | import android.support.v7.app.AppCompatActivity;
4 | import android.os.Bundle;
5 | import android.view.View;
6 | import android.widget.EditText;
7 | import android.widget.Toast;
8 |
9 | import brain.LimbicSystem;
10 |
11 | public class RenameActivity extends AppCompatActivity {
12 |
13 | @Override
14 | protected void onCreate(Bundle savedInstanceState) {
15 | super.onCreate(savedInstanceState);
16 | setContentView(R.layout.activity_rename);
17 | }
18 |
19 | public void sureToRename(View view){
20 | EditText editText = (EditText) findViewById(R.id.nameEditor);
21 | String name = editText.getText().toString();
22 |
23 | LimbicSystem limbicSystem = new LimbicSystem(this);
24 | limbicSystem.putName(name);
25 |
26 | Toast.makeText(
27 | RenameActivity.this,
28 | "好的~今后我就叫"+name+"啦~",
29 | Toast.LENGTH_SHORT
30 | ).show();
31 | finish();
32 | }
33 |
34 | public void cancelToRename(View view){
35 | finish();
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/app/src/main/java/com/tesla/ai/SettingsActivity.java:
--------------------------------------------------------------------------------
1 | package com.tesla.ai;
2 |
3 | import android.content.Intent;
4 | import android.net.Uri;
5 | import android.os.Bundle;
6 | import android.view.View;
7 | import android.widget.AdapterView;
8 | import android.widget.ArrayAdapter;
9 | import android.widget.ListView;
10 | import android.widget.Toast;
11 |
12 | import java.util.ArrayList;
13 |
14 | import brain.LimbicSystem;
15 | import util.BaseActivity;
16 |
17 | public class SettingsActivity extends BaseActivity {
18 |
19 | @Override
20 | protected void onCreate(Bundle savedInstanceState){
21 | super.onCreate(savedInstanceState);
22 | setContentView(R.layout.activity_settings);
23 |
24 | LimbicSystem limbicSystem = new LimbicSystem(this);
25 |
26 | ArrayList data = new ArrayList<>();
27 | data.add("推广:HDF Studio神经病编程社区(QQ群");
28 | data.add("推广:PL中学生编程社区(QQ群");
29 | data.add("查看项目源代码(github)");
30 | data.add("给" + limbicSystem.getName() + "起个名字吧");
31 | data.add("关于开发者");
32 | data.add("加入我们(其实也就一个人。。)");
33 | data.add("继续和" + limbicSystem.getName() + "聊天");
34 | data.add("推广:PLSG组(github组织");
35 |
36 | ListView settings = (ListView) findViewById(R.id.settings);
37 |
38 | settings.setAdapter(new ArrayAdapter<>(this,
39 | R.layout.support_simple_spinner_dropdown_item, data));
40 |
41 | settings.setOnItemClickListener(new AdapterView.OnItemClickListener() {
42 | @Override
43 | public void onItemClick(
44 | AdapterView> adapterView, View view, int i, long l) {
45 | switch (i){
46 | case 0:
47 | joinQQ(T.HDF_STUDIO);
48 | break;
49 | case 1:
50 | joinQQ(T.PROGRAM_LEAGUE);
51 | break;
52 | case 2:
53 | startActivity(new Intent(
54 | SettingsActivity.this,
55 | GithubActivity.class
56 | ));
57 | // finish();
58 | break;
59 | case 3:
60 | startActivity(new Intent(
61 | SettingsActivity.this,
62 | RenameActivity.class
63 | ));
64 | // Toast.makeText(
65 | // SettingsActivity.this,
66 | // T.SORRY_CANNOT_USE,
67 | // Toast.LENGTH_SHORT).show();
68 | break;
69 | case 4:
70 | startActivity(new Intent(
71 | SettingsActivity.this,
72 | AboutMeActivity.class
73 | ));
74 | // finish();
75 | break;
76 | case 5:
77 | Toast.makeText(
78 | SettingsActivity.this,
79 | T.SORRY_CANNOT_JOIN,
80 | Toast.LENGTH_SHORT
81 | ).show();
82 | break;
83 | case 6:
84 | startActivity(new Intent(
85 | SettingsActivity.this,
86 | MainActivity.class
87 | ));
88 | break;
89 | case 7: {
90 | Intent intent = new Intent(
91 | Intent.ACTION_VIEW,
92 | Uri.parse("https://github.com/orgs/ProgramLeague")
93 | );
94 | startActivity(intent);
95 | }
96 | default:
97 | break;
98 | }
99 | }
100 | });
101 | }
102 |
103 | private void joinQQ(int QQGroupId){
104 | String key;
105 | switch (QQGroupId){
106 | case T.PROGRAM_LEAGUE:
107 | key = "1xAz-QGQL0FrWLWvBz_a5yE6aIv_64et";
108 | break;
109 | case T.HDF_STUDIO:
110 | key = "BulOWcuBrEZZh2gZDGhxikoGDQaNHlgg";
111 | break;
112 | default:
113 | return;
114 | }
115 |
116 | if(!joinQQGroup(key)){
117 | Toast.makeText(SettingsActivity.this,
118 | "对不起,您未安装手机QQ,或安装的版本不支持,请更新。",
119 | Toast.LENGTH_SHORT).show();
120 | }
121 | }
122 |
123 | /**
124 | * 发起添加群流程。群号:ProgramLeague(319293196) 的 key 为:
125 | * 1xAz-QGQL0FrWLWvBz_a5yE6aIv_64et
126 | * 调用 joinQQGroup(1xAz-QGQL0FrWLWvBz_a5yE6aIv_64et)
127 | * 即可发起手Q客户端申请加群 ProgramLeague(319293196)
128 | *
129 | * 发起添加群流程。群号:HDF Studio ~ 编程之家(196383664) 的 key 为:
130 | * BulOWcuBrEZZh2gZDGhxikoGDQaNHlgg
131 | * 调用 joinQQGroup(BulOWcuBrEZZh2gZDGhxikoGDQaNHlgg)
132 | * 即可发起手Q客户端申请加群 HDF Studio ~ 编程之家(196383664)
133 | *
134 | * @param key 由官网生成的key
135 | * @return 返回true表示呼起手Q成功,返回false表示呼起失败
136 | */
137 | private boolean joinQQGroup(String key) {
138 |
139 | Intent intent = new Intent();
140 | intent.setData(Uri.parse(
141 | "mqqopensdkapi://bizAgent/qm/qr?url=http%3A%2F%2Fqm.qq.com"+
142 | "%2Fcgi-bin%2Fqm%2Fqr%3Ffrom%3Dapp%26p%3Dandroid%26k%3D" + key));
143 | // 此Flag可根据具体产品需要自定义,如设置,则在加群界面按返回,
144 | // 返回手Q主界面,不设置,按返回会返回到呼起产品界面
145 | // intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
146 | try {
147 | startActivity(intent);
148 | return true;
149 | } catch (Exception e) {
150 | // 未安装手Q或安装的版本不支持
151 | return false;
152 | }
153 | }
154 |
155 | }
156 |
--------------------------------------------------------------------------------
/app/src/main/java/database/SQLiteManager.java:
--------------------------------------------------------------------------------
1 | package database;
2 |
3 | import android.content.ContentValues;
4 | import android.content.Context;
5 | import android.database.Cursor;
6 | import android.database.sqlite.SQLiteDatabase;
7 | import android.util.Log;
8 |
9 | import java.util.ArrayList;
10 |
11 | import util.MyMessage;
12 | import util.T;
13 |
14 | /**
15 | * Copyright 2016(c) Comet Corporation.
16 | * Created by Administrator on 2016/1/6 0006.
17 | */
18 | public class SQLiteManager {
19 |
20 | private SQLiteDatabase database;
21 |
22 | public SQLiteManager(Context context) {
23 | SQLiteOpener opener = new SQLiteOpener(context);
24 | database = opener.getWritableDatabase();
25 | }
26 |
27 | public ArrayList getMessages(){
28 |
29 | ArrayList messages = new ArrayList<>();
30 | Cursor cursor = database.query(
31 | T.TALK_LOG_TABLE,
32 | // new String[]{
33 | // MyMessage.FROM_SABER,
34 | // MyMessage.MSG
35 | // },
36 | null,
37 | null,
38 | null,
39 | null,
40 | null,
41 | MyMessage.ID
42 | );
43 |
44 | cursor.moveToFirst();
45 |
46 | // 避免什么都没有的情况
47 | if(cursor.isAfterLast()){
48 | return new ArrayList<>();
49 | }
50 |
51 | Log.d(toString(), "in the beginning, cursor.getInt(cursor.getColumnIndex(MyMessage.ID)) = " +
52 | cursor.getInt(cursor.getColumnIndex(MyMessage.ID)));
53 |
54 | if(!cursor.isBeforeFirst() && !cursor.isAfterLast()){
55 | do {
56 | messages.add(new MyMessage(
57 | cursor.getInt(cursor.getColumnIndex(MyMessage.FROM_SABER)),
58 | cursor.getString(cursor.getColumnIndex(MyMessage.MSG)),
59 | cursor.getInt(cursor.getColumnIndex(MyMessage.ID))
60 | ));
61 |
62 | Log.d(toString(), "cursor.getInt(cursor.getColumnIndex(MyMessage.ID)) = " +
63 | cursor.getInt(cursor.getColumnIndex(MyMessage.ID)));
64 | } while (cursor.moveToNext());
65 | }
66 |
67 | cursor.close();
68 | return messages;
69 | }
70 |
71 | public void addMessage(MyMessage myMessage){
72 |
73 | ContentValues contentValues = new ContentValues();
74 | contentValues.put(MyMessage.MSG, myMessage.getMessage());
75 |
76 | // 因为SQLite没有boolean类型所以在存取的时候转换成整数
77 | contentValues.put(MyMessage.FROM_SABER, myMessage.isFromSaber()
78 | ? MyMessage.IS_FROM_SABER : 0);
79 |
80 | database.insert(T.TALK_LOG_TABLE,
81 | null, contentValues);
82 | }
83 |
84 | public MyMessage getLastMessage(){
85 | Cursor cursor = database.query(
86 | T.TALK_LOG_TABLE,
87 | null,
88 | null,
89 | null,
90 | null,
91 | null,
92 | MyMessage.ID
93 | );
94 | cursor.moveToLast();
95 | return new MyMessage(
96 | cursor.getInt(cursor.getColumnIndex(MyMessage.FROM_SABER)),
97 | cursor.getString(cursor.getColumnIndex(MyMessage.MSG)),
98 | cursor.getInt(cursor.getColumnIndex(MyMessage.ID))
99 | );
100 | }
101 |
102 | public MyMessage getOneMessage(int id){
103 | Cursor cursor = database.rawQuery(
104 | "select * from " + T.TALK_LOG_TABLE + " where " + MyMessage.ID + "=" + id,
105 | null
106 | );
107 | cursor.moveToFirst();
108 | return new MyMessage(
109 | cursor.getInt(cursor.getColumnIndex(MyMessage.FROM_SABER)),
110 | cursor.getString(cursor.getColumnIndex(MyMessage.MSG)),
111 | cursor.getInt(cursor.getColumnIndex(MyMessage.ID))
112 | );
113 | }
114 |
115 | public void deleteMessageById(int id) {
116 | Log.d(toString(), "id = " + id);
117 | // MyMessage message = getOneMessage(id);
118 | // Log.d(toString(),
119 | // "message.getId() = " + message.getId() +
120 | // ", id = " + id
121 | // );
122 | database.delete(
123 | T.TALK_LOG_TABLE,
124 | MyMessage.ID + "=" + id,
125 | null
126 | );
127 | }
128 |
129 | public void removeAll(){
130 | database.execSQL(
131 | "DELETE FROM " + T.TALK_LOG_TABLE
132 | );
133 | }
134 | }
135 |
--------------------------------------------------------------------------------
/app/src/main/java/database/SQLiteOpener.java:
--------------------------------------------------------------------------------
1 | package database;
2 |
3 | import android.content.Context;
4 | import android.database.sqlite.SQLiteDatabase;
5 | import android.database.sqlite.SQLiteOpenHelper;
6 | import android.util.Log;
7 |
8 | import util.MyMessage;
9 | import util.T;
10 |
11 | /**
12 | * SQLite处理
13 | * Created by Administrator on 2016/1/5 0005.
14 | */
15 | public class SQLiteOpener extends SQLiteOpenHelper {
16 |
17 |
18 | public static final int DATABASE_VERSION = 1;
19 |
20 | public SQLiteOpener(Context context){
21 | this(context, T.DATABASE_NAME, null, DATABASE_VERSION);
22 | }
23 |
24 | public SQLiteOpener(Context context, String name, SQLiteDatabase.CursorFactory factory, int version) {
25 | super(context, name, factory, version);
26 | }
27 |
28 | @Override
29 | public void onCreate(SQLiteDatabase sqLiteDatabase) {
30 | sqLiteDatabase.execSQL("CREATE TABLE IF NOT EXISTS " +
31 | T.TALK_LOG_TABLE + "(" +
32 | MyMessage.ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " +
33 | MyMessage.MSG + " TEXT, " +
34 | MyMessage.FROM_SABER + " INTEGER)");
35 | }
36 |
37 | @Override
38 | public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) {
39 | Log.d(this.toString(), T.WHAT_THE_FUCK);
40 | }
41 |
42 | @Override
43 | public synchronized void close() {
44 | super.close();
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/app/src/main/java/util/BaseActivity.java:
--------------------------------------------------------------------------------
1 | package util;
2 |
3 | import android.content.Intent;
4 | import android.graphics.drawable.AnimationDrawable;
5 | import android.os.Bundle;
6 | import android.support.annotation.AnimRes;
7 | import android.support.annotation.DrawableRes;
8 | import android.support.annotation.IdRes;
9 | import android.support.annotation.Nullable;
10 | import android.support.v7.app.AppCompatActivity;
11 | import android.support.v7.widget.Toolbar;
12 | import android.view.Menu;
13 | import android.view.MenuItem;
14 | import android.view.animation.AnimationUtils;
15 | import android.widget.ImageView;
16 |
17 | import com.tesla.ai.R;
18 | import com.tesla.ai.SettingsActivity;
19 |
20 | /**
21 | * 封装的基类
22 | * Copyright 2016(c) Comet Corporation.
23 | * Created by asus1 on 2016/1/23.
24 | */
25 | public class BaseActivity extends AppCompatActivity {
26 |
27 | @Override
28 | protected void onCreate(@Nullable Bundle savedInstanceState) {
29 | super.onCreate(savedInstanceState);
30 | }
31 |
32 | /**
33 | * 初始化ToolBar
34 | * @return 可能还会对ToolBar有一些操作
35 | */
36 | protected Toolbar initToolBar(){
37 | Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
38 | setSupportActionBar(toolbar);
39 | return toolbar;
40 | }
41 |
42 | /**
43 | * 播放一个逐帧动画。
44 | * @param id1 View的ID
45 | * @param id2 逐帧动画的ID
46 | */
47 | protected void playFrameAnimation(@IdRes int id1, @DrawableRes int id2){
48 | ImageView Saber = (ImageView) findViewById(id1);
49 | Saber.setBackgroundResource(id2);
50 | ((AnimationDrawable) Saber.getBackground()).start();
51 | }
52 |
53 | /**
54 | * 播放一个补间动画。
55 | * @param id1 View的ID
56 | * @param id2 补间动画的ID
57 | */
58 | protected void playTweenAnimation(@IdRes int id1, @AnimRes int id2){
59 | findViewById(id1).startAnimation(
60 | AnimationUtils.loadAnimation(this, id2)
61 | );
62 | }
63 |
64 | @Override
65 | public boolean onCreateOptionsMenu(Menu menu) {
66 | // Inflate the menu; this adds items to the action bar if it is present.
67 | getMenuInflater().inflate(R.menu.menu_other, menu);
68 | return true;
69 | }
70 |
71 | @Override
72 | public boolean onOptionsItemSelected(MenuItem item) {
73 | int id = item.getItemId();
74 | switch (id) {
75 | case R.id.action_settings:
76 | startActivity(new Intent(
77 | this, SettingsActivity.class));
78 | return true;
79 | default:
80 | return super.onOptionsItemSelected(item);
81 | }
82 | }
83 |
84 | /**
85 | * 只保留了Activity中需要的
86 | * Created by Administrator on 2016/1/5 0005.
87 | */
88 | public static class T {
89 |
90 | public static final String PREFERENCE_NAME = "PREFERENCE_NAME";
91 | public static final String SABER_NAME = "SABER_NAME";
92 | public static final String HAVEN_T_GOT_NAME = "快给我起个名字\n\\(≧▽≦)/";
93 | public static final String WHAT_THE_FUCK = "好想念主人啊~";
94 | public static final String POSITION = "POSITION";
95 | public static final String DELETE_OR_NOT = "DELETE_OR_NOT";
96 | public static final String SORRY_CANNOT_JOIN = "由于开发者害怕被肛,暂时无法联系上他。百度ID @精灵谱尼 哦";
97 |
98 | // 在MainActivity中的
99 | public static final int DONT_NEED_THIS_PARAM = -1;
100 | // 数字都是随手打的,记住绝对不能一样!
101 | public static final int DELETE_REQUEST = 1;
102 | public static final int BACKGROUND_COLOR_IS_5 = 2;
103 | public static final int BACKGROUND_COLOR_IS_1 = 3;
104 | public static final int BACKGROUND_COLOR_IS_0 = 4;
105 | // 在SettingsActivity中的
106 | public static final int HDF_STUDIO = 5;
107 | public static final int PROGRAM_LEAGUE = 6;
108 |
109 | // 在主脑中的
110 | public static final int ANSWER_MESSAGE_SENT = 7;
111 | public static final int ANSWER_MESSAGE_DELETED = 8;
112 | public static final int WHOLE_DATASET_CHANGED = 9;
113 | public static final int ANSWER_MESSAGE_RECIEVED = 10;
114 |
115 | // 还有几个在MyMessage中
116 | }
117 | }
118 |
--------------------------------------------------------------------------------
/app/src/main/java/util/MyMessage.java:
--------------------------------------------------------------------------------
1 | package util;
2 |
3 | /**
4 | * 数据字段的封装。
5 | * Created by Administrator on 2016/1/6 0006.
6 | */
7 | public class MyMessage {
8 |
9 | public static final String ID = "id";
10 | public static final String MSG = "msg";
11 | public static final String FROM_SABER = "fromSaber";
12 | public static final int IS_FROM_SABER = 1;
13 |
14 | private boolean fromSaber;
15 | private boolean idAvailable;
16 | private String message;
17 | private int id;
18 |
19 | public MyMessage(boolean fromSaber, String message) {
20 | this.fromSaber = fromSaber;
21 | this.message = message;
22 | idAvailable = false;
23 | }
24 |
25 | public MyMessage(int fromSaber, String message) {
26 | this.fromSaber = fromSaber == IS_FROM_SABER;
27 | this.message = message;
28 | idAvailable = false;
29 | }
30 |
31 | public MyMessage(int fromSaber, String message, int id) {
32 | this.fromSaber = fromSaber == IS_FROM_SABER;
33 | this.message = message;
34 | idAvailable = true;
35 | this.id = id;
36 | }
37 |
38 | public MyMessage(boolean fromSaber, String message, int id) {
39 | this.fromSaber = fromSaber;
40 | this.message = message;
41 | idAvailable = true;
42 | this.id = id;
43 | }
44 |
45 | public int getId() {
46 | return idAvailable ? id : 0;
47 | }
48 |
49 | public boolean isFromSaber() {
50 | return fromSaber;
51 | }
52 |
53 | public String getMessage() {
54 | return message;
55 | }
56 |
57 | public boolean isIdAvailable() {
58 | return idAvailable;
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/app/src/main/java/util/OnItemClickListener.java:
--------------------------------------------------------------------------------
1 | package util;
2 |
3 | import android.view.MotionEvent;
4 | import android.view.View;
5 |
6 | /**
7 | * Copyright 2015(c) Comet Corporation.
8 | * Created by asus1 on 2015/12/31.
9 | */
10 |
11 | public interface OnItemClickListener {
12 | void onItemClick(View view, int position);
13 | void onItemLongClick(View view, int position);
14 | void onItemTouch(View view, int position, MotionEvent event);
15 | }
16 |
--------------------------------------------------------------------------------
/app/src/main/java/util/OnMessageChangedListener.java:
--------------------------------------------------------------------------------
1 | package util;
2 |
3 | /**
4 | * Copyright 2016(c) Comet Corporation.
5 | * Created by asus1 on 2016/1/9.
6 | */
7 | public interface OnMessageChangedListener {
8 |
9 | void onMessageChanged(int position, int action);
10 |
11 | }
12 |
--------------------------------------------------------------------------------
/app/src/main/java/util/T.java:
--------------------------------------------------------------------------------
1 | package util;
2 |
3 | /**
4 | * 方便外部调用
5 | * Copyright 2016(c) Comet Corporation.
6 | * Created by asus1 on 2016/1/24.
7 | */
8 | public class T extends BaseActivity.T {
9 | // 字库,正则表达式
10 | public static final String SHOULD_BE_SPLIT = "[\n,;]|;|,|。";
11 | public static final String SHOULD_BE_DELETE = "[\n;]|;|,|。";
12 |
13 | // 在SQLite中的
14 | public static final String DATABASE_NAME = "ice1000.db";
15 | public static final String TALK_LOG_TABLE = "TALK_LOG_TABLE";
16 | public static final String KNOWLEDGE = "KNOWLEDGE";
17 |
18 | // 暂时没用的
19 | public static final String MEET_FIRST_TIME = "第一次见,先生您好~";
20 | public static final String DELETE_FAILED = "删除失败,使用暴力方法删除";
21 | public static final String SORRY_CANNOT_USE = "抱歉本功能暂未开放";
22 | public static final String HELLO_HONEY = "嗨~";
23 | public static final String NO_MESSAGE_FOUND = "没有找到消息";
24 |
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/progress_turning.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/animator/background_color_0_to_1.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/animator/background_color_0_to_5.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/animator/background_color_1_to_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/animator/background_color_1_to_5.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/animator/background_color_5_to_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/animator/background_color_5_to_1.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/bd_wallet_bottom_1.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ice1000/AIAndroid/d6645dd84a86833d901b5a2dda18222cbde7f317/app/src/main/res/drawable-hdpi/bd_wallet_bottom_1.9.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/bd_wallet_bottom_1_hover.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ice1000/AIAndroid/d6645dd84a86833d901b5a2dda18222cbde7f317/app/src/main/res/drawable-hdpi/bd_wallet_bottom_1_hover.9.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/bg_dredge_tips.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ice1000/AIAndroid/d6645dd84a86833d901b5a2dda18222cbde7f317/app/src/main/res/drawable-hdpi/bg_dredge_tips.9.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/bg_dredge_tips_1.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ice1000/AIAndroid/d6645dd84a86833d901b5a2dda18222cbde7f317/app/src/main/res/drawable-hdpi/bg_dredge_tips_1.9.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_account_circle_black_18dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ice1000/AIAndroid/d6645dd84a86833d901b5a2dda18222cbde7f317/app/src/main/res/drawable-hdpi/ic_account_circle_black_18dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_book_black_18dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ice1000/AIAndroid/d6645dd84a86833d901b5a2dda18222cbde7f317/app/src/main/res/drawable-hdpi/ic_book_black_18dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_settings_black_18dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ice1000/AIAndroid/d6645dd84a86833d901b5a2dda18222cbde7f317/app/src/main/res/drawable-hdpi/ic_settings_black_18dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_settings_white_18dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ice1000/AIAndroid/d6645dd84a86833d901b5a2dda18222cbde7f317/app/src/main/res/drawable-hdpi/ic_settings_white_18dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_visibility_black_18dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ice1000/AIAndroid/d6645dd84a86833d901b5a2dda18222cbde7f317/app/src/main/res/drawable-hdpi/ic_visibility_black_18dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/nc_anim1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ice1000/AIAndroid/d6645dd84a86833d901b5a2dda18222cbde7f317/app/src/main/res/drawable-hdpi/nc_anim1.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/nc_anim2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ice1000/AIAndroid/d6645dd84a86833d901b5a2dda18222cbde7f317/app/src/main/res/drawable-hdpi/nc_anim2.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/nc_anim3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ice1000/AIAndroid/d6645dd84a86833d901b5a2dda18222cbde7f317/app/src/main/res/drawable-hdpi/nc_anim3.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/nc_anim4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ice1000/AIAndroid/d6645dd84a86833d901b5a2dda18222cbde7f317/app/src/main/res/drawable-hdpi/nc_anim4.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/nc_anim5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ice1000/AIAndroid/d6645dd84a86833d901b5a2dda18222cbde7f317/app/src/main/res/drawable-hdpi/nc_anim5.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ritsu_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ice1000/AIAndroid/d6645dd84a86833d901b5a2dda18222cbde7f317/app/src/main/res/drawable-hdpi/ritsu_1.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ritsu_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ice1000/AIAndroid/d6645dd84a86833d901b5a2dda18222cbde7f317/app/src/main/res/drawable-hdpi/ritsu_2.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ritsu_2_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ice1000/AIAndroid/d6645dd84a86833d901b5a2dda18222cbde7f317/app/src/main/res/drawable-hdpi/ritsu_2_round.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ritsu_3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ice1000/AIAndroid/d6645dd84a86833d901b5a2dda18222cbde7f317/app/src/main/res/drawable-hdpi/ritsu_3.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/round_background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ice1000/AIAndroid/d6645dd84a86833d901b5a2dda18222cbde7f317/app/src/main/res/drawable-hdpi/round_background.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/round_fore_dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ice1000/AIAndroid/d6645dd84a86833d901b5a2dda18222cbde7f317/app/src/main/res/drawable-hdpi/round_fore_dark.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/round_fore_light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ice1000/AIAndroid/d6645dd84a86833d901b5a2dda18222cbde7f317/app/src/main/res/drawable-hdpi/round_fore_light.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_account_circle_black_18dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ice1000/AIAndroid/d6645dd84a86833d901b5a2dda18222cbde7f317/app/src/main/res/drawable-mdpi/ic_account_circle_black_18dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_book_black_18dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ice1000/AIAndroid/d6645dd84a86833d901b5a2dda18222cbde7f317/app/src/main/res/drawable-mdpi/ic_book_black_18dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_settings_black_18dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ice1000/AIAndroid/d6645dd84a86833d901b5a2dda18222cbde7f317/app/src/main/res/drawable-mdpi/ic_settings_black_18dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_visibility_black_18dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ice1000/AIAndroid/d6645dd84a86833d901b5a2dda18222cbde7f317/app/src/main/res/drawable-mdpi/ic_visibility_black_18dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_account_circle_black_18dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ice1000/AIAndroid/d6645dd84a86833d901b5a2dda18222cbde7f317/app/src/main/res/drawable-xhdpi/ic_account_circle_black_18dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_book_black_18dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ice1000/AIAndroid/d6645dd84a86833d901b5a2dda18222cbde7f317/app/src/main/res/drawable-xhdpi/ic_book_black_18dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_settings_black_18dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ice1000/AIAndroid/d6645dd84a86833d901b5a2dda18222cbde7f317/app/src/main/res/drawable-xhdpi/ic_settings_black_18dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_visibility_black_18dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ice1000/AIAndroid/d6645dd84a86833d901b5a2dda18222cbde7f317/app/src/main/res/drawable-xhdpi/ic_visibility_black_18dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_account_circle_black_18dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ice1000/AIAndroid/d6645dd84a86833d901b5a2dda18222cbde7f317/app/src/main/res/drawable-xxhdpi/ic_account_circle_black_18dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_book_black_18dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ice1000/AIAndroid/d6645dd84a86833d901b5a2dda18222cbde7f317/app/src/main/res/drawable-xxhdpi/ic_book_black_18dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_settings_black_18dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ice1000/AIAndroid/d6645dd84a86833d901b5a2dda18222cbde7f317/app/src/main/res/drawable-xxhdpi/ic_settings_black_18dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_settings_white_18dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ice1000/AIAndroid/d6645dd84a86833d901b5a2dda18222cbde7f317/app/src/main/res/drawable-xxhdpi/ic_settings_white_18dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_visibility_black_18dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ice1000/AIAndroid/d6645dd84a86833d901b5a2dda18222cbde7f317/app/src/main/res/drawable-xxhdpi/ic_visibility_black_18dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/bd_wallet_bottom_1_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
8 |
11 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/bg_dredge_tips_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
8 |
11 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/colorful.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
14 |
15 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/nc_floating.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
7 |
9 |
11 |
13 |
15 |
17 |
19 |
21 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/progress_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/test.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/app/src/main/res/layout-v11/toolbar.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
19 |
20 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_about_me.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
13 |
14 |
17 |
21 |
22 |
30 |
31 |
38 |
39 |
40 |
46 |
47 |
53 |
54 |
60 |
61 |
62 |
63 |
69 |
70 |
73 |
74 |
75 |
76 |
77 |
78 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_delete.xml:
--------------------------------------------------------------------------------
1 |
2 |
13 |
14 |
19 |
20 |
31 |
32 |
37 |
52 |
67 |
68 |
69 |
70 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_github.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
12 |
13 |
19 |
20 |
21 |
22 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_login.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
18 |
19 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
61 |
62 |
72 |
73 |
74 |
80 |
81 |
86 |
87 |
88 |
89 |
90 |
91 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
12 |
13 |
14 |
15 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main_header.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
29 |
30 |
31 |
32 |
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_rename.xml:
--------------------------------------------------------------------------------
1 |
2 |
14 |
15 |
20 |
21 |
32 |
33 |
42 |
43 |
48 |
49 |
63 |
64 |
78 |
79 |
80 |
81 |
82 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/content_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
14 |
15 |
19 |
20 |
24 |
25 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
45 |
46 |
52 |
53 |
61 |
62 |
63 |
64 |
70 |
71 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fab.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/message.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
18 |
19 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/toolbar.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_extend_usage.xml:
--------------------------------------------------------------------------------
1 |
2 |
45 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_main.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
11 |
16 |
21 |
22 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_other.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ice1000/AIAndroid/d6645dd84a86833d901b5a2dda18222cbde7f317/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-ldpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ice1000/AIAndroid/d6645dd84a86833d901b5a2dda18222cbde7f317/app/src/main/res/mipmap-ldpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ice1000/AIAndroid/d6645dd84a86833d901b5a2dda18222cbde7f317/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ice1000/AIAndroid/d6645dd84a86833d901b5a2dda18222cbde7f317/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/values-v21/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
13 |
14 |
28 |
29 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | #2b99ff
5 | #2e67a1
6 | #b300ff
7 | #39006b
8 |
9 |
10 |
11 |
12 |
13 | #f2f2f2
14 | #5b5b5b
15 |
16 | #4aa3df
17 |
18 | #007ff5
19 | #004779
20 |
21 | #f500e1
22 | #70017a
23 |
24 | #f50008
25 | #7a0101
26 |
27 | #00d8f5
28 | #016c7a
29 |
30 |
31 | #f2f2f2
32 | #e4e4e4
33 | #878787
34 |
35 | #e1f500
36 | #687a01
37 |
38 | #f55200
39 | #7a2501
40 |
41 | #2ecc71
42 |
43 | #00f562
44 | #017a33
45 |
46 |
47 | #ffffff
48 | #4edcff
49 | #96b8ff
50 | #ffffff
51 |
52 |
53 | #8682DF
54 | #76E784
55 | #5C8C9A
56 | #9DD77E
57 | #ffffff
58 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 | 20dp
6 | 10dp
7 | 58dp
8 | 20sp
9 | 65dp
10 |
11 | 3dp
12 | 6dp
13 | 5dp
14 | 15dp
15 | 12dp
16 |
17 | 20dp
18 | 2dp
19 | 25dp
20 | 10dp
21 | 80dp
22 | 50dp
23 | 24dp
24 |
25 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | 字符串分割机
3 | 选项
4 | 你好哦~
5 | 发送
6 | 冰封暂时还没想好这里写什么
7 | 想跟小律说点什么呢?
8 | 确认
9 | 取消
10 | 确认删除本条消息记录吗?
11 |
12 | 姓名:冰封。\n\n人物介绍:本APP的开发者,代码极其高产,性格污而暖,爱好哲♂学,爱好足球,爱好翘课狂撸代码。。\n喜欢讲黄段子,喜欢在别人撕逼的时候去搅浑水,因为爱好装逼和讲黄段子,认识了一堆看起来智商120以上的狐♂朋狗友。\n很享受在APP里写“关于开发者”和在github里写README的感觉(笑)。在各大社交网站上使用上图作为头像,所以有时被称为脑残。由于五年前放荡不羁地起了个百度ID叫 @精灵谱尼 因此被宅吧吧友称为脑抽谱尼、脑抽君\n学编程学的很慢,可能是因为太傻。\n\n冰封:“本APP全面采用Material♂Design~♪(^∇^*)”\n但由于开发者太傻\n有些地方用的不太好,有什么问题去github上面issue我吧~\n\n本APP大多数效果仅针对Android5.0以上,强烈建议不要使用5.0以下的系统运行本APP!
13 |
14 | \n\n自律思考固定炮台,日本漫画家松井优征所著漫画及其改编动画《暗杀教室》中登场的人物。来自挪威的机械暗杀者。被冰封用作APP的虚拟形象。
15 | 没有网络喵~
16 | 样例数据
17 | 我萌吗?
18 | 刷新
19 | 清空消息记录
20 | 那么。。。名字叫?
21 | PLAuto studio
22 | 扩展功能
23 | 书本总结
24 | 请问有什么我能做的吗?
25 | 参与开发
26 | 联系作者
27 | 查看源码
28 |
29 | 打开侧滑菜单
30 | 关闭侧滑菜单
31 |
32 |
33 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
15 |
16 |
23 |
24 |
27 |
28 |
31 |
32 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/app/src/test/java/com/tesla/ai/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.tesla.ai;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * To work on unit tests, switch the Test Artifact in the Build Variants view.
9 | */
10 | public class ExampleUnitTest {
11 | @Test
12 | public void addition_isCorrect() throws Exception {
13 | assertEquals(4, 2 + 2);
14 | }
15 | }
--------------------------------------------------------------------------------
/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.0.0-beta6'
9 |
10 | // NOTE: Do not place your application dependencies here; they belong
11 | // in the individual module build.gradle files
12 | }
13 | }
14 |
15 | allprojects {
16 | repositories {
17 | jcenter()
18 | }
19 | }
20 |
21 | task clean(type: Delete) {
22 | delete rootProject.buildDir
23 | }
24 |
--------------------------------------------------------------------------------
/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 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ice1000/AIAndroid/d6645dd84a86833d901b5a2dda18222cbde7f317/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Fri Jan 22 20:44:44 CST 2016
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.10-all.zip
7 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------