9 |
10 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/1642010646.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JunXiaoRuo/unicom/9767299bc0ec28ca41f42c3b1a9417a641c9bd6f/1642010646.jpg
--------------------------------------------------------------------------------
/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 |
635 | Copyright (C)
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 | Copyright (C)
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 | ## 云免QQ群:914950367
2 | ## 联通流量监控
3 | ****
4 | ### 开源不易,点一个Stars吧,你可以任意的下载本仓库代码进行二次开发,请保留原作者版权信息,谢谢。
5 | ### 联系方式:QQ(1813774883)、酷安(君小若)、微博(这是君若)、哔哩哔哩(君小若呀)
6 | #### 本仓库将进行封存,暂不进行更新,感谢大家支持。
7 | ### 最新版本下载
8 | ### https://wwa.lanzoui.com/b016pelqj 密码:h28r
9 | ## 捐助
10 | ### 
11 | ### 
12 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'com.android.application'
3 | }
4 |
5 |
6 | android {
7 | compileSdkVersion 30
8 | buildToolsVersion '30.0.3'
9 |
10 | defaultConfig {
11 | applicationId "com.junruo.jiankong"
12 | minSdkVersion 19
13 | targetSdkVersion 30
14 | versionCode 8
15 | versionName '2.0'
16 |
17 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
18 | }
19 |
20 | buildTypes {
21 | release {
22 | minifyEnabled false
23 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
24 | }
25 | }
26 | compileOptions {
27 | sourceCompatibility JavaVersion.VERSION_1_8
28 | targetCompatibility JavaVersion.VERSION_1_8
29 | }
30 |
31 | /* viewBinding {
32 | enabled = true
33 | }*/
34 | buildFeatures{
35 | dataBinding = true
36 | // for view binding :
37 | viewBinding = true
38 | }
39 | lintOptions {
40 | checkReleaseBuilds false
41 | abortOnError false
42 | }
43 | }
44 |
45 | dependencies {
46 |
47 | implementation 'androidx.appcompat:appcompat:1.2.0'
48 | implementation 'com.google.android.material:material:1.2.1'
49 | implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
50 | testImplementation 'junit:junit:4.+'
51 | androidTestImplementation 'androidx.test.ext:junit:1.1.2'
52 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
53 |
54 | implementation 'com.alibaba:fastjson:1.2.73'
55 |
56 |
57 |
58 | implementation 'com.squareup.okhttp3:okhttp:3.9.0'
59 | // okhttp3 网络请求模块
60 | implementation 'com.lzy.net:okhttputils:1.8.1'
61 | implementation 'com.github.medyo:fancybuttons:1.9.1'
62 |
63 |
64 | }
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
--------------------------------------------------------------------------------
/app/release/output-metadata.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": 2,
3 | "artifactType": {
4 | "type": "APK",
5 | "kind": "Directory"
6 | },
7 | "applicationId": "com.junruo.jiankong",
8 | "variantName": "release",
9 | "elements": [
10 | {
11 | "type": "SINGLE",
12 | "filters": [],
13 | "versionCode": 8,
14 | "versionName": "2.0",
15 | "outputFile": "app-release.apk"
16 | }
17 | ]
18 | }
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/junruo/jiankong/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.junruo.jiankong;
2 |
3 | import android.content.Context;
4 |
5 | import androidx.test.platform.app.InstrumentationRegistry;
6 | import androidx.test.ext.junit.runners.AndroidJUnit4;
7 |
8 | import org.junit.Test;
9 | import org.junit.runner.RunWith;
10 |
11 | import static org.junit.Assert.*;
12 |
13 | /**
14 | * Instrumented test, which will execute on an Android device.
15 | *
16 | * @see Testing documentation
17 | */
18 | @RunWith(AndroidJUnit4.class)
19 | public class ExampleInstrumentedTest {
20 | @Test
21 | public void useAppContext() {
22 | // Context of the app under test.
23 | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
24 | assertEquals("com.junruo.jiankong", appContext.getPackageName());
25 | }
26 | }
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
10 |
12 |
13 |
14 |
15 |
16 |
17 |
26 |
28 |
29 |
30 |
31 |
32 |
33 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
44 |
45 |
46 |
47 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/app/src/main/ic_launcher-playstore.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JunXiaoRuo/unicom/9767299bc0ec28ca41f42c3b1a9417a641c9bd6f/app/src/main/ic_launcher-playstore.png
--------------------------------------------------------------------------------
/app/src/main/java/com/junruo/jiankong/CrashHandler.java:
--------------------------------------------------------------------------------
1 | package com.junruo.jiankong;
2 |
3 | import java.io.BufferedReader;
4 | import java.io.File;
5 | import java.io.FileFilter;
6 | import java.io.FileInputStream;
7 | import java.io.FileNotFoundException;
8 | import java.io.FileOutputStream;
9 | import java.io.IOException;
10 | import java.io.InputStreamReader;
11 | import java.io.PrintWriter;
12 | import java.io.StringWriter;
13 | import java.io.Writer;
14 | import java.lang.Thread.UncaughtExceptionHandler;
15 | import java.lang.reflect.Field;
16 | import java.text.DateFormat;
17 | import java.text.SimpleDateFormat;
18 | import java.util.Arrays;
19 | import java.util.Comparator;
20 | import java.util.Date;
21 | import java.util.HashMap;
22 | import java.util.Map;
23 |
24 | import android.content.Context;
25 | import android.content.pm.PackageInfo;
26 | import android.content.pm.PackageManager;
27 | import android.content.pm.PackageManager.NameNotFoundException;
28 | import android.os.Build;
29 | import android.os.Environment;
30 | import android.os.Looper;
31 | import android.util.Log;
32 | import android.widget.Toast;
33 |
34 | /**
35 | * UncaughtException处理类,当程序发生Uncaught异常的时候,有该类来接管程序,并记录发送错误报告.
36 | * 需要在Application中注册,为了要在程序启动器就监控整个程序。
37 | * fenghaitao
38 | */
39 | public class CrashHandler implements UncaughtExceptionHandler {
40 |
41 | public static final String TAG = "CrashHandler";
42 |
43 | //系统默认的UncaughtException处理类
44 | private Thread.UncaughtExceptionHandler mDefaultHandler;
45 | //CrashHandler实例
46 | private static CrashHandler instance;
47 | //程序的Context对象
48 | private Context mContext;
49 | //用来存储设备信息和异常信息
50 | private Map infos = new HashMap();
51 |
52 | //用于格式化日期,作为日志文件名的一部分
53 | private DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss");
54 |
55 | //日志文件存储路径
56 | private String path = "/storage/emulated/0/Android/data/com.junruo.jiankong/files/crash/";
57 | //最大文件数量,超过数量即删除旧日志文件
58 | private int limitLogCount = 50;
59 |
60 | /** 保证只有一个CrashHandler实例 */
61 | private CrashHandler() {}
62 |
63 | /** 获取CrashHandler实例 ,单例模式 */
64 | public static CrashHandler getInstance() {
65 | if(instance == null)
66 | instance = new CrashHandler();
67 | return instance;
68 | }
69 |
70 | /**
71 | * 初始化
72 | */
73 | public void init(Context context) {
74 | mContext = context;
75 | //获取系统默认的UncaughtException处理器
76 | mDefaultHandler = Thread.getDefaultUncaughtExceptionHandler();
77 | //设置该CrashHandler为程序的默认处理器
78 | Thread.setDefaultUncaughtExceptionHandler(this);
79 | }
80 |
81 | /**
82 | * 当UncaughtException发生时会转入该函数来处理
83 | */
84 | @Override
85 | public void uncaughtException(Thread thread, Throwable ex) {
86 | if (!handleException(ex) && mDefaultHandler != null) {
87 | //如果用户没有处理则让系统默认的异常处理器来处理
88 | mDefaultHandler.uncaughtException(thread, ex);
89 | } else {
90 | try {
91 | Thread.sleep(3000);
92 | } catch (InterruptedException e) {
93 | Log.e(TAG, "error : ", e);
94 | }
95 | //退出程序
96 | android.os.Process.killProcess(android.os.Process.myPid());
97 | System.exit(1);
98 | }
99 | }
100 |
101 | /**
102 | * 自定义错误处理,收集错误信息 发送错误报告等操作均在此完成.
103 | *
104 | * @param ex
105 | * @return true:如果处理了该异常信息;否则返回false.
106 | */
107 | private boolean handleException(Throwable ex) {
108 | if (ex == null) {
109 | return false;
110 | }
111 | //收集设备参数信息
112 | collectDeviceInfo(mContext);
113 |
114 | //使用Toast来显示异常信息
115 | new Thread() {
116 | @Override
117 | public void run() {
118 | Looper.prepare();
119 | Toast.makeText(mContext, "很抱歉,程序出现异常,即将退出.崩溃日志存储在"+path+"下,可将本目录下最新文件发给开发者", Toast.LENGTH_SHORT).show();
120 | Looper.loop();
121 | }
122 | }.start();
123 | //控制日志文件数量
124 | limitAppLogCount();
125 | //保存日志文件
126 | saveCatchInfo2File(ex);
127 | return true;
128 | }
129 |
130 | /**
131 | * 收集设备参数信息
132 | * @param ctx
133 | */
134 | public void collectDeviceInfo(Context ctx) {
135 | try {
136 | PackageManager pm = ctx.getPackageManager();
137 | PackageInfo pi = pm.getPackageInfo(ctx.getPackageName(), PackageManager.GET_ACTIVITIES);
138 | if (pi != null) {
139 | String versionName = pi.versionName == null ? "null" : pi.versionName;
140 | String versionCode = pi.versionCode + "";
141 | infos.put("versionName", versionName);
142 | infos.put("versionCode", versionCode);
143 | }
144 | } catch (NameNotFoundException e) {
145 | Log.e(TAG, "an error occured when collect package info", e);
146 | }
147 | Field[] fields = Build.class.getDeclaredFields();
148 | for (Field field : fields) {
149 | try {
150 | field.setAccessible(true);
151 | infos.put(field.getName(), field.get(null).toString());
152 | Log.d(TAG, field.getName() + " : " + field.get(null));
153 | } catch (Exception e) {
154 | Log.e(TAG, "an error occured when collect crash info", e);
155 | }
156 | }
157 | }
158 |
159 | /**
160 | * 保存错误信息到文件中
161 | *
162 | * @param ex
163 | * @return 返回文件名称,便于将文件传送到服务器
164 | */
165 | private String saveCatchInfo2File(Throwable ex) {
166 |
167 | StringBuffer sb = new StringBuffer();
168 | for (Map.Entry entry : infos.entrySet()) {
169 | String key = entry.getKey();
170 | String value = entry.getValue();
171 | sb.append(key + "=" + value + "\n");
172 | }
173 |
174 | Writer writer = new StringWriter();
175 | PrintWriter printWriter = new PrintWriter(writer);
176 | ex.printStackTrace(printWriter);
177 | Throwable cause = ex.getCause();
178 | while (cause != null) {
179 | cause.printStackTrace(printWriter);
180 | cause = cause.getCause();
181 | }
182 | printWriter.close();
183 | String result = writer.toString();
184 | sb.append(result);
185 | try {
186 | long timestamp = System.currentTimeMillis();
187 | String time = formatter.format(new Date());
188 | //日志文件名称
189 | String fileName = "crash-" + time + "-" + timestamp + ".txt";
190 | if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
191 | File dir = new File(path);
192 | if (!dir.exists()) {
193 | dir.mkdirs();
194 | }
195 | FileOutputStream fos = new FileOutputStream(path + fileName);
196 | fos.write(sb.toString().getBytes());
197 | //发送给开发人员
198 | sendCrashLog2PM(path+fileName);
199 | fos.close();
200 | }
201 | return fileName;
202 | } catch (Exception e) {
203 | Log.e(TAG, "an error occured while writing file...", e);
204 | }
205 | return null;
206 | }
207 |
208 | /**
209 | * 将捕获的导致崩溃的错误信息发送给开发人员
210 | *
211 | * 目前只将log日志保存在sdcard 和输出到LogCat中,并未发送给后台。
212 | */
213 | private void sendCrashLog2PM(String fileName){
214 | if(!new File(fileName).exists()){
215 | Toast.makeText(mContext, "日志文件不存在!", Toast.LENGTH_SHORT).show();
216 | return;
217 | }
218 | FileInputStream fis = null;
219 | BufferedReader reader = null;
220 | String s = null;
221 | try {
222 | fis = new FileInputStream(fileName);
223 | reader = new BufferedReader(new InputStreamReader(fis, "GBK"));
224 | while(true){
225 | s = reader.readLine();
226 | if(s == null) break;
227 | //由于目前尚未确定以何种方式发送,所以先打出log日志。
228 | //TODO 发送文件到服务器
229 | Log.i("info", s.toString());
230 | }
231 | } catch (FileNotFoundException e) {
232 | e.printStackTrace();
233 | } catch (IOException e) {
234 | e.printStackTrace();
235 | }finally{ // 关闭流
236 | try {
237 | reader.close();
238 | fis.close();
239 | } catch (IOException e) {
240 | e.printStackTrace();
241 | }
242 | }
243 | }
244 |
245 | /**
246 | * 最大文件数量
247 | */
248 | private void limitAppLogCount() {
249 | try {
250 | File file = new File(path);
251 | if (file != null && file.isDirectory()) {
252 | File[] files = file.listFiles(new CrashLogFliter());
253 | if(files != null && files.length >0) {
254 | // Arrays.sort(files, comparator);
255 | if (files.length > limitLogCount) {
256 | for (int i = 0 ; i < files.length - 1 ;i++) {
257 | files[i+1].delete();
258 | }
259 | }
260 | }
261 | }
262 | }catch (Exception e) {
263 | Log.e(TAG, "limitAppLogCount - "+e.getMessage());
264 | }
265 | }
266 |
267 | /**
268 | * 日志文件按日志大小排序
269 | */
270 | private Comparator comparator = new Comparator() {
271 | @Override
272 | public int compare(File l, File r) {
273 | if (l.lastModified() > r.lastModified())
274 | return 1;
275 | if (l.lastModified() < r.lastModified())
276 | return -1;
277 | return 0;
278 | }
279 | };
280 | /**
281 | * 过滤.txt的文件
282 | */
283 | public class CrashLogFliter implements FileFilter {
284 | @Override
285 | public boolean accept(File file) {
286 | if (file.getName().endsWith(".txt"))
287 | return true;
288 | return false;
289 | }
290 | }
291 | }
292 |
293 |
--------------------------------------------------------------------------------
/app/src/main/java/com/junruo/jiankong/GetCookieActivity.java:
--------------------------------------------------------------------------------
1 | package com.junruo.jiankong;
2 |
3 | import android.annotation.SuppressLint;
4 | import android.annotation.TargetApi;
5 | import android.app.Activity;
6 | import android.content.ClipData;
7 | import android.content.Context;
8 | import android.content.Intent;
9 | import android.content.SharedPreferences;
10 | import android.net.Uri;
11 | import android.net.http.SslError;
12 | import android.os.Build;
13 | import android.os.Bundle;
14 | import android.util.Log;
15 | import android.view.KeyEvent;
16 | import android.view.View;
17 | import android.webkit.CookieManager;
18 | import android.webkit.CookieSyncManager;
19 | import android.webkit.SslErrorHandler;
20 | import android.webkit.ValueCallback;
21 | import android.webkit.WebChromeClient;
22 | import android.webkit.WebSettings;
23 | import android.webkit.WebView;
24 | import android.webkit.WebViewClient;
25 |
26 | import androidx.appcompat.app.AppCompatActivity;
27 |
28 |
29 | import com.junruo.jiankong.databinding.ActivityGetcookieBinding;
30 | import com.junruo.jiankong.server.FloatingImageDisplayService;
31 |
32 | import java.io.UnsupportedEncodingException;
33 |
34 | import static android.view.KeyEvent.KEYCODE_BACK;
35 |
36 |
37 | public class GetCookieActivity extends AppCompatActivity {
38 |
39 | public static String URL = "http://www.baidu.com";
40 |
41 | private ValueCallback uploadMessage;
42 | private ValueCallback uploadMessageAboveL;
43 | private final static int FILE_CHOOSER_RESULT_CODE = 10000;
44 | private ActivityGetcookieBinding binding;
45 | private WebView webView,mainWeb;
46 |
47 | @SuppressLint("SetJavaScriptEnabled")
48 | @Override
49 | protected void onCreate(Bundle savedInstanceState) {
50 | super.onCreate(savedInstanceState);
51 | setContentView(R.layout.activity_getcookie);
52 |
53 |
54 |
55 | // 创建SharedPreferences对象用于存储公告信息,并将其私有化
56 | SharedPreferences share = getSharedPreferences("gonggao",
57 | Context.MODE_PRIVATE);
58 | URL = share.getString("getcookie","http://www.baidu.com");
59 |
60 |
61 | CookieSyncManager.createInstance(this);
62 | CookieManager.getInstance().removeAllCookie();
63 |
64 | binding = ActivityGetcookieBinding.inflate(getLayoutInflater());
65 | View view = binding.getRoot();
66 | setContentView(view);
67 |
68 | mainWeb=binding.uptikuWebview;
69 | mainWeb.setBackgroundColor(0x00000000);
70 | mainWeb.setLayerType(View.LAYER_TYPE_HARDWARE,null);
71 |
72 | WebSettings webSettings = mainWeb.getSettings();
73 | webSettings.setJavaScriptEnabled(true);
74 | webSettings.setDomStorageEnabled(true);
75 |
76 | //设置自适应屏幕,两者合用
77 | webSettings.setUseWideViewPort(true);
78 | webSettings.setLoadWithOverviewMode(true);
79 |
80 | //其他细节操作
81 | webSettings.setCacheMode(WebSettings.LOAD_NO_CACHE);
82 | webSettings.setLoadsImagesAutomatically(true);
83 | webSettings.setDefaultTextEncodingName("utf-8");
84 |
85 |
86 |
87 | mainWeb.setWebViewClient(new WebViewClient() {
88 | @Override
89 | public boolean shouldOverrideUrlLoading(WebView view, String url) {
90 | view.loadUrl(url);
91 | return true;
92 | }
93 |
94 |
95 | public void onPageFinished(WebView view, String url) {
96 | //编写 javaScript方法
97 | view.loadUrl("javascript:document.getElementsByTagName('b').remove();");
98 |
99 |
100 |
101 | super.onPageFinished(view, url);
102 | }
103 |
104 |
105 |
106 | @Override
107 | public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error){
108 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
109 | mainWeb.getSettings()
110 | .setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
111 | }
112 | }
113 | });
114 |
115 | mainWeb.setWebChromeClient(new WebChromeClient() {
116 |
117 | // For Android < 3.0
118 | public void openFileChooser(ValueCallback valueCallback) {
119 | uploadMessage = valueCallback;
120 | openImageChooserActivity();
121 | }
122 |
123 | // For Android >= 3.0
124 | public void openFileChooser(ValueCallback valueCallback, String acceptType) {
125 | uploadMessage = valueCallback;
126 | openImageChooserActivity();
127 | }
128 |
129 | //For Android >= 4.1
130 | public void openFileChooser(ValueCallback valueCallback, String acceptType, String capture) {
131 | uploadMessage = valueCallback;
132 | openImageChooserActivity();
133 | }
134 |
135 | // For Android >= 5.0
136 | @Override
137 | public boolean onShowFileChooser(WebView webView, ValueCallback filePathCallback, FileChooserParams fileChooserParams) {
138 | uploadMessageAboveL = filePathCallback;
139 | openImageChooserActivity();
140 | return true;
141 | }
142 | });
143 |
144 | mainWeb.loadUrl(URL);
145 |
146 | initView();
147 | }
148 |
149 | private void openImageChooserActivity() {
150 | Intent i = new Intent(Intent.ACTION_GET_CONTENT);
151 | i.addCategory(Intent.CATEGORY_OPENABLE);
152 | i.setType("image/*");
153 | startActivityForResult(Intent.createChooser(i, "Image Chooser"), FILE_CHOOSER_RESULT_CODE);
154 | }
155 |
156 | @Override
157 | protected void onActivityResult(int requestCode, int resultCode, Intent data) {
158 | super.onActivityResult(requestCode, resultCode, data);
159 | if (requestCode == FILE_CHOOSER_RESULT_CODE) {
160 | if (null == uploadMessage && null == uploadMessageAboveL) return;
161 | Uri result = data == null || resultCode != RESULT_OK ? null : data.getData();
162 | if (uploadMessageAboveL != null) {
163 | onActivityResultAboveL(requestCode, resultCode, data);
164 | } else if (uploadMessage != null) {
165 | uploadMessage.onReceiveValue(result);
166 | uploadMessage = null;
167 | }
168 | }
169 | }
170 |
171 | @TargetApi(Build.VERSION_CODES.LOLLIPOP)
172 | private void onActivityResultAboveL(int requestCode, int resultCode, Intent intent) {
173 | if (requestCode != FILE_CHOOSER_RESULT_CODE || uploadMessageAboveL == null)
174 | return;
175 | Uri[] results = null;
176 | if (resultCode == Activity.RESULT_OK) {
177 | if (intent != null) {
178 | String dataString = intent.getDataString();
179 | ClipData clipData = intent.getClipData();
180 | if (clipData != null) {
181 | results = new Uri[clipData.getItemCount()];
182 | for (int i = 0; i < clipData.getItemCount(); i++) {
183 | ClipData.Item item = clipData.getItemAt(i);
184 | results[i] = item.getUri();
185 | }
186 | }
187 | if (dataString != null)
188 | results = new Uri[]{Uri.parse(dataString)};
189 | }
190 | }
191 | uploadMessageAboveL.onReceiveValue(results);
192 | uploadMessageAboveL = null;
193 | }
194 |
195 | public boolean onKeyDown(int keyCode, KeyEvent event) {
196 | if ((keyCode == KEYCODE_BACK) && mainWeb.canGoBack()) {
197 | mainWeb.goBack();
198 | return true;
199 | }
200 | return super.onKeyDown(keyCode, event);
201 | }
202 |
203 |
204 | private void initView() {
205 |
206 |
207 | binding.aAboutBtnGoback.setOnClickListener(v ->{
208 | CookieSyncManager.createInstance(this);
209 | CookieManager.getInstance().removeAllCookie();
210 | goBack();
211 | });
212 | }
213 |
214 |
215 | private void goBack() {
216 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
217 | finishAfterTransition();
218 | } else {
219 | finish();
220 | }
221 | }
222 | }
223 |
--------------------------------------------------------------------------------
/app/src/main/java/com/junruo/jiankong/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.junruo.jiankong;
2 |
3 | import androidx.annotation.RequiresApi;
4 | import androidx.appcompat.app.AlertDialog;
5 | import androidx.appcompat.app.AppCompatActivity;
6 | import androidx.core.app.ActivityCompat;
7 |
8 | import android.annotation.SuppressLint;
9 | import android.app.Activity;
10 | import android.content.ClipData;
11 | import android.content.ClipboardManager;
12 | import android.content.Context;
13 | import android.content.DialogInterface;
14 | import android.content.Intent;
15 | import android.content.SharedPreferences;
16 | import android.content.pm.PackageInfo;
17 | import android.content.pm.PackageManager;
18 | import android.content.pm.ShortcutInfo;
19 | import android.content.pm.ShortcutManager;
20 | import android.graphics.drawable.Icon;
21 | import android.net.Uri;
22 | import android.os.Build;
23 | import android.os.Bundle;
24 | import android.provider.Settings;
25 | import android.util.Log;
26 | import android.view.View;
27 | import android.widget.Toast;
28 |
29 | import com.alibaba.fastjson.JSONArray;
30 | import com.alibaba.fastjson.JSONObject;
31 | import com.junruo.jiankong.databinding.ActivityMainBinding;
32 | import com.junruo.jiankong.server.FloatingImageDisplayService;
33 | import com.lzy.okhttputils.OkHttpUtils;
34 | import com.lzy.okhttputils.callback.StringCallback;
35 |
36 | import java.io.File;
37 | import java.text.DecimalFormat;
38 | import java.text.SimpleDateFormat;
39 | import java.util.Arrays;
40 | import java.util.Date;
41 |
42 | import okhttp3.Call;
43 | import okhttp3.Response;
44 |
45 | public class MainActivity extends AppCompatActivity {
46 |
47 | private ActivityMainBinding binding;
48 |
49 | private String dayin = "";//打印流量包
50 | private Double mianliu=0.00;//总免流
51 | private Double zong=0.00;//套餐总量
52 | private Double yong=0.00;//套餐已用
53 | private Double sheng =0.00;//剩余流量
54 | private Double ben = 0.00;//本次免流
55 | private Double tiao = 0.00;//本次消耗
56 |
57 | private Double dingz = 0.00;//定向总量
58 | private Double dingy = 0.00;//定向已用
59 | private Double dings = 0.00;//定向剩余
60 |
61 | private String orone = "yes";//是否首次获取
62 |
63 | private Double onem = 0.00;//初始化本次免流
64 | private Double onet = 0.00;//初始化本次消耗
65 |
66 | private String time ;
67 |
68 | private String cookie = "";//储存cookie信息
69 |
70 | private String versionName = "";
71 | private int versioncode;
72 | private String oldVersion ;
73 |
74 | private String NewVersion,versionmsg,getcookie,gonggao,notice;
75 |
76 | private String gao,kuan,xgao,xkuan;
77 |
78 | //定义读写权限
79 | private static final int REQUEST_EXTERNAL_STORAGE = 1;
80 |
81 | private static String[] PERMISSIONS_STORAGE = {
82 | "android.permission.READ_EXTERNAL_STORAGE",
83 | "android.permission.WRITE_EXTERNAL_STORAGE" };
84 |
85 | //动态菜单
86 | private ShortcutManager shortcutManager;
87 |
88 | public static Context context;
89 |
90 | @RequiresApi(api = Build.VERSION_CODES.M)
91 | @Override
92 | protected void onCreate(Bundle savedInstanceState) {
93 | super.onCreate(savedInstanceState);
94 | CrashHandler.getInstance().init(getApplicationContext());
95 | setContentView(R.layout.activity_main);
96 | binding = ActivityMainBinding.inflate(getLayoutInflater());
97 | View view = binding.getRoot();
98 | setContentView(view);
99 |
100 | //获取当前版本
101 | oldVersion = getAppVersionName(this);
102 |
103 | //初始化
104 | initView();
105 |
106 | //获取读写外部存储权限
107 | verifyStoragePermissions(this);
108 |
109 | }
110 |
111 | //申请读写权限
112 | public void verifyStoragePermissions(Activity activity) {
113 | try {
114 | //检测是否有写的权限
115 | int permission = ActivityCompat.checkSelfPermission(activity,
116 | "android.permission.WRITE_EXTERNAL_STORAGE");
117 | if (permission != PackageManager.PERMISSION_GRANTED) {
118 | // 没有写的权限,去申请写的权限,会弹出对话框
119 | ActivityCompat.requestPermissions(activity, PERMISSIONS_STORAGE,REQUEST_EXTERNAL_STORAGE);
120 | }else {
121 | File file = new File(getExternalFilesDir(null).toString()+"/crash/");
122 | //判断文件夹是否存在,如果不存在则创建文件夹
123 | if (!file.exists()) {
124 | boolean mkdir = file.mkdir();
125 |
126 | }
127 | }
128 | } catch (Exception e) {
129 | e.printStackTrace();
130 | }
131 | }
132 |
133 | //获取当前版本
134 | public String getAppVersionName(Context context) {
135 | try {
136 | // ---get the package info---
137 | PackageManager pm = context.getPackageManager();
138 | PackageInfo pi = pm.getPackageInfo(context.getPackageName(), 0);
139 | versionName = pi.versionName;
140 | versioncode = pi.versionCode;
141 | if (versionName == null || versionName.length() <= 0) {
142 | return "";
143 | }
144 | } catch (Exception e) {
145 | Log.e("VersionInfo", "Exception", e);
146 | }
147 | return versionName;
148 | }
149 |
150 |
151 | //初始化
152 | private void initView() {
153 |
154 | Intent intent = new Intent(this, toumingActivity.class);
155 | intent.setAction(Intent.ACTION_VIEW);
156 | //动态菜单
157 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) {
158 | shortcutManager = getSystemService(ShortcutManager.class);
159 | ShortcutInfo shortcut = new ShortcutInfo.Builder(this, "id1")
160 | .setShortLabel("监控")
161 | .setLongLabel("监控")
162 | .setIcon(Icon.createWithResource(this, R.mipmap.ic_launcher))
163 | .setIntent(intent)
164 | .build();
165 | /* ShortcutInfo shortcut2 = new ShortcutInfo.Builder(this, "id2")
166 | .setShortLabel("Web site")
167 | .setLongLabel("第二个")
168 | .setIcon(Icon.createWithResource(this, R.drawable.link))
169 | .setIntent(new Intent(Intent.ACTION_VIEW,
170 | Uri.parse("https://www.csdn.com/")))
171 | .build();*/
172 |
173 |
174 | shortcutManager.setDynamicShortcuts(Arrays.asList(shortcut));
175 | }
176 |
177 | //检查更新
178 | upupup();
179 |
180 | // 创建SharedPreferences对象用于获取Cookie信息,并将其私有化
181 | SharedPreferences share = getSharedPreferences("Cookie",
182 | Context.MODE_PRIVATE);
183 | // 获取编辑器来存储数据到sha redpreferences中
184 | cookie = share.getString("Cookie","");
185 | time = share.getString("time","");
186 | gao = share.getString("gao","320");
187 | xgao = share.getString("xgao","150");
188 | xkuan = share.getString("xkuan","200");
189 | kuan = share.getString("kuan","230");
190 |
191 |
192 | if (time.equals("")){
193 |
194 | }else {
195 | binding.shuaxin.setText(time);
196 | }
197 |
198 | binding.cookie.setText(cookie);
199 |
200 | binding.kuan.setText(kuan);
201 | binding.gao.setText(gao);
202 | binding.xkuan.setText(xkuan);
203 | binding.xgao.setText(xgao);
204 |
205 |
206 | OnClick();
207 |
208 |
209 | }
210 |
211 | private void OnClick() {
212 |
213 | binding.stop.setOnClickListener(v -> {//点击开始
214 | if (binding.cookie.getText().toString().equals("")){
215 | toast("请填写cookie后再登录!");
216 | }else {
217 | cookie = binding.cookie.getText().toString();
218 | //开始获取数据
219 | update();
220 | }
221 |
222 | });
223 |
224 |
225 | binding.join.setOnClickListener(v -> {
226 | //加群代码
227 |
228 | String key = "QE-4bRJCa2w2Tu4lnWNuRBx4NqlIL8Op";
229 | Intent intent = new Intent();
230 | intent.setData(Uri.parse("mqqopensdkapi://bizAgent/qm/qr?url=http%3A%2F%2Fqm.qq.com%2Fcgi-bin%2Fqm%2Fqr%3Ffrom%3Dapp%26p%3Dandroid%26jump_from%3Dwebapi%26k%3D" + key));
231 | // 此Flag可根据具体产品需要自定义,如设置,则在加群界面按返回,返回手Q主界面,不设置,按返回会返回到呼起产品界面 //intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
232 | try {
233 | startActivity(intent);
234 | toast("正在加群.....");
235 | return ;
236 | } catch (Exception e) {
237 | // 未安装手Q或安装的版本不支持
238 | toast("未安装手Q或安装的版本不支持.");
239 | return ;
240 | }
241 |
242 | });
243 |
244 |
245 | binding.get.setOnClickListener(v -> {
246 | Intent intent2 = new Intent(this,GetCookieActivity.class);
247 | AlertDialog alertDialog2 = new AlertDialog.Builder(MainActivity.this)
248 | .setTitle("警告")
249 | .setMessage("本功能为第三方支持,本软件不会保存此功能获取的所有返回信息,并在退出第三方获取cookie时,清除所有页面缓存信息,有更好的工具可以找我进行添加,介意者请自行通过抓包的方式获取cookie!")
250 | .setIcon(R.mipmap.ic_launcher)
251 | .setPositiveButton("我已知晓", new DialogInterface.OnClickListener() {//添加"Yes"按钮
252 | @Override
253 | public void onClick(DialogInterface dialogInterface, int i) {
254 | startActivity(intent2);
255 | }
256 | })
257 |
258 | .setNegativeButton("不同意", new DialogInterface.OnClickListener() {//添加取消
259 | @Override
260 | public void onClick(DialogInterface dialogInterface, int i) {
261 | }
262 | })
263 | .create();
264 | alertDialog2.show();
265 |
266 | });
267 |
268 |
269 | binding.clear.setOnClickListener(v -> {
270 | binding.cookie.setText("");
271 | toast("已清除");
272 | });
273 |
274 | binding.paste.setOnClickListener(v -> {
275 | String clipboardContent = getClipboardContent(this);
276 | binding.cookie.setText(clipboardContent);
277 | toast("已粘贴");
278 |
279 | });
280 |
281 | binding.usehelp.setOnClickListener(v -> {
282 |
283 | AlertDialog alertDialog2 = new AlertDialog.Builder(MainActivity.this)
284 | .setTitle("使用帮助")
285 | .setMessage(gonggao)
286 | .setIcon(R.mipmap.ic_launcher)
287 | .setPositiveButton("确定", new DialogInterface.OnClickListener() {//添加"Yes"按钮
288 | @Override
289 | public void onClick(DialogInterface dialogInterface, int i) {
290 |
291 | }
292 | })
293 |
294 | .create();
295 | alertDialog2.show();
296 |
297 | });
298 |
299 | binding.noticecv.setOnClickListener(v -> {
300 | AlertDialog alertDialog2 = new AlertDialog.Builder(MainActivity.this)
301 | .setTitle("公告")
302 | .setMessage(notice)
303 | .setIcon(R.mipmap.ic_launcher)
304 | .setPositiveButton("确定", new DialogInterface.OnClickListener() {//添加"Yes"按钮
305 | @Override
306 | public void onClick(DialogInterface dialogInterface, int i) {
307 |
308 | }
309 | })
310 |
311 | .create();
312 | alertDialog2.show();
313 | });
314 |
315 | binding.zhichi.setOnClickListener(v -> {
316 | Intent intent =new Intent(this, payActivity.class);
317 |
318 | AlertDialog alertDialog2 = new AlertDialog.Builder(MainActivity.this)
319 | .setTitle("赞助")
320 | .setMessage("每一次赞助都承载的希望,如果您觉得本软件还不错的话,您可以随意赞助。当然,也不会因为没有人赞助而添加会员机制。\n因为本软件永久免费。")
321 | .setIcon(R.mipmap.ic_launcher)
322 | .setPositiveButton("赞助", new DialogInterface.OnClickListener() {//添加"Yes"按钮
323 | @Override
324 | public void onClick(DialogInterface dialogInterface, int i) {
325 | startActivity(intent);
326 | toast("感谢您对本软件的支持!");
327 | }
328 | })
329 | .setNegativeButton("算了", new DialogInterface.OnClickListener() {//添加"no"按钮
330 | @Override
331 | public void onClick(DialogInterface dialogInterface, int i) {
332 | toast("嘤嘤嘤");
333 | }
334 | })
335 |
336 | .create();
337 | alertDialog2.show();
338 |
339 | });
340 |
341 | }
342 |
343 | //获取剪贴板内容
344 | public static String getClipboardContent(Context context) {
345 | ClipboardManager cm = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
346 | if (cm != null) {
347 | ClipData data = cm.getPrimaryClip();
348 | if (data != null && data.getItemCount() > 0) {
349 | ClipData.Item item = data.getItemAt(0);
350 | if (item != null) {
351 | CharSequence sequence = item.coerceToText(context);
352 | if (sequence != null) {
353 | return sequence.toString();
354 | }
355 | }
356 | }
357 | }
358 | return null;
359 | }
360 |
361 |
362 | //版本更新检查
363 | private void upupup() {
364 |
365 | try {
366 |
367 | OkHttpUtils.get("http://tool.chaoxing.zmorg.cn/api/appConfig.php?id=5&action=useConfig")
368 | .execute(new StringCallback() {
369 | @Override
370 | public void onSuccess(String s, Call call, Response response) {
371 |
372 | JSONObject json = JSONObject.parseObject(s);
373 |
374 | NewVersion = json.getString("version");
375 | versionmsg = json.getString("msg");
376 | getcookie = json.getString("getcookie");
377 | gonggao = json.getString("gonggao");
378 | notice = json.getString("notice");
379 |
380 | binding.notice.setText(notice);
381 |
382 |
383 | if (gonggao==null||gonggao.equals("")){
384 | gonggao = "很抱歉,你可能需要更新最新版才能看见最新的使用帮助,或者检查你的网络连接。请加群获取最新软件。QQ群:729376299";
385 | }
386 |
387 |
388 | // 创建SharedPreferences对象用于存储公告信息,并将其私有化
389 | SharedPreferences share = getSharedPreferences("gonggao",
390 | Context.MODE_PRIVATE);
391 | // 获取编辑器来存储数据到sharedpreferences中
392 | SharedPreferences.Editor editor = share.edit();
393 | editor.putString("gonggao",gonggao);
394 | editor.putString("getcookie",getcookie);
395 | editor.commit();
396 |
397 | if (!oldVersion.equals(NewVersion)) {
398 | AlertDialog alertDialog2 = new AlertDialog.Builder(MainActivity.this)
399 | .setTitle("有更新啦!")
400 | .setMessage(versionmsg)
401 | .setIcon(R.mipmap.ic_launcher)
402 | .setPositiveButton("更新", new DialogInterface.OnClickListener() {//添加"Yes"按钮
403 | @Override
404 | public void onClick(DialogInterface dialogInterface, int i) {
405 | String key = "QE-4bRJCa2w2Tu4lnWNuRBx4NqlIL8Op";
406 | Intent intent = new Intent();
407 | intent.setData(Uri.parse("mqqopensdkapi://bizAgent/qm/qr?url=http%3A%2F%2Fqm.qq.com%2Fcgi-bin%2Fqm%2Fqr%3Ffrom%3Dapp%26p%3Dandroid%26jump_from%3Dwebapi%26k%3D" + key));
408 | // 此Flag可根据具体产品需要自定义,如设置,则在加群界面按返回,返回手Q主界面,不设置,按返回会返回到呼起产品界面 //intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
409 | try {
410 | startActivity(intent);
411 | toast("正在加群.....");
412 | return ;
413 | } catch (Exception e) {
414 | // 未安装手Q或安装的版本不支持
415 | toast("未安装手Q或安装的版本不支持.");
416 | return ;
417 | }
418 |
419 |
420 | }
421 | })
422 |
423 | .setNegativeButton("待会更新", new DialogInterface.OnClickListener() {//添加取消
424 | @Override
425 | public void onClick(DialogInterface dialogInterface, int i) {
426 | }
427 | })
428 | .create();
429 | alertDialog2.show();
430 |
431 | }
432 | }
433 | });
434 |
435 | } catch (Exception e) {
436 | e.printStackTrace();
437 | }
438 |
439 |
440 | }
441 |
442 | @RequiresApi(api = Build.VERSION_CODES.M)
443 | public void startFloatingButtonService(View view) {
444 | if (binding.xfc.getText().toString().equals("显示悬浮窗")){
445 |
446 | if (binding.cookie.getText().toString().equals("")){
447 | toast("请填写cookie后再开启悬浮窗!");
448 | }else {
449 | if (FloatingImageDisplayService.isStarted) {
450 | binding.xfc.setText("关闭悬浮窗");
451 | return;
452 | }
453 | if (!Settings.canDrawOverlays(this)) {
454 | Toast.makeText(this, "当前无权限,请授权", Toast.LENGTH_SHORT);
455 | startActivityForResult(new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION, Uri.parse("package:" + getPackageName())), 1);
456 | } else {
457 | if (binding.shuaxin.getText().toString().equals("")){
458 | toast("请输入刷新时间后开启悬浮窗。");
459 | }else {
460 | // 创建SharedPreferences对象用于存储Cookie信息,并将其私有化
461 | SharedPreferences share = getSharedPreferences("Cookie",
462 | Context.MODE_PRIVATE);
463 | // 获取编辑器来存储数据到sharedpreferences中
464 | SharedPreferences.Editor editor = share.edit();
465 | editor.putString("time",binding.shuaxin.getText().toString());
466 | editor.putString("Cookie",binding.cookie.getText().toString());
467 | editor.putString("gao",binding.gao.getText().toString());
468 | editor.putString("kuan",binding.kuan.getText().toString());
469 | editor.putString("xgao",binding.xgao.getText().toString());
470 | editor.putString("xkuan",binding.xkuan.getText().toString());
471 | editor.commit();
472 | binding.xfc.setText("关闭悬浮窗");
473 |
474 | Intent intent = new Intent(MainActivity.this, FloatingImageDisplayService.class);
475 | startService(intent);
476 |
477 |
478 | }
479 | }
480 | }
481 |
482 | } else {
483 |
484 | Intent intent = new Intent(MainActivity.this, FloatingImageDisplayService.class);
485 | stopService(intent);
486 |
487 | binding.xfc.setText("显示悬浮窗");
488 |
489 | }
490 |
491 | }
492 |
493 |
494 |
495 | @RequiresApi(api = Build.VERSION_CODES.M)
496 | @Override
497 | protected void onActivityResult(int requestCode, int resultCode, Intent data) {
498 | super.onActivityResult(requestCode, resultCode, data);
499 | if (requestCode == 1) {
500 | if (!Settings.canDrawOverlays(this)) {
501 | } else {
502 | Toast.makeText(this, "授权成功", Toast.LENGTH_SHORT).show();
503 | //startService(new Intent(MainActivity.this, FloatingImageDisplayService.class));
504 | }
505 | }
506 | }
507 |
508 |
509 |
510 | //更新数据
511 | private void update(){
512 |
513 | //初始化数据防止累加
514 | mianliu=0.00;//总免流
515 | zong=0.00;//套餐总量
516 | yong=0.00;//套餐已用
517 | sheng =0.00;//剩余流量
518 | dingz = 0.00;//定向总量
519 | dingy = 0.00;//定向已用
520 | dings = 0.00;//定向剩余
521 |
522 | dayin = "";
523 | binding.dayin.setText("");
524 | //格式化double值
525 | DecimalFormat df = new DecimalFormat("0.000");
526 | Date day=new Date();
527 | SimpleDateFormat sj = new SimpleDateFormat("HH:mm:ss");
528 | binding.sj.setText(sj.format(day));
529 |
530 | try {
531 | OkHttpUtils.post("https://m.client.10010.com/mobileservicequery/operationservice/queryOcsPackageFlowLeftContent")
532 | .headers("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8")
533 | .headers("Cookie", cookie)
534 | .execute(new StringCallback() {
535 | @Override
536 | public void onError(Call call, Response response, Exception e) {
537 | super.onError(call, response, e);
538 | Toast.makeText(MainActivity.this,e.getMessage(),Toast.LENGTH_LONG).show();
539 | }
540 |
541 | @SuppressLint("LongLogTag")
542 | @Override
543 | public void onSuccess(String s, Call call, Response response) {
544 | toast("正在解析");
545 | System.out.println(s);
546 | if (s.equals("999999")||s.equals("")||s == null){
547 | toast("失败,请重新获取cookie");
548 | return;
549 | }
550 | JSONObject json = JSONObject.parseObject(s);
551 |
552 | binding.packageName.setText(json.get("packageName").toString());
553 |
554 |
555 | JSONObject summary = json.getJSONObject("summary");
556 |
557 |
558 | mianliu = Double.parseDouble(summary.getString("freeFlow"));//总免
559 | yong = Double.parseDouble(summary.getString("sum")) - mianliu;//本月已用
560 |
561 |
562 | JSONArray jsonArray = json.getJSONArray("resources");
563 |
564 | JSONObject job = jsonArray.getJSONObject(0);
565 |
566 | JSONArray details = job.getJSONArray("details");
567 |
568 |
569 | for (int i = 0; i < details.size(); i++) {
570 | JSONObject liuliang = details.getJSONObject(i);
571 | if (liuliang.getString("limited").equals("0")) {//套内流量包
572 | if (liuliang.getString("addupItemCode") != null){
573 |
574 | if (!liuliang.getString("addupItemCode").equals("40008")){//通用流量包
575 | String feePolicyName = liuliang.getString("feePolicyName");//流量包名称
576 | String total = liuliang.getString("total");//流量包总量
577 | String use = liuliang.getString("use");//流量包使用
578 | String remain = liuliang.getString("remain");//流量包剩余
579 |
580 | zong = zong + Double.parseDouble(total);
581 | //yong = yong + Double.parseDouble(use);
582 | sheng = sheng + Double.parseDouble(remain);
583 |
584 | dayin = dayin + "\n通用包名称:" + feePolicyName + "总量:" + total + "M,已使用:" + use + "M,剩余" + remain + "M\n";
585 | }else {//定向流量包
586 | String feePolicyName = liuliang.getString("feePolicyName");//流量包名称
587 | String total = liuliang.getString("total");//流量包总量
588 | String use = liuliang.getString("use");//流量包使用
589 | String remain = liuliang.getString("remain");//流量包剩余
590 |
591 | dingz = dingz + Double.parseDouble(total);
592 | dingy = dingy + Double.parseDouble(use);
593 | dings = dings + Double.parseDouble(remain);
594 |
595 |
596 | //mianliu = mianliu + Double.parseDouble(use);
597 |
598 | dayin = dayin + "\n定向包名称:" + feePolicyName + "总量:" + total + "M,已使用:" + use + "M,剩余" + remain + "M\n";
599 | }
600 |
601 | }else {
602 |
603 | String feePolicyName = liuliang.getString("feePolicyName");//流量包名称
604 | String total = liuliang.getString("total");//流量包总量
605 | String use = liuliang.getString("use");//流量包使用
606 | String remain = liuliang.getString("remain");//流量包剩余
607 |
608 | zong = zong + Double.parseDouble(total);
609 | //yong = yong + Double.parseDouble(use);
610 | sheng = sheng + Double.parseDouble(remain);
611 |
612 | dayin = dayin + "\n通用包名称:" + feePolicyName + "总量:" + total + "M,已使用:" + use + "M,剩余" + remain + "M\n";
613 |
614 | }
615 |
616 | }else if (liuliang.getString("addUpItemName")==null||liuliang.getString("addupItemCode").equals("40008")){
617 | String feePolicyName = liuliang.getString("feePolicyName");//免流包名称
618 | String use = liuliang.getString("use");//已免流
619 |
620 |
621 | //mianliu = mianliu + Double.parseDouble(use);
622 | dayin = dayin + "\n免流包名称:" + feePolicyName +"已使用:" + use + "M\n";
623 | }
624 |
625 | }
626 |
627 | if (orone.equals("yes")){
628 | onet = yong;
629 | onem = mianliu;
630 | orone="no";
631 | // 创建SharedPreferences对象用于存储Cookie信息,并将其私有化
632 | SharedPreferences share = getSharedPreferences("Cookie",
633 | Context.MODE_PRIVATE);
634 | // 获取编辑器来存储数据到sharedpreferences中
635 | SharedPreferences.Editor editor = share.edit();
636 | editor.putString("Cookie",cookie);
637 | editor.commit();
638 | }else {
639 | //toast("不是第一次");
640 | }
641 |
642 | ben = mianliu - onem;//本次免流
643 | if (ben >= 1024.00){//流量大于1024m将使用G来表示
644 | ben = ben / 1024.00;
645 |
646 | binding.ben.setText(df.format(ben)+"G");
647 | }else {
648 | binding.ben.setText(df.format(ben)+"M");
649 | }
650 |
651 | tiao = yong - onet;//本次消耗
652 | if (tiao >= 1024.00){//流量大于1024m将使用G来表示
653 | tiao = tiao / 1024.00;
654 |
655 | binding.tiao.setText(df.format(tiao)+"G");
656 | }else {
657 | binding.tiao.setText(df.format(tiao)+"M");
658 | }
659 |
660 |
661 | if (mianliu >= 1024.00){//流量大于1024m将使用G来表示
662 | mianliu = mianliu / 1024.00;
663 |
664 | binding.mian.setText(df.format(mianliu)+"G");
665 | }else {
666 | binding.mian.setText(df.format(mianliu)+"M");
667 | }
668 |
669 | //套餐
670 | if (zong >= 1024.00){//流量大于1024m将使用G来表示
671 | zong = zong / 1024.00;
672 |
673 | binding.zong.setText(df.format(zong)+"G");
674 | }else {
675 | binding.zong.setText(df.format(zong)+"M");
676 | }
677 |
678 |
679 | if (yong >= 1024.00){//流量大于1024m将使用G来表示
680 | yong = yong / 1024.00;
681 |
682 | binding.yong.setText(df.format(yong)+"G");
683 | }else {
684 | binding.yong.setText(df.format(yong)+"M");
685 | }
686 |
687 |
688 | if (sheng >= 1024.00){//流量大于1024m将使用G来表示
689 | sheng = sheng / 1024.00;
690 |
691 | binding.sheng.setText(df.format(sheng)+"G");
692 | }else {
693 | binding.sheng.setText(df.format(sheng)+"M");
694 | }
695 |
696 | //定向
697 | if (dingz >= 1024.00){//流量大于1024m将使用G来表示
698 | dingz = dingz / 1024.00;
699 |
700 | binding.dingz.setText(df.format(dingz)+"G");
701 | }else {
702 | binding.dingz.setText(df.format(dingz)+"M");
703 | }
704 |
705 |
706 | if (dingy >= 1024.00){//流量大于1024m将使用G来表示
707 | dingy = dingy / 1024.00;
708 |
709 | binding.dingy.setText(df.format(dingy)+"G");
710 | }else {
711 | binding.dingy.setText(df.format(dingy)+"M");
712 | }
713 |
714 |
715 | if (dings >= 1024.00){//流量大于1024m将使用G来表示
716 | dings = dings / 1024.00;
717 |
718 | binding.dings.setText(df.format(dings)+"G");
719 | }else {
720 | binding.dings.setText(df.format(dings)+"M");
721 | }
722 |
723 | binding.dayin.setText(dayin);
724 |
725 | toast("解析成功");
726 | binding.stop.setText("刷新");
727 |
728 | /* if (code.equals("200")){
729 | //toast("获取用户信息成功!");
730 | JSONObject data = JSONArray.parseObject(json.get("data").toString());
731 |
732 | }else {
733 | toast("未知错误");
734 | }*/
735 |
736 | }
737 | });
738 | }catch (Exception e){
739 | e.printStackTrace();
740 | }
741 | }
742 |
743 | //自定义吐司
744 | void toast(String msg) {
745 | runOnUiThread(new Runnable() {
746 | @Override
747 | public void run() {
748 | Toast.makeText(getApplicationContext(), msg, Toast.LENGTH_SHORT).show();
749 | }
750 | });
751 | }
752 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/junruo/jiankong/MarqueeTextView.java:
--------------------------------------------------------------------------------
1 | package com.junruo.jiankong;
2 |
3 | import android.content.Context;
4 | import android.text.TextUtils.TruncateAt;
5 | import android.util.AttributeSet;
6 |
7 | import androidx.appcompat.widget.AppCompatTextView;
8 |
9 | /**
10 | * Copyright:meixiansong-driver-android
11 | * Author: liyang
12 | * Date:2018/4/2 下午2:50
13 | * Desc:
14 | */
15 |
16 | public class MarqueeTextView extends AppCompatTextView {
17 |
18 | public MarqueeTextView(Context context) {
19 | super(context);
20 | initView();
21 | }
22 |
23 | private void initView() {
24 | setSingleLine();
25 | setEllipsize(TruncateAt.MARQUEE);
26 | }
27 |
28 | public MarqueeTextView(Context context, AttributeSet attrs) {
29 | super(context, attrs);
30 | initView();
31 | }
32 |
33 | public MarqueeTextView(Context context, AttributeSet attrs, int defStyleAttr) {
34 | super(context, attrs, defStyleAttr);
35 | initView();
36 | }
37 |
38 |
39 | @Override
40 | public boolean isFocused() {
41 | return true;
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/app/src/main/java/com/junruo/jiankong/payActivity.java:
--------------------------------------------------------------------------------
1 | package com.junruo.jiankong;
2 |
3 | import android.annotation.SuppressLint;
4 | import android.content.Intent;
5 | import android.os.Build;
6 | import android.os.Bundle;
7 | import android.view.View;
8 | import android.webkit.CookieManager;
9 | import android.webkit.CookieSyncManager;
10 | import android.widget.Toast;
11 |
12 | import androidx.appcompat.app.AppCompatActivity;
13 |
14 | import com.junruo.jiankong.databinding.ActivityGetcookieBinding;
15 | import com.junruo.jiankong.databinding.ActivityPayBinding;
16 | import com.junruo.jiankong.server.FloatingImageDisplayService;
17 |
18 |
19 | public class payActivity extends AppCompatActivity {
20 |
21 | private ActivityPayBinding binding;
22 |
23 | @Override
24 | protected void onCreate(Bundle savedInstanceState) {
25 | super.onCreate(savedInstanceState);
26 |
27 | binding = ActivityPayBinding.inflate(getLayoutInflater());
28 | View view = binding.getRoot();
29 | setContentView(view);
30 |
31 | binding.aAboutBtnGoback.setOnClickListener(v ->{
32 | CookieSyncManager.createInstance(this);
33 | CookieManager.getInstance().removeAllCookie();
34 | goBack();
35 | });
36 |
37 | }
38 |
39 |
40 | private void goBack() {
41 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
42 | finishAfterTransition();
43 | } else {
44 | finish();
45 | }
46 | }
47 |
48 | }
49 |
50 |
--------------------------------------------------------------------------------
/app/src/main/java/com/junruo/jiankong/server/FloatingImageDisplayService.java:
--------------------------------------------------------------------------------
1 | package com.junruo.jiankong.server;
2 |
3 | import android.annotation.SuppressLint;
4 | import android.app.Notification;
5 | import android.app.NotificationChannel;
6 | import android.app.NotificationManager;
7 | import android.app.PendingIntent;
8 | import android.app.Service;
9 | import android.content.Context;
10 | import android.content.Intent;
11 | import android.content.SharedPreferences;
12 | import android.graphics.BitmapFactory;
13 | import android.graphics.PixelFormat;
14 | import android.os.Build;
15 | import android.os.Handler;
16 | import android.os.IBinder;
17 | import android.provider.Settings;
18 | import android.support.annotation.Nullable;
19 | import android.view.Gravity;
20 | import android.view.LayoutInflater;
21 | import android.view.MotionEvent;
22 | import android.view.View;
23 | import android.view.WindowManager;
24 | import android.widget.LinearLayout;
25 | import android.widget.TextView;
26 | import android.widget.Toast;
27 |
28 | import androidx.annotation.RequiresApi;
29 | import androidx.core.app.NotificationCompat;
30 |
31 | import com.alibaba.fastjson.JSONArray;
32 | import com.alibaba.fastjson.JSONObject;
33 | import com.junruo.jiankong.MainActivity;
34 | import com.junruo.jiankong.R;
35 | import com.lzy.okhttputils.OkHttpUtils;
36 | import com.lzy.okhttputils.callback.StringCallback;
37 |
38 | import java.text.DecimalFormat;
39 | import java.text.SimpleDateFormat;
40 | import java.util.Date;
41 |
42 | import okhttp3.Call;
43 | import okhttp3.Response;
44 |
45 |
46 | public class FloatingImageDisplayService extends Service {
47 | public static boolean isStarted = false;
48 |
49 | private WindowManager windowManager;
50 | private WindowManager.LayoutParams layoutParams;
51 |
52 |
53 | private View displayView;
54 |
55 | private String dayin = "";//打印流量包
56 | private Double mianliu=0.00;//总免流
57 | private Double zong=0.00;//套餐总量
58 | private Double yong=0.00;//套餐已用
59 | private Double sheng =0.00;//剩余流量
60 | private Double ben = 0.00;//本次免流
61 | private Double tiao = 0.00;//本次消耗
62 |
63 |
64 | private String orone = "yes";//是否首次获取
65 |
66 | private Double onem = 0.00;//初始化本次免流
67 | private Double onet = 0.00;//初始化本次消耗
68 |
69 | private Long time ;//默认3分钟刷新一次180000l
70 |
71 | private String cookie = "";//储存cookie信息
72 |
73 | private Boolean isZhan = true;//悬浮窗展开状态
74 |
75 |
76 |
77 | TextView miantv,zongtv,yongtv,shengtv,bentv,tiaotv,sjtv,miant,zongt,yongt,shengt,sjt;
78 |
79 | LinearLayout zhe;
80 |
81 | private String gao,kuan,xgao,xkuan;
82 |
83 | @RequiresApi(api = Build.VERSION_CODES.N)
84 | @Override
85 | public void onCreate() {
86 | super.onCreate();
87 |
88 | // 创建SharedPreferences对象用于获取Cookie信息,并将其私有化
89 | SharedPreferences share = getSharedPreferences("Cookie",
90 | Context.MODE_PRIVATE);
91 | // 获取编辑器来存储数据到sharedpreferences中
92 | cookie = share.getString("Cookie","");
93 | gao = share.getString("gao","320");
94 | kuan = share.getString("kuan","230");
95 | xgao = share.getString("xgao","152");
96 | xkuan = share.getString("xkuan","202");
97 |
98 | time = Long.valueOf(share.getString("time","180"))*1000;
99 | System.out.println("==========>高"+gao+"==========>宽"+kuan+"==========>小高"+xgao+"==========>小宽"+xkuan);
100 |
101 | isStarted = true;
102 | windowManager = (WindowManager) getSystemService(WINDOW_SERVICE);
103 | layoutParams = new WindowManager.LayoutParams();
104 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
105 | layoutParams.type = WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
106 | } else {
107 | layoutParams.type = WindowManager.LayoutParams.TYPE_PHONE;
108 | }
109 | layoutParams.format = PixelFormat.RGBA_8888;
110 | layoutParams.gravity = Gravity.LEFT | Gravity.TOP;
111 | layoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
112 | layoutParams.width = Integer.parseInt(kuan);//230
113 | layoutParams.height = Integer.parseInt(gao);//320
114 | layoutParams.x = 300;
115 | layoutParams.y = 300;
116 |
117 |
118 | LayoutInflater layoutInflater = LayoutInflater.from(this);
119 | displayView = layoutInflater.inflate(R.layout.xfc, null);
120 | displayView.setOnTouchListener(new FloatingOnTouchListener());
121 |
122 | miant = displayView.findViewById(R.id.miant);
123 | zongt = displayView.findViewById(R.id.zongt);
124 | yongt = displayView.findViewById(R.id.yongt);
125 | shengt = displayView.findViewById(R.id.shengt);
126 |
127 | miantv = displayView.findViewById(R.id.mian);
128 | zongtv = displayView.findViewById(R.id.zong);
129 | yongtv = displayView.findViewById(R.id.yong);
130 | shengtv = displayView.findViewById(R.id.sheng);
131 | bentv = displayView.findViewById(R.id.ben);
132 | tiaotv = displayView.findViewById(R.id.tiao);
133 | sjtv = displayView.findViewById(R.id.sj);
134 | sjt = displayView.findViewById(R.id.sjt);
135 |
136 | zhe = displayView.findViewById(R.id.zhe);
137 |
138 |
139 |
140 | }
141 |
142 | @Nullable
143 | @Override
144 | public IBinder onBind(Intent intent) {
145 | return null;
146 | }
147 |
148 | private void startForeground() {
149 | startForeground(1, getMyActivityNotification(""));
150 | }
151 |
152 |
153 |
154 | private Notification getMyActivityNotification(String text){
155 |
156 | String ID = "com.junruo.jiankong"; //这里的id里面输入自己的项目的包的路径
157 | String NAME = "前台服务通知栏";
158 | Intent intent1 = new Intent(FloatingImageDisplayService.this, MainActivity.class);
159 | PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent1, 0);
160 | NotificationCompat.Builder notification; //创建服务对象
161 | NotificationManager manager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
162 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
163 | NotificationChannel channel = new NotificationChannel(ID, NAME, manager.IMPORTANCE_MIN);//静默通知
164 | channel.enableLights(true);
165 | channel.setShowBadge(true);
166 | channel.setLockscreenVisibility(Notification.VISIBILITY_PUBLIC);
167 | manager.createNotificationChannel(channel);
168 | notification = new NotificationCompat.Builder(FloatingImageDisplayService.this).setChannelId(ID);
169 | } else {
170 | notification = new NotificationCompat.Builder(FloatingImageDisplayService.this);
171 | }
172 | notification.setContentTitle("联通流量监控")
173 | .setContentText(text)//设置内容
174 | .setWhen(System.currentTimeMillis())
175 | .setSmallIcon(R.mipmap.ic_launcher)
176 | .setLargeIcon(BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher))
177 | .setContentIntent(pendingIntent)
178 | .build();
179 |
180 |
181 | Notification notification1 = notification.build();
182 | startForeground(1,notification1);// 开始前台服务
183 |
184 |
185 | return notification1;
186 | }
187 |
188 |
189 | private void updateNotification(String text) {
190 | String text1 = text;
191 |
192 | Notification notification = getMyActivityNotification(text1);
193 |
194 | NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
195 | mNotificationManager.notify(1, notification);
196 | }
197 |
198 |
199 |
200 |
201 | @RequiresApi(api = Build.VERSION_CODES.M)
202 | @Override
203 | public int onStartCommand(Intent intent, int flags, int startId) {
204 |
205 | startForeground();
206 |
207 | showFloatingWindow();
208 | return super.onStartCommand(intent, flags, startId);
209 | }
210 | @Override
211 | public void onDestroy() {
212 | super.onDestroy();
213 | windowManager.removeView(displayView);
214 | handler.removeCallbacksAndMessages(null);
215 | isStarted = false;
216 | stopForeground(true);// 停止前台服务--参数:表示是否移除之前的通知
217 | // Service被终止的同时也停止定时器继续运行
218 | Toast.makeText(getApplicationContext(), "已关闭悬浮窗", Toast.LENGTH_SHORT).show();
219 |
220 | }
221 |
222 | //1,首先创建一个Handler对象
223 | Handler handler=new Handler();
224 | @SuppressLint("WrongConstant")
225 | @RequiresApi(api = Build.VERSION_CODES.M)
226 | private void showFloatingWindow() {
227 | if (Settings.canDrawOverlays(this)) {
228 |
229 | update();
230 | //2,然后创建一个Runnable对像
231 | Runnable runnable=new Runnable(){
232 | @Override
233 | public void run() {
234 | update();
235 | windowManager.updateViewLayout(displayView, layoutParams);
236 | // TODO Auto-generated method stub
237 | //要做的事情,这里再次调用此Runnable对象,以实现每两秒实现一次的定时器操作
238 | handler.postDelayed(this, time);
239 | }
240 | };
241 | //3,使用PostDelayed方法,调用此Runnable对象
242 | handler.postDelayed(runnable, time);
243 | //4,关闭此定时器,可以这样操作
244 | // handler.removeCallbacks(runnable);
245 | //移除所有的消息
246 | //handler.removeCallbacksAndMessages(null);
247 |
248 |
249 | zhe.setOnClickListener(v -> {
250 | if (isZhan){
251 | layoutParams.width = Integer.parseInt(xkuan);//200
252 | layoutParams.height = Integer.parseInt(xgao);//150
253 |
254 |
255 | sjt.setText("更:");
256 | miantv.setVisibility(8);
257 | zongtv.setVisibility(8);
258 | yongtv.setVisibility(8);
259 | shengtv.setVisibility(8);
260 | miant.setVisibility(8);
261 | zongt.setVisibility(8);
262 | yongt.setVisibility(8);
263 | shengt.setVisibility(8);
264 | isZhan = false;
265 |
266 | windowManager.updateViewLayout(displayView, layoutParams);
267 |
268 | }else if (!isZhan){
269 | layoutParams.width = Integer.parseInt(kuan);//230
270 | layoutParams.height = Integer.parseInt(gao);//320
271 | sjt.setText("时间:");
272 | miantv.setVisibility(0);
273 | zongtv.setVisibility(0);
274 | yongtv.setVisibility(0);
275 | shengtv.setVisibility(0);
276 | miant.setVisibility(0);
277 | zongt.setVisibility(0);
278 | yongt.setVisibility(0);
279 | shengt.setVisibility(0);
280 | isZhan = true;
281 |
282 | windowManager.updateViewLayout(displayView, layoutParams);
283 | }
284 |
285 |
286 | });
287 |
288 | windowManager.addView(displayView, layoutParams);
289 |
290 |
291 | }
292 | }
293 |
294 | private void update(){
295 | mianliu=0.00;//总免流
296 | zong=0.00;//套餐总量
297 | yong=0.00;//套餐已用
298 | sheng =0.00;//剩余流量
299 |
300 | DecimalFormat df = new DecimalFormat("0.000");
301 | Date day=new Date();
302 | SimpleDateFormat sj = new SimpleDateFormat("HH:mm:ss");
303 | sjtv.setText(sj.format(day));
304 |
305 | try {
306 |
307 | OkHttpUtils.post("https://m.client.10010.com/mobileservicequery/operationservice/queryOcsPackageFlowLeftContent")
308 | .headers("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8")
309 | .headers("Cookie", cookie)
310 | .execute(new StringCallback() {
311 | @Override
312 | public void onSuccess(String s, Call call, Response response) {
313 | if (s.equals("999999")||s.equals("")||s == null){
314 | Toast.makeText(FloatingImageDisplayService.this,"解析cookie失败,请重新获取。",Toast.LENGTH_LONG).show();
315 | return;
316 | }
317 | JSONObject json = JSONObject.parseObject(s);
318 | System.out.println("=========================>成功");
319 | //binding.packageName.setText(json.get("packageName").toString());
320 |
321 | JSONObject summary = json.getJSONObject("summary");
322 |
323 |
324 | //summary.getString("sum");//本月已用
325 | mianliu = mianliu + Double.parseDouble(summary.getString("freeFlow"));//总免
326 |
327 | JSONArray jsonArray = json.getJSONArray("resources");
328 |
329 |
330 | JSONObject job = jsonArray.getJSONObject(0);
331 |
332 | JSONArray details = job.getJSONArray("details");
333 |
334 |
335 |
336 | for (int i = 0; i < details.size(); i++) {
337 | JSONObject liuliang = details.getJSONObject(i);
338 | if (liuliang.getString("limited").equals("0")) {//套内流量包
339 | if (liuliang.getString("addupItemCode") != null){
340 |
341 | if (!liuliang.getString("addupItemCode").equals("40008")){//通用流量包
342 | String total = liuliang.getString("total");//流量包总量
343 | String use = liuliang.getString("use");//流量包使用
344 | String remain = liuliang.getString("remain");//流量包剩余
345 |
346 | zong = zong + Double.parseDouble(total);
347 | yong = yong + Double.parseDouble(use);
348 | sheng = sheng + Double.parseDouble(remain);
349 | }else {//定向流量包
350 |
351 | String use = liuliang.getString("use");//流量包使用
352 |
353 | //mianliu = mianliu + Double.parseDouble(use);
354 |
355 | }
356 |
357 | }else {
358 | String total = liuliang.getString("total");//流量包总量
359 | String use = liuliang.getString("use");//流量包使用
360 | String remain = liuliang.getString("remain");//流量包剩余
361 |
362 | zong = zong + Double.parseDouble(total);
363 | yong = yong + Double.parseDouble(use);
364 | sheng = sheng + Double.parseDouble(remain);
365 | }
366 |
367 |
368 | // dayin = dayin + "\n流量包名称:" + feePolicyName + "总量:" + total + "M,已使用:" + use + "M,剩余" + remain + "M\n";
369 | }else if (liuliang.getString("addUpItemName")==null||liuliang.getString("addupItemCode").equals("40008")){
370 | String feePolicyName = liuliang.getString("feePolicyName");//免流包名称
371 | String use = liuliang.getString("use");//已免流
372 |
373 |
374 | ///mianliu = mianliu + Double.parseDouble(use);
375 | }
376 |
377 | }
378 |
379 | if (orone.equals("yes")){
380 | onet = yong;
381 | onem = mianliu;
382 | orone="no";
383 | // 创建SharedPreferences对象用于存储Cookie信息,并将其私有化
384 | SharedPreferences share = getSharedPreferences("Cookie",
385 | Context.MODE_PRIVATE);
386 | // 获取编辑器来存储数据到sharedpreferences中
387 | SharedPreferences.Editor editor = share.edit();
388 | editor.putString("Cookie",cookie);
389 | editor.commit();
390 | }else {
391 | }
392 | String dayin = "";//打印到通知栏
393 | ben = mianliu - onem;//本次免流
394 | if (ben >= 1024.00){//流量大于1024m将使用G来表示
395 | ben = ben / 1024.00;
396 | bentv.setText(df.format(ben)+"G");
397 | dayin = dayin + "免:" + df.format(ben)+"G\t";
398 | }else {
399 | bentv.setText(df.format(ben)+"M");
400 | dayin = dayin + "免:" + df.format(ben)+"M\t";
401 |
402 | }
403 |
404 | tiao = yong - onet;//本次消耗
405 | if (tiao >= 1024.00){//流量大于1024m将使用G来表示
406 | tiao = tiao / 1024.00;
407 | tiaotv.setText(df.format(tiao)+"G");
408 | dayin = dayin + "跳:" + df.format(tiao)+"G";
409 | }else {
410 | tiaotv.setText(df.format(tiao)+"M");
411 | dayin = dayin + "跳:" + df.format(tiao)+"M";
412 | }
413 |
414 |
415 | if (mianliu >= 1024.00){//流量大于1024m将使用G来表示
416 | mianliu = mianliu / 1024.00;
417 |
418 | miantv.setText(df.format(mianliu)+"G");
419 | }else {
420 | miantv.setText(df.format(mianliu)+"M");
421 | }
422 |
423 |
424 | if (zong >= 1024.00){//流量大于1024m将使用G来表示
425 | zong = zong / 1024.00;
426 |
427 | zongtv.setText(df.format(zong)+"G");
428 | }else {
429 | zongtv.setText(df.format(zong)+"M");
430 | }
431 |
432 |
433 | if (yong >= 1024.00){//流量大于1024m将使用G来表示
434 | yong = yong / 1024.00;
435 |
436 | yongtv.setText(df.format(yong)+"G");
437 | }else {
438 | yongtv.setText(df.format(yong)+"M");
439 | }
440 |
441 |
442 | if (sheng >= 1024.00){//流量大于1024m将使用G来表示
443 | sheng = sheng / 1024.00;
444 |
445 | shengtv.setText(df.format(sheng)+"G");
446 | }else {
447 | shengtv.setText(df.format(sheng)+"M");
448 | }
449 |
450 | updateNotification(dayin+"\t更:"+sj.format(day));
451 |
452 | }
453 | });
454 |
455 | }catch (Exception e){
456 | e.printStackTrace();
457 | }
458 |
459 |
460 | }
461 |
462 |
463 |
464 |
465 | private class FloatingOnTouchListener implements View.OnTouchListener {
466 | private int x;
467 | private int y;
468 |
469 | @Override
470 | public boolean onTouch(View view, MotionEvent event) {
471 | switch (event.getAction()) {
472 | case MotionEvent.ACTION_DOWN:
473 | x = (int) event.getRawX();
474 | y = (int) event.getRawY();
475 | break;
476 | case MotionEvent.ACTION_MOVE:
477 | int nowX = (int) event.getRawX();
478 | int nowY = (int) event.getRawY();
479 | int movedX = nowX - x;
480 | int movedY = nowY - y;
481 | x = nowX;
482 | y = nowY;
483 | layoutParams.x = layoutParams.x + movedX;
484 | layoutParams.y = layoutParams.y + movedY;
485 | windowManager.updateViewLayout(view, layoutParams);
486 | break;
487 | default:
488 | break;
489 | }
490 | return false;
491 | }
492 | }
493 | }
494 |
--------------------------------------------------------------------------------
/app/src/main/java/com/junruo/jiankong/server/NoticeBarToolService.java:
--------------------------------------------------------------------------------
1 | package com.junruo.jiankong.server;
2 |
3 | import android.annotation.SuppressLint;
4 | import android.content.Context;
5 | import android.content.Intent;
6 | import android.net.Uri;
7 | import android.os.Build;
8 | import android.provider.Settings;
9 | import android.service.quicksettings.Tile;
10 | import android.service.quicksettings.TileService;
11 | import android.util.Log;
12 | import android.widget.Toast;
13 | import com.junruo.jiankong.MainActivity;
14 |
15 | import androidx.annotation.RequiresApi;
16 |
17 |
18 | import java.lang.reflect.Method;
19 |
20 | @RequiresApi(api = Build.VERSION_CODES.N)
21 | public class NoticeBarToolService extends TileService {
22 |
23 | String TAG = "jiankong";
24 |
25 | // 添加磁贴时调用
26 | @Override
27 | public void onTileAdded() {
28 | super.onTileAdded();
29 | }
30 |
31 | // 移除磁贴时调用
32 | @Override
33 | public void onTileRemoved() {
34 | super.onTileRemoved();
35 | }
36 |
37 | //点击事件
38 | @Override
39 | public void onClick() {
40 | super.onClick();
41 |
42 | Context mContext = this;
43 | collapseStatusBar(mContext);
44 |
45 | if (FloatingImageDisplayService.isStarted) {
46 | Intent intent = new Intent(this, FloatingImageDisplayService.class);
47 | stopService(intent);
48 | getQsTile().setState(Tile.STATE_INACTIVE);
49 | getQsTile().updateTile();
50 | return;
51 | }else {
52 | getQsTile().setState(Tile.STATE_ACTIVE);
53 | getQsTile().updateTile();
54 | Intent intent = new Intent(this, FloatingImageDisplayService.class);
55 | startService(intent);
56 | }
57 |
58 | }
59 |
60 | // 只有添加后才调用
61 | // 通知栏下拉
62 | @Override
63 | public void onStartListening() {
64 | super.onStartListening();
65 | }
66 |
67 | // 通知栏关闭
68 | @Override
69 | public void onStopListening() {
70 | super.onStopListening();
71 | Log.d(TAG, "onStopListening: ");
72 | }
73 |
74 | // 收起通知栏
75 | public static void collapseStatusBar(Context context) {
76 | try{
77 | @SuppressLint("WrongConstant") Object statusBarManager = context.getSystemService("statusbar");
78 | Method collapse;
79 |
80 | if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.JELLY_BEAN){
81 | assert statusBarManager != null;
82 | collapse = statusBarManager.getClass().getMethod("collapse");
83 | } else {
84 | assert statusBarManager != null;
85 | collapse = statusBarManager.getClass().getMethod("collapsePanels");
86 | }
87 | collapse.invoke(statusBarManager);
88 | } catch (Exception localException) {
89 | localException.printStackTrace();
90 | }
91 | }
92 |
93 |
94 |
95 | // 设置磁贴颜色
96 | public void setQuickSettingColor() {
97 | // 更改成非活跃状态(灰色)
98 | getQsTile().setState(Tile.STATE_ACTIVE);
99 | // 更改成活跃状态(白色)
100 | // getQsTile().setState(Tile.STATE_INACTIVE);
101 | getQsTile().updateTile();// 更新Tile
102 | }
103 |
104 | }
105 |
--------------------------------------------------------------------------------
/app/src/main/java/com/junruo/jiankong/toumingActivity.java:
--------------------------------------------------------------------------------
1 | package com.junruo.jiankong;
2 |
3 | import android.annotation.SuppressLint;
4 | import android.annotation.TargetApi;
5 | import android.app.Activity;
6 | import android.content.ClipData;
7 | import android.content.Context;
8 | import android.content.Intent;
9 | import android.content.SharedPreferences;
10 | import android.net.Uri;
11 | import android.net.http.SslError;
12 | import android.os.Build;
13 | import android.os.Bundle;
14 | import android.service.quicksettings.Tile;
15 | import android.view.KeyEvent;
16 | import android.view.View;
17 | import android.webkit.CookieManager;
18 | import android.webkit.CookieSyncManager;
19 | import android.webkit.SslErrorHandler;
20 | import android.webkit.ValueCallback;
21 | import android.webkit.WebChromeClient;
22 | import android.webkit.WebSettings;
23 | import android.webkit.WebView;
24 | import android.webkit.WebViewClient;
25 | import android.widget.Toast;
26 |
27 | import androidx.appcompat.app.AppCompatActivity;
28 |
29 | import com.junruo.jiankong.databinding.ActivityGetcookieBinding;
30 | import com.junruo.jiankong.server.FloatingImageDisplayService;
31 |
32 | import static android.view.KeyEvent.KEYCODE_BACK;
33 |
34 |
35 | public class toumingActivity extends AppCompatActivity {
36 |
37 |
38 |
39 | @SuppressLint("SetJavaScriptEnabled")
40 | @Override
41 | protected void onCreate(Bundle savedInstanceState) {
42 | super.onCreate(savedInstanceState);
43 |
44 | if (FloatingImageDisplayService.isStarted) {
45 | Intent intent = new Intent(this, FloatingImageDisplayService.class);
46 | stopService(intent);
47 | finish();
48 | }else {
49 | toast("已开启");
50 | Intent intent = new Intent(this, FloatingImageDisplayService.class);
51 | startService(intent);
52 | finish();
53 | }
54 |
55 | }
56 |
57 |
58 | //自定义吐司
59 | void toast(String msg) {
60 | runOnUiThread(new Runnable() {
61 | @Override
62 | public void run() {
63 | Toast.makeText(getApplicationContext(), msg, Toast.LENGTH_SHORT).show();
64 | }
65 | });
66 | }
67 |
68 | }
69 |
70 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
15 |
18 |
21 |
22 |
23 |
24 |
30 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/alipay.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JunXiaoRuo/unicom/9767299bc0ec28ca41f42c3b1a9417a641c9bd6f/app/src/main/res/drawable/alipay.jpg
--------------------------------------------------------------------------------
/app/src/main/res/drawable/blackground.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_arrowleft.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JunXiaoRuo/unicom/9767299bc0ec28ca41f42c3b1a9417a641c9bd6f/app/src/main/res/drawable/ic_arrowleft.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JunXiaoRuo/unicom/9767299bc0ec28ca41f42c3b1a9417a641c9bd6f/app/src/main/res/drawable/logo.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/notice.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JunXiaoRuo/unicom/9767299bc0ec28ca41f42c3b1a9417a641c9bd6f/app/src/main/res/drawable/notice.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/privacy_l.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/weixinpay.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JunXiaoRuo/unicom/9767299bc0ec28ca41f42c3b1a9417a641c9bd6f/app/src/main/res/drawable/weixinpay.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/xfc_center.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JunXiaoRuo/unicom/9767299bc0ec28ca41f42c3b1a9417a641c9bd6f/app/src/main/res/drawable/xfc_center.png
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_getcookie.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
13 |
20 |
28 |
29 |
38 |
39 |
40 |
44 |
45 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
12 |
13 |
17 |
18 |
23 |
32 |
33 |
43 |
44 |
49 |
50 |
55 |
61 |
62 |
63 |
64 |
65 |
66 |
72 |
75 |
76 |
81 |
82 |
87 |
88 |
104 |
105 |
122 |
123 |
124 |
125 |
135 |
136 |
142 |
147 |
148 |
149 |
155 |
162 |
163 |
164 |
165 |
171 |
172 |
176 |
177 |
181 |
187 |
194 |
195 |
199 |
205 |
212 |
213 |
217 |
223 |
230 |
231 |
235 |
241 |
248 |
249 |
253 |
259 |
266 |
267 |
268 |
272 |
278 |
285 |
286 |
290 |
296 |
303 |
304 |
305 |
306 |
307 |
308 |
313 |
314 |
315 |
319 |
325 |
332 |
333 |
337 |
343 |
350 |
351 |
355 |
361 |
368 |
369 |
370 |
371 |
372 |
373 |
374 |
375 |
376 |
386 |
392 |
393 |
394 |
399 |
400 |
404 |
405 |
411 |
412 |
418 |
419 |
420 |
421 |
428 |
429 |
437 |
438 |
439 |
444 |
445 |
450 |
451 |
456 |
457 |
472 |
473 |
474 |
490 |
491 |
507 |
508 |
509 |
510 |
511 |
512 |
522 |
523 |
529 |
536 |
540 |
548 |
553 |
559 |
565 |
566 |
573 |
579 |
580 |
591 |
592 |
600 |
601 |
606 |
607 |
613 |
619 |
620 |
627 |
633 |
634 |
635 |
636 |
641 |
642 |
643 |
649 |
655 |
656 |
657 |
658 |
674 |
675 |
676 |
677 |
678 |
679 |
680 |
681 |
691 |
692 |
698 |
699 |
706 |
714 |
715 |
716 |
717 |
718 |
719 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_pay.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
13 |
20 |
28 |
29 |
38 |
39 |
40 |
41 |
42 |
45 |
49 |
50 |
56 |
57 |
58 |
62 |
63 |
64 |
68 |
69 |
70 |
71 |
72 |
73 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/xfc.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
16 |
17 |
22 |
23 |
24 |
25 |
29 |
30 |
34 |
35 |
42 |
49 |
50 |
51 |
52 |
56 |
57 |
58 |
65 |
72 |
73 |
74 |
78 |
79 |
80 |
87 |
94 |
95 |
99 |
100 |
101 |
108 |
115 |
116 |
117 |
121 |
122 |
123 |
130 |
137 |
138 |
139 |
143 |
144 |
145 |
151 |
158 |
159 |
160 |
164 |
165 |
166 |
172 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JunXiaoRuo/unicom/9767299bc0ec28ca41f42c3b1a9417a641c9bd6f/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JunXiaoRuo/unicom/9767299bc0ec28ca41f42c3b1a9417a641c9bd6f/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JunXiaoRuo/unicom/9767299bc0ec28ca41f42c3b1a9417a641c9bd6f/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JunXiaoRuo/unicom/9767299bc0ec28ca41f42c3b1a9417a641c9bd6f/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JunXiaoRuo/unicom/9767299bc0ec28ca41f42c3b1a9417a641c9bd6f/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/raw/jingyin.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JunXiaoRuo/unicom/9767299bc0ec28ca41f42c3b1a9417a641c9bd6f/app/src/main/res/raw/jingyin.mp3
--------------------------------------------------------------------------------
/app/src/main/res/values-night/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
16 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #FFBB86FC
4 | #FF6200EE
5 | #FF3700B3
6 | #FF03DAC5
7 | #FF018786
8 | #FF000000
9 | #FFFFFFFF
10 | #31A6D3
11 | #F79060
12 |
--------------------------------------------------------------------------------
/app/src/main/res/values/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #FFFFFF
4 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | 联通流量监控
3 | 开启监控
4 | 开启监控
5 | 停用
6 |
--------------------------------------------------------------------------------
/app/src/main/res/values/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/network_security_config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/shortcuts.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
10 |
14 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/test/java/com/junruo/jiankong/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.junruo.jiankong;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 | buildscript {
3 | repositories {
4 | google()
5 | mavenCentral()
6 | maven { url 'https://repo1.maven.org/maven2/' }
7 | maven { url 'https://maven.aliyun.com/repository/google/' }
8 | maven { url 'https://maven.aliyun.com/repository/jcenter/' }
9 | maven {
10 | url 'https://dl.bintray.com/spark/maven'
11 | }
12 | maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' }
13 |
14 | }
15 | dependencies {
16 | classpath 'com.android.tools.build:gradle:4.2.2'
17 |
18 | // NOTE: Do not place your application dependencies here; they belong
19 | // in the individual module build.gradle files
20 | }
21 | }
22 |
23 | allprojects {
24 | repositories {
25 | google()
26 | mavenCentral()
27 | maven { url 'https://repo1.maven.org/maven2/' }
28 | maven { url 'https://maven.aliyun.com/repository/google/' }
29 | maven { url 'https://maven.aliyun.com/repository/jcenter/' }
30 | maven {
31 | url 'https://dl.bintray.com/spark/maven'
32 | }
33 | maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' }
34 |
35 | }
36 | }
37 |
38 | task clean(type: Delete) {
39 | delete rootProject.buildDir
40 | }
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 | # AndroidX package structure to make it clearer which packages are bundled with the
15 | # Android operating system, and which are packaged with your app"s APK
16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
17 | android.useAndroidX=true
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JunXiaoRuo/unicom/9767299bc0ec28ca41f42c3b1a9417a641c9bd6f/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Wed Aug 25 16:03:15 CST 2021
2 | distributionBase=GRADLE_USER_HOME
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip
4 | distributionPath=wrapper/dists
5 | zipStorePath=wrapper/dists
6 | zipStoreBase=GRADLE_USER_HOME
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Attempt to set APP_HOME
10 | # Resolve links: $0 may be a link
11 | PRG="$0"
12 | # Need this for relative symlinks.
13 | while [ -h "$PRG" ] ; do
14 | ls=`ls -ld "$PRG"`
15 | link=`expr "$ls" : '.*-> \(.*\)$'`
16 | if expr "$link" : '/.*' > /dev/null; then
17 | PRG="$link"
18 | else
19 | PRG=`dirname "$PRG"`"/$link"
20 | fi
21 | done
22 | SAVED="`pwd`"
23 | cd "`dirname \"$PRG\"`/" >/dev/null
24 | APP_HOME="`pwd -P`"
25 | cd "$SAVED" >/dev/null
26 |
27 | APP_NAME="Gradle"
28 | APP_BASE_NAME=`basename "$0"`
29 |
30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31 | DEFAULT_JVM_OPTS=""
32 |
33 | # Use the maximum available, or set MAX_FD != -1 to use that value.
34 | MAX_FD="maximum"
35 |
36 | warn () {
37 | echo "$*"
38 | }
39 |
40 | die () {
41 | echo
42 | echo "$*"
43 | echo
44 | exit 1
45 | }
46 |
47 | # OS specific support (must be 'true' or 'false').
48 | cygwin=false
49 | msys=false
50 | darwin=false
51 | nonstop=false
52 | case "`uname`" in
53 | CYGWIN* )
54 | cygwin=true
55 | ;;
56 | Darwin* )
57 | darwin=true
58 | ;;
59 | MINGW* )
60 | msys=true
61 | ;;
62 | NONSTOP* )
63 | nonstop=true
64 | ;;
65 | esac
66 |
67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68 |
69 | # Determine the Java command to use to start the JVM.
70 | if [ -n "$JAVA_HOME" ] ; then
71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72 | # IBM's JDK on AIX uses strange locations for the executables
73 | JAVACMD="$JAVA_HOME/jre/sh/java"
74 | else
75 | JAVACMD="$JAVA_HOME/bin/java"
76 | fi
77 | if [ ! -x "$JAVACMD" ] ; then
78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79 |
80 | Please set the JAVA_HOME variable in your environment to match the
81 | location of your Java installation."
82 | fi
83 | else
84 | JAVACMD="java"
85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86 |
87 | Please set the JAVA_HOME variable in your environment to match the
88 | location of your Java installation."
89 | fi
90 |
91 | # Increase the maximum file descriptors if we can.
92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93 | MAX_FD_LIMIT=`ulimit -H -n`
94 | if [ $? -eq 0 ] ; then
95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96 | MAX_FD="$MAX_FD_LIMIT"
97 | fi
98 | ulimit -n $MAX_FD
99 | if [ $? -ne 0 ] ; then
100 | warn "Could not set maximum file descriptor limit: $MAX_FD"
101 | fi
102 | else
103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104 | fi
105 | fi
106 |
107 | # For Darwin, add options to specify how the application appears in the dock
108 | if $darwin; then
109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110 | fi
111 |
112 | # For Cygwin, switch paths to Windows format before running java
113 | if $cygwin ; then
114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116 | JAVACMD=`cygpath --unix "$JAVACMD"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Escape application args
158 | save () {
159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160 | echo " "
161 | }
162 | APP_ARGS=$(save "$@")
163 |
164 | # Collect all arguments for the java command, following the shell quoting and substitution rules
165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166 |
167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169 | cd "$(dirname "$0")"
170 | fi
171 |
172 | exec "$JAVACMD" "$@"
173 |
--------------------------------------------------------------------------------
/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 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
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 Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/mm_facetoface_collect_qrcode_1642385101367.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JunXiaoRuo/unicom/9767299bc0ec28ca41f42c3b1a9417a641c9bd6f/mm_facetoface_collect_qrcode_1642385101367.png
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = "jiankong"
2 | include ':app'
3 |
--------------------------------------------------------------------------------