diff --git a/.gitignore b/.gitignore deleted file mode 100644 index be382473..00000000 --- a/.gitignore +++ /dev/null @@ -1,25 +0,0 @@ -/apl -/captures -*.apk -*.ap_ -/releases -/local.properties -/app/keys.properties -*.dex -*.class -bin/ -gen/ -/app/extra.gradle -Thumbs.db -.DS_Store -.classpath -.project -.idea -.gradle -build -*.iml -google-services.json -/app/standard/ -tmp -dependencies.txt -test.sh \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 6cfbe40d..00000000 --- a/.travis.yml +++ /dev/null @@ -1,53 +0,0 @@ -language: android - -jdk: oraclejdk8 - -sudo: false - -env: - global: - - MALLOC_ARENA_MAX=1 -# matrix: -# - API_LEVEL=25 SYS_IMAGE_TAG=google_apis ANDROID_ABI=arm64-v8a -# - API_LEVEL=24 SYS_IMAGE_TAG=google_apis ANDROID_ABI=arm64-v8a -# - API_LEVEL=21 SYS_IMAGE_TAG=google_apis ANDROID_ABI=armeabi-v7a -# - API_LEVEL=19 SYS_IMAGE_TAG=google_apis ANDROID_ABI=armeabi-v7a -# - API_LEVEL=17 SYS_IMAGE_TAG=google_apis ANDROID_ABI=armeabi-v7a - -android: - components: - - tools - - android-28 -# - android-$API_LEVEL - - build-tools-28.0.3 - - platform-tools - - extra -# - sys-img-$ANDROID_ABI-$SYS_IMAGE_TAG-$API_LEVEL - -before_cache: - - rm -rf $HOME/.gradle/caches/modules-2/modules-2.lock - - rm -rf $HOME/.gradle/caches/*/plugin-resolution/ - -cache: - directories: - - $HOME/.gradle/caches/ - - $HOME/.gradle/wrapper/ - - $HOME/.android/build-cache - -#install: -# - ulimit -s 1082768 -# - touch app/keys.properties -# - echo no | android create avd --force -n test -t android-$API_LEVEL --abi $ANDROID_ABI --tag $SYS_IMAGE_TAG -# - emulator -avd test -no-skin -no-window & -# - android-wait-for-emulator -# - adb shell input keyevent 82 & - -before_script: - - cp -f app/mock-google-services.json app/google-services.json - - cat app/keys.properties.example | envsubst > app/keys.properties - - yes | sdkmanager "platforms;android-28" - - yes | sdkmanager "build-tools;28.0.3" - -script: -# - ./gradlew connectedAndroidTest --stacktrace -w - - ./gradlew assembleRelease --stacktrace -w diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md deleted file mode 100644 index e3b3093e..00000000 --- a/CONTRIBUTING.md +++ /dev/null @@ -1,30 +0,0 @@ -## Contributing to ShowJava - -1. Fork the repository. ([niranjan94/show-java](https://www.github.com/niranjan94/show-java)) -2. Clone the repository locally by using the command: ```git clone git@github.com:username/show-java``` - -> Connect your local to the original ‘upstream’ repository by adding it as a remote. Pull in changes from ‘upstream’ often so that you stay up to date so that when you submit your pull request, merge conflicts will be less likely. See more detailed instructions [here](https://help.github.com/articles/syncing-a-fork). - -3. Create a branch for your edits/bugfixes/feature additions -4. Do your magic -5. Test whatever you made in Android versions 4.1.x , 4.4.x, 5.x, 6.x, 7.x etc (You get the idea :wink: ) -6. Once you're confident in your code, send a pull request to the `development` branch of the upstream repository with a proper descriptions explaining what you did and why. Be clear and consise. -7. Wait for one of the project maintainers to review your pull request. -8. We may merge it into the `development` branch if it's good. - -> Also have a look at the [GitHub Flow](https://guides.github.com/introduction/flow/), to understand better how all this works. - -## Reporting a Bug ([over here](https://github.com/niranjan94/show-java/issues/new)) - -1. Check [existing issues](https://github.com/niranjan94/show-java/issues) for your issue. Duplicating an issue is slower for both parties so search through open and closed issues to see if what you’re running into has been addressed already. -2. Be clear about what your problem is: what was the expected outcome, what happened instead? Detail how someone else can recreate the problem. -3. Include system details like Android version, total RAM, etc. -4. If possible, include the link to the app that you were trying to decompile -5. Paste stacktrace (if possible) in your issue or in a Gist. If pasting them in the issue, wrap it in three backticks: ``` so that it renders nicely. -6. Submit it and wait for one of the project maintainers to review it. (Please be patient) - -## Requesting a Feature/Enhancement ([over here](https://github.com/niranjan94/show-java/issues/new)) - -1. Check [existing issues](https://github.com/niranjan94/show-java/issues) for your issue. Duplicating an issue is slower for both parties so search through open and closed issues to see if what you’re running into has been addressed already. -2. Give a clear and a consise description about the feature/enhancement that you'd love to see in ShowJava -3. Submit it and wait for one of the project maintainers to review it. (Please be patient) \ No newline at end of file diff --git a/LICENSE b/LICENSE deleted file mode 100644 index e72bfdda..00000000 --- a/LICENSE +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. \ No newline at end of file diff --git a/README.md b/README.md index 4c23baac..41165323 100644 --- a/README.md +++ b/README.md @@ -1,88 +1,3 @@ -[![Known Vulnerabilities](https://snyk.io/test/github/niranjan94/show-java/badge.svg?style=flat-square)](https://snyk.io/test/github/niranjan94/show-java) - [![Build Status](https://img.shields.io/travis/com/niranjan94/show-java/development.svg?style=flat-square)](https://travis-ci.com/niranjan94/show-java) [![License Info](https://img.shields.io/badge/license-GNU_GPLv3-blue.svg?style=flat-square)](https://github.com/niranjan94/show-java) [![Play Store Info](https://img.shields.io/badge/Play_Store-v3.0.5-36B0C1.svg?style=flat-square)](https://play.google.com/store/apps/details?id=com.njlabs.showjava) [![GitHub app version](https://img.shields.io/badge/GitHub-v3.0.6-yellow.svg?style=flat-square)](https://github.com/niranjan94/show-java) [![Play Store downloads](https://img.shields.io/badge/downloads-435k%20total-E04253.svg?style=flat-square)](https://play.google.com/store/apps/details?id=com.njlabs.showjava) +

Show Java Github Page

- -![ShowJava Banner v0.1](https://res.cloudinary.com/niranjan94/image/upload/v1518341743/banner_lihb7z.png) - -An APK (android application), JAR & Dex decompiler for android. - -> The current GitHub master branch may be ahead of the Play Store version (and could be unstable/incomplete/buggy at some places) - -[Get Show Java on Google Play](https://play.google.com/store/apps/details?id=com.njlabs.showjava "Get Show Java on Google Play") -## About -This is a Decompiler that extracts the source code of an Android application (including XML files and image assets), JAR Packages and dex files. Works directly from your android device. - -## Features - -- Select either **CFR 0.140**, **JaDX 0.9.0** or **FernFlower [`a0a8f0a`](https://github.com/fesh0r/fernflower/tree/a0a8f0a8dd777a7010958474acbca857071ee941) (analytical decompiler)** to use as the decompiler. -- Runs directly on an android device (4.1.x and above). -- Select apk/jar/dex from sdcard (or) from a list of installed applications. -- Decompiles android resources (layouts, Drawables, Menus, AndroidManifest, image assets, values, etc). -- Easy to use source navigator with built-in media & code viewer. -- Displays code in a clean-syntax-highlighted form with zoom & line-wrap. -- The decompiled source can easily be copied from the sdcard (source is stored in `show-java` folder in the sdcard). -- Share the decompiled source easily with the built in archive + share mechanism. - -## Compatibility Matrix - -### Version 3.0 - -JaDX and Fernflower use newer Java features such as some types of lambda's which are not available on pre-N versions of Android. - -| | CFR 0.140 | JaDX 0.9.0 | Fernflower | -|------------:|:------------------:|:------------------:|:------------------:| -| Oreo | :white_check_mark: | :white_check_mark: | :white_check_mark: | -| Nougat | :white_check_mark: | :white_check_mark: | :white_check_mark: | -| Marshmallow | :white_check_mark: | - | - | -| Lollipop | :white_check_mark: | - | - | -| KitKat | :white_check_mark: | - | - | -| Jelly Bean | :white_check_mark: | - | - | - -> Available from the [Play Store](https://play.google.com/store/apps/details?id=com.njlabs.showjava) on all Android devices running Jelly Bean and above. - -### Version 2.0 - -| | CFR 0.110 | JaDX 0.6.1 | Fernflower | -|------------:|:------------------:|:------------------:|:------------------:| -| ICS & Above | :white_check_mark: | :white_check_mark: | :white_check_mark: | - -> Can be downloaded from [here](https://github.com/niranjan94/show-java/releases/tag/v2.1.0). - -## Contributing to ShowJava - -Head over [here](https://github.com/niranjan94/show-java/blob/master/CONTRIBUTING.md) to know more about how to contribute, report bugs and request feature additions. - -## Open Source License - -Unless explicitly stated otherwise all files in this repository are licensed under the [GNU General Public License v3.0](https://www.gnu.org/licenses/gpl-3.0-standalone.html). All projects **must** properly attribute [The Original Source](https://github.com/niranjan94/show-java). - - Show Java - A java/apk decompiler for android - Copyright (C) 2019 Niranjan Rajendran - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -An unmodified copy of the above license text must be included in all forks. - -To obtain the software under a different license, please contact [Niranjan Rajendran](https://niranjan.io) at `me niranjan.io`. - -## External Credits - -1. A Big-Huge Thanks to Lee Benfield ([lee@benf.org](mailto:lee@benf.org)) for his awesome CFR - Class File Reader -2. Panxiaobo ([pxb1988@gmail.com](mailto:pxb1988@gmail.com)) for dex2jar. -3. [Hsiafan](https://github.com/hsiafan/apk-parser) for apk-parser. -4. [Ben Gruver](https://github.com/JesusFreke/) for dexlib2. -5. [skylot](https://github.com/skylot/jadx) for JaDX. -6. [JetBrains](https://github.com/JetBrains) for FernFlower analytical decompiler. - -> Android, Google Play and the Google Play logo are trademarks of Google LLC. +This repo contains the source of http://niranjan94.github.io/show-java diff --git a/_config.yml b/_config.yml new file mode 100644 index 00000000..2ee89668 --- /dev/null +++ b/_config.yml @@ -0,0 +1,8 @@ +title: Show Java +description: An apk decompiler for android +google_analytics: +show_downloads: true +theme: jekyll-theme-minimal + +gems: + - jekyll-mentions diff --git a/app/build.gradle b/app/build.gradle deleted file mode 100644 index 335d4492..00000000 --- a/app/build.gradle +++ /dev/null @@ -1,344 +0,0 @@ -/* - //noinspection GradleDependency - * Show Java - A java/apk decompiler for android - * Copyright (c) 2018 Niranjan Rajendran - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -apply plugin: "com.android.application" -apply plugin: "kotlin-android" -apply plugin: "kotlin-android-extensions" -apply plugin: "io.fabric" -apply plugin: "com.google.android.gms.oss-licenses-plugin" -apply plugin: "io.michaelrocks.paranoid" -apply plugin: "ru.tinkoff.gradle.jarjar" - -def versionMajor = 3 -def versionMinor = 0 -def versionPatch = 6 -def versionBuild = 4 - -def getGitHash = { -> - def stdout = new ByteArrayOutputStream() - exec { - commandLine "git", "rev-parse", "--short", "HEAD" - standardOutput = stdout - } - return stdout.toString().trim() -} - -def buildTime = new Date().format("yyyy-MM-dd'T'HH:mm'Z'", TimeZone.getTimeZone("UTC")) - -def isCi = "true" == System.getenv("CI") -def preDexEnabled = "true" == System.getProperty("PRE_DEX", "true") - -def props = new Properties() -try { - props.load(new FileInputStream("app/keys.properties")) -} catch (e) { - props.load(new FileInputStream("app/keys.properties.example")) - println("===========") - println(e.message) - println("Loaded app/keys.properties.example instead.") - println("===========") - println() -} - -android { - compileSdkVersion 28 - buildToolsVersion "28.0.3" - - dexOptions { - preDexLibraries = preDexEnabled && !isCi - } - - defaultConfig { - minSdkVersion 16 - targetSdkVersion 28 - multiDexEnabled true - multiDexKeepProguard file("multidex-config.pro") - - applicationId "com.njlabs.showjava" - versionCode versionMajor * 10000 + versionMinor * 1000 + versionPatch * 100 + versionBuild - versionName "${versionMajor}.${versionMinor}.${versionPatch}" - - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - - resConfigs "en" - vectorDrawables.useSupportLibrary true - - proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" - - resValue "string", "appName", "Show Java" - resValue "string", "appNameGetPro", "Get Show Java Pro" - resValue "string", "appVersion", android.defaultConfig.versionName - resValue "string", "appVersionExtended", "Version ${android.defaultConfig.versionName}" - resValue "string", "appVersionExtendedWithHash", "Version ${android.defaultConfig.versionName} (${getGitHash()})" - - resValue "string", "deviceId", props.getProperty("deviceId") - resValue "string", "adUnitId", props.getProperty("adUnitId") - resValue "string", "admobAppId", props.getProperty("admobAppId") - resValue "string", "admobPublisherId", props.getProperty("admobPublisherId") - resValue "string", "privacyPolicyUrl", props.getProperty("privacyPolicyUrl") - - buildConfigField "String", "GIT_SHA", "\"${getGitHash()}\"" - buildConfigField "String", "BUILD_TIME", "\"${buildTime}\"" - buildConfigField "String", "PLAY_LICENSE_KEY", "\"${props.getProperty("googlePlayLicenseKey")}\"" - buildConfigField "String", "IAP_PRODUCT_ID", "\"${props.getProperty("IapProductId")}\"" - buildConfigField "String", "BACKEND_URL", "\"${props.getProperty("backendUrl")}\"" - buildConfigField "String", "PURCHASE_VERIFIER_PATH", "\"${props.getProperty("purchaseVerifierPath")}\"" - buildConfigField "Boolean", "IS_CI", "${isCi}" - buildConfigField "Boolean", "EXTENDED_VALIDATION", "false" - - manifestPlaceholders = [admobAppId: props.getProperty("admobAppId"), crashlyticsApiKey: props.getProperty("crashlyticsApiKey")] - } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - - dexOptions { - javaMaxHeapSize "4g" - } - - packagingOptions { - exclude "META-INF/LICENSE" - exclude "META-INF/LICENSE.txt" - exclude "META-INF/NOTICE.txt" - exclude "META-INF/MANIFEST.MF" - exclude "META-INF/rxjava.properties" - } - - lintOptions { - abortOnError false - } - - flavorDimensions "type" - - productFlavors { - standard { - dimension = "type" - } - } - - testOptions { - unitTests.includeAndroidResources = true - } - - buildTypes { - release { - minifyEnabled true - shrinkResources true - buildConfigField "Boolean", "EXTENDED_VALIDATION", "true" - } - debug { - buildConfigField "Boolean", "EXTENDED_VALIDATION", props.getProperty("debugExtendedValidation", "false") - minifyEnabled props.getProperty("minifyEnabled", "true") == "true" - shrinkResources props.getProperty("shrinkResources", "true") == "true" - testProguardFile "test-proguard-rules.pro" - } - } - - sourceSets { - main.java.srcDirs += "src/main/kotlin" - main.resources.srcDirs += "src/main/config" - test.java.srcDirs += "src/test/kotlin" - androidTest.java.srcDirs += "src/androidTest/kotlin" - } -} - -configurations.all { - resolutionStrategy { - force "com.google.code.findbugs:jsr305:2.0.3" - } -} - -dependencies { - // Multi-dex - implementation "androidx.multidex:multidex:2.0.1" - - // Kotlin Standard library - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - - // Firebase-related dependencies - implementation 'com.google.firebase:firebase-core:17.0.0' - implementation 'com.google.firebase:firebase-ads:18.0.0' - implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1' - - // AndroidX support libraries - implementation 'androidx.appcompat:appcompat:1.0.2' - implementation "com.google.android.material:material:1.0.0" - implementation "androidx.cardview:cardview:1.0.0" - implementation "androidx.preference:preference:1.0.0" - implementation "androidx.recyclerview:recyclerview:1.0.0" - implementation 'androidx.core:core:1.0.2' - implementation 'com.google.android.gms:play-services-oss-licenses:17.0.0' - implementation "com.google.android.ads.consent:consent-library:1.0.7" - implementation "com.android.volley:volley:1.1.1" - - // Android WorkManager - implementation("android.arch.work:work-runtime-ktx:1.0.1", { - exclude group: "com.google.guava", module: "listenablefuture" - }) - - - // Dex2Jar & friends - implementation "asm:asm-all:3.3.1" - implementation files("libs/smali-2.2.1.jar") - implementation files("libs/dex-ir-1.12.jar") - implementation files("libs/dex-reader-1.15.jar") - implementation files("libs/dex-tools-0.0.9.15.jar") - implementation files("libs/dex-translator-0.0.9.15.jar") - - // CFR Decompiler - implementation 'org.benf:cfr:0.144' - - // DX Tool. We are using jar-jar to repackage the dx lib. - // As android comes with the same classes in the lib-art.jar package that is usually a tad bit - // older than what we need and hence missing stuff. - jarJar files("libs/dx-1.16.jar") - - // JaDX & friends - implementation files("libs/jadx-core-0.9.0.jar") - implementation files("libs/dx-1.16.jar") - implementation files("libs/android-5.1.jar") - implementation 'org.slf4j:slf4j-api:1.7.26' - implementation 'org.slf4j:slf4j-simple:1.7.26' - implementation 'uk.com.robust-it:cloning:1.9.12' - // Fix version to 1.9.11. Update to 1.9.12 causes compilation to fail due to org.objenesis:3.0.1 - // implementation "ch.qos.logback:logback-classic:1.2.3" - // implementation "ch.qos.logback:logback-core:1.2.3" - - // APK parser - implementation 'net.dongliu:apk-parser:2.6.9' - - // Fernflower decompiler - implementation "com.github.fesh0r:fernflower:a0a8f0a8dd" - - // RxAndroid & friends - implementation "io.reactivex.rxjava2:rxandroid:2.1.1" - implementation "io.reactivex.rxjava2:rxkotlin:2.3.0" - - // Testing tools - testImplementation "junit:junit:4.12" - androidTestImplementation "junit:junit:4.12" - androidTestImplementation 'androidx.test:core:1.2.0' - androidTestImplementation 'androidx.test:rules:1.2.0' - androidTestImplementation 'androidx.test.ext:junit:1.1.1' - androidTestImplementation('androidx.test.espresso:espresso-core:3.2.0', { - exclude group: "com.android.support", module: "support-annotations" - exclude group: "com.google.code.findbugs", module: "jsr305" - }) - - // Everybody else - //noinspection GradleDependency - implementation "commons-io:commons-io:2.5" // Fix to 2.5 for compatibility - implementation "com.jakewharton.timber:timber:4.7.1" - implementation('org.solovyev.android:checkout:1.2.1', { - exclude group: "com.google.code.findbugs", module: "jsr305" - }) - implementation "pub.devrel:easypermissions:3.0.0" - implementation("org.solovyev.android:checkout:1.2.1", { - exclude group: "com.google.code.findbugs", module: "jsr305" - }) - implementation ("com.github.kobakei:MaterialFabSpeedDial:1.2.1", { - exclude group: "com.google.android.material", module: "material" - }) - implementation "com.daimajia.numberprogressbar:library:1.4@aar" - implementation "com.davemorrissey.labs:subsampling-scale-image-view:3.10.0" - implementation "com.github.angads25:filepicker:1.1.1" - implementation "com.github.javiersantos:PiracyChecker:1.2.5" - implementation 'com.scottyab:secure-preferences-lib:0.1.7' - implementation "com.github.nekocode:Badge:2.1" - - implementation fileTree(dir: "build/libs", include: ["*.jar"]) -} - -jarJar { - rules = ["dx-1.16.jar": "com.android.** xyz.codezero.android.@1"] -} - -apply plugin: "hiBeaver" - -import com.bryansharp.gradle.hibeaver.utils.MethodLogAdapter -import org.objectweb.asm.ClassVisitor -import org.objectweb.asm.MethodVisitor -import org.objectweb.asm.Opcodes - -hiBeaver { - hiBeaverModifyName = "showJavaDexModifications" - showHelp = false - keepQuiet = false - watchTimeConsume = false - - modifyMatchMaps = [ - /* - * JaDX does not log class-by-class progress updates. - * So we patch the the method that saves the class at the bytecode level - * to invoke a log method at com.njlabs.showjava.Logger - * - * Note: this needs to be tested and adjusted for every update of JaDX. - */ - "jadx.core.dex.visitors.SaveCode": [ - ["methodName": "save", "methodDesc": "(Ljava/io/File;Ljadx/api/JadxArgs;Ljadx/core/dex/nodes/ClassNode;)V", "adapter": { - ClassVisitor cv, int access, String name, String desc, String signature, String[] exceptions -> - MethodVisitor methodVisitor = cv.visitMethod(access, name, desc, signature, exceptions) - MethodVisitor adapter = new MethodLogAdapter(methodVisitor) { - @Override - void visitCode() { - super.visitCode() - methodVisitor.visitVarInsn(Opcodes.ALOAD, 0) - methodVisitor.visitVarInsn(Opcodes.ALOAD, 1) - methodVisitor.visitVarInsn(Opcodes.ALOAD, 2) - methodVisitor.visitMethodInsn( - Opcodes.INVOKESTATIC, - className2Path("com.njlabs.showjava.utils.streams.Logger"), - "logJadxClassWrite", - "(Ljava/io/File;Ljadx/api/JadxArgs;Ljadx/core/dex/nodes/ClassNode;)V", - false - ) - } - } - return adapter - }] - ], - /* - * JaDX uses java.nio.* classes for checking if the file system is case sensitive or not. - * But java.nio.* classes are not available on on Android API < 26. - * So, we will patch the method to return true thereby skipping all java.nio.* usages. - * - * Note: this needs to be tested and adjusted for every update of JaDX. - */ - "jadx.core.utils.files.FileUtils": [ - ["methodName": "isCaseSensitiveFS", "methodDesc": "(Ljava/io/File;)Z", "adapter": { - ClassVisitor cv, int access, String name, String desc, String signature, String[] exceptions -> - MethodVisitor methodVisitor = cv.visitMethod(access, name, desc, signature, exceptions) - MethodVisitor adapter = new MethodLogAdapter(methodVisitor) { - @Override - void visitCode() { - methodVisitor.visitCode() - methodVisitor.visitInsn(Opcodes.ICONST_1) - methodVisitor.visitInsn(Opcodes.IRETURN) - methodVisitor.visitEnd() - } - } - return adapter - }] - ] - ] -} - -apply plugin: "com.google.gms.google-services" diff --git a/app/keys.properties.example b/app/keys.properties.example deleted file mode 100644 index 7da7b2b5..00000000 --- a/app/keys.properties.example +++ /dev/null @@ -1,12 +0,0 @@ -deviceId=YourDeviceId -admobPublisherId=pub-3940256099942544 -adUnitId=YourAdUnitId -admobAppId=ca-app-pub-3940256099942544~3347511713 -IapProductId=pro_app -googlePlayLicenseKey=xyzzy -backendUrl=https://postb.in/iiolsQAd -purchaseVerifierPath=check/buy -privacyPolicyUrl=https://example.com/privacy-policy/ -minifyEnabled=true -shrinkResources=true -crashlyticsApiKey=$CRASHLYTICS_API_KEY \ No newline at end of file diff --git a/app/libs/android-5.1.jar b/app/libs/android-5.1.jar deleted file mode 100644 index 68b8a554..00000000 Binary files a/app/libs/android-5.1.jar and /dev/null differ diff --git a/app/libs/dex-ir-1.12.jar b/app/libs/dex-ir-1.12.jar deleted file mode 100644 index 396ff804..00000000 Binary files a/app/libs/dex-ir-1.12.jar and /dev/null differ diff --git a/app/libs/dex-reader-1.15.jar b/app/libs/dex-reader-1.15.jar deleted file mode 100644 index a18ee9ab..00000000 Binary files a/app/libs/dex-reader-1.15.jar and /dev/null differ diff --git a/app/libs/dex-tools-0.0.9.15.jar b/app/libs/dex-tools-0.0.9.15.jar deleted file mode 100644 index 0f3dc36f..00000000 Binary files a/app/libs/dex-tools-0.0.9.15.jar and /dev/null differ diff --git a/app/libs/dex-translator-0.0.9.15.jar b/app/libs/dex-translator-0.0.9.15.jar deleted file mode 100644 index 637c3695..00000000 Binary files a/app/libs/dex-translator-0.0.9.15.jar and /dev/null differ diff --git a/app/libs/dx-1.16.jar b/app/libs/dx-1.16.jar deleted file mode 100644 index cb0161bb..00000000 Binary files a/app/libs/dx-1.16.jar and /dev/null differ diff --git a/app/libs/jadx-core-0.9.0.jar b/app/libs/jadx-core-0.9.0.jar deleted file mode 100644 index eefa26ee..00000000 Binary files a/app/libs/jadx-core-0.9.0.jar and /dev/null differ diff --git a/app/libs/smali-2.2.1.jar b/app/libs/smali-2.2.1.jar deleted file mode 100644 index 9f88d6b1..00000000 Binary files a/app/libs/smali-2.2.1.jar and /dev/null differ diff --git a/app/mock-google-services.json b/app/mock-google-services.json deleted file mode 100644 index d7052f7c..00000000 --- a/app/mock-google-services.json +++ /dev/null @@ -1,908 +0,0 @@ -{ - "project_info": { - "project_id": "mockproject-1234", - "project_number": "123456789000", - "name": "FirebaseQuickstarts", - "firebase_url": "https://mockproject-1234.firebaseio.com" - }, - "client": [ - { - "client_info": { - "mobilesdk_app_id": "1:123456789000:android:f1bf012572b04063", - "client_id": "android:com.njlabs.showjava", - "client_type": 1, - "android_client_info": { - "package_name": "com.njlabs.showjava", - "certificate_hash": [] - } - }, - "oauth_client": [ - { - "client_id": "123456789000-hjugbg6ud799v4c49dim8ce2usclthar.apps.googleusercontent.com", - "client_type": 1, - "android_info": { - "package_name": "com.njlabs.showjava", - "certificate_hash": "4C20644DE36B8F89D25650C7D1FF9FBAE650FDF7" - } - }, - { - "client_id": "123456789000-e4uksm38sne0bqrj6uvkbo4oiu4hvigl.apps.googleusercontent.com", - "client_type": 3 - } - ], - "api_key": [ - { - "current_key": "AIzbSzCn1N6LWIe6wthYyrgUUSAlUsdqMb-wvTo" - } - ], - "services": { - "analytics_service": { - "status": 1 - }, - "cloud_messaging_service": { - "status": 2, - "apns_config": [] - }, - "appinvite_service": { - "status": 2, - "other_platform_oauth_client": [ - { - "client_id": "123456789000-e4uksm38sne0bqrj6uvkbo4oiu4hvigl.apps.googleusercontent.com", - "client_type": 3 - } - ] - }, - "google_signin_service": { - "status": 2 - }, - "ads_service": { - "status": 2, - "test_banner_ad_unit_id": "ca-app-pub-3940256099942544/6300978111", - "test_interstitial_ad_unit_id": "ca-app-pub-3940256099942544/1033173712" - } - } - }, - { - "client_info": { - "mobilesdk_app_id": "1:123456789000:android:f1bf012572b04063", - "client_id": "android:com.google.firebase.quickstart.analytics", - "client_type": 1, - "android_client_info": { - "package_name": "com.google.firebase.quickstart.analytics", - "certificate_hash": [] - } - }, - "oauth_client": [ - { - "client_id": "123456789000-hjugbg6ud799v4c49dim8ce2usclthar.apps.googleusercontent.com", - "client_type": 1, - "android_info": { - "package_name": "com.google.firebase.quickstart.analytics", - "certificate_hash": "4C20644DE36B8F89D25650C7D1FF9FBAE650FDF7" - } - }, - { - "client_id": "123456789000-e4uksm38sne0bqrj6uvkbo4oiu4hvigl.apps.googleusercontent.com", - "client_type": 3 - } - ], - "api_key": [ - { - "current_key": "AIzbSzCn1N6LWIe6wthYyrgUUSAlUsdqMb-wvTo" - } - ], - "services": { - "analytics_service": { - "status": 1 - }, - "cloud_messaging_service": { - "status": 2, - "apns_config": [] - }, - "appinvite_service": { - "status": 2, - "other_platform_oauth_client": [ - { - "client_id": "123456789000-e4uksm38sne0bqrj6uvkbo4oiu4hvigl.apps.googleusercontent.com", - "client_type": 3 - } - ] - }, - "google_signin_service": { - "status": 2 - }, - "ads_service": { - "status": 2, - "test_banner_ad_unit_id": "ca-app-pub-3940256099942544/6300978111", - "test_interstitial_ad_unit_id": "ca-app-pub-3940256099942544/1033173712" - } - } - }, - { - "client_info": { - "mobilesdk_app_id": "1:123456789000:android:f1bf012572b04063", - "client_id": "android:com.google.samples.quickstart.appindexing", - "client_type": 1, - "android_client_info": { - "package_name": "com.google.samples.quickstart.appindexing", - "certificate_hash": [] - } - }, - "oauth_client": [ - { - "client_id": "123456789000-hjugbg6ud799v4c49dim8ce2usclthar.apps.googleusercontent.com", - "client_type": 1, - "android_info": { - "package_name": "com.google.samples.quickstart.appindexing", - "certificate_hash": "4C20644DE36B8F89D25650C7D1FF9FBAE650FDF7" - } - }, - { - "client_id": "123456789000-e4uksm38sne0bqrj6uvkbo4oiu4hvigl.apps.googleusercontent.com", - "client_type": 3 - } - ], - "api_key": [ - { - "current_key": "AIzbSzCn1N6LWIe6wthYyrgUUSAlUsdqMb-wvTo" - } - ], - "services": { - "analytics_service": { - "status": 1 - }, - "cloud_messaging_service": { - "status": 2, - "apns_config": [] - }, - "appinvite_service": { - "status": 2, - "other_platform_oauth_client": [ - { - "client_id": "123456789000-e4uksm38sne0bqrj6uvkbo4oiu4hvigl.apps.googleusercontent.com", - "client_type": 3 - } - ] - }, - "google_signin_service": { - "status": 2 - }, - "ads_service": { - "status": 2, - "test_banner_ad_unit_id": "ca-app-pub-3940256099942544/6300978111", - "test_interstitial_ad_unit_id": "ca-app-pub-3940256099942544/1033173712" - } - } - }, - { - "client_info": { - "mobilesdk_app_id": "1:123456789000:android:f1bf012572b04063", - "client_id": "android:com.google.firebase.quickstart.auth", - "client_type": 1, - "android_client_info": { - "package_name": "com.google.firebase.quickstart.auth", - "certificate_hash": [] - } - }, - "oauth_client": [ - { - "client_id": "123456789000-hjugbg6ud799v4c49dim8ce2usclthar.apps.googleusercontent.com", - "client_type": 1, - "android_info": { - "package_name": "com.google.firebase.quickstart.auth", - "certificate_hash": "4C20644DE36B8F89D25650C7D1FF9FBAE650FDF7" - } - }, - { - "client_id": "123456789000-e4uksm38sne0bqrj6uvkbo4oiu4hvigl.apps.googleusercontent.com", - "client_type": 3 - } - ], - "api_key": [ - { - "current_key": "AIzbSzCn1N6LWIe6wthYyrgUUSAlUsdqMb-wvTo" - } - ], - "services": { - "analytics_service": { - "status": 1 - }, - "cloud_messaging_service": { - "status": 2, - "apns_config": [] - }, - "appinvite_service": { - "status": 2, - "other_platform_oauth_client": [ - { - "client_id": "123456789000-e4uksm38sne0bqrj6uvkbo4oiu4hvigl.apps.googleusercontent.com", - "client_type": 3 - } - ] - }, - "google_signin_service": { - "status": 2 - }, - "ads_service": { - "status": 2, - "test_banner_ad_unit_id": "ca-app-pub-3940256099942544/6300978111", - "test_interstitial_ad_unit_id": "ca-app-pub-3940256099942544/1033173712" - } - } - }, - { - "client_info": { - "mobilesdk_app_id": "1:123456789000:android:f1bf012572b04063", - "client_id": "android:com.google.samples.quickstart.config", - "client_type": 1, - "android_client_info": { - "package_name": "com.google.samples.quickstart.config", - "certificate_hash": [] - } - }, - "oauth_client": [ - { - "client_id": "123456789000-hjugbg6ud799v4c49dim8ce2usclthar.apps.googleusercontent.com", - "client_type": 1, - "android_info": { - "package_name": "com.google.samples.quickstart.config", - "certificate_hash": "4C20644DE36B8F89D25650C7D1FF9FBAE650FDF7" - } - }, - { - "client_id": "123456789000-e4uksm38sne0bqrj6uvkbo4oiu4hvigl.apps.googleusercontent.com", - "client_type": 3 - } - ], - "api_key": [ - { - "current_key": "AIzbSzCn1N6LWIe6wthYyrgUUSAlUsdqMb-wvTo" - } - ], - "services": { - "analytics_service": { - "status": 1 - }, - "cloud_messaging_service": { - "status": 2, - "apns_config": [] - }, - "appinvite_service": { - "status": 2, - "other_platform_oauth_client": [ - { - "client_id": "123456789000-e4uksm38sne0bqrj6uvkbo4oiu4hvigl.apps.googleusercontent.com", - "client_type": 3 - } - ] - }, - "google_signin_service": { - "status": 2 - }, - "ads_service": { - "status": 2, - "test_banner_ad_unit_id": "ca-app-pub-3940256099942544/6300978111", - "test_interstitial_ad_unit_id": "ca-app-pub-3940256099942544/1033173712" - } - } - }, - { - "client_info": { - "mobilesdk_app_id": "1:123456789000:android:f1bf012572b04063", - "client_id": "android:com.google.samples.quickstart.crash", - "client_type": 1, - "android_client_info": { - "package_name": "com.google.samples.quickstart.crash", - "certificate_hash": [] - } - }, - "oauth_client": [ - { - "client_id": "123456789000-hjugbg6ud799v4c49dim8ce2usclthar.apps.googleusercontent.com", - "client_type": 1, - "android_info": { - "package_name": "com.google.samples.quickstart.crash", - "certificate_hash": "4C20644DE36B8F89D25650C7D1FF9FBAE650FDF7" - } - }, - { - "client_id": "123456789000-e4uksm38sne0bqrj6uvkbo4oiu4hvigl.apps.googleusercontent.com", - "client_type": 3 - } - ], - "api_key": [ - { - "current_key": "AIzbSzCn1N6LWIe6wthYyrgUUSAlUsdqMb-wvTo" - } - ], - "services": { - "analytics_service": { - "status": 1 - }, - "cloud_messaging_service": { - "status": 2, - "apns_config": [] - }, - "appinvite_service": { - "status": 2, - "other_platform_oauth_client": [ - { - "client_id": "123456789000-e4uksm38sne0bqrj6uvkbo4oiu4hvigl.apps.googleusercontent.com", - "client_type": 3 - } - ] - }, - "google_signin_service": { - "status": 2 - }, - "ads_service": { - "status": 2, - "test_banner_ad_unit_id": "ca-app-pub-3940256099942544/6300978111", - "test_interstitial_ad_unit_id": "ca-app-pub-3940256099942544/1033173712" - } - } - }, - { - "client_info": { - "mobilesdk_app_id": "1:123456789000:android:f1bf012572b04063", - "client_id": "android:com.google.firebase.quickstart.database", - "client_type": 1, - "android_client_info": { - "package_name": "com.google.firebase.quickstart.database", - "certificate_hash": [] - } - }, - "oauth_client": [ - { - "client_id": "123456789000-hjugbg6ud799v4c49dim8ce2usclthar.apps.googleusercontent.com", - "client_type": 1, - "android_info": { - "package_name": "com.google.firebase.quickstart.database", - "certificate_hash": "4C20644DE36B8F89D25650C7D1FF9FBAE650FDF7" - } - }, - { - "client_id": "123456789000-e4uksm38sne0bqrj6uvkbo4oiu4hvigl.apps.googleusercontent.com", - "client_type": 3 - } - ], - "api_key": [ - { - "current_key": "AIzbSzCn1N6LWIe6wthYyrgUUSAlUsdqMb-wvTo" - } - ], - "services": { - "analytics_service": { - "status": 1 - }, - "cloud_messaging_service": { - "status": 2, - "apns_config": [] - }, - "appinvite_service": { - "status": 2, - "other_platform_oauth_client": [ - { - "client_id": "123456789000-e4uksm38sne0bqrj6uvkbo4oiu4hvigl.apps.googleusercontent.com", - "client_type": 3 - } - ] - }, - "google_signin_service": { - "status": 2 - }, - "ads_service": { - "status": 2, - "test_banner_ad_unit_id": "ca-app-pub-3940256099942544/6300978111", - "test_interstitial_ad_unit_id": "ca-app-pub-3940256099942544/1033173712" - } - } - }, - { - "client_info": { - "mobilesdk_app_id": "1:123456789000:android:f1bf012572b04063", - "client_id": "android:com.google.firebase.quickstart.deeplinks", - "client_type": 1, - "android_client_info": { - "package_name": "com.google.firebase.quickstart.deeplinks", - "certificate_hash": [] - } - }, - "oauth_client": [ - { - "client_id": "123456789000-hjugbg6ud799v4c49dim8ce2usclthar.apps.googleusercontent.com", - "client_type": 1, - "android_info": { - "package_name": "com.google.firebase.quickstart.deeplinks", - "certificate_hash": "4C20644DE36B8F89D25650C7D1FF9FBAE650FDF7" - } - }, - { - "client_id": "123456789000-e4uksm38sne0bqrj6uvkbo4oiu4hvigl.apps.googleusercontent.com", - "client_type": 3 - } - ], - "api_key": [ - { - "current_key": "AIzbSzCn1N6LWIe6wthYyrgUUSAlUsdqMb-wvTo" - } - ], - "services": { - "analytics_service": { - "status": 1 - }, - "cloud_messaging_service": { - "status": 2, - "apns_config": [] - }, - "appinvite_service": { - "status": 2, - "other_platform_oauth_client": [ - { - "client_id": "123456789000-e4uksm38sne0bqrj6uvkbo4oiu4hvigl.apps.googleusercontent.com", - "client_type": 3 - } - ] - }, - "google_signin_service": { - "status": 2 - }, - "ads_service": { - "status": 2, - "test_banner_ad_unit_id": "ca-app-pub-3940256099942544/6300978111", - "test_interstitial_ad_unit_id": "ca-app-pub-3940256099942544/1033173712" - } - } - }, - { - "client_info": { - "mobilesdk_app_id": "1:123456789000:android:f1bf012572b04063", - "client_id": "android:com.google.firebase.quickstart.invites", - "client_type": 1, - "android_client_info": { - "package_name": "com.google.firebase.quickstart.invites", - "certificate_hash": [] - } - }, - "oauth_client": [ - { - "client_id": "123456789000-hjugbg6ud799v4c49dim8ce2usclthar.apps.googleusercontent.com", - "client_type": 1, - "android_info": { - "package_name": "com.google.firebase.quickstart.invites", - "certificate_hash": "4C20644DE36B8F89D25650C7D1FF9FBAE650FDF7" - } - }, - { - "client_id": "123456789000-e4uksm38sne0bqrj6uvkbo4oiu4hvigl.apps.googleusercontent.com", - "client_type": 3 - } - ], - "api_key": [ - { - "current_key": "AIzbSzCn1N6LWIe6wthYyrgUUSAlUsdqMb-wvTo" - } - ], - "services": { - "analytics_service": { - "status": 1 - }, - "cloud_messaging_service": { - "status": 2, - "apns_config": [] - }, - "appinvite_service": { - "status": 2, - "other_platform_oauth_client": [ - { - "client_id": "123456789000-e4uksm38sne0bqrj6uvkbo4oiu4hvigl.apps.googleusercontent.com", - "client_type": 3 - } - ] - }, - "google_signin_service": { - "status": 2 - }, - "ads_service": { - "status": 2, - "test_banner_ad_unit_id": "ca-app-pub-3940256099942544/6300978111", - "test_interstitial_ad_unit_id": "ca-app-pub-3940256099942544/1033173712" - } - } - }, - { - "client_info": { - "mobilesdk_app_id": "1:123456789000:android:f1bf012572b04063", - "client_id": "android:com.google.firebase.example.fireeats", - "client_type": 1, - "android_client_info": { - "package_name": "com.google.firebase.example.fireeats", - "certificate_hash": [] - } - }, - "oauth_client": [ - { - "client_id": "123456789000-hjugbg6ud799v4c49dim8ce2usclthar.apps.googleusercontent.com", - "client_type": 1, - "android_info": { - "package_name": "com.google.firebase.example.fireeats", - "certificate_hash": "4C20644DE36B8F89D25650C7D1FF9FBAE650FDF7" - } - }, - { - "client_id": "123456789000-e4uksm38sne0bqrj6uvkbo4oiu4hvigl.apps.googleusercontent.com", - "client_type": 3 - } - ], - "api_key": [ - { - "current_key": "AIzbSzCn1N6LWIe6wthYyrgUUSAlUsdqMb-wvTo" - } - ], - "services": { - "analytics_service": { - "status": 1 - }, - "cloud_messaging_service": { - "status": 2, - "apns_config": [] - }, - "appinvite_service": { - "status": 2, - "other_platform_oauth_client": [ - { - "client_id": "123456789000-e4uksm38sne0bqrj6uvkbo4oiu4hvigl.apps.googleusercontent.com", - "client_type": 3 - } - ] - }, - "google_signin_service": { - "status": 2 - }, - "ads_service": { - "status": 2, - "test_banner_ad_unit_id": "ca-app-pub-3940256099942544/6300978111", - "test_interstitial_ad_unit_id": "ca-app-pub-3940256099942544/1033173712" - } - } - }, - { - "client_info": { - "mobilesdk_app_id": "1:123456789000:android:f1bf012572b04063", - "client_id": "android:com.google.firebase.quickstart.fcm", - "client_type": 1, - "android_client_info": { - "package_name": "com.google.firebase.quickstart.fcm", - "certificate_hash": [] - } - }, - "oauth_client": [ - { - "client_id": "123456789000-hjugbg6ud799v4c49dim8ce2usclthar.apps.googleusercontent.com", - "client_type": 1, - "android_info": { - "package_name": "com.google.firebase.quickstart.fcm", - "certificate_hash": "4C20644DE36B8F89D25650C7D1FF9FBAE650FDF7" - } - }, - { - "client_id": "123456789000-e4uksm38sne0bqrj6uvkbo4oiu4hvigl.apps.googleusercontent.com", - "client_type": 3 - } - ], - "api_key": [ - { - "current_key": "AIzbSzCn1N6LWIe6wthYyrgUUSAlUsdqMb-wvTo" - } - ], - "services": { - "analytics_service": { - "status": 1 - }, - "cloud_messaging_service": { - "status": 2, - "apns_config": [] - }, - "appinvite_service": { - "status": 2, - "other_platform_oauth_client": [ - { - "client_id": "123456789000-e4uksm38sne0bqrj6uvkbo4oiu4hvigl.apps.googleusercontent.com", - "client_type": 3 - } - ] - }, - "google_signin_service": { - "status": 2 - }, - "ads_service": { - "status": 2, - "test_banner_ad_unit_id": "ca-app-pub-3940256099942544/6300978111", - "test_interstitial_ad_unit_id": "ca-app-pub-3940256099942544/1033173712" - } - } - }, - { - "client_info": { - "mobilesdk_app_id": "1:123456789000:android:f1bf012572b04063", - "client_id": "com.google.firebase.quickstart.perfmon", - "client_type": 1, - "android_client_info": { - "package_name": "com.google.firebase.quickstart.perfmon", - "certificate_hash": [] - } - }, - "oauth_client": [ - { - "client_id": "123456789000-hjugbg6ud799v4c49dim8ce2usclthar.apps.googleusercontent.com", - "client_type": 1, - "android_info": { - "package_name": "com.google.firebase.quickstart.perfmon", - "certificate_hash": "4C20644DE36B8F89D25650C7D1FF9FBAE650FDF7" - } - }, - { - "client_id": "123456789000-e4uksm38sne0bqrj6uvkbo4oiu4hvigl.apps.googleusercontent.com", - "client_type": 3 - } - ], - "api_key": [ - { - "current_key": "AIzbSzCn1N6LWIe6wthYyrgUUSAlUsdqMb-wvTo" - } - ], - "services": { - "analytics_service": { - "status": 1 - }, - "cloud_messaging_service": { - "status": 2, - "apns_config": [] - }, - "appinvite_service": { - "status": 2, - "other_platform_oauth_client": [ - { - "client_id": "123456789000-e4uksm38sne0bqrj6uvkbo4oiu4hvigl.apps.googleusercontent.com", - "client_type": 3 - } - ] - }, - "google_signin_service": { - "status": 2 - }, - "ads_service": { - "status": 2, - "test_banner_ad_unit_id": "ca-app-pub-3940256099942544/6300978111", - "test_interstitial_ad_unit_id": "ca-app-pub-3940256099942544/1033173712" - } - } - }, - { - "client_info": { - "mobilesdk_app_id": "1:123456789000:android:f1bf012572b04063", - "client_id": "android:com.google.firebase.quickstart.firebasestorage", - "client_type": 1, - "android_client_info": { - "package_name": "com.google.firebase.quickstart.firebasestorage", - "certificate_hash": [] - } - }, - "oauth_client": [ - { - "client_id": "123456789000-hjugbg6ud799v4c49dim8ce2usclthar.apps.googleusercontent.com", - "client_type": 1, - "android_info": { - "package_name": "com.google.firebase.quickstart.firebasestorage", - "certificate_hash": "4C20644DE36B8F89D25650C7D1FF9FBAE650FDF7" - } - }, - { - "client_id": "123456789000-e4uksm38sne0bqrj6uvkbo4oiu4hvigl.apps.googleusercontent.com", - "client_type": 3 - } - ], - "api_key": [ - { - "current_key": "AIzbSzCn1N6LWIe6wthYyrgUUSAlUsdqMb-wvTo" - } - ], - "services": { - "analytics_service": { - "status": 1 - }, - "cloud_messaging_service": { - "status": 2, - "apns_config": [] - }, - "appinvite_service": { - "status": 2, - "other_platform_oauth_client": [ - { - "client_id": "123456789000-e4uksm38sne0bqrj6uvkbo4oiu4hvigl.apps.googleusercontent.com", - "client_type": 3 - } - ] - }, - "google_signin_service": { - "status": 2 - }, - "ads_service": { - "status": 2, - "test_banner_ad_unit_id": "ca-app-pub-3940256099942544/6300978111", - "test_interstitial_ad_unit_id": "ca-app-pub-3940256099942544/1033173712" - } - } - }, - { - "client_info": { - "mobilesdk_app_id": "1:123456789000:android:f1bf012572b04063", - "client_id": "android:com.google.samples.quickstart.functions", - "client_type": 1, - "android_client_info": { - "package_name": "com.google.samples.quickstart.functions", - "certificate_hash": [] - } - }, - "oauth_client": [ - { - "client_id": "123456789000-hjugbg6ud799v4c49dim8ce2usclthar.apps.googleusercontent.com", - "client_type": 1, - "android_info": { - "package_name": "com.google.samples.quickstart.functions", - "certificate_hash": "4C20644DE36B8F89D25650C7D1FF9FBAE650FDF7" - } - }, - { - "client_id": "123456789000-e4uksm38sne0bqrj6uvkbo4oiu4hvigl.apps.googleusercontent.com", - "client_type": 3 - } - ], - "api_key": [ - { - "current_key": "AIzbSzCn1N6LWIe6wthYyrgUUSAlUsdqMb-wvTo" - } - ], - "services": { - "analytics_service": { - "status": 1 - }, - "cloud_messaging_service": { - "status": 2, - "apns_config": [] - }, - "appinvite_service": { - "status": 2, - "other_platform_oauth_client": [ - { - "client_id": "123456789000-e4uksm38sne0bqrj6uvkbo4oiu4hvigl.apps.googleusercontent.com", - "client_type": 3 - } - ] - }, - "google_signin_service": { - "status": 2 - }, - "ads_service": { - "status": 2, - "test_banner_ad_unit_id": "ca-app-pub-3940256099942544/6300978111", - "test_interstitial_ad_unit_id": "ca-app-pub-3940256099942544/1033173712" - } - } - }, - { - "client_info": { - "mobilesdk_app_id": "1:123456789000:android:f1bf012572b04063", - "client_id": "android:com.google.firebase.samples.apps.mlkit", - "client_type": 1, - "android_client_info": { - "package_name": "com.google.firebase.samples.apps.mlkit", - "certificate_hash": [] - } - }, - "oauth_client": [ - { - "client_id": "123456789000-hjugbg6ud799v4c49dim8ce2usclthar.apps.googleusercontent.com", - "client_type": 1, - "android_info": { - "package_name": "com.google.firebase.samples.apps.mlkit", - "certificate_hash": "4C20644DE36B8F89D25650C7D1FF9FBAE650FDF7" - } - }, - { - "client_id": "123456789000-e4uksm38sne0bqrj6uvkbo4oiu4hvigl.apps.googleusercontent.com", - "client_type": 3 - } - ], - "api_key": [ - { - "current_key": "AIzbSzCn1N6LWIe6wthYyrgUUSAlUsdqMb-wvTo" - } - ], - "services": { - "analytics_service": { - "status": 1 - }, - "cloud_messaging_service": { - "status": 2, - "apns_config": [] - }, - "appinvite_service": { - "status": 2, - "other_platform_oauth_client": [ - { - "client_id": "123456789000-e4uksm38sne0bqrj6uvkbo4oiu4hvigl.apps.googleusercontent.com", - "client_type": 3 - } - ] - }, - "google_signin_service": { - "status": 2 - }, - "ads_service": { - "status": 2, - "test_banner_ad_unit_id": "ca-app-pub-3940256099942544/6300978111", - "test_interstitial_ad_unit_id": "ca-app-pub-3940256099942544/1033173712" - } - } - }, - { - "client_info": { - "mobilesdk_app_id": "1:123456789000:android:f1bf012572b04063", - "client_id": "android:com.google.firebase.fiamquickstart", - "client_type": 1, - "android_client_info": { - "package_name": "com.google.firebase.fiamquickstart", - "certificate_hash": [] - } - }, - "oauth_client": [ - { - "client_id": "123456789000-hjugbg6ud799v4c49dim8ce2usclthar.apps.googleusercontent.com", - "client_type": 1, - "android_info": { - "package_name": "com.google.firebase.fiamquickstart", - "certificate_hash": "4C20644DE36B8F89D25650C7D1FF9FBAE650FDF7" - } - }, - { - "client_id": "123456789000-e4uksm38sne0bqrj6uvkbo4oiu4hvigl.apps.googleusercontent.com", - "client_type": 3 - } - ], - "api_key": [ - { - "current_key": "AIzbSzCn1N6LWIe6wthYyrgUUSAlUsdqMb-wvTo" - } - ], - "services": { - "analytics_service": { - "status": 1 - }, - "cloud_messaging_service": { - "status": 2, - "apns_config": [] - }, - "appinvite_service": { - "status": 2, - "other_platform_oauth_client": [ - { - "client_id": "123456789000-e4uksm38sne0bqrj6uvkbo4oiu4hvigl.apps.googleusercontent.com", - "client_type": 3 - } - ] - }, - "google_signin_service": { - "status": 2 - }, - "ads_service": { - "status": 2, - "test_banner_ad_unit_id": "ca-app-pub-3940256099942544/6300978111", - "test_interstitial_ad_unit_id": "ca-app-pub-3940256099942544/1033173712" - } - } - } - ], - "client_info": [], - "ARTIFACT_VERSION": "1" -} diff --git a/app/multidex-config.pro b/app/multidex-config.pro deleted file mode 100644 index de67740c..00000000 --- a/app/multidex-config.pro +++ /dev/null @@ -1,7 +0,0 @@ --keep class com.njlabs.MainApplication --keep class com.njlabs.MainApplication { *; } --keep class com.njlabs.showjava.utils.logging.** { *; } --keep class com.njlabs.showjava.test.** { *; } --keep class androidx.test.** { *; } --keep class androidx.multidex.** { *; } --keep class kotlin.** { *; } diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro deleted file mode 100644 index 506cda9e..00000000 --- a/app/proguard-rules.pro +++ /dev/null @@ -1,90 +0,0 @@ --optimizationpasses 5 --dontusemixedcaseclassnames --dontskipnonpubliclibraryclasses --dontpreverify --verbose - --libraryjars libs/android-5.1.jar --libraryjars libs/dex-ir-1.12.jar --libraryjars libs/dex-reader-1.15.jar --libraryjars libs/dex-tools-0.0.9.15.jar --libraryjars libs/dex-translator-0.0.9.15.jar --libraryjars libs/dx-1.16.jar --libraryjars libs/jadx-core-0.9.0.jar --libraryjars libs/smali-2.2.1.jar - --optimizations !code/simplification/arithmetic,!code/simplification/cast,!field/*,!class/merging/*,!code/allocation/variable --allowaccessmodification - --keep public class com.android.vending.billing.IInAppBillingService --keep class com.android.vending.billing.** --keep public class * extends android.view.View { - public (android.content.Context); - public (android.content.Context, android.util.AttributeSet); - public (android.content.Context, android.util.AttributeSet, int); -} --keepclasseswithmembers class * { - public (android.content.Context, android.util.AttributeSet); -} --keepclasseswithmembers class * { - public (android.content.Context, android.util.AttributeSet, int); -} --keepclassmembers class * extends android.content.Context { - public void *(android.view.View); - public void *(android.view.MenuItem); -} - --keep class android.support.v4.app.** { *; } --keep interface android.support.v4.app.** { *; } - --keep class android.support.** { *; } --keep interface android.support.** { *; } - - --keepattributes *Annotation* --keepattributes Signature --keepattributes InnerClasses --keepattributes InnerClasses,EnclosingMethod - --keep class com.googlecode.** --keep class com.android.** --keep class com.crashlytics.android.** --keep class org.objectweb.asm.** --keep class io.fabric.sdk.android.** --keep class com.crashlytics.android.** --keep class com.google.android.** --keep class ch.qos.logback.** --keep class com.android.dex.** { *; } --keep class xyz.codezero.android.dex.** { *; } --keep class kotlin.** { *; } --keep class com.njlabs.showjava.MainApplication { *; } --keep class com.njlabs.showjava.decompilers.** { *; } --keep class jadx.core.clsp.** { *; } - --keepattributes SourceFile,LineNumberTable - --keep public class * extends java.lang.Exception - --dontwarn com.google.** --dontwarn com.android.** --dontwarn antlr.debug.** --dontwarn org.antlr.** --dontwarn com.njlabs.showjava.** --dontwarn rx.internal.** --dontwarn com.googlecode.dex2jar.** --dontwarn android.test.** --dontwarn p.rn.** --dontwarn junit.runner.** --dontwarn net.dongliu.** --dontwarn com.** --dontwarn android.** --dontwarn org.** --dontwarn net.** --dontwarn uk.** --dontwarn io.** --dontwarn jadx.** --dontwarn java.** --dontwarn org.jetbrains.java.decompiler.** --dontwarn com.crashlytics.** --dontwarn com.google.android.** --dontwarn ch.qos.logback.** \ No newline at end of file diff --git a/app/src/androidTest/assets/test-application.jar b/app/src/androidTest/assets/test-application.jar deleted file mode 100644 index 57249fe3..00000000 Binary files a/app/src/androidTest/assets/test-application.jar and /dev/null differ diff --git a/app/src/androidTest/kotlin/com/njlabs/showjava/test/DecompilerTestBase.kt b/app/src/androidTest/kotlin/com/njlabs/showjava/test/DecompilerTestBase.kt deleted file mode 100644 index 3265a718..00000000 --- a/app/src/androidTest/kotlin/com/njlabs/showjava/test/DecompilerTestBase.kt +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Show Java - A java/apk decompiler for android - * Copyright (c) 2018 Niranjan Rajendran - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.njlabs.showjava.test - -import android.os.Build -import android.os.Environment -import androidx.test.platform.app.InstrumentationRegistry -import androidx.test.rule.GrantPermissionRule -import androidx.work.ListenableWorker -import com.njlabs.showjava.data.PackageInfo -import com.njlabs.showjava.decompilers.BaseDecompiler -import com.njlabs.showjava.decompilers.JarExtractionWorker -import com.njlabs.showjava.decompilers.JavaExtractionWorker -import com.njlabs.showjava.decompilers.ResourcesExtractionWorker -import junit.framework.TestCase -import org.junit.Assume -import org.junit.Before -import org.junit.Rule -import org.junit.Test -import java.io.File - -abstract class DecompilerTestBase { - - abstract val decompiler: String - abstract val type: PackageInfo.Type - - private val testAssets: File - get() = File(Environment.getExternalStorageDirectory(), "show-java") - .resolve("test-assets") - - private val testApplicationFile: File - get() = testAssets.resolve("test-application.${type.name.toLowerCase()}") - - @Rule - @JvmField - val grantPermissionRule: GrantPermissionRule = - GrantPermissionRule.grant( - android.Manifest.permission.READ_EXTERNAL_STORAGE, - android.Manifest.permission.INTERNET, - android.Manifest.permission.ACCESS_NETWORK_STATE, - android.Manifest.permission.WAKE_LOCK, - android.Manifest.permission.WRITE_EXTERNAL_STORAGE - ) - - @Before - fun initializeEnvironment() { - val appContext = InstrumentationRegistry.getInstrumentation() - if (testAssets.exists() && testAssets.isFile) { - testAssets.delete() - } - if (!testAssets.exists()) { - testAssets.mkdirs() - } - if (!testApplicationFile.exists()) { - testApplicationFile.outputStream().use { - appContext.context.assets - .open("test-application.${type.name.toLowerCase()}") - .copyTo(it) - } - } - } - - @Before - fun checkDecompilerAvailability() { - Assume.assumeTrue( - "Assume $decompiler is available on API ${Build.VERSION.SDK_INT}.", - BaseDecompiler.isAvailable(decompiler) - ) - } - - @Test - fun testDecompiler() { - val data = BaseDecompiler.formData(hashMapOf( - "shouldIgnoreLibs" to true, - "keepIntermediateFiles" to true, - "chunkSize" to 2000, - "maxAttempts" to 1, - "memoryThreshold" to 80, - "decompiler" to decompiler, - "name" to "xyz.codezero.testapplication.$decompiler.${type.name}", - "label" to "TestApplication-$decompiler-${type.name}", - "inputPackageFile" to testApplicationFile.canonicalPath, - "type" to type.ordinal - )) - - val packageInfo = PackageInfo.fromFile( - InstrumentationRegistry.getInstrumentation().targetContext, - testApplicationFile - ) - - TestCase.assertNotNull("Can parse PackageInfo from file", packageInfo) - - val outputDirectory = File( - Environment.getExternalStorageDirectory(), "show-java/sources/${data.getString("name")}" - ) - - if (outputDirectory.exists()) { - outputDirectory.deleteRecursively() - } - - val appContext = InstrumentationRegistry.getInstrumentation() - - var result: ListenableWorker.Result - var worker: BaseDecompiler - - worker = JarExtractionWorker(appContext.targetContext, data) - result = worker.doWork() - worker.onStopped() - TestCase.assertEquals("Can extract JAR", ListenableWorker.Result.success(), result) - - worker = JavaExtractionWorker(appContext.targetContext, data) - result = worker.doWork() - worker.onStopped() - TestCase.assertEquals("Can extract JAVA Code", ListenableWorker.Result.success(), result) - - worker = ResourcesExtractionWorker(appContext.targetContext, data) - result = worker.doWork() - worker.onStopped() - TestCase.assertEquals("Can extract resources", ListenableWorker.Result.success(), result) - } -} \ No newline at end of file diff --git a/app/src/androidTest/kotlin/com/njlabs/showjava/test/decompilers/apk/ApkViaCfr.kt b/app/src/androidTest/kotlin/com/njlabs/showjava/test/decompilers/apk/ApkViaCfr.kt deleted file mode 100644 index e08e2003..00000000 --- a/app/src/androidTest/kotlin/com/njlabs/showjava/test/decompilers/apk/ApkViaCfr.kt +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Show Java - A java/apk decompiler for android - * Copyright (c) 2018 Niranjan Rajendran - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.njlabs.showjava.test.decompilers.apk - -import androidx.test.ext.junit.runners.AndroidJUnit4 -import com.njlabs.showjava.test.DecompilerTestBase -import com.njlabs.showjava.data.PackageInfo -import org.junit.runner.RunWith - -@RunWith(AndroidJUnit4::class) -class ApkViaCfr: DecompilerTestBase() { - override val type: PackageInfo.Type = PackageInfo.Type.APK - override val decompiler: String = "cfr" -} \ No newline at end of file diff --git a/app/src/androidTest/kotlin/com/njlabs/showjava/test/decompilers/apk/ApkViaFernFlower.kt b/app/src/androidTest/kotlin/com/njlabs/showjava/test/decompilers/apk/ApkViaFernFlower.kt deleted file mode 100644 index 460e5d76..00000000 --- a/app/src/androidTest/kotlin/com/njlabs/showjava/test/decompilers/apk/ApkViaFernFlower.kt +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Show Java - A java/apk decompiler for android - * Copyright (c) 2018 Niranjan Rajendran - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.njlabs.showjava.test.decompilers.apk - -import androidx.test.ext.junit.runners.AndroidJUnit4 -import com.njlabs.showjava.test.DecompilerTestBase -import com.njlabs.showjava.data.PackageInfo -import org.junit.runner.RunWith - -@RunWith(AndroidJUnit4::class) -class ApkViaFernFlower: DecompilerTestBase() { - override val type: PackageInfo.Type = PackageInfo.Type.APK - override val decompiler: String = "fernflower" -} \ No newline at end of file diff --git a/app/src/androidTest/kotlin/com/njlabs/showjava/test/decompilers/apk/ApkViaJadx.kt b/app/src/androidTest/kotlin/com/njlabs/showjava/test/decompilers/apk/ApkViaJadx.kt deleted file mode 100644 index 16a864e0..00000000 --- a/app/src/androidTest/kotlin/com/njlabs/showjava/test/decompilers/apk/ApkViaJadx.kt +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Show Java - A java/apk decompiler for android - * Copyright (c) 2018 Niranjan Rajendran - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.njlabs.showjava.test.decompilers.apk - -import androidx.test.ext.junit.runners.AndroidJUnit4 -import com.njlabs.showjava.test.DecompilerTestBase -import com.njlabs.showjava.data.PackageInfo -import org.junit.runner.RunWith - -@RunWith(AndroidJUnit4::class) -class ApkViaJadx: DecompilerTestBase() { - override val type: PackageInfo.Type = PackageInfo.Type.APK - override val decompiler: String = "jadx" -} \ No newline at end of file diff --git a/app/src/androidTest/kotlin/com/njlabs/showjava/test/decompilers/dex/DexViaCfr.kt b/app/src/androidTest/kotlin/com/njlabs/showjava/test/decompilers/dex/DexViaCfr.kt deleted file mode 100644 index 23a05e27..00000000 --- a/app/src/androidTest/kotlin/com/njlabs/showjava/test/decompilers/dex/DexViaCfr.kt +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Show Java - A java/apk decompiler for android - * Copyright (c) 2018 Niranjan Rajendran - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.njlabs.showjava.test.decompilers.dex - -import androidx.test.ext.junit.runners.AndroidJUnit4 -import com.njlabs.showjava.test.DecompilerTestBase -import com.njlabs.showjava.data.PackageInfo -import org.junit.runner.RunWith - -@RunWith(AndroidJUnit4::class) -class DexViaCfr: DecompilerTestBase() { - override val type: PackageInfo.Type = PackageInfo.Type.DEX - override val decompiler: String = "cfr" -} \ No newline at end of file diff --git a/app/src/androidTest/kotlin/com/njlabs/showjava/test/decompilers/dex/DexViaFernFlower.kt b/app/src/androidTest/kotlin/com/njlabs/showjava/test/decompilers/dex/DexViaFernFlower.kt deleted file mode 100644 index e5713a17..00000000 --- a/app/src/androidTest/kotlin/com/njlabs/showjava/test/decompilers/dex/DexViaFernFlower.kt +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Show Java - A java/apk decompiler for android - * Copyright (c) 2018 Niranjan Rajendran - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.njlabs.showjava.test.decompilers.dex - -import androidx.test.ext.junit.runners.AndroidJUnit4 -import com.njlabs.showjava.test.DecompilerTestBase -import com.njlabs.showjava.data.PackageInfo -import org.junit.runner.RunWith - -@RunWith(AndroidJUnit4::class) -class DexViaFernFlower: DecompilerTestBase() { - override val type: PackageInfo.Type = PackageInfo.Type.DEX - override val decompiler: String = "fernflower" -} \ No newline at end of file diff --git a/app/src/androidTest/kotlin/com/njlabs/showjava/test/decompilers/dex/DexViaJadx.kt b/app/src/androidTest/kotlin/com/njlabs/showjava/test/decompilers/dex/DexViaJadx.kt deleted file mode 100644 index 6ea8f222..00000000 --- a/app/src/androidTest/kotlin/com/njlabs/showjava/test/decompilers/dex/DexViaJadx.kt +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Show Java - A java/apk decompiler for android - * Copyright (c) 2018 Niranjan Rajendran - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.njlabs.showjava.test.decompilers.dex - -import androidx.test.ext.junit.runners.AndroidJUnit4 -import com.njlabs.showjava.test.DecompilerTestBase -import com.njlabs.showjava.data.PackageInfo -import org.junit.runner.RunWith - -@RunWith(AndroidJUnit4::class) -class DexViaJadx: DecompilerTestBase() { - override val type: PackageInfo.Type = PackageInfo.Type.DEX - override val decompiler: String = "jadx" -} \ No newline at end of file diff --git a/app/src/androidTest/kotlin/com/njlabs/showjava/test/decompilers/jar/JarViaCfr.kt b/app/src/androidTest/kotlin/com/njlabs/showjava/test/decompilers/jar/JarViaCfr.kt deleted file mode 100644 index 8a906bd2..00000000 --- a/app/src/androidTest/kotlin/com/njlabs/showjava/test/decompilers/jar/JarViaCfr.kt +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Show Java - A java/apk decompiler for android - * Copyright (c) 2018 Niranjan Rajendran - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.njlabs.showjava.test.decompilers.jar - -import androidx.test.ext.junit.runners.AndroidJUnit4 -import com.njlabs.showjava.test.DecompilerTestBase -import com.njlabs.showjava.data.PackageInfo -import org.junit.runner.RunWith - -@RunWith(AndroidJUnit4::class) -class JarViaCfr: DecompilerTestBase() { - override val type: PackageInfo.Type = PackageInfo.Type.JAR - override val decompiler: String = "cfr" -} \ No newline at end of file diff --git a/app/src/androidTest/kotlin/com/njlabs/showjava/test/decompilers/jar/JarViaFernFlower.kt b/app/src/androidTest/kotlin/com/njlabs/showjava/test/decompilers/jar/JarViaFernFlower.kt deleted file mode 100644 index 55fd6c1f..00000000 --- a/app/src/androidTest/kotlin/com/njlabs/showjava/test/decompilers/jar/JarViaFernFlower.kt +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Show Java - A java/apk decompiler for android - * Copyright (c) 2018 Niranjan Rajendran - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.njlabs.showjava.test.decompilers.jar - -import androidx.test.ext.junit.runners.AndroidJUnit4 -import com.njlabs.showjava.test.DecompilerTestBase -import com.njlabs.showjava.data.PackageInfo -import org.junit.runner.RunWith - -@RunWith(AndroidJUnit4::class) -class JarViaFernFlower: DecompilerTestBase() { - override val type: PackageInfo.Type = PackageInfo.Type.JAR - override val decompiler: String = "fernflower" -} \ No newline at end of file diff --git a/app/src/androidTest/kotlin/com/njlabs/showjava/test/decompilers/jar/JarViaJadx.kt b/app/src/androidTest/kotlin/com/njlabs/showjava/test/decompilers/jar/JarViaJadx.kt deleted file mode 100644 index a24316cf..00000000 --- a/app/src/androidTest/kotlin/com/njlabs/showjava/test/decompilers/jar/JarViaJadx.kt +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Show Java - A java/apk decompiler for android - * Copyright (c) 2018 Niranjan Rajendran - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.njlabs.showjava.test.decompilers.jar - -import androidx.test.ext.junit.runners.AndroidJUnit4 -import com.njlabs.showjava.test.DecompilerTestBase -import com.njlabs.showjava.data.PackageInfo -import org.junit.runner.RunWith - -@RunWith(AndroidJUnit4::class) -class JarViaJadx: DecompilerTestBase() { - override val type: PackageInfo.Type = PackageInfo.Type.JAR - override val decompiler: String = "jadx" -} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml deleted file mode 100644 index 2571b480..00000000 --- a/app/src/main/AndroidManifest.xml +++ /dev/null @@ -1,279 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/assets/codeview/highlightjs/highlight.js b/app/src/main/assets/codeview/highlightjs/highlight.js deleted file mode 100644 index ea3aacc9..00000000 --- a/app/src/main/assets/codeview/highlightjs/highlight.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! highlight.js v9.15.6 | BSD3 License | git.io/hljslicense */ -!function(e){var n="object"==typeof window&&window||"object"==typeof self&&self;"undefined"!=typeof exports?e(exports):n&&(n.hljs=e({}),"function"==typeof define&&define.amd&&define([],function(){return n.hljs}))}(function(a){var E=[],u=Object.keys,N={},g={},n=/^(no-?highlight|plain|text)$/i,R=/\blang(?:uage)?-([\w-]+)\b/i,t=/((^(<[^>]+>|\t|)+|(?:\n)))/gm,r={case_insensitive:"cI",lexemes:"l",contains:"c",keywords:"k",subLanguage:"sL",className:"cN",begin:"b",beginKeywords:"bK",end:"e",endsWithParent:"eW",illegal:"i",excludeBegin:"eB",excludeEnd:"eE",returnBegin:"rB",returnEnd:"rE",relevance:"r",variants:"v",IDENT_RE:"IR",UNDERSCORE_IDENT_RE:"UIR",NUMBER_RE:"NR",C_NUMBER_RE:"CNR",BINARY_NUMBER_RE:"BNR",RE_STARTERS_RE:"RSR",BACKSLASH_ESCAPE:"BE",APOS_STRING_MODE:"ASM",QUOTE_STRING_MODE:"QSM",PHRASAL_WORDS_MODE:"PWM",C_LINE_COMMENT_MODE:"CLCM",C_BLOCK_COMMENT_MODE:"CBCM",HASH_COMMENT_MODE:"HCM",NUMBER_MODE:"NM",C_NUMBER_MODE:"CNM",BINARY_NUMBER_MODE:"BNM",CSS_NUMBER_MODE:"CSSNM",REGEXP_MODE:"RM",TITLE_MODE:"TM",UNDERSCORE_TITLE_MODE:"UTM",COMMENT:"C",beginRe:"bR",endRe:"eR",illegalRe:"iR",lexemesRe:"lR",terminators:"t",terminator_end:"tE"},b="",h={classPrefix:"hljs-",tabReplace:null,useBR:!1,languages:void 0};function _(e){return e.replace(/&/g,"&").replace(//g,">")}function d(e){return e.nodeName.toLowerCase()}function v(e,n){var t=e&&e.exec(n);return t&&0===t.index}function p(e){return n.test(e)}function l(e){var n,t={},r=Array.prototype.slice.call(arguments,1);for(n in e)t[n]=e[n];return r.forEach(function(e){for(n in e)t[n]=e[n]}),t}function M(e){var a=[];return function e(n,t){for(var r=n.firstChild;r;r=r.nextSibling)3===r.nodeType?t+=r.nodeValue.length:1===r.nodeType&&(a.push({event:"start",offset:t,node:r}),t=e(r,t),d(r).match(/br|hr|img|input/)||a.push({event:"stop",offset:t,node:r}));return t}(e,0),a}function i(e){if(r&&!e.langApiRestored){for(var n in e.langApiRestored=!0,r)e[n]&&(e[r[n]]=e[n]);(e.c||[]).concat(e.v||[]).forEach(i)}}function m(c){function s(e){return e&&e.source||e}function o(e,n){return new RegExp(s(e),"m"+(c.cI?"i":"")+(n?"g":""))}!function n(t,e){if(!t.compiled){if(t.compiled=!0,t.k=t.k||t.bK,t.k){var r={},a=function(t,e){c.cI&&(e=e.toLowerCase()),e.split(" ").forEach(function(e){var n=e.split("|");r[n[0]]=[t,n[1]?Number(n[1]):1]})};"string"==typeof t.k?a("keyword",t.k):u(t.k).forEach(function(e){a(e,t.k[e])}),t.k=r}t.lR=o(t.l||/\w+/,!0),e&&(t.bK&&(t.b="\\b("+t.bK.split(" ").join("|")+")\\b"),t.b||(t.b=/\B|\b/),t.bR=o(t.b),t.endSameAsBegin&&(t.e=t.b),t.e||t.eW||(t.e=/\B|\b/),t.e&&(t.eR=o(t.e)),t.tE=s(t.e)||"",t.eW&&e.tE&&(t.tE+=(t.e?"|":"")+e.tE)),t.i&&(t.iR=o(t.i)),null==t.r&&(t.r=1),t.c||(t.c=[]),t.c=Array.prototype.concat.apply([],t.c.map(function(e){return(n="self"===e?t:e).v&&!n.cached_variants&&(n.cached_variants=n.v.map(function(e){return l(n,{v:null},e)})),n.cached_variants||n.eW&&[l(n)]||[n];var n})),t.c.forEach(function(e){n(e,t)}),t.starts&&n(t.starts,e);var i=t.c.map(function(e){return e.bK?"\\.?(?:"+e.b+")\\.?":e.b}).concat([t.tE,t.i]).map(s).filter(Boolean);t.t=i.length?o(function(e,n){for(var t=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./,r=0,a="",i=0;i')+n+(t?"":b)}function s(){g+=null!=E.sL?function(){var e="string"==typeof E.sL;if(e&&!N[E.sL])return _(R);var n=e?C(E.sL,R,!0,i[E.sL]):O(R,E.sL.length?E.sL:void 0);return 0")+'"');return R+=n,n.length||1}var f=S(e);if(!f)throw new Error('Unknown language: "'+e+'"');m(f);var a,E=t||f,i={},g="";for(a=E;a!==f;a=a.parent)a.cN&&(g=u(a.cN,"",!0)+g);var R="",d=0;try{for(var c,p,M=0;E.t.lastIndex=M,c=E.t.exec(n);)p=r(n.substring(M,c.index),c[0]),M=c.index+p;for(r(n.substr(M)),a=E;a.parent;a=a.parent)a.cN&&(g+=b);return{r:d,value:g,language:e,top:E}}catch(e){if(e.message&&-1!==e.message.indexOf("Illegal"))return{r:0,value:_(n)};throw e}}function O(t,e){e=e||h.languages||u(N);var r={r:0,value:_(t)},a=r;return e.filter(S).filter(s).forEach(function(e){var n=C(e,t,!1);n.language=e,n.r>a.r&&(a=n),n.r>r.r&&(a=r,r=n)}),a.language&&(r.second_best=a),r}function B(e){return h.tabReplace||h.useBR?e.replace(t,function(e,n){return h.useBR&&"\n"===e?"
":h.tabReplace?n.replace(/\t/g,h.tabReplace):""}):e}function c(e){var n,t,r,a,i,c,o,u,s,l,f=function(e){var n,t,r,a,i=e.className+" ";if(i+=e.parentNode?e.parentNode.className:"",t=R.exec(i))return S(t[1])?t[1]:"no-highlight";for(n=0,r=(i=i.split(/\s+/)).length;n/g,"\n"):n=e,i=n.textContent,r=f?C(f,i,!0):O(i),(t=M(n)).length&&((a=document.createElementNS("http://www.w3.org/1999/xhtml","div")).innerHTML=r.value,r.value=function(e,n,t){var r=0,a="",i=[];function c(){return e.length&&n.length?e[0].offset!==n[0].offset?e[0].offset"}function u(e){a+=""}function s(e){("start"===e.event?o:u)(e.node)}for(;e.length||n.length;){var l=c();if(a+=_(t.substring(r,l[0].offset)),r=l[0].offset,l===e){for(i.reverse().forEach(u);s(l.splice(0,1)[0]),(l=c())===e&&l.length&&l[0].offset===r;);i.reverse().forEach(o)}else"start"===l[0].event?i.push(l[0].node):i.pop(),s(l.splice(0,1)[0])}return a+_(t.substr(r))}(t,M(a),i)),r.value=B(r.value),e.innerHTML=r.value,e.className=(c=e.className,o=f,u=r.language,s=o?g[o]:u,l=[c.trim()],c.match(/\bhljs\b/)||l.push("hljs"),-1===c.indexOf(s)&&l.push(s),l.join(" ").trim()),e.result={language:r.language,re:r.r},r.second_best&&(e.second_best={language:r.second_best.language,re:r.second_best.r}))}function o(){if(!o.called){o.called=!0;var e=document.querySelectorAll("pre code");E.forEach.call(e,c)}}function S(e){return e=(e||"").toLowerCase(),N[e]||N[g[e]]}function s(e){var n=S(e);return n&&!n.disableAutodetect}return a.highlight=C,a.highlightAuto=O,a.fixMarkup=B,a.highlightBlock=c,a.configure=function(e){h=l(h,e)},a.initHighlighting=o,a.initHighlightingOnLoad=function(){addEventListener("DOMContentLoaded",o,!1),addEventListener("load",o,!1)},a.registerLanguage=function(n,e){var t=N[n]=e(a);i(t),t.aliases&&t.aliases.forEach(function(e){g[e]=n})},a.listLanguages=function(){return u(N)},a.getLanguage=S,a.autoDetection=s,a.inherit=l,a.IR=a.IDENT_RE="[a-zA-Z]\\w*",a.UIR=a.UNDERSCORE_IDENT_RE="[a-zA-Z_]\\w*",a.NR=a.NUMBER_RE="\\b\\d+(\\.\\d+)?",a.CNR=a.C_NUMBER_RE="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",a.BNR=a.BINARY_NUMBER_RE="\\b(0b[01]+)",a.RSR=a.RE_STARTERS_RE="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",a.BE=a.BACKSLASH_ESCAPE={b:"\\\\[\\s\\S]",r:0},a.ASM=a.APOS_STRING_MODE={cN:"string",b:"'",e:"'",i:"\\n",c:[a.BE]},a.QSM=a.QUOTE_STRING_MODE={cN:"string",b:'"',e:'"',i:"\\n",c:[a.BE]},a.PWM=a.PHRASAL_WORDS_MODE={b:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},a.C=a.COMMENT=function(e,n,t){var r=a.inherit({cN:"comment",b:e,e:n,c:[]},t||{});return r.c.push(a.PWM),r.c.push({cN:"doctag",b:"(?:TODO|FIXME|NOTE|BUG|XXX):",r:0}),r},a.CLCM=a.C_LINE_COMMENT_MODE=a.C("//","$"),a.CBCM=a.C_BLOCK_COMMENT_MODE=a.C("/\\*","\\*/"),a.HCM=a.HASH_COMMENT_MODE=a.C("#","$"),a.NM=a.NUMBER_MODE={cN:"number",b:a.NR,r:0},a.CNM=a.C_NUMBER_MODE={cN:"number",b:a.CNR,r:0},a.BNM=a.BINARY_NUMBER_MODE={cN:"number",b:a.BNR,r:0},a.CSSNM=a.CSS_NUMBER_MODE={cN:"number",b:a.NR+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",r:0},a.RM=a.REGEXP_MODE={cN:"regexp",b:/\//,e:/\/[gimuy]*/,i:/\n/,c:[a.BE,{b:/\[/,e:/\]/,r:0,c:[a.BE]}]},a.TM=a.TITLE_MODE={cN:"title",b:a.IR,r:0},a.UTM=a.UNDERSCORE_TITLE_MODE={cN:"title",b:a.UIR,r:0},a.METHOD_GUARD={b:"\\.\\s*"+a.UIR,r:0},a});hljs.registerLanguage("json",function(e){var i={literal:"true false null"},n=[e.QSM,e.CNM],r={e:",",eW:!0,eE:!0,c:n,k:i},t={b:"{",e:"}",c:[{cN:"attr",b:/"/,e:/"/,c:[e.BE],i:"\\n"},e.inherit(r,{b:/:/})],i:"\\S"},c={b:"\\[",e:"\\]",c:[e.inherit(r)],i:"\\S"};return n.splice(n.length,0,t,c),{c:n,k:i,i:"\\S"}});hljs.registerLanguage("coffeescript",function(e){var c={keyword:"in if for while finally new do return else break catch instanceof throw try this switch continue typeof delete debugger super yield import export from as default await then unless until loop of by when and or is isnt not",literal:"true false null undefined yes no on off",built_in:"npm require console print module global window document"},n="[A-Za-z$_][0-9A-Za-z$_]*",r={cN:"subst",b:/#\{/,e:/}/,k:c},i=[e.BNM,e.inherit(e.CNM,{starts:{e:"(\\s*/)?",r:0}}),{cN:"string",v:[{b:/'''/,e:/'''/,c:[e.BE]},{b:/'/,e:/'/,c:[e.BE]},{b:/"""/,e:/"""/,c:[e.BE,r]},{b:/"/,e:/"/,c:[e.BE,r]}]},{cN:"regexp",v:[{b:"///",e:"///",c:[r,e.HCM]},{b:"//[gim]*",r:0},{b:/\/(?![ *])(\\\/|.)*?\/[gim]*(?=\W|$)/}]},{b:"@"+n},{sL:"javascript",eB:!0,eE:!0,v:[{b:"```",e:"```"},{b:"`",e:"`"}]}];r.c=i;var s=e.inherit(e.TM,{b:n}),t="(\\(.*\\))?\\s*\\B[-=]>",o={cN:"params",b:"\\([^\\(]",rB:!0,c:[{b:/\(/,e:/\)/,k:c,c:["self"].concat(i)}]};return{aliases:["coffee","cson","iced"],k:c,i:/\/\*/,c:i.concat([e.C("###","###"),e.HCM,{cN:"function",b:"^\\s*"+n+"\\s*=\\s*"+t,e:"[-=]>",rB:!0,c:[s,o]},{b:/[:\(,=]\s*/,r:0,c:[{cN:"function",b:t,e:"[-=]>",rB:!0,c:[o]}]},{cN:"class",bK:"class",e:"$",i:/[:="\[\]]/,c:[{bK:"extends",eW:!0,i:/[:="\[\]]/,c:[s]},s]},{b:n+":",e:":",rB:!0,rE:!0,r:0}])}});hljs.registerLanguage("properties",function(r){var t="[ \\t\\f]*",e="("+t+"[:=]"+t+"|[ \\t\\f]+)",s="([^\\\\\\W:= \\t\\f\\n]|\\\\.)+",n="([^\\\\:= \\t\\f\\n]|\\\\.)+",a={e:e,r:0,starts:{cN:"string",e:/$/,r:0,c:[{b:"\\\\\\n"}]}};return{cI:!0,i:/\S/,c:[r.C("^\\s*[!#]","$"),{b:s+e,rB:!0,c:[{cN:"attr",b:s,endsParent:!0,r:0}],starts:a},{b:n+e,rB:!0,r:0,c:[{cN:"meta",b:n,endsParent:!0,r:0}],starts:a},{cN:"attr",r:0,b:n+t+"$"}]}});hljs.registerLanguage("less",function(e){var r="[\\w-]+",t="("+r+"|@{"+r+"})",a=[],c=[],s=function(e){return{cN:"string",b:"~?"+e+".*?"+e}},b=function(e,r,t){return{cN:e,b:r,r:t}},n={b:"\\(",e:"\\)",c:c,r:0};c.push(e.CLCM,e.CBCM,s("'"),s('"'),e.CSSNM,{b:"(url|data-uri)\\(",starts:{cN:"string",e:"[\\)\\n]",eE:!0}},b("number","#[0-9A-Fa-f]+\\b"),n,b("variable","@@?"+r,10),b("variable","@{"+r+"}"),b("built_in","~?`[^`]*?`"),{cN:"attribute",b:r+"\\s*:",e:":",rB:!0,eE:!0},{cN:"meta",b:"!important"});var i=c.concat({b:"{",e:"}",c:a}),o={bK:"when",eW:!0,c:[{bK:"and not"}].concat(c)},u={b:t+"\\s*:",rB:!0,e:"[;}]",r:0,c:[{cN:"attribute",b:t,e:":",eE:!0,starts:{eW:!0,i:"[<=$]",r:0,c:c}}]},l={cN:"keyword",b:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b",starts:{e:"[;{}]",rE:!0,c:c,r:0}},C={cN:"variable",v:[{b:"@"+r+"\\s*:",r:15},{b:"@"+r}],starts:{e:"[;}]",rE:!0,c:i}},p={v:[{b:"[\\.#:&\\[>]",e:"[;{}]"},{b:t,e:"{"}],rB:!0,rE:!0,i:"[<='$\"]",r:0,c:[e.CLCM,e.CBCM,o,b("keyword","all\\b"),b("variable","@{"+r+"}"),b("selector-tag",t+"%?",0),b("selector-id","#"+t),b("selector-class","\\."+t,0),b("selector-tag","&",0),{cN:"selector-attr",b:"\\[",e:"\\]"},{cN:"selector-pseudo",b:/:(:)?[a-zA-Z0-9\_\-\+\(\)"'.]+/},{b:"\\(",e:"\\)",c:i},{b:"!important"}]};return a.push(e.CLCM,e.CBCM,l,C,u,p),{cI:!0,i:"[=>'/<($\"]",c:a}});hljs.registerLanguage("http",function(e){var t="HTTP/[0-9\\.]+";return{aliases:["https"],i:"\\S",c:[{b:"^"+t,e:"$",c:[{cN:"number",b:"\\b\\d{3}\\b"}]},{b:"^[A-Z]+ (.*?) "+t+"$",rB:!0,e:"$",c:[{cN:"string",b:" ",e:" ",eB:!0,eE:!0},{b:t},{cN:"keyword",b:"[A-Z]+"}]},{cN:"attribute",b:"^\\w",e:": ",eE:!0,i:"\\n|\\s|=",starts:{e:"$",r:0}},{b:"\\n\\n",starts:{sL:[],eW:!0}}]}});hljs.registerLanguage("gradle",function(e){return{cI:!0,k:{keyword:"task project allprojects subprojects artifacts buildscript configurations dependencies repositories sourceSets description delete from into include exclude source classpath destinationDir includes options sourceCompatibility targetCompatibility group flatDir doLast doFirst flatten todir fromdir ant def abstract break case catch continue default do else extends final finally for if implements instanceof native new private protected public return static switch synchronized throw throws transient try volatile while strictfp package import false null super this true antlrtask checkstyle codenarc copy boolean byte char class double float int interface long short void compile runTime file fileTree abs any append asList asWritable call collect compareTo count div dump each eachByte eachFile eachLine every find findAll flatten getAt getErr getIn getOut getText grep immutable inject inspect intersect invokeMethods isCase join leftShift minus multiply newInputStream newOutputStream newPrintWriter newReader newWriter next plus pop power previous print println push putAt read readBytes readLines reverse reverseEach round size sort splitEachLine step subMap times toInteger toList tokenize upto waitForOrKill withPrintWriter withReader withStream withWriter withWriterAppend write writeLine"},c:[e.CLCM,e.CBCM,e.ASM,e.QSM,e.NM,e.RM]}});hljs.registerLanguage("xml",function(s){var e={eW:!0,i:/`]+/}]}]}]};return{aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist"],cI:!0,c:[{cN:"meta",b:"",r:10,c:[{b:"\\[",e:"\\]"}]},s.C("\x3c!--","--\x3e",{r:10}),{b:"<\\!\\[CDATA\\[",e:"\\]\\]>",r:10},{cN:"meta",b:/<\?xml/,e:/\?>/,r:10},{b:/<\?(php)?/,e:/\?>/,sL:"php",c:[{b:"/\\*",e:"\\*/",skip:!0},{b:'b"',e:'"',skip:!0},{b:"b'",e:"'",skip:!0},s.inherit(s.ASM,{i:null,cN:null,c:null,skip:!0}),s.inherit(s.QSM,{i:null,cN:null,c:null,skip:!0})]},{cN:"tag",b:"|$)",e:">",k:{name:"style"},c:[e],starts:{e:"",rE:!0,sL:["css","xml"]}},{cN:"tag",b:"|$)",e:">",k:{name:"script"},c:[e],starts:{e:"<\/script>",rE:!0,sL:["actionscript","javascript","handlebars","xml"]}},{cN:"tag",b:"",c:[{cN:"name",b:/[^\/><\s]+/,r:0},e]}]}});hljs.registerLanguage("groovy",function(e){return{k:{literal:"true false null",keyword:"byte short char int long boolean float double void def as in assert trait super this abstract static volatile transient public private protected synchronized final class interface enum if else for while switch case break default continue throw throws try catch finally implements extends new import package return instanceof"},c:[e.C("/\\*\\*","\\*/",{r:0,c:[{b:/\w+@/,r:0},{cN:"doctag",b:"@[A-Za-z]+"}]}),e.CLCM,e.CBCM,{cN:"string",b:'"""',e:'"""'},{cN:"string",b:"'''",e:"'''"},{cN:"string",b:"\\$/",e:"/\\$",r:10},e.ASM,{cN:"regexp",b:/~?\/[^\/\n]+\//,c:[e.BE]},e.QSM,{cN:"meta",b:"^#!/usr/bin/env",e:"$",i:"\n"},e.BNM,{cN:"class",bK:"class interface trait enum",e:"{",i:":",c:[{bK:"extends implements"},e.UTM]},e.CNM,{cN:"meta",b:"@[A-Za-z]+"},{cN:"string",b:/[^\?]{0}[A-Za-z0-9_$]+ *:/},{b:/\?/,e:/\:/},{cN:"symbol",b:"^\\s*[A-Za-z0-9_$]+:",r:0}],i:/#|<\//}});hljs.registerLanguage("markdown",function(e){return{aliases:["md","mkdown","mkd"],c:[{cN:"section",v:[{b:"^#{1,6}",e:"$"},{b:"^.+?\\n[=-]{2,}$"}]},{b:"<",e:">",sL:"xml",r:0},{cN:"bullet",b:"^([*+-]|(\\d+\\.))\\s+"},{cN:"strong",b:"[*_]{2}.+?[*_]{2}"},{cN:"emphasis",v:[{b:"\\*.+?\\*"},{b:"_.+?_",r:0}]},{cN:"quote",b:"^>\\s+",e:"$"},{cN:"code",v:[{b:"^```w*s*$",e:"^```s*$"},{b:"`.+?`"},{b:"^( {4}|\t)",e:"$",r:0}]},{b:"^[-\\*]{3,}",e:"$"},{b:"\\[.+?\\][\\(\\[].*?[\\)\\]]",rB:!0,c:[{cN:"string",b:"\\[",e:"\\]",eB:!0,rE:!0,r:0},{cN:"link",b:"\\]\\(",e:"\\)",eB:!0,eE:!0},{cN:"symbol",b:"\\]\\[",e:"\\]",eB:!0,eE:!0}],r:10},{b:/^\[[^\n]+\]:/,rB:!0,c:[{cN:"symbol",b:/\[/,e:/\]/,eB:!0,eE:!0},{cN:"link",b:/:\s*/,e:/$/,eB:!0}]}]}});hljs.registerLanguage("sql",function(e){var t=e.C("--","$");return{cI:!0,i:/[<>{}*]/,c:[{bK:"begin end start commit rollback savepoint lock alter create drop rename call delete do handler insert load replace select truncate update set show pragma grant merge describe use explain help declare prepare execute deallocate release unlock purge reset change stop analyze cache flush optimize repair kill install uninstall checksum restore check backup revoke comment values with",e:/;/,eW:!0,l:/[\w\.]+/,k:{keyword:"as abort abs absolute acc acce accep accept access accessed accessible account acos action activate add addtime admin administer advanced advise aes_decrypt aes_encrypt after agent aggregate ali alia alias all allocate allow alter always analyze ancillary and anti any anydata anydataset anyschema anytype apply archive archived archivelog are as asc ascii asin assembly assertion associate asynchronous at atan atn2 attr attri attrib attribu attribut attribute attributes audit authenticated authentication authid authors auto autoallocate autodblink autoextend automatic availability avg backup badfile basicfile before begin beginning benchmark between bfile bfile_base big bigfile bin binary_double binary_float binlog bit_and bit_count bit_length bit_or bit_xor bitmap blob_base block blocksize body both bound bucket buffer_cache buffer_pool build bulk by byte byteordermark bytes cache caching call calling cancel capacity cascade cascaded case cast catalog category ceil ceiling chain change changed char_base char_length character_length characters characterset charindex charset charsetform charsetid check checksum checksum_agg child choose chr chunk class cleanup clear client clob clob_base clone close cluster_id cluster_probability cluster_set clustering coalesce coercibility col collate collation collect colu colum column column_value columns columns_updated comment commit compact compatibility compiled complete composite_limit compound compress compute concat concat_ws concurrent confirm conn connec connect connect_by_iscycle connect_by_isleaf connect_by_root connect_time connection consider consistent constant constraint constraints constructor container content contents context contributors controlfile conv convert convert_tz corr corr_k corr_s corresponding corruption cos cost count count_big counted covar_pop covar_samp cpu_per_call cpu_per_session crc32 create creation critical cross cube cume_dist curdate current current_date current_time current_timestamp current_user cursor curtime customdatum cycle data database databases datafile datafiles datalength date_add date_cache date_format date_sub dateadd datediff datefromparts datename datepart datetime2fromparts day day_to_second dayname dayofmonth dayofweek dayofyear days db_role_change dbtimezone ddl deallocate declare decode decompose decrement decrypt deduplicate def defa defau defaul default defaults deferred defi defin define degrees delayed delegate delete delete_all delimited demand dense_rank depth dequeue des_decrypt des_encrypt des_key_file desc descr descri describ describe descriptor deterministic diagnostics difference dimension direct_load directory disable disable_all disallow disassociate discardfile disconnect diskgroup distinct distinctrow distribute distributed div do document domain dotnet double downgrade drop dumpfile duplicate duration each edition editionable editions element ellipsis else elsif elt empty enable enable_all enclosed encode encoding encrypt end end-exec endian enforced engine engines enqueue enterprise entityescaping eomonth error errors escaped evalname evaluate event eventdata events except exception exceptions exchange exclude excluding execu execut execute exempt exists exit exp expire explain explode export export_set extended extent external external_1 external_2 externally extract failed failed_login_attempts failover failure far fast feature_set feature_value fetch field fields file file_name_convert filesystem_like_logging final finish first first_value fixed flash_cache flashback floor flush following follows for forall force foreign form forma format found found_rows freelist freelists freepools fresh from from_base64 from_days ftp full function general generated get get_format get_lock getdate getutcdate global global_name globally go goto grant grants greatest group group_concat group_id grouping grouping_id groups gtid_subtract guarantee guard handler hash hashkeys having hea head headi headin heading heap help hex hierarchy high high_priority hosts hour hours http id ident_current ident_incr ident_seed identified identity idle_time if ifnull ignore iif ilike ilm immediate import in include including increment index indexes indexing indextype indicator indices inet6_aton inet6_ntoa inet_aton inet_ntoa infile initial initialized initially initrans inmemory inner innodb input insert install instance instantiable instr interface interleaved intersect into invalidate invisible is is_free_lock is_ipv4 is_ipv4_compat is_not is_not_null is_used_lock isdate isnull isolation iterate java join json json_exists keep keep_duplicates key keys kill language large last last_day last_insert_id last_value lateral lax lcase lead leading least leaves left len lenght length less level levels library like like2 like4 likec limit lines link list listagg little ln load load_file lob lobs local localtime localtimestamp locate locator lock locked log log10 log2 logfile logfiles logging logical logical_reads_per_call logoff logon logs long loop low low_priority lower lpad lrtrim ltrim main make_set makedate maketime managed management manual map mapping mask master master_pos_wait match matched materialized max maxextents maximize maxinstances maxlen maxlogfiles maxloghistory maxlogmembers maxsize maxtrans md5 measures median medium member memcompress memory merge microsecond mid migration min minextents minimum mining minus minute minutes minvalue missing mod mode model modification modify module monitoring month months mount move movement multiset mutex name name_const names nan national native natural nav nchar nclob nested never new newline next nextval no no_write_to_binlog noarchivelog noaudit nobadfile nocheck nocompress nocopy nocycle nodelay nodiscardfile noentityescaping noguarantee nokeep nologfile nomapping nomaxvalue nominimize nominvalue nomonitoring none noneditionable nonschema noorder nopr nopro noprom nopromp noprompt norely noresetlogs noreverse normal norowdependencies noschemacheck noswitch not nothing notice notnull notrim novalidate now nowait nth_value nullif nulls num numb numbe nvarchar nvarchar2 object ocicoll ocidate ocidatetime ociduration ociinterval ociloblocator ocinumber ociref ocirefcursor ocirowid ocistring ocitype oct octet_length of off offline offset oid oidindex old on online only opaque open operations operator optimal optimize option optionally or oracle oracle_date oradata ord ordaudio orddicom orddoc order ordimage ordinality ordvideo organization orlany orlvary out outer outfile outline output over overflow overriding package pad parallel parallel_enable parameters parent parse partial partition partitions pascal passing password password_grace_time password_lock_time password_reuse_max password_reuse_time password_verify_function patch path patindex pctincrease pctthreshold pctused pctversion percent percent_rank percentile_cont percentile_disc performance period period_add period_diff permanent physical pi pipe pipelined pivot pluggable plugin policy position post_transaction pow power pragma prebuilt precedes preceding precision prediction prediction_cost prediction_details prediction_probability prediction_set prepare present preserve prior priority private private_sga privileges procedural procedure procedure_analyze processlist profiles project prompt protection public publishingservername purge quarter query quick quiesce quota quotename radians raise rand range rank raw read reads readsize rebuild record records recover recovery recursive recycle redo reduced ref reference referenced references referencing refresh regexp_like register regr_avgx regr_avgy regr_count regr_intercept regr_r2 regr_slope regr_sxx regr_sxy reject rekey relational relative relaylog release release_lock relies_on relocate rely rem remainder rename repair repeat replace replicate replication required reset resetlogs resize resource respect restore restricted result result_cache resumable resume retention return returning returns reuse reverse revoke right rlike role roles rollback rolling rollup round row row_count rowdependencies rowid rownum rows rtrim rules safe salt sample save savepoint sb1 sb2 sb4 scan schema schemacheck scn scope scroll sdo_georaster sdo_topo_geometry search sec_to_time second seconds section securefile security seed segment select self semi sequence sequential serializable server servererror session session_user sessions_per_user set sets settings sha sha1 sha2 share shared shared_pool short show shrink shutdown si_averagecolor si_colorhistogram si_featurelist si_positionalcolor si_stillimage si_texture siblings sid sign sin size size_t sizes skip slave sleep smalldatetimefromparts smallfile snapshot some soname sort soundex source space sparse spfile split sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_small_result sql_variant_property sqlcode sqldata sqlerror sqlname sqlstate sqrt square standalone standby start starting startup statement static statistics stats_binomial_test stats_crosstab stats_ks_test stats_mode stats_mw_test stats_one_way_anova stats_t_test_ stats_t_test_indep stats_t_test_one stats_t_test_paired stats_wsr_test status std stddev stddev_pop stddev_samp stdev stop storage store stored str str_to_date straight_join strcmp strict string struct stuff style subdate subpartition subpartitions substitutable substr substring subtime subtring_index subtype success sum suspend switch switchoffset switchover sync synchronous synonym sys sys_xmlagg sysasm sysaux sysdate sysdatetimeoffset sysdba sysoper system system_user sysutcdatetime table tables tablespace tablesample tan tdo template temporary terminated tertiary_weights test than then thread through tier ties time time_format time_zone timediff timefromparts timeout timestamp timestampadd timestampdiff timezone_abbr timezone_minute timezone_region to to_base64 to_date to_days to_seconds todatetimeoffset trace tracking transaction transactional translate translation treat trigger trigger_nestlevel triggers trim truncate try_cast try_convert try_parse type ub1 ub2 ub4 ucase unarchived unbounded uncompress under undo unhex unicode uniform uninstall union unique unix_timestamp unknown unlimited unlock unnest unpivot unrecoverable unsafe unsigned until untrusted unusable unused update updated upgrade upped upper upsert url urowid usable usage use use_stored_outlines user user_data user_resources users using utc_date utc_timestamp uuid uuid_short validate validate_password_strength validation valist value values var var_samp varcharc vari varia variab variabl variable variables variance varp varraw varrawc varray verify version versions view virtual visible void wait wallet warning warnings week weekday weekofyear wellformed when whene whenev wheneve whenever where while whitespace window with within without work wrapped xdb xml xmlagg xmlattributes xmlcast xmlcolattval xmlelement xmlexists xmlforest xmlindex xmlnamespaces xmlpi xmlquery xmlroot xmlschema xmlserialize xmltable xmltype xor year year_to_month years yearweek",literal:"true false null unknown",built_in:"array bigint binary bit blob bool boolean char character date dec decimal float int int8 integer interval number numeric real record serial serial8 smallint text time timestamp tinyint varchar varying void"},c:[{cN:"string",b:"'",e:"'",c:[e.BE,{b:"''"}]},{cN:"string",b:'"',e:'"',c:[e.BE,{b:'""'}]},{cN:"string",b:"`",e:"`",c:[e.BE]},e.CNM,e.CBCM,t,e.HCM]},e.CBCM,t,e.HCM]}});hljs.registerLanguage("java",function(e){var a="false synchronized int abstract float private char boolean var static null if const for true while long strictfp finally protected import native final void enum else break transient catch instanceof byte super volatile case assert short package default double public try this switch continue throws protected public private module requires exports do",t={cN:"number",b:"\\b(0[bB]([01]+[01_]+[01]+|[01]+)|0[xX]([a-fA-F0-9]+[a-fA-F0-9_]+[a-fA-F0-9]+|[a-fA-F0-9]+)|(([\\d]+[\\d_]+[\\d]+|[\\d]+)(\\.([\\d]+[\\d_]+[\\d]+|[\\d]+))?|\\.([\\d]+[\\d_]+[\\d]+|[\\d]+))([eE][-+]?\\d+)?)[lLfF]?",r:0};return{aliases:["jsp"],k:a,i:/<\/|#/,c:[e.C("/\\*\\*","\\*/",{r:0,c:[{b:/\w+@/,r:0},{cN:"doctag",b:"@[A-Za-z]+"}]}),e.CLCM,e.CBCM,e.ASM,e.QSM,{cN:"class",bK:"class interface",e:/[{;=]/,eE:!0,k:"class interface",i:/[:"\[\]]/,c:[{bK:"extends implements"},e.UTM]},{bK:"new throw return else",r:0},{cN:"function",b:"([À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*(<[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*(\\s*,\\s*[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*)*>)?\\s+)+"+e.UIR+"\\s*\\(",rB:!0,e:/[{;=]/,eE:!0,k:a,c:[{b:e.UIR+"\\s*\\(",rB:!0,r:0,c:[e.UTM]},{cN:"params",b:/\(/,e:/\)/,k:a,r:0,c:[e.ASM,e.QSM,e.CNM,e.CBCM]},e.CLCM,e.CBCM]},t,{cN:"meta",b:"@[A-Za-z]+"}]}});hljs.registerLanguage("css",function(e){var c={b:/[A-Z\_\.\-]+\s*:/,rB:!0,e:";",eW:!0,c:[{cN:"attribute",b:/\S/,e:":",eE:!0,starts:{eW:!0,eE:!0,c:[{b:/[\w-]+\(/,rB:!0,c:[{cN:"built_in",b:/[\w-]+/},{b:/\(/,e:/\)/,c:[e.ASM,e.QSM]}]},e.CSSNM,e.QSM,e.ASM,e.CBCM,{cN:"number",b:"#[0-9A-Fa-f]+"},{cN:"meta",b:"!important"}]}}]};return{cI:!0,i:/[=\/|'\$]/,c:[e.CBCM,{cN:"selector-id",b:/#[A-Za-z0-9_-]+/},{cN:"selector-class",b:/\.[A-Za-z0-9_-]+/},{cN:"selector-attr",b:/\[/,e:/\]/,i:"$"},{cN:"selector-pseudo",b:/:(:)?[a-zA-Z0-9\_\-\+\(\)"'.]+/},{b:"@(font-face|page)",l:"[a-z-]+",k:"font-face page"},{b:"@",e:"[{;]",i:/:/,c:[{cN:"keyword",b:/\w+/},{b:/\s/,eW:!0,eE:!0,r:0,c:[e.ASM,e.QSM,e.CSSNM]}]},{cN:"selector-tag",b:"[a-zA-Z-][a-zA-Z0-9_-]*",r:0},{b:"{",e:"}",i:/\S/,c:[e.CBCM,c]}]}});hljs.registerLanguage("ruby",function(e){var b="[a-zA-Z_]\\w*[!?=]?|[-+~]\\@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?",r={keyword:"and then defined module in return redo if BEGIN retry end for self when next until do begin unless END rescue else break undef not super class case require yield alias while ensure elsif or include attr_reader attr_writer attr_accessor",literal:"true false nil"},c={cN:"doctag",b:"@[A-Za-z]+"},a={b:"#<",e:">"},s=[e.C("#","$",{c:[c]}),e.C("^\\=begin","^\\=end",{c:[c],r:10}),e.C("^__END__","\\n$")],n={cN:"subst",b:"#\\{",e:"}",k:r},t={cN:"string",c:[e.BE,n],v:[{b:/'/,e:/'/},{b:/"/,e:/"/},{b:/`/,e:/`/},{b:"%[qQwWx]?\\(",e:"\\)"},{b:"%[qQwWx]?\\[",e:"\\]"},{b:"%[qQwWx]?{",e:"}"},{b:"%[qQwWx]?<",e:">"},{b:"%[qQwWx]?/",e:"/"},{b:"%[qQwWx]?%",e:"%"},{b:"%[qQwWx]?-",e:"-"},{b:"%[qQwWx]?\\|",e:"\\|"},{b:/\B\?(\\\d{1,3}|\\x[A-Fa-f0-9]{1,2}|\\u[A-Fa-f0-9]{4}|\\?\S)\b/},{b:/<<(-?)\w+$/,e:/^\s*\w+$/}]},i={cN:"params",b:"\\(",e:"\\)",endsParent:!0,k:r},d=[t,a,{cN:"class",bK:"class module",e:"$|;",i:/=/,c:[e.inherit(e.TM,{b:"[A-Za-z_]\\w*(::\\w+)*(\\?|\\!)?"}),{b:"<\\s*",c:[{b:"("+e.IR+"::)?"+e.IR}]}].concat(s)},{cN:"function",bK:"def",e:"$|;",c:[e.inherit(e.TM,{b:b}),i].concat(s)},{b:e.IR+"::"},{cN:"symbol",b:e.UIR+"(\\!|\\?)?:",r:0},{cN:"symbol",b:":(?!\\s)",c:[t,{b:b}],r:0},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{b:"(\\$\\W)|((\\$|\\@\\@?)(\\w+))"},{cN:"params",b:/\|/,e:/\|/,k:r},{b:"("+e.RSR+"|unless)\\s*",k:"unless",c:[a,{cN:"regexp",c:[e.BE,n],i:/\n/,v:[{b:"/",e:"/[a-z]*"},{b:"%r{",e:"}[a-z]*"},{b:"%r\\(",e:"\\)[a-z]*"},{b:"%r!",e:"![a-z]*"},{b:"%r\\[",e:"\\][a-z]*"}]}].concat(s),r:0}].concat(s);n.c=d;var l=[{b:/^\s*=>/,starts:{e:"$",c:i.c=d}},{cN:"meta",b:"^([>?]>|[\\w#]+\\(\\w+\\):\\d+:\\d+>|(\\w+-)?\\d+\\.\\d+\\.\\d(p\\d+)?[^>]+>)",starts:{e:"$",c:d}}];return{aliases:["rb","gemspec","podspec","thor","irb"],k:r,i:/\/\*/,c:s.concat(l).concat(d)}});hljs.registerLanguage("yaml",function(e){var b="true false yes no null",a="^[ \\-]*",r="[a-zA-Z_][\\w\\-]*",t={cN:"attr",v:[{b:a+r+":"},{b:a+'"'+r+'":'},{b:a+"'"+r+"':"}]},c={cN:"string",r:0,v:[{b:/'/,e:/'/},{b:/"/,e:/"/},{b:/\S+/}],c:[e.BE,{cN:"template-variable",v:[{b:"{{",e:"}}"},{b:"%{",e:"}"}]}]};return{cI:!0,aliases:["yml","YAML","yaml"],c:[t,{cN:"meta",b:"^---s*$",r:10},{cN:"string",b:"[\\|>] *$",rE:!0,c:c.c,e:t.v[0].b},{b:"<%[%=-]?",e:"[%-]?%>",sL:"ruby",eB:!0,eE:!0,r:0},{cN:"type",b:"!"+e.UIR},{cN:"type",b:"!!"+e.UIR},{cN:"meta",b:"&"+e.UIR+"$"},{cN:"meta",b:"\\*"+e.UIR+"$"},{cN:"bullet",b:"^ *-",r:0},e.HCM,{bK:b,k:{literal:b}},e.CNM,c]}});hljs.registerLanguage("ini",function(e){var b={cN:"string",c:[e.BE],v:[{b:"'''",e:"'''",r:10},{b:'"""',e:'"""',r:10},{b:'"',e:'"'},{b:"'",e:"'"}]};return{aliases:["toml"],cI:!0,i:/\S/,c:[e.C(";","$"),e.HCM,{cN:"section",b:/^\s*\[+/,e:/\]+/},{b:/^[a-z0-9\[\]_\.-]+\s*=\s*/,e:"$",rB:!0,c:[{cN:"attr",b:/[a-z0-9\[\]_\.-]+/},{b:/=/,eW:!0,r:0,c:[{cN:"literal",b:/\bon|off|true|false|yes|no\b/},{cN:"variable",v:[{b:/\$[\w\d"][\w\d_]*/},{b:/\$\{(.*?)}/}]},b,{cN:"number",b:/([\+\-]+)?[\d]+_[\d_]+/},e.NM]}]}]}});hljs.registerLanguage("protobuf",function(e){return{k:{keyword:"package import option optional required repeated group oneof",built_in:"double float int32 int64 uint32 uint64 sint32 sint64 fixed32 fixed64 sfixed32 sfixed64 bool string bytes",literal:"true false"},c:[e.QSM,e.NM,e.CLCM,{cN:"class",bK:"message enum service",e:/\{/,i:/\n/,c:[e.inherit(e.TM,{starts:{eW:!0,eE:!0}})]},{cN:"function",bK:"rpc",e:/;/,eE:!0,k:"rpc returns"},{b:/^\s*[A-Z_]+/,e:/\s*=/,eE:!0}]}});hljs.registerLanguage("plaintext",function(e){return{disableAutodetect:!0}});hljs.registerLanguage("bash",function(e){var t={cN:"variable",v:[{b:/\$[\w\d#@][\w\d_]*/},{b:/\$\{(.*?)}/}]},s={cN:"string",b:/"/,e:/"/,c:[e.BE,t,{cN:"variable",b:/\$\(/,e:/\)/,c:[e.BE]}]};return{aliases:["sh","zsh"],l:/\b-?[a-z\._]+\b/,k:{keyword:"if then else elif fi for while in do done case esac function",literal:"true false",built_in:"break cd continue eval exec exit export getopts hash pwd readonly return shift test times trap umask unset alias bind builtin caller command declare echo enable help let local logout mapfile printf read readarray source type typeset ulimit unalias set shopt autoload bg bindkey bye cap chdir clone comparguments compcall compctl compdescribe compfiles compgroups compquote comptags comptry compvalues dirs disable disown echotc echoti emulate fc fg float functions getcap getln history integer jobs kill limit log noglob popd print pushd pushln rehash sched setcap setopt stat suspend ttyctl unfunction unhash unlimit unsetopt vared wait whence where which zcompile zformat zftp zle zmodload zparseopts zprof zpty zregexparse zsocket zstyle ztcp",_:"-ne -eq -lt -gt -f -d -e -s -l -a"},c:[{cN:"meta",b:/^#![^\n]+sh\s*$/,r:10},{cN:"function",b:/\w[\w\d_]*\s*\(\s*\)\s*\{/,rB:!0,c:[e.inherit(e.TM,{b:/\w[\w\d_]*/})],r:0},e.HCM,s,{cN:"string",b:/'/,e:/'/},t]}});hljs.registerLanguage("python",function(e){var r={keyword:"and elif is global as in if from raise for except finally print import pass return exec else break not with class assert yield try while continue del or def lambda async await nonlocal|10",built_in:"Ellipsis NotImplemented",literal:"False None True"},b={cN:"meta",b:/^(>>>|\.\.\.) /},c={cN:"subst",b:/\{/,e:/\}/,k:r,i:/#/},a={cN:"string",c:[e.BE],v:[{b:/(u|b)?r?'''/,e:/'''/,c:[e.BE,b],r:10},{b:/(u|b)?r?"""/,e:/"""/,c:[e.BE,b],r:10},{b:/(fr|rf|f)'''/,e:/'''/,c:[e.BE,b,c]},{b:/(fr|rf|f)"""/,e:/"""/,c:[e.BE,b,c]},{b:/(u|r|ur)'/,e:/'/,r:10},{b:/(u|r|ur)"/,e:/"/,r:10},{b:/(b|br)'/,e:/'/},{b:/(b|br)"/,e:/"/},{b:/(fr|rf|f)'/,e:/'/,c:[e.BE,c]},{b:/(fr|rf|f)"/,e:/"/,c:[e.BE,c]},e.ASM,e.QSM]},i={cN:"number",r:0,v:[{b:e.BNR+"[lLjJ]?"},{b:"\\b(0o[0-7]+)[lLjJ]?"},{b:e.CNR+"[lLjJ]?"}]},l={cN:"params",b:/\(/,e:/\)/,c:["self",b,i,a]};return c.c=[a,i,b],{aliases:["py","gyp","ipython"],k:r,i:/(<\/|->|\?)|=>/,c:[b,i,a,e.HCM,{v:[{cN:"function",bK:"def"},{cN:"class",bK:"class"}],e:/:/,i:/[${=;\n,]/,c:[e.UTM,l,{b:/->/,eW:!0,k:"None"}]},{cN:"meta",b:/^[\t ]*@/,e:/$/},{b:/\b(print|exec)\(/}]}});hljs.registerLanguage("javascript",function(e){var r="[A-Za-z$_][0-9A-Za-z$_]*",t={keyword:"in of if for while finally var new function do return void else break catch instanceof with throw case default try this switch continue typeof delete let yield const export super debugger as async await static import from as",literal:"true false null undefined NaN Infinity",built_in:"eval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Error EvalError InternalError RangeError ReferenceError StopIteration SyntaxError TypeError URIError Number Math Date String RegExp Array Float32Array Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require module console window document Symbol Set Map WeakSet WeakMap Proxy Reflect Promise"},a={cN:"number",v:[{b:"\\b(0[bB][01]+)"},{b:"\\b(0[oO][0-7]+)"},{b:e.CNR}],r:0},n={cN:"subst",b:"\\$\\{",e:"\\}",k:t,c:[]},c={cN:"string",b:"`",e:"`",c:[e.BE,n]};n.c=[e.ASM,e.QSM,c,a,e.RM];var s=n.c.concat([e.CBCM,e.CLCM]);return{aliases:["js","jsx"],k:t,c:[{cN:"meta",r:10,b:/^\s*['"]use (strict|asm)['"]/},{cN:"meta",b:/^#!/,e:/$/},e.ASM,e.QSM,c,e.CLCM,e.CBCM,a,{b:/[{,]\s*/,r:0,c:[{b:r+"\\s*:",rB:!0,r:0,c:[{cN:"attr",b:r,r:0}]}]},{b:"("+e.RSR+"|\\b(case|return|throw)\\b)\\s*",k:"return throw case",c:[e.CLCM,e.CBCM,e.RM,{cN:"function",b:"(\\(.*?\\)|"+r+")\\s*=>",rB:!0,e:"\\s*=>",c:[{cN:"params",v:[{b:r},{b:/\(\s*\)/},{b:/\(/,e:/\)/,eB:!0,eE:!0,k:t,c:s}]}]},{b://,sL:"xml",c:[{b:/<\w+\s*\/>/,skip:!0},{b:/<\w+/,e:/(\/\w+|\w+\/)>/,skip:!0,c:[{b:/<\w+\s*\/>/,skip:!0},"self"]}]}],r:0},{cN:"function",bK:"function",e:/\{/,eE:!0,c:[e.inherit(e.TM,{b:r}),{cN:"params",b:/\(/,e:/\)/,eB:!0,eE:!0,c:s}],i:/\[|%/},{b:/\$[(.]/},e.METHOD_GUARD,{cN:"class",bK:"class",e:/[{;=]/,eE:!0,i:/[:"\[\]]/,c:[{bK:"extends"},e.UTM]},{bK:"constructor get set",e:/\{/,eE:!0}],i:/#(?!!)/}});hljs.registerLanguage("scss",function(e){var t={cN:"variable",b:"(\\$[a-zA-Z-][a-zA-Z0-9_-]*)\\b"},i={cN:"number",b:"#[0-9A-Fa-f]+"};e.CSSNM,e.QSM,e.ASM,e.CBCM;return{cI:!0,i:"[=/|']",c:[e.CLCM,e.CBCM,{cN:"selector-id",b:"\\#[A-Za-z0-9_-]+",r:0},{cN:"selector-class",b:"\\.[A-Za-z0-9_-]+",r:0},{cN:"selector-attr",b:"\\[",e:"\\]",i:"$"},{cN:"selector-tag",b:"\\b(a|abbr|acronym|address|area|article|aside|audio|b|base|big|blockquote|body|br|button|canvas|caption|cite|code|col|colgroup|command|datalist|dd|del|details|dfn|div|dl|dt|em|embed|fieldset|figcaption|figure|footer|form|frame|frameset|(h[1-6])|head|header|hgroup|hr|html|i|iframe|img|input|ins|kbd|keygen|label|legend|li|link|map|mark|meta|meter|nav|noframes|noscript|object|ol|optgroup|option|output|p|param|pre|progress|q|rp|rt|ruby|samp|script|section|select|small|span|strike|strong|style|sub|sup|table|tbody|td|textarea|tfoot|th|thead|time|title|tr|tt|ul|var|video)\\b",r:0},{b:":(visited|valid|root|right|required|read-write|read-only|out-range|optional|only-of-type|only-child|nth-of-type|nth-last-of-type|nth-last-child|nth-child|not|link|left|last-of-type|last-child|lang|invalid|indeterminate|in-range|hover|focus|first-of-type|first-line|first-letter|first-child|first|enabled|empty|disabled|default|checked|before|after|active)"},{b:"::(after|before|choices|first-letter|first-line|repeat-index|repeat-item|selection|value)"},t,{cN:"attribute",b:"\\b(z-index|word-wrap|word-spacing|word-break|width|widows|white-space|visibility|vertical-align|unicode-bidi|transition-timing-function|transition-property|transition-duration|transition-delay|transition|transform-style|transform-origin|transform|top|text-underline-position|text-transform|text-shadow|text-rendering|text-overflow|text-indent|text-decoration-style|text-decoration-line|text-decoration-color|text-decoration|text-align-last|text-align|tab-size|table-layout|right|resize|quotes|position|pointer-events|perspective-origin|perspective|page-break-inside|page-break-before|page-break-after|padding-top|padding-right|padding-left|padding-bottom|padding|overflow-y|overflow-x|overflow-wrap|overflow|outline-width|outline-style|outline-offset|outline-color|outline|orphans|order|opacity|object-position|object-fit|normal|none|nav-up|nav-right|nav-left|nav-index|nav-down|min-width|min-height|max-width|max-height|mask|marks|margin-top|margin-right|margin-left|margin-bottom|margin|list-style-type|list-style-position|list-style-image|list-style|line-height|letter-spacing|left|justify-content|initial|inherit|ime-mode|image-orientation|image-resolution|image-rendering|icon|hyphens|height|font-weight|font-variant-ligatures|font-variant|font-style|font-stretch|font-size-adjust|font-size|font-language-override|font-kerning|font-feature-settings|font-family|font|float|flex-wrap|flex-shrink|flex-grow|flex-flow|flex-direction|flex-basis|flex|filter|empty-cells|display|direction|cursor|counter-reset|counter-increment|content|column-width|column-span|column-rule-width|column-rule-style|column-rule-color|column-rule|column-gap|column-fill|column-count|columns|color|clip-path|clip|clear|caption-side|break-inside|break-before|break-after|box-sizing|box-shadow|box-decoration-break|bottom|border-width|border-top-width|border-top-style|border-top-right-radius|border-top-left-radius|border-top-color|border-top|border-style|border-spacing|border-right-width|border-right-style|border-right-color|border-right|border-radius|border-left-width|border-left-style|border-left-color|border-left|border-image-width|border-image-source|border-image-slice|border-image-repeat|border-image-outset|border-image|border-color|border-collapse|border-bottom-width|border-bottom-style|border-bottom-right-radius|border-bottom-left-radius|border-bottom-color|border-bottom|border|background-size|background-repeat|background-position|background-origin|background-image|background-color|background-clip|background-attachment|background-blend-mode|background|backface-visibility|auto|animation-timing-function|animation-play-state|animation-name|animation-iteration-count|animation-fill-mode|animation-duration|animation-direction|animation-delay|animation|align-self|align-items|align-content)\\b",i:"[^\\s]"},{b:"\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b"},{b:":",e:";",c:[t,i,e.CSSNM,e.QSM,e.ASM,{cN:"meta",b:"!important"}]},{b:"@",e:"[{;]",k:"mixin include extend for if else each while charset import debug media page content font-face namespace warn",c:[t,e.QSM,e.ASM,i,e.CSSNM,{b:"\\s[A-Za-z0-9_.-]+",r:0}]}]}}); \ No newline at end of file diff --git a/app/src/main/assets/codeview/highlightjs/styles/androidstudio.css b/app/src/main/assets/codeview/highlightjs/styles/androidstudio.css deleted file mode 100644 index bc8e473b..00000000 --- a/app/src/main/assets/codeview/highlightjs/styles/androidstudio.css +++ /dev/null @@ -1,66 +0,0 @@ -/* -Date: 24 Fev 2015 -Author: Pedro Oliveira -*/ - -.hljs { - color: #a9b7c6; - background: #282b2e; - display: block; - overflow-x: auto; - padding: 0.5em; -} - -.hljs-number, -.hljs-literal, -.hljs-symbol, -.hljs-bullet { - color: #6897BB; -} - -.hljs-keyword, -.hljs-selector-tag, -.hljs-deletion { - color: #cc7832; -} - -.hljs-variable, -.hljs-template-variable, -.hljs-link { - color: #629755; -} - -.hljs-comment, -.hljs-quote { - color: #808080; -} - -.hljs-meta { - color: #bbb529; -} - -.hljs-string, -.hljs-attribute, -.hljs-addition { - color: #6A8759; -} - -.hljs-section, -.hljs-title, -.hljs-type { - color: #ffc66d; -} - -.hljs-name, -.hljs-selector-id, -.hljs-selector-class { - color: #e8bf6a; -} - -.hljs-emphasis { - font-style: italic; -} - -.hljs-strong { - font-weight: bold; -} diff --git a/app/src/main/assets/codeview/highlightjs/styles/github-gist.css b/app/src/main/assets/codeview/highlightjs/styles/github-gist.css deleted file mode 100644 index 155f0b91..00000000 --- a/app/src/main/assets/codeview/highlightjs/styles/github-gist.css +++ /dev/null @@ -1,71 +0,0 @@ -/** - * GitHub Gist Theme - * Author : Louis Barranqueiro - https://github.com/LouisBarranqueiro - */ - -.hljs { - display: block; - background: white; - padding: 0.5em; - color: #333333; - overflow-x: auto; -} - -.hljs-comment, -.hljs-meta { - color: #969896; -} - -.hljs-string, -.hljs-variable, -.hljs-template-variable, -.hljs-strong, -.hljs-emphasis, -.hljs-quote { - color: #df5000; -} - -.hljs-keyword, -.hljs-selector-tag, -.hljs-type { - color: #a71d5d; -} - -.hljs-literal, -.hljs-symbol, -.hljs-bullet, -.hljs-attribute { - color: #0086b3; -} - -.hljs-section, -.hljs-name { - color: #63a35c; -} - -.hljs-tag { - color: #333333; -} - -.hljs-title, -.hljs-attr, -.hljs-selector-id, -.hljs-selector-class, -.hljs-selector-attr, -.hljs-selector-pseudo { - color: #795da3; -} - -.hljs-addition { - color: #55a532; - background-color: #eaffea; -} - -.hljs-deletion { - color: #bd2c00; - background-color: #ffecec; -} - -.hljs-link { - text-decoration: underline; -} diff --git a/app/src/main/assets/codeview/script.js b/app/src/main/assets/codeview/script.js deleted file mode 100644 index 326d650e..00000000 --- a/app/src/main/assets/codeview/script.js +++ /dev/null @@ -1,48 +0,0 @@ -var lines; - -function highlightCode() { - try { - android.onStartCodeHighlight(); - } catch (ignored) { } - var codeHolder = document.getElementById('code-holder'); - hljs.highlightBlock(codeHolder); - try { - android.onFinishCodeHighlight(); - lines = document.querySelectorAll('td.ln'); - } catch (ignored) { } -} - - -function updateStyleAndClasses(styleUri, bodyClass) { - document.getElementById('stylesheet').setAttribute('href', styleUri); - document.getElementById('body').setAttribute('class', bodyClass); -} - -function showHideLineNumber(isShown) { - for (var i = 0; i < lines.length; i++) { - lines[i].style.display = isShown ? '' : 'none'; - } -} - -function changeFontSize(size) { - document.body.style.fontSize = size + 'px'; -} - -function fillLineNumbers() { - for (var i = 0; i < lines.length; i++) { - lines[i].innerHTML = lines[i].getAttribute('line'); - } -} - -function highlightLineNumber(number) { - var x = document.querySelectorAll('.highlighted-line'); - if(x && x.length === 1) { - x[0].classList.remove('highlighted-line'); - } - if (number > 0) { - var x = document.querySelectorAll("td.line[line='" + number + "']"); - if(x && x.length === 1) { - x[0].classList.add('highlighted-line') - } - } -} \ No newline at end of file diff --git a/app/src/main/assets/codeview/styles.css b/app/src/main/assets/codeview/styles.css deleted file mode 100644 index 1df1fa97..00000000 --- a/app/src/main/assets/codeview/styles.css +++ /dev/null @@ -1,62 +0,0 @@ -body { - margin: 0; - line-height: 1.2; -} - -body.dark { - background: #212121 !important; -} - -body.light { - background: white !important; -} - -.hljs { -} - -pre { - margin: 0; - position: relative; -} - -table, td, tr { - margin: 0; - padding: 0; -} - -code > span { - display: none; -} - -td.ln { - text-align: right; - padding-right: 2px; -} - -td.line:hover span { - background: #661d76; - color: #fff; -} - -td.line:hover { - background: #661d76; - color: #fff; - border-radius: 2px; -} - -td.highlighted-line { - background: #ffda11; - color: #000; - border-radius: 2px; -} - -td.highlighted-line span { - background: #ffda11; - color: #000; -} - -body.wrapped td.line { - word-wrap: break-word; - white-space: pre-wrap; - word-break: break-all; -} \ No newline at end of file diff --git a/app/src/main/assets/extra/LICENSE b/app/src/main/assets/extra/LICENSE deleted file mode 100644 index b867e910..00000000 --- a/app/src/main/assets/extra/LICENSE +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - Show Java - A java/apk decompiler for android - Copyright (C) 2018 Niranjan Rajendran - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - Show Java - A java/apk decompiler for android Copyright (C) 2018 Niranjan Rajendran - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. \ No newline at end of file diff --git a/app/src/main/assets/ignored.basic.list b/app/src/main/assets/ignored.basic.list deleted file mode 100644 index 0dde1c02..00000000 --- a/app/src/main/assets/ignored.basic.list +++ /dev/null @@ -1,31 +0,0 @@ -com.google.apps -android -com.android.support -com.android -com.google.android.gms -com.google.common -com.google.auto -com.google.ads -com.google.android -com.google.android.vending -javax -junit -kotlin -androidx -sun.misc -dalvik.system -org.junit -java -org.intellij.lang.annotations -org.jetbrains.annotations -rx -io.reactivex -dagger -io.realm -com.facebook.react -com.android.volley -com.facebook.fresco -com.facebook.drawee -com.facebook.rebound -com.google.protobuf -com.google.gson diff --git a/app/src/main/assets/ignored.list b/app/src/main/assets/ignored.list deleted file mode 100644 index 32b13c70..00000000 --- a/app/src/main/assets/ignored.list +++ /dev/null @@ -1,57 +0,0 @@ -com.bumptech.glide -org.androidannotations -de.greenrobot.event -roboguice -com.squareup.okhttp -okhttp3 -com.square.picasso -com.squareup.picasso -com.square.tape -com.squareup.tape -com.nineoldandroids -bolts -com.mikepenz.iconics -com.mikepenz.google_material -retrofit -org.parceler -butterknife -com.crashlytics -io.fabric.sdk -com.androidquery -com.parse -com.actionbarsherlock -org.apache -org.acra -org.joda -org.antlr -org.achartengine -com.bugsense -org.andengine -com.inmobi -com.google.zxing -com.dacer.androidcharts -com.astuetz -com.viewpagerindicator -de.greenrobot.dao -com.mopub -com.millennialmedia -com.amazon.inapp -com.flurry.sdk -org.spongycastle -com.google.firebase -org.jsoup -com.fasterxml.jackson -org.codehaus.jackson -org.greenrobot.eventbus -pub.devrel.easypermissions -org.slf4j -cz.msebera.android.httpclient -net.sourceforge.javaflacencoder -vavi.sound -okio -org.objectweb.asm -com.appsflyer -com.mobikwik.sdk -com.clevertap.android.sdk -com.mixpanel -com.google.vr.sdk \ No newline at end of file diff --git a/app/src/main/config/logback.xml b/app/src/main/config/logback.xml deleted file mode 100644 index 38e67371..00000000 --- a/app/src/main/config/logback.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - [ignored] %msg%n - - - - - - diff --git a/app/src/main/ic_launcher_round-web.png b/app/src/main/ic_launcher_round-web.png deleted file mode 100644 index 3549f9b0..00000000 Binary files a/app/src/main/ic_launcher_round-web.png and /dev/null differ diff --git a/app/src/main/ic_logo_plain-web.png b/app/src/main/ic_logo_plain-web.png deleted file mode 100644 index 4a768d41..00000000 Binary files a/app/src/main/ic_logo_plain-web.png and /dev/null differ diff --git a/app/src/main/kotlin/com/njlabs/showjava/Constants.kt b/app/src/main/kotlin/com/njlabs/showjava/Constants.kt deleted file mode 100644 index 2b0644ad..00000000 --- a/app/src/main/kotlin/com/njlabs/showjava/Constants.kt +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Show Java - A java/apk decompiler for android - * Copyright (c) 2018 Niranjan Rajendran - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.njlabs.showjava - -/** - * Constants used throughout the application - */ -object Constants { - - const val STORAGE_PERMISSION_REQUEST = 1009 - - interface EVENTS { - companion object { - const val CLEAR_SOURCE_HISTORY = "clear_source_history" - const val CHANGE_FONT = "change_font" - const val TOGGLE_DARK_MODE = "toggle_dark_mode" - const val SELECT_DECOMPILER = "select_decompiler" - const val DECOMPILE_APP = "decompile_app" - const val REPORT_APP_LOW_MEMORY = "report_app_low_memory" - } - } - - /** - * Workers related constants - */ - interface WORKER { - - companion object { - const val STATUS_TYPE = "com.njlabs.showjava.worker.STATUS_TYPE" - const val STATUS_TITLE = "com.njlabs.showjava.worker.STATUS_TITLE" - const val STATUS_MESSAGE = "com.njlabs.showjava.worker.STATUS_MESSAGE" - - const val PROGRESS_NOTIFICATION_CHANNEL = "com.njlabs.showjava.worker.notification.progress" - const val COMPLETION_NOTIFICATION_CHANNEL = "com.njlabs.showjava.worker.notification.completion" - const val PROGRESS_NOTIFICATION_ID = 1094 - const val COMPLETED_NOTIFICATION_ID = 1095 - } - - /** - * Actions used for interacting with workers - */ - interface ACTION { - companion object { - // Action to broadcast status to receivers - const val BROADCAST = "com.njlabs.showjava.worker.action.BROADCAST" - - // Action to instruct the receiver to stop the worker - const val STOP = "com.njlabs.showjava.worker.action.STOP" - } - } - } -} \ No newline at end of file diff --git a/app/src/main/kotlin/com/njlabs/showjava/MainApplication.kt b/app/src/main/kotlin/com/njlabs/showjava/MainApplication.kt deleted file mode 100644 index 74596921..00000000 --- a/app/src/main/kotlin/com/njlabs/showjava/MainApplication.kt +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Show Java - A java/apk decompiler for android - * Copyright (c) 2018 Niranjan Rajendran - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.njlabs.showjava - -import android.app.NotificationManager -import android.content.Context -import android.os.Build -import androidx.annotation.RequiresApi -import androidx.appcompat.app.AppCompatDelegate -import androidx.multidex.MultiDexApplication -import androidx.preference.PreferenceManager -import androidx.work.WorkManager -import com.njlabs.showjava.utils.Ads -import com.njlabs.showjava.utils.UserPreferences -import com.njlabs.showjava.utils.logging.ProductionTree -import io.reactivex.Observable -import io.reactivex.disposables.CompositeDisposable -import io.reactivex.schedulers.Schedulers -import timber.log.Timber -import com.crashlytics.android.Crashlytics -import com.google.firebase.iid.FirebaseInstanceId -import io.fabric.sdk.android.Fabric - - -class MainApplication : MultiDexApplication() { - - val disposables = CompositeDisposable() - lateinit var instanceId: String - - override fun onCreate() { - super.onCreate() - instanceId = FirebaseInstanceId.getInstance().id - - PreferenceManager.setDefaultValues( - applicationContext, - UserPreferences.NAME, - Context.MODE_PRIVATE, - R.xml.preferences, - false - ) - - val preferences = - UserPreferences( - applicationContext.getSharedPreferences( - UserPreferences.NAME, - Context.MODE_PRIVATE - ) - ) - - AppCompatDelegate.setDefaultNightMode( - if (preferences.darkMode) - AppCompatDelegate.MODE_NIGHT_YES - else - AppCompatDelegate.MODE_NIGHT_NO - ) - - Ads(this).init() - Fabric.with(this, Crashlytics()) - Crashlytics.setUserIdentifier(instanceId) - - if (BuildConfig.DEBUG) { - Timber.plant(Timber.DebugTree()) - } else { - Timber.plant(ProductionTree()) - } - - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { - disposables.add( - cleanStaleNotifications() - .subscribeOn(Schedulers.io()) - .observeOn(Schedulers.io()) - .onErrorReturn {} - .subscribe() - ) - } - } - - /** - * Clean any stale notifications not linked to any decompiler process - */ - @RequiresApi(Build.VERSION_CODES.M) - fun cleanStaleNotifications(): Observable { - return Observable.fromCallable { - val manager = applicationContext - .getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager - val workManager = WorkManager.getInstance() - manager.activeNotifications.forEach { notification -> - val status = workManager.getWorkInfosForUniqueWorkLiveData(notification.tag) - .value?.any { it.state.isFinished } - if (status == null || status == true) { - manager.cancel(notification.tag, notification.id) - } - } - } - } - - override fun onTerminate() { - super.onTerminate() - disposables.clear() - } -} diff --git a/app/src/main/kotlin/com/njlabs/showjava/activities/BaseActivity.kt b/app/src/main/kotlin/com/njlabs/showjava/activities/BaseActivity.kt deleted file mode 100644 index f53f271a..00000000 --- a/app/src/main/kotlin/com/njlabs/showjava/activities/BaseActivity.kt +++ /dev/null @@ -1,270 +0,0 @@ -/* - * Show Java - A java/apk decompiler for android - * Copyright (c) 2018 Niranjan Rajendran - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.njlabs.showjava.activities - -import android.Manifest -import android.content.Context -import android.content.Intent -import android.content.pm.ActivityInfo -import android.content.pm.PackageManager -import android.net.Uri -import android.os.Bundle -import android.view.Menu -import android.view.MenuItem -import android.view.View -import android.widget.Toast -import androidx.appcompat.app.AppCompatActivity -import androidx.appcompat.widget.Toolbar -import com.google.ads.consent.ConsentInformation -import com.google.ads.consent.ConsentStatus -import com.google.ads.mediation.admob.AdMobAdapter -import com.google.android.gms.ads.AdListener -import com.google.android.gms.ads.AdRequest -import com.google.android.gms.ads.AdView -import com.google.firebase.analytics.FirebaseAnalytics -import com.njlabs.showjava.Constants -import com.njlabs.showjava.MainApplication -import com.njlabs.showjava.R -import com.njlabs.showjava.activities.about.AboutActivity -import com.njlabs.showjava.activities.purchase.PurchaseActivity -import com.njlabs.showjava.activities.settings.SettingsActivity -import com.njlabs.showjava.utils.secure.SecureUtils -import com.njlabs.showjava.utils.UserPreferences -import com.njlabs.showjava.utils.ktx.checkDataConnection -import io.reactivex.disposables.CompositeDisposable -import pub.devrel.easypermissions.AppSettingsDialog -import pub.devrel.easypermissions.EasyPermissions - - -abstract class BaseActivity : AppCompatActivity(), EasyPermissions.PermissionCallbacks { - - protected lateinit var toolbar: Toolbar - protected lateinit var context: AppCompatActivity - protected lateinit var userPreferences: UserPreferences - protected lateinit var secureUtils: SecureUtils - protected lateinit var mainApplication: MainApplication - - lateinit var firebaseAnalytics: FirebaseAnalytics - - protected val disposables = CompositeDisposable() - protected var inEea = false - - abstract fun init(savedInstanceState: Bundle?) - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - context = this - inEea = ConsentInformation.getInstance(this).isRequestLocationInEeaOrUnknown - firebaseAnalytics = FirebaseAnalytics.getInstance(this) - mainApplication = application as MainApplication - firebaseAnalytics.setUserProperty("instance_id", mainApplication.instanceId) - - userPreferences = UserPreferences(getSharedPreferences(UserPreferences.NAME, Context.MODE_PRIVATE)) - secureUtils = SecureUtils.getInstance(applicationContext) - - if (userPreferences.customFont) { - context.theme.applyStyle(R.style.LatoFontStyle, true) - } - - if (!EasyPermissions.hasPermissions(this, Manifest.permission.WRITE_EXTERNAL_STORAGE)) { - EasyPermissions.requestPermissions( - this, - getString(R.string.storagePermissionRationale), - Constants.STORAGE_PERMISSION_REQUEST, - Manifest.permission.WRITE_EXTERNAL_STORAGE - ) - init(savedInstanceState) - } else { - init(savedInstanceState) - postPermissionsGrant() - } - } - - fun setupLayout(layoutRef: Int) { - setContentView(layoutRef) - setupToolbar(null) - setupGoogleAds() - } - - fun setupLayout(layoutRef: Int, title: String) { - setContentView(layoutRef) - setupToolbar(title) - setupGoogleAds() - } - - fun setupLayoutNoActionBar(layoutRef: Int) { - setContentView(layoutRef) - } - - fun setSubtitle(subtitle: String?) { - // Workaround for a weird bug caused by Calligraphy - // https://github.com/chrisjenx/Calligraphy/issues/280#issuecomment-256444828 - toolbar.post { - toolbar.subtitle = subtitle - } - - } - - private fun setupToolbar(title: String?) { - toolbar = findViewById(R.id.toolbar) as Toolbar - setSupportActionBar(toolbar) - if (title != null) { - supportActionBar?.title = title - } else { - if (isPro()) { - val activityInfo: ActivityInfo - try { - activityInfo = packageManager.getActivityInfo( - componentName, - PackageManager.GET_META_DATA - ) - val currentTitle = activityInfo.loadLabel(packageManager).toString() - if (currentTitle.trim() == getString(R.string.appName)) { - supportActionBar?.title = "${getString(R.string.appName)} Pro" - } - } catch (ignored: PackageManager.NameNotFoundException) { - - } - } - } - supportActionBar?.setDisplayHomeAsUpEnabled(true) - supportActionBar?.setDisplayShowHomeEnabled(true) - } - - private fun setupGoogleAds() { - findViewById(R.id.adView)?.let {it -> - it.visibility = View.GONE - if (!isPro()) { - val extras = Bundle() - val consentStatus = ConsentStatus.values()[userPreferences.consentStatus] - if (consentStatus == ConsentStatus.NON_PERSONALIZED) { - extras.putString("npa", "1") - } - - val adRequest = AdRequest.Builder() - .addNetworkExtrasBundle(AdMobAdapter::class.java, extras) - .addTestDevice(AdRequest.DEVICE_ID_EMULATOR) - .addTestDevice(getString(R.string.adUnitId)) - .build() - - it.adListener = object : AdListener() { - override fun onAdFailedToLoad(errorCode: Int) { - super.onAdFailedToLoad(errorCode) - it.visibility = View.GONE - } - - override fun onAdLoaded() { - super.onAdLoaded() - it.visibility = View.VISIBLE - } - } - it.loadAd(adRequest) - if (!checkDataConnection(context)) { - it.visibility = View.GONE - } - } - } - } - - fun isPro(): Boolean { - return secureUtils.hasPurchasedPro() - } - - override fun onCreateOptionsMenu(menu: Menu): Boolean { - menuInflater.inflate(R.menu.menu_main, menu) - return true - } - - override fun onOptionsItemSelected(item: MenuItem): Boolean { - when (item.itemId) { - android.R.id.home -> { - finish() - return true - } - R.id.about_option -> { - startActivity(Intent(baseContext, AboutActivity::class.java)) - return true - } - R.id.bug_report_option -> { - val uri = Uri.parse("https://github.com/niranjan94/show-java/issues") - startActivity(Intent(Intent.ACTION_VIEW, uri)) - overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out) - return true - } - R.id.settings_option -> { - startActivity(Intent(baseContext, SettingsActivity::class.java)) - return true - } - R.id.get_pro_option -> { - startActivity(Intent(baseContext, PurchaseActivity::class.java)) - return true - } - } - - return super.onOptionsItemSelected(item) - } - - open fun postPermissionsGrant() {} - - override fun onPermissionsGranted(requestCode: Int, perms: MutableList) { - postPermissionsGrant() - } - - override fun onRequestPermissionsResult( - requestCode: Int, - permissions: Array, - grantResults: IntArray - ) { - super.onRequestPermissionsResult(requestCode, permissions, grantResults) - EasyPermissions.onRequestPermissionsResult(requestCode, permissions, grantResults, this) - } - - override fun onPermissionsDenied(requestCode: Int, perms: List) { - if (perms.isNotEmpty() || EasyPermissions.somePermissionPermanentlyDenied(this, perms)) { - AppSettingsDialog.Builder(this) - .build() - .show() - } - } - - fun hasValidPermissions(): Boolean { - return EasyPermissions.hasPermissions(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) - } - - public override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { - super.onActivityResult(requestCode, resultCode, data) - if (requestCode == AppSettingsDialog.DEFAULT_SETTINGS_REQ_CODE) { - if (!EasyPermissions.hasPermissions(this, Manifest.permission.WRITE_EXTERNAL_STORAGE)) { - Toast.makeText( - this, - R.string.storagePermissionRationale, - Toast.LENGTH_LONG - ).show() - finish() - } else { - postPermissionsGrant() - } - } - } - - override fun onDestroy() { - super.onDestroy() - disposables.clear() - } -} diff --git a/app/src/main/kotlin/com/njlabs/showjava/activities/about/AboutActivity.kt b/app/src/main/kotlin/com/njlabs/showjava/activities/about/AboutActivity.kt deleted file mode 100644 index a72228f4..00000000 --- a/app/src/main/kotlin/com/njlabs/showjava/activities/about/AboutActivity.kt +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Show Java - A java/apk decompiler for android - * Copyright (c) 2018 Niranjan Rajendran - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.njlabs.showjava.activities.about - -import android.content.Intent -import android.os.Bundle -import com.google.android.gms.oss.licenses.OssLicensesMenuActivity -import com.njlabs.showjava.BuildConfig -import com.njlabs.showjava.R -import com.njlabs.showjava.activities.BaseActivity -import kotlinx.android.synthetic.main.activity_about.* - -/** - * Show information about the app, its version & licenses to all open source libraries used - */ -class AboutActivity : BaseActivity() { - override fun init(savedInstanceState: Bundle?) { - setupLayout(R.layout.activity_about) - if (BuildConfig.GIT_SHA.isNotEmpty()) { - version.setText(R.string.appVersionExtendedWithHash) - } - - appInstanceId.text = getString(R.string.instanceId, mainApplication.instanceId) - - viewOpenSourceLicenses.setOnClickListener { - overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out) - startActivity(Intent(context, OssLicensesMenuActivity::class.java)) - } - } -} \ No newline at end of file diff --git a/app/src/main/kotlin/com/njlabs/showjava/activities/apps/AppsActivity.kt b/app/src/main/kotlin/com/njlabs/showjava/activities/apps/AppsActivity.kt deleted file mode 100644 index 4d3dbe39..00000000 --- a/app/src/main/kotlin/com/njlabs/showjava/activities/apps/AppsActivity.kt +++ /dev/null @@ -1,192 +0,0 @@ -/* - * Show Java - A java/apk decompiler for android - * Copyright (c) 2018 Niranjan Rajendran - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.njlabs.showjava.activities.apps - -import android.app.ActivityOptions -import android.app.SearchManager -import android.content.Context -import android.content.Intent -import android.os.Build -import android.os.Bundle -import android.view.Menu -import android.view.MenuItem -import android.view.View -import android.widget.Toast -import androidx.appcompat.widget.SearchView -import com.njlabs.showjava.BuildConfig -import com.njlabs.showjava.R -import com.njlabs.showjava.activities.BaseActivity -import com.njlabs.showjava.activities.apps.adapters.AppsListAdapter -import com.njlabs.showjava.activities.decompiler.DecompilerActivity -import com.njlabs.showjava.data.PackageInfo -import io.reactivex.android.schedulers.AndroidSchedulers -import io.reactivex.schedulers.Schedulers -import kotlinx.android.synthetic.main.activity_apps.* -import timber.log.Timber - - -class AppsActivity : BaseActivity(), SearchView.OnQueryTextListener, SearchView.OnCloseListener { - private lateinit var appsHandler: AppsHandler - private lateinit var historyListAdapter: AppsListAdapter - - private var searchMenuItem: MenuItem? = null - - private var apps = ArrayList() - private var filteredApps = ArrayList() - private var withSystemApps: Boolean = false - - override fun init(savedInstanceState: Bundle?) { - setupLayout(R.layout.activity_apps) - appsHandler = AppsHandler(context) - withSystemApps = userPreferences.showSystemApps - - loadingView.visibility = View.VISIBLE - appsList.visibility = View.GONE - typeRadioGroup.visibility = View.GONE - searchMenuItem?.isVisible = false - - savedInstanceState?.let { - val apps = it.getParcelableArrayList("apps") - if (!apps.isNullOrEmpty()) { - this.apps = apps - this.filteredApps = apps - setupList() - filterApps(R.id.userRadioButton) - } - } - - if (this.apps.isEmpty( )) { - loadApps() - } - typeRadioGroup.setOnCheckedChangeListener { _, checkedId -> - filterApps(checkedId) - } - } - - private fun loadApps() { - disposables.add(appsHandler.loadApps(withSystemApps) - .subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe( - { processStatus -> - if (!processStatus.isDone) { - progressBar.progress = processStatus.progress.toInt() - statusText.text = processStatus.status - processStatus.secondaryStatus?.let { - secondaryStatusText.text = it - } - } else { - if (processStatus.result != null) { - apps = processStatus.result - filteredApps = processStatus.result - } - setupList() - filterApps(R.id.userRadioButton) - } - }, - { e -> - Timber.e(e) - } - ) - ) - } - - private fun setupList() { - loadingView.visibility = View.GONE - appsList.visibility = View.VISIBLE - typeRadioGroup.visibility = if (withSystemApps) View.VISIBLE else View.GONE - searchMenuItem?.isVisible = true - appsList.setHasFixedSize(true) - appsList.layoutManager = androidx.recyclerview.widget.LinearLayoutManager(context) - historyListAdapter = AppsListAdapter(apps) { selectedApp: PackageInfo, view: View -> - Timber.d(selectedApp.name) - if (selectedApp.name.toLowerCase().contains(BuildConfig.APPLICATION_ID.toLowerCase())) { - Toast.makeText( - applicationContext, - getString(R.string.checkoutSourceLink), - Toast.LENGTH_SHORT - ).show() - } - openProcessActivity(selectedApp, view) - } - appsList.adapter = historyListAdapter - } - - private fun openProcessActivity(packageInfo: PackageInfo, view: View) { - val i = Intent(context, DecompilerActivity::class.java) - i.putExtra("packageInfo", packageInfo) - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - val options = ActivityOptions - .makeSceneTransitionAnimation(this, view.findViewById(R.id.itemCard), "appListItem") - return startActivity(i, options.toBundle()) - } - - startActivity(i) - } - - override fun onSaveInstanceState(bundle: Bundle) { - super.onSaveInstanceState(bundle) - bundle.putParcelableArrayList("apps", apps) - } - - override fun onCreateOptionsMenu(menu: Menu): Boolean { - menuInflater.inflate(R.menu.menu_app, menu) - val searchManager = getSystemService(Context.SEARCH_SERVICE) as SearchManager - searchMenuItem = menu.findItem(R.id.search) - val searchView = searchMenuItem?.actionView as SearchView - searchView.setSearchableInfo(searchManager.getSearchableInfo(componentName)) - searchView.isSubmitButtonEnabled = true - searchView.setOnQueryTextListener(this) - searchView.setOnCloseListener(this) - return true - } - - private fun searchApps(query: String?) { - val cleanedQuery = query?.trim()?.toLowerCase() ?: "" - historyListAdapter.updateList(filteredApps.filter { - cleanedQuery == "" || it.label.toLowerCase().contains(cleanedQuery) - }) - } - - private fun filterApps(filterId: Int) { - filteredApps = apps.filter { - when(filterId) { - R.id.systemRadioButton -> it.isSystemPackage - R.id.userRadioButton -> !it.isSystemPackage - else -> true - } - } as ArrayList - historyListAdapter.updateList(filteredApps) - } - - override fun onQueryTextSubmit(query: String?): Boolean { - searchApps(query) - return true - } - - override fun onQueryTextChange(query: String?): Boolean { - searchApps(query) - return true - } - - override fun onClose(): Boolean { - searchApps(null) - return true - } -} \ No newline at end of file diff --git a/app/src/main/kotlin/com/njlabs/showjava/activities/apps/AppsHandler.kt b/app/src/main/kotlin/com/njlabs/showjava/activities/apps/AppsHandler.kt deleted file mode 100644 index ede8dd37..00000000 --- a/app/src/main/kotlin/com/njlabs/showjava/activities/apps/AppsHandler.kt +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Show Java - A java/apk decompiler for android - * Copyright (c) 2018 Niranjan Rajendran - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.njlabs.showjava.activities.apps - -import android.content.Context -import com.njlabs.showjava.R -import com.njlabs.showjava.data.PackageInfo -import com.njlabs.showjava.utils.ktx.isSystemPackage -import com.njlabs.showjava.utils.rx.ProcessStatus -import io.reactivex.Observable -import io.reactivex.ObservableEmitter - -class AppsHandler(private var context: Context) { - - /** - * Load all installed applications. - * - * @return [Observable] which can be used to track the loading progress and completion state. - */ - fun loadApps(withSystemApps: Boolean): Observable>> { - return Observable.create { emitter: ObservableEmitter>> -> - val installedApps = ArrayList() - var packages = context.packageManager.getInstalledPackages(0) - packages = packages.filter { pack -> - withSystemApps || !isSystemPackage(pack) - } - packages.forEachIndexed { index, pack -> - val packageInfo = PackageInfo.fromApkPackageInfo(context, pack) - packageInfo.icon = pack.applicationInfo.loadIcon(context.packageManager) - packageInfo.isSystemPackage = isSystemPackage(pack) - installedApps.add(packageInfo) - val currentCount = index + 1 - emitter.onNext( - ProcessStatus( - (currentCount.toFloat() / packages.size.toFloat()) * 100f, - context.getString(R.string.loadingApp, packageInfo.label), - context.getString(R.string.loadingStatistic, currentCount, packages.size) - ) - ) - } - installedApps.sortBy { - it.label.toLowerCase() - } - emitter.onNext(ProcessStatus(installedApps)) - emitter.onComplete() - } - } -} \ No newline at end of file diff --git a/app/src/main/kotlin/com/njlabs/showjava/activities/apps/adapters/AppsListAdapter.kt b/app/src/main/kotlin/com/njlabs/showjava/activities/apps/adapters/AppsListAdapter.kt deleted file mode 100644 index cdcc8310..00000000 --- a/app/src/main/kotlin/com/njlabs/showjava/activities/apps/adapters/AppsListAdapter.kt +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Show Java - A java/apk decompiler for android - * Copyright (c) 2018 Niranjan Rajendran - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.njlabs.showjava.activities.apps.adapters - -import android.content.Context -import android.text.SpannableString -import android.text.TextUtils -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import androidx.core.content.ContextCompat -import androidx.core.content.res.ResourcesCompat -import cn.nekocode.badge.BadgeDrawable -import com.njlabs.showjava.R -import com.njlabs.showjava.data.PackageInfo -import kotlinx.android.synthetic.main.layout_app_list_item.view.* - - -fun getSystemBadge(context: Context): BadgeDrawable { - return BadgeDrawable.Builder() - .type(BadgeDrawable.TYPE_ONLY_ONE_TEXT) - .badgeColor(ContextCompat.getColor(context, R.color.grey_400)) - .typeFace(ResourcesCompat.getFont(context, R.font.lato)) - .text1("system") - .build() -} - -/** - * Adapter for populating and managing the Apps list - */ -class AppsListAdapter( - private var apps: List, - private val itemClick: (PackageInfo, View) -> Unit -) : androidx.recyclerview.widget.RecyclerView.Adapter() { - - private lateinit var systemBadgeInstance: BadgeDrawable - - inner class ViewHolder(private val view: View, private val itemClick: (PackageInfo, View) -> Unit) : - androidx.recyclerview.widget.RecyclerView.ViewHolder(view) { - - private val systemBadge: BadgeDrawable - get() { - if (!::systemBadgeInstance.isInitialized) { - systemBadgeInstance = getSystemBadge(view.context) - } - return systemBadgeInstance - } - - fun bindPackageInfo(packageInfo: PackageInfo) { - with(packageInfo) { - itemView.itemLabel.text = if (packageInfo.isSystemPackage) - SpannableString( - TextUtils.concat( - packageInfo.label, - " ", " ", - systemBadge.toSpannable() - ) - ) - else - packageInfo.label - - itemView.itemSecondaryLabel.text = packageInfo.version - itemView.itemIcon.setImageDrawable(packageInfo.icon) - itemView.itemCard.cardElevation = 1F - itemView.itemCard.setOnClickListener { itemClick(this, itemView) } - } - } - } - - override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder { - val view = LayoutInflater.from(parent.context) - .inflate(R.layout.layout_app_list_item, parent, false) - return ViewHolder(view, itemClick) - } - - override fun onBindViewHolder(holder: AppsListAdapter.ViewHolder, position: Int) { - holder.bindPackageInfo(apps[position]) - } - - override fun getItemCount(): Int { - return apps.size - } - - fun updateList(apps: List) { - this.apps = apps - notifyDataSetChanged() - } -} diff --git a/app/src/main/kotlin/com/njlabs/showjava/activities/decompiler/DecompilerActivity.kt b/app/src/main/kotlin/com/njlabs/showjava/activities/decompiler/DecompilerActivity.kt deleted file mode 100644 index 3d9eec8d..00000000 --- a/app/src/main/kotlin/com/njlabs/showjava/activities/decompiler/DecompilerActivity.kt +++ /dev/null @@ -1,231 +0,0 @@ -/* - * Show Java - A java/apk decompiler for android - * Copyright (c) 2018 Niranjan Rajendran - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.njlabs.showjava.activities.decompiler - -import android.annotation.SuppressLint -import android.app.ActivityOptions -import android.content.Intent -import android.graphics.Typeface -import android.os.Build -import android.os.Bundle -import android.text.Spannable -import android.text.SpannableString -import android.text.SpannableStringBuilder -import android.text.TextUtils -import android.text.style.StyleSpan -import android.view.LayoutInflater -import android.view.View -import android.widget.Toast -import androidx.appcompat.app.AlertDialog -import com.google.firebase.analytics.FirebaseAnalytics -import com.njlabs.showjava.Constants -import com.njlabs.showjava.R -import com.njlabs.showjava.activities.BaseActivity -import com.njlabs.showjava.activities.apps.adapters.getSystemBadge -import com.njlabs.showjava.activities.explorer.navigator.NavigatorActivity -import com.njlabs.showjava.data.PackageInfo -import com.njlabs.showjava.data.SourceInfo -import com.njlabs.showjava.decompilers.BaseDecompiler -import com.njlabs.showjava.decompilers.BaseDecompiler.Companion.isAvailable -import com.njlabs.showjava.utils.ktx.sourceDir -import com.njlabs.showjava.utils.ktx.toBundle -import io.reactivex.Observable -import io.reactivex.android.schedulers.AndroidSchedulers -import io.reactivex.schedulers.Schedulers -import kotlinx.android.synthetic.main.activity_decompiler.* -import kotlinx.android.synthetic.main.layout_app_list_item.view.* -import kotlinx.android.synthetic.main.layout_pick_decompiler_list_item.view.* -import org.apache.commons.io.FileUtils -import java.io.File -import java.net.URI - - -class DecompilerActivity : BaseActivity() { - - private lateinit var packageInfo: PackageInfo - - @SuppressLint("SetTextI18n") - override fun init(savedInstanceState: Bundle?) { - setupLayout(R.layout.activity_decompiler) - - loadPackageInfoFromIntent() - - if (!::packageInfo.isInitialized) { - Toast.makeText(context, R.string.cannotDecompileFile, Toast.LENGTH_LONG).show() - finish() - return - } - - val apkSize = FileUtils.byteCountToDisplaySize(packageInfo.file.length()) - - itemLabel.itemLabel.text = if (packageInfo.isSystemPackage) - SpannableString( - TextUtils.concat( - packageInfo.label, - " ", " ", - getSystemBadge(context).toSpannable() - ) - ) - else - packageInfo.label - - itemSecondaryLabel.text = "${packageInfo.version} - $apkSize" - - val decompilersValues = resources.getStringArray(R.array.decompilersValues) - val decompilers = resources.getStringArray(R.array.decompilers) - val decompilerDescriptions = resources.getStringArray(R.array.decompilerDescriptions) - - decompilersValues.forEachIndexed { index, decompiler -> - val view = LayoutInflater.from(pickerList.context) - .inflate(R.layout.layout_pick_decompiler_list_item, pickerList, false) - view.decompilerName.text = decompilers[index] - view.decompilerDescription.text = decompilerDescriptions[index] - view.decompilerItemCard.cardElevation = 1F - view.decompilerItemCard.setOnClickListener { - startProcess(it, decompiler, index) - } - pickerList.addView(view) - } - - if (packageInfo.isSystemPackage) { - systemAppWarning.visibility = View.VISIBLE - val warning = getString(R.string.systemAppWarning) - val sb = SpannableStringBuilder(warning) - val bss = StyleSpan(Typeface.BOLD) - val iss = StyleSpan(Typeface.ITALIC) - val nss = StyleSpan(Typeface.NORMAL) - sb.setSpan(bss, 0, 8, Spannable.SPAN_INCLUSIVE_INCLUSIVE) - sb.setSpan(nss, 8, warning.length, Spannable.SPAN_INCLUSIVE_INCLUSIVE) - sb.setSpan(iss, 0, warning.length, Spannable.SPAN_INCLUSIVE_INCLUSIVE) - systemAppWarning.text = sb - } - - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { - decompilersUnavailableNotification.visibility = View.VISIBLE - } - - disposables.add( - Observable.fromCallable { - packageInfo.loadIcon(context) - } - .subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .onErrorReturn { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - resources.getDrawable(R.drawable.ic_list_generic, null) - } else { - resources.getDrawable(R.drawable.ic_list_generic) - } - } - .subscribe { itemIcon.setImageDrawable(it) } - ) - - assertSourceExistence(true) - } - - private fun loadPackageInfoFromIntent() { - if (intent.dataString.isNullOrEmpty()) { - if (intent.hasExtra("packageInfo")) { - packageInfo = intent.getParcelableExtra("packageInfo") - } else { - Toast.makeText(context, R.string.errorLoadingInputFile, Toast.LENGTH_SHORT).show() - finish() - } - } else { - val info = PackageInfo.fromFile( - context, - File(URI.create(intent.dataString)).canonicalFile - ) - if (info != null) { - packageInfo = info - } - } - } - - override fun onResume() { - super.onResume() - assertSourceExistence() - } - - private fun assertSourceExistence(addListener: Boolean = false) { - val sourceInfo = SourceInfo.from(sourceDir(packageInfo.name)) - if (addListener) { - historyCard.setOnClickListener { - val intent = Intent(context, NavigatorActivity::class.java) - intent.putExtra("selectedApp", sourceInfo) - startActivity(intent) - } - } - if (sourceInfo.exists()) { - historyCard.visibility = View.VISIBLE - historyInfo.text = FileUtils.byteCountToDisplaySize(sourceInfo.sourceSize) - } else { - historyCard.visibility = View.GONE - } - } - - private fun startProcess(view: View, decompiler: String, decompilerIndex: Int) { - - if (!isAvailable(decompiler)) { - AlertDialog.Builder(context) - .setTitle(getString(R.string.decompilerUnavailable)) - .setMessage(getString(R.string.decompilerUnavailableExplanation)) - .setIcon(R.drawable.ic_error_outline_black) - .setNegativeButton(android.R.string.ok, null) - .show() - return - } - - val inputMap = hashMapOf( - "shouldIgnoreLibs" to userPreferences.ignoreLibraries, - "maxAttempts" to userPreferences.maxAttempts, - "chunkSize" to userPreferences.chunkSize, - "memoryThreshold" to userPreferences.memoryThreshold, - "keepIntermediateFiles" to userPreferences.keepIntermediateFiles, - "decompiler" to decompiler, - "name" to packageInfo.name, - "label" to packageInfo.label, - "inputPackageFile" to packageInfo.filePath, - "type" to packageInfo.type.ordinal - ) - - BaseDecompiler.start(inputMap) - - firebaseAnalytics.logEvent( - Constants.EVENTS.SELECT_DECOMPILER, hashMapOf( - FirebaseAnalytics.Param.VALUE to decompiler - ).toBundle() - ) - - firebaseAnalytics.logEvent(Constants.EVENTS.DECOMPILE_APP, inputMap.toBundle()) - - val i = Intent(this, DecompilerProcessActivity::class.java) - i.putExtra("packageInfo", packageInfo) - i.putExtra("decompilerIndex", decompilerIndex) - - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - val options = ActivityOptions - .makeSceneTransitionAnimation(this, view, "decompilerItemCard") - startActivity(i, options.toBundle()) - } else { - startActivity(i) - } - finish() - } -} \ No newline at end of file diff --git a/app/src/main/kotlin/com/njlabs/showjava/activities/decompiler/DecompilerProcessActivity.kt b/app/src/main/kotlin/com/njlabs/showjava/activities/decompiler/DecompilerProcessActivity.kt deleted file mode 100644 index 2ab91ea4..00000000 --- a/app/src/main/kotlin/com/njlabs/showjava/activities/decompiler/DecompilerProcessActivity.kt +++ /dev/null @@ -1,235 +0,0 @@ -/* - * Show Java - A java/apk decompiler for android - * Copyright (c) 2018 Niranjan Rajendran - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.njlabs.showjava.activities.decompiler - -import android.annotation.SuppressLint -import android.content.BroadcastReceiver -import android.content.Context -import android.content.Intent -import android.os.Bundle -import android.view.animation.Animation -import android.view.animation.LinearInterpolator -import android.view.animation.RotateAnimation -import android.widget.TextView -import com.njlabs.showjava.R -import com.njlabs.showjava.activities.BaseActivity -import com.njlabs.showjava.data.PackageInfo -import kotlinx.android.synthetic.main.activity_decompiler_process.* -import android.content.IntentFilter -import android.os.Build -import android.view.View -import android.widget.Toast -import androidx.core.content.ContextCompat -import androidx.lifecycle.Observer -import androidx.work.WorkInfo -import androidx.work.WorkManager -import com.njlabs.showjava.BuildConfig -import com.njlabs.showjava.Constants -import com.njlabs.showjava.activities.explorer.navigator.NavigatorActivity -import com.njlabs.showjava.data.SourceInfo -import com.njlabs.showjava.utils.ktx.sourceDir -import com.njlabs.showjava.workers.DecompilerWorker -import timber.log.Timber - - -class DecompilerProcessActivity : BaseActivity() { - - private val statusesMap = mutableMapOf( - "jar-extraction" to WorkInfo.State.ENQUEUED, - "java-extraction" to WorkInfo.State.ENQUEUED, - "resources-extraction" to WorkInfo.State.ENQUEUED - ) - - private lateinit var packageInfo: PackageInfo - private var hasCompleted = false - private var showMemoryUsage = false - private var ranOutOfMemory = false - - override fun init(savedInstanceState: Bundle?) { - setupLayout(R.layout.activity_decompiler_process) - packageInfo = intent.getParcelableExtra("packageInfo") - showMemoryUsage = userPreferences.showMemoryUsage - - memoryUsage.visibility = if (showMemoryUsage) View.VISIBLE else View.GONE - memoryStatus.visibility = if (showMemoryUsage) View.VISIBLE else View.GONE - - val decompilerIndex = intent.getIntExtra("decompilerIndex", 0) - - inputPackageLabel.text = packageInfo.label - - val decompilers = resources.getStringArray(R.array.decompilers) - val decompilerValues = resources.getStringArray(R.array.decompilersValues) - val decompilerDescriptions = resources.getStringArray(R.array.decompilerDescriptions) - - decompilerItemCard.findViewById(R.id.decompilerName).text = decompilers[decompilerIndex] - decompilerItemCard.findViewById(R.id.decompilerDescription).text = decompilerDescriptions[decompilerIndex] - - setupGears() - - val statusIntentFilter = IntentFilter(Constants.WORKER.ACTION.BROADCAST + packageInfo.name) - registerReceiver(progressReceiver, statusIntentFilter) - - cancelButton.setOnClickListener { - DecompilerWorker.cancel(context, packageInfo.name) - finish() - } - - WorkManager.getInstance() - .getWorkInfosForUniqueWorkLiveData(packageInfo.name) - .observe(this, Observer> { statuses -> - statuses.forEach { - statusesMap.keys.forEach { tag -> - if (it.tags.contains(tag)) { - statusesMap[tag] = it.state - } - } - - if (BuildConfig.DEBUG && Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { - it.outputData.keyValueMap.forEach { t, u -> - Timber.d("[status][data] $t : $u") - } - statusesMap.forEach { t, u -> - Timber.d("[status][statuses] $t : $u") - } - } - - if (it.outputData.getBoolean("ranOutOfMemory", false)) { - val intent = Intent(context, LowMemoryActivity::class.java) - intent.putExtra("packageInfo", packageInfo) - intent.putExtra("decompiler", decompilerValues[decompilerIndex]) - startActivity(intent) - hasCompleted = true - finish() - } else { - reconcileDecompilerStatus() - } - } - }) - } - - private fun reconcileDecompilerStatus() { - synchronized(hasCompleted) { - if (hasCompleted) { - return - } - - val hasFailed = statusesMap.values.any { it == WorkInfo.State.FAILED } - val isWaiting = statusesMap.values.any { it == WorkInfo.State.ENQUEUED } - val hasPassed = statusesMap.values.all { it == WorkInfo.State.SUCCEEDED } - val isCancelled = statusesMap.values.any { it == WorkInfo.State.CANCELLED } - - if (BuildConfig.DEBUG && Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { - statusesMap.forEach { t, u -> - Timber.d("[status] Worker: $t State: ${u.name}") - } - } - - Timber.d("[status] [${packageInfo.name}] hasPassed: $hasPassed | hasFailed: $hasFailed") - - when { - isCancelled -> { - hasCompleted = true - finish() - } - hasFailed -> { - Toast.makeText( - context, - getString(R.string.errorDecompilingApp, packageInfo.label), - Toast.LENGTH_LONG - ).show() - hasCompleted = true - finish() - } - hasPassed -> { - val intent = Intent(context, NavigatorActivity::class.java) - intent.putExtra("selectedApp", SourceInfo.from( - sourceDir( - packageInfo.name - ) - )) - startActivity(intent) - hasCompleted = true - finish() - } - isWaiting -> statusText.text = getString(R.string.waitingToStart) - } - } - } - - private fun getGearAnimation(duration: Int = 1, isClockwise: Boolean = true): RotateAnimation { - val animation = RotateAnimation( - if (isClockwise) 0.0f else 360.0f, - if (isClockwise) 360.0f else 0.0f, - Animation.RELATIVE_TO_SELF, 0.5f, - Animation.RELATIVE_TO_SELF, 0.5f - ) - animation.repeatCount = Animation.INFINITE - animation.duration = duration.toLong() * 1500 - animation.interpolator = LinearInterpolator() - return animation - } - - private fun setupGears() { - leftProgressGear.post { leftProgressGear.animation = getGearAnimation(2, true) } - rightProgressGear.post { rightProgressGear.animation = getGearAnimation(1, false) } - } - - private val progressReceiver = object : BroadcastReceiver() { - - @SuppressLint("SetTextI18n") // For memory status - override fun onReceive(context: Context, intent: Intent) { - val message = intent.getStringExtra(Constants.WORKER.STATUS_MESSAGE) - if (intent.getStringExtra(Constants.WORKER.STATUS_TYPE) == "memory") { - if (!showMemoryUsage) { - return - } - try { - val percentage = message.toDouble() - memoryStatus.text = "$message%" - val textColor = ContextCompat.getColor( - context, - when { - percentage < 40 -> R.color.green_500 - percentage < 60 -> R.color.amber_500 - percentage < 80 -> R.color.orange_500 - else -> R.color.red_500 - } - ) - memoryStatus.setTextColor(textColor) - memoryUsage.setTextColor(textColor) - } catch (ignored: Exception) { } - return - } - - intent.getStringExtra(Constants.WORKER.STATUS_TITLE)?.let { - if (it.trim().isNotEmpty()) { - statusTitle.text = it - } - } - message?.let { - statusText.text = it - } - } - } - - override fun onDestroy() { - super.onDestroy() - unregisterReceiver(progressReceiver) - } -} \ No newline at end of file diff --git a/app/src/main/kotlin/com/njlabs/showjava/activities/decompiler/LowMemoryActivity.kt b/app/src/main/kotlin/com/njlabs/showjava/activities/decompiler/LowMemoryActivity.kt deleted file mode 100644 index 3beab20c..00000000 --- a/app/src/main/kotlin/com/njlabs/showjava/activities/decompiler/LowMemoryActivity.kt +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Show Java - A java/apk decompiler for android - * Copyright (c) 2018 Niranjan Rajendran - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.njlabs.showjava.activities.decompiler - -import android.os.Bundle -import android.widget.Toast -import com.njlabs.showjava.Constants -import com.njlabs.showjava.R -import com.njlabs.showjava.activities.BaseActivity -import com.njlabs.showjava.data.PackageInfo -import com.njlabs.showjava.utils.ktx.toBundle -import io.reactivex.android.schedulers.AndroidSchedulers -import io.reactivex.schedulers.Schedulers -import kotlinx.android.synthetic.main.activity_low_memory.* -import timber.log.Timber - -/** - * If an app's decompilation was stopped due to low memory, explain what happened to the user - * And also provide user a way to report the app that failed to decompile. This can then - * be investigated later on to see what can be done to reduce the memory usage. - */ -class LowMemoryActivity : BaseActivity() { - - override fun init(savedInstanceState: Bundle?) { - setupLayout(R.layout.activity_low_memory) - val packageInfo = intent.getParcelableExtra("packageInfo") - val decompiler = intent.getStringExtra("decompiler") - - reportButton.setOnClickListener { - - firebaseAnalytics.logEvent(Constants.EVENTS.REPORT_APP_LOW_MEMORY, mapOf( - "shouldIgnoreLibs" to userPreferences.ignoreLibraries, - "maxAttempts" to userPreferences.maxAttempts, - "chunkSize" to userPreferences.chunkSize, - "memoryThreshold" to userPreferences.memoryThreshold, - "label" to packageInfo.label, - "name" to packageInfo.name, - "type" to packageInfo.type.name, - "decompiler" to decompiler - ).toBundle()) - - Toast.makeText(context, R.string.appReportThanks, Toast.LENGTH_LONG).show() - } - } - -} \ No newline at end of file diff --git a/app/src/main/kotlin/com/njlabs/showjava/activities/explorer/navigator/NavigatorActivity.kt b/app/src/main/kotlin/com/njlabs/showjava/activities/explorer/navigator/NavigatorActivity.kt deleted file mode 100644 index 933aed64..00000000 --- a/app/src/main/kotlin/com/njlabs/showjava/activities/explorer/navigator/NavigatorActivity.kt +++ /dev/null @@ -1,339 +0,0 @@ -/* - * Show Java - A java/apk decompiler for android - * Copyright (c) 2018 Niranjan Rajendran - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.njlabs.showjava.activities.explorer.navigator - -import android.app.ProgressDialog -import android.content.ActivityNotFoundException -import android.content.Intent -import android.net.Uri -import android.os.Bundle -import android.os.Environment -import android.view.Menu -import android.view.MenuItem -import android.view.View -import android.webkit.MimeTypeMap -import android.widget.Toast -import androidx.appcompat.app.AlertDialog -import androidx.core.content.FileProvider -import com.njlabs.showjava.R -import com.njlabs.showjava.activities.BaseActivity -import com.njlabs.showjava.activities.explorer.navigator.adapters.FilesListAdapter -import com.njlabs.showjava.activities.explorer.viewer.CodeViewerActivity -import com.njlabs.showjava.activities.explorer.viewer.ImageViewerActivity -import com.njlabs.showjava.data.FileItem -import com.njlabs.showjava.data.SourceInfo -import io.reactivex.android.schedulers.AndroidSchedulers -import io.reactivex.schedulers.Schedulers -import kotlinx.android.synthetic.main.activity_navigator.* -import timber.log.Timber -import java.io.File - - -class NavigatorActivity : BaseActivity() { - - private lateinit var navigationHandler: NavigatorHandler - private lateinit var filesListAdapter: FilesListAdapter - private var currentDirectory: File? = null - private var sourceArchive: File? = null - - private var zipProgressDialog: ProgressDialog? = null - - private var fileItems: ArrayList = ArrayList() - private var selectedApp: SourceInfo? = null - - override fun init(savedInstanceState: Bundle?) { - setupLayout(R.layout.activity_navigator) - selectedApp = intent.extras?.getParcelable("selectedApp") - navigationHandler = NavigatorHandler(this) - - if (savedInstanceState != null) { - savedInstanceState.getParcelableArrayList("fileItems")?.let { - fileItems = it - } - selectedApp = selectedApp ?: savedInstanceState.getParcelable("selectedApp") - val currentDirectoryString = savedInstanceState.getString("currentDirectory") - currentDirectoryString?.let { - currentDirectory = File(it) - } - } - supportActionBar?.title = selectedApp?.packageLabel - currentDirectory = currentDirectory ?: selectedApp?.sourceDirectory - setupList() - filesListAdapter.updateData(fileItems) - currentDirectory?.let { populateList(it) } - - swipeRefresh.setOnRefreshListener { - currentDirectory?.let { populateList(it) } - } - } - - private fun setListVisibility(isListVisible: Boolean = true) { - val listGroupVisibility = if (isListVisible) View.VISIBLE else View.GONE - filesList.visibility = listGroupVisibility - } - - private fun populateList(startDirectory: File) { - currentDirectory = startDirectory - val packageName = selectedApp?.packageName - if (isAtRoot()) { - setSubtitle(packageName) - } else { - setSubtitle( - startDirectory.canonicalPath.replace( - "${Environment.getExternalStorageDirectory()}/show-java/sources/$packageName/", - "" - ) - ) - } - swipeRefresh.isRefreshing = true - disposables.add(navigationHandler.loadFiles(startDirectory) - .subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .onErrorReturn { - Timber.e(it) - Toast.makeText(context, R.string.errorLoadingFiles, Toast.LENGTH_SHORT).show() - ArrayList() - } - .subscribe { - updateList(it) - swipeRefresh.isRefreshing = false - } - ) - } - - private fun updateList(fileItems: ArrayList?) { - if (fileItems != null) { - this.fileItems = fileItems - filesListAdapter.updateData(fileItems) - if (fileItems.isEmpty()) { - setListVisibility(false) - } else { - setListVisibility(true) - } - - } - } - - private fun setupList() { - filesList.setHasFixedSize(true) - filesList.layoutManager = androidx.recyclerview.widget.LinearLayoutManager(context) - filesListAdapter = FilesListAdapter(fileItems) { selectedFile -> - if (selectedFile.file.isDirectory) { - populateList(selectedFile.file) - } else { - when { - arrayOf("jpeg", "jpg", "png").contains(selectedFile.file.extension) -> { - val intent = Intent(context, ImageViewerActivity::class.java) - intent.putExtra("filePath", selectedFile.file.canonicalPath) - intent.putExtra("name", selectedApp?.packageName) - startActivity(intent) - } - arrayOf( - "java", "xml", "json", "txt", "properties", "sql", - "yml", "yaml", "md", "html", "class", - "js", "css", "scss", "sass" - ).contains(selectedFile.file.extension) -> { - val intent = Intent(context, CodeViewerActivity::class.java) - intent.putExtra("filePath", selectedFile.file.canonicalPath) - intent.putExtra("name", selectedApp?.packageName) - startActivity(intent) - } - else -> { - val mimeTypeDetector = MimeTypeMap.getSingleton() - val fileIntent = Intent(Intent.ACTION_VIEW) - val mimeType = - mimeTypeDetector.getMimeTypeFromExtension(selectedFile.file.extension) - fileIntent.setDataAndType( - FileProvider.getUriForFile( - context, - context.applicationContext.packageName + ".provider", - selectedFile.file - ), - mimeType - ) - fileIntent.flags = Intent.FLAG_ACTIVITY_NEW_TASK - fileIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) - try { - context.startActivity(fileIntent) - } catch (e: ActivityNotFoundException) { - Toast.makeText( - context, - getString(R.string.noSupportedHandlerForFileType), - Toast.LENGTH_LONG - ).show() - } - } - } - } - } - filesList.adapter = filesListAdapter - updateList(fileItems) - } - - override fun onSaveInstanceState(bundle: Bundle) { - super.onSaveInstanceState(bundle) - if (fileItems.size <= 1000) { - bundle.putParcelableArrayList("fileItems", fileItems) - } - selectedApp?.let { - bundle.putParcelable("selectedApp", it) - } - currentDirectory?.let { - bundle.putString("currentDirectory", it.canonicalPath) - } - } - - override fun onCreateOptionsMenu(menu: Menu): Boolean { - menuInflater.inflate(R.menu.menu_main, menu) - menu.findItem(R.id.share_code).isVisible = true - menu.findItem(R.id.delete_code).isVisible = true - return true - } - - private fun showProgressDialog() { - if (zipProgressDialog == null) { - zipProgressDialog = ProgressDialog(this) - zipProgressDialog!!.isIndeterminate = false - zipProgressDialog!!.setCancelable(false) - zipProgressDialog!!.setInverseBackgroundForced(false) - zipProgressDialog!!.setCanceledOnTouchOutside(false) - zipProgressDialog!!.setMessage(getString(R.string.compressingSource)) - } - zipProgressDialog!!.show() - } - - private fun dismissProgressDialog() { - if (zipProgressDialog != null && zipProgressDialog!!.isShowing) { - zipProgressDialog!!.dismiss() - } - } - - /** - * Check if the current folder the user is in, is the root - */ - private fun isAtRoot(): Boolean { - return currentDirectory?.canonicalPath == selectedApp?.sourceDirectory?.canonicalPath - } - - private fun shareArchive(file: File?) { - if (file == null) { - Toast.makeText(context, R.string.genericError, Toast.LENGTH_SHORT).show() - return - } - - dismissProgressDialog() - val shareIntent = Intent() - shareIntent.action = Intent.ACTION_SEND - shareIntent.putExtra( - Intent.EXTRA_STREAM, - FileProvider.getUriForFile(context, context.applicationContext.packageName + ".provider", file) - ) - shareIntent.type = "application/zip" - startActivity( - Intent.createChooser( - shareIntent, - getString(R.string.sendSourceVia) - ) - ) - } - - private fun goBack(): Boolean { - if (isAtRoot()) { - finish() - return true - } - currentDirectory?.parent?.let { - populateList(File(it)) - return true - } - return false - } - - override fun onOptionsItemSelected(item: MenuItem): Boolean { - when (item.itemId) { - android.R.id.home -> { - if (goBack()) { - return true - } - } - R.id.share_code -> { - sourceArchive?.let { - shareArchive(it) - return true - } - - showProgressDialog() - disposables.add(navigationHandler.archiveDirectory( - selectedApp!!.sourceDirectory, selectedApp!!.packageName - ) - .subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .onErrorReturn { - Timber.e(it) - null - } - .subscribe { - sourceArchive = it - shareArchive(it) - } - ) - return true - - } - R.id.delete_code -> { - AlertDialog.Builder(this) - .setTitle(getString(R.string.deleteSource)) - .setMessage(getString(R.string.deleteSourceConfirm)) - .setIcon(R.drawable.ic_error_outline_black) - .setPositiveButton( - android.R.string.yes - ) { _, _ -> - deleteSource() - } - .setNegativeButton(android.R.string.no, null) - .show() - return true - } - } - return super.onOptionsItemSelected(item) - } - - private fun deleteSource() { - selectedApp?.let { - deleteProgress.visibility = View.VISIBLE - filesList.visibility = View.GONE - disposables.add(navigationHandler.deleteDirectory(it.sourceDirectory) - .subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe { - Toast.makeText( - baseContext, - getString(R.string.sourceDeleted), - Toast.LENGTH_SHORT - ).show() - finish() - } - ) - } - } - - override fun onBackPressed() { - goBack() - } -} \ No newline at end of file diff --git a/app/src/main/kotlin/com/njlabs/showjava/activities/explorer/navigator/NavigatorHandler.kt b/app/src/main/kotlin/com/njlabs/showjava/activities/explorer/navigator/NavigatorHandler.kt deleted file mode 100644 index dd195e47..00000000 --- a/app/src/main/kotlin/com/njlabs/showjava/activities/explorer/navigator/NavigatorHandler.kt +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Show Java - A java/apk decompiler for android - * Copyright (c) 2018 Niranjan Rajendran - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.njlabs.showjava.activities.explorer.navigator - -import android.content.Context -import com.crashlytics.android.Crashlytics -import com.njlabs.showjava.data.FileItem -import com.njlabs.showjava.utils.ZipUtils -import io.reactivex.Observable -import org.apache.commons.io.FileUtils -import java.io.File -import java.io.IOException -import java.text.DateFormat -import java.util.Date -import kotlin.collections.ArrayList -import kotlin.collections.forEach -import kotlin.collections.sortBy - -class NavigatorHandler(private var context: Context) { - - /** - * Load all files in the given directory - */ - fun loadFiles(currentDirectory: File): Observable> { - return Observable.fromCallable { - val directories = ArrayList() - val files = ArrayList() - val items = currentDirectory.listFiles() - if (items.isNullOrEmpty()) { - return@fromCallable directories - } - items.forEach { file -> - val lastModDate = DateFormat.getDateTimeInstance() - .format( - Date( - file.lastModified() - ) - ) - if (file.isDirectory) { - val children = file.listFiles() - val noOfChildren = children?.size ?: 0 - val fileSize = "$noOfChildren ${if (noOfChildren == 1) "item" else "items"}" - directories.add(FileItem(file, fileSize, lastModDate)) - } else { - val fileSize = FileUtils.byteCountToDisplaySize(file.length()) - files.add(FileItem(file, fileSize, lastModDate)) - } - } - directories.sortBy { it.name?.toLowerCase() } - files.sortBy { it.name?.toLowerCase() } - directories.addAll(files) - directories - } - } - - /** - * Package an entire directory containing the source code into a .zip archive. - */ - fun archiveDirectory(sourceDirectory: File, packageName: String): Observable { - return Observable.fromCallable { - ZipUtils.zipDir(sourceDirectory, packageName) - } - } - - /** - * Delete the source directory - */ - fun deleteDirectory(sourceDirectory: File): Observable { - return Observable.fromCallable { - try { - if (sourceDirectory.exists()) { - FileUtils.deleteDirectory(sourceDirectory) - } - } catch (e: IOException) { - Crashlytics.logException(e) - } - } - } -} diff --git a/app/src/main/kotlin/com/njlabs/showjava/activities/explorer/navigator/adapters/FilesListAdapter.kt b/app/src/main/kotlin/com/njlabs/showjava/activities/explorer/navigator/adapters/FilesListAdapter.kt deleted file mode 100644 index f0d34226..00000000 --- a/app/src/main/kotlin/com/njlabs/showjava/activities/explorer/navigator/adapters/FilesListAdapter.kt +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Show Java - A java/apk decompiler for android - * Copyright (c) 2018 Niranjan Rajendran - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.njlabs.showjava.activities.explorer.navigator.adapters - -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import com.njlabs.showjava.R -import com.njlabs.showjava.data.FileItem -import kotlinx.android.synthetic.main.layout_app_list_item.view.* - -/** - * List adapter for the code navigator - */ -class FilesListAdapter( - private var fileItems: List, - private val itemClick: (FileItem) -> Unit -) : androidx.recyclerview.widget.RecyclerView.Adapter() { - - class ViewHolder(view: View, private val itemClick: (FileItem) -> Unit) : - androidx.recyclerview.widget.RecyclerView.ViewHolder(view) { - fun bindSourceInfo(fileItem: FileItem) { - with(fileItem) { - itemView.itemLabel.text = fileItem.name - itemView.itemSecondaryLabel.text = fileItem.fileSize - itemView.itemIcon.setImageResource(fileItem.iconResource) - itemView.itemCard.cardElevation = 1F - itemView.itemCard.setOnClickListener { itemClick(this) } - } - } - } - - fun updateData(fileItems: List?) { - if (fileItems != null) { - this.fileItems = fileItems - notifyDataSetChanged() - } - } - - override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder { - val view = LayoutInflater.from(parent.context) - .inflate(R.layout.layout_app_list_item, parent, false) - return ViewHolder(view, itemClick) - } - - override fun onBindViewHolder(holder: ViewHolder, position: Int) { - holder.bindSourceInfo(fileItems[position]) - } - - override fun getItemCount(): Int { - return fileItems.size - } -} diff --git a/app/src/main/kotlin/com/njlabs/showjava/activities/explorer/viewer/CodeViewerActivity.kt b/app/src/main/kotlin/com/njlabs/showjava/activities/explorer/viewer/CodeViewerActivity.kt deleted file mode 100644 index 9a9b73f7..00000000 --- a/app/src/main/kotlin/com/njlabs/showjava/activities/explorer/viewer/CodeViewerActivity.kt +++ /dev/null @@ -1,194 +0,0 @@ -/* - * Show Java - A java/apk decompiler for android - * Copyright (c) 2018 Niranjan Rajendran - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.njlabs.showjava.activities.explorer.viewer - -import android.content.Context -import android.content.SharedPreferences -import android.os.Build -import android.os.Bundle -import android.os.Environment -import android.view.Menu -import android.view.MenuItem -import android.view.View -import com.njlabs.showjava.R -import com.njlabs.showjava.activities.BaseActivity -import com.njlabs.showjava.utils.views.CodeView -import io.reactivex.Observable -import io.reactivex.android.schedulers.AndroidSchedulers -import io.reactivex.schedulers.Schedulers -import kotlinx.android.synthetic.main.activity_code_viewer.* -import java.io.File - -class CodeViewerActivity : BaseActivity(), CodeView.OnHighlightListener { - - private var extensionTypeMap = hashMapOf( - "txt" to "plaintext", - "class" to "java", - "yml" to "yaml", - "md" to "markdown" - ) - - private lateinit var codeViewPreferences: SharedPreferences - - private var wrapLine = false - private var zoomable = true - private var showLineNumbers = true - private var invertColors = true - - override fun init(savedInstanceState: Bundle?) { - - setupLayout(R.layout.activity_code_viewer) - val extras = intent.extras - - val file = File(extras?.getString("filePath")) - val packageName = extras?.getString("name") - - toolbar.popupTheme = R.style.AppTheme_DarkPopupOverlay - - supportActionBar?.title = file.name - val subtitle = file.canonicalPath.replace( - "${Environment.getExternalStorageDirectory()}/show-java/sources/$packageName/", - "" - ) - - file.name.trim().let { - if (it.equals("AndroidManifest.xml", true) || it.equals("info.json", true)) { - setSubtitle(packageName) - } else { - setSubtitle(subtitle) - } - } - - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { - codeView.visibility = View.INVISIBLE - codeLoadProgress.visibility = View.VISIBLE - } else { - codeView.visibility = View.VISIBLE - codeLoadProgress.visibility = View.GONE - } - - var language = file.extension - extensionTypeMap[language]?.let { - language = it - } - - codeViewPreferences = getSharedPreferences( - "code_view_prefs", - Context.MODE_PRIVATE - ) - - wrapLine = codeViewPreferences.getBoolean("wrapLine", false) - zoomable = codeViewPreferences.getBoolean("zoomable", true) - showLineNumbers = codeViewPreferences.getBoolean("showLineNumbers", true) - invertColors = codeViewPreferences.getBoolean("invertColors", true) - - disposables.add( - loadFile(file) - .subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .onErrorReturn { - it.localizedMessage - } - .subscribe { fileContent -> - codeView.setCode(fileContent) - .setLanguage(language) - .setWrapLine(wrapLine) - .setDarkMode(invertColors) - .setFontSize(14F) - .setZoomEnabled(zoomable) - .setShowLineNumber(showLineNumbers) - .setOnHighlightListener(this) - .load() - } - ) - } - - private fun loadFile(fileToLoad: File): Observable { - return Observable.fromCallable { - fileToLoad.readText() - } - } - - override fun onFontSizeChanged(sizeInPx: Int) {} - override fun onLineClicked(lineNumber: Int, content: String) {} - - override fun onStartCodeHighlight() { - runOnUiThread { - codeView.visibility = View.INVISIBLE - codeLoadProgress.visibility = View.VISIBLE - } - } - - override fun onFinishCodeHighlight() { - runOnUiThread { - codeView.visibility = View.VISIBLE - codeLoadProgress.visibility = View.GONE - } - } - - override fun onCreateOptionsMenu(menu: Menu): Boolean { - menuInflater.inflate(R.menu.menu_main, menu) - - menu.findItem(R.id.wrap_text).isVisible = true - menu.findItem(R.id.invert_colors).isVisible = true - menu.findItem(R.id.zoomable).isVisible = true - - menu.findItem(R.id.wrap_text).isChecked = wrapLine - menu.findItem(R.id.zoomable).isChecked = zoomable - - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { - menu.findItem(R.id.line_number).isVisible = true - menu.findItem(R.id.line_number).isChecked = showLineNumbers - } - return true - } - - override fun onOptionsItemSelected(item: MenuItem): Boolean { - when (item.itemId) { - R.id.wrap_text -> { - val newState = !item.isChecked - codeViewPreferences.edit().putBoolean("wrapLine", newState).apply() - codeView.setWrapLine(newState).apply() - item.isChecked = newState - return true - } - R.id.zoomable -> { - val newState = !item.isChecked - codeViewPreferences.edit().putBoolean("zoomable", newState).apply() - codeView.setZoomEnabled(newState) - item.isChecked = newState - return true - } - R.id.line_number -> { - val newState = !item.isChecked - codeViewPreferences.edit().putBoolean("showLineNumbers", newState).apply() - codeView.setShowLineNumber(newState).apply() - item.isChecked = newState - return true - } - R.id.invert_colors -> { - invertColors = !invertColors - codeViewPreferences.edit().putBoolean("invertColors", invertColors).apply() - codeView.setDarkMode(invertColors).apply() - return true - } - } - return super.onOptionsItemSelected(item) - } -} \ No newline at end of file diff --git a/app/src/main/kotlin/com/njlabs/showjava/activities/explorer/viewer/ImageViewerActivity.kt b/app/src/main/kotlin/com/njlabs/showjava/activities/explorer/viewer/ImageViewerActivity.kt deleted file mode 100644 index c2e4c5dd..00000000 --- a/app/src/main/kotlin/com/njlabs/showjava/activities/explorer/viewer/ImageViewerActivity.kt +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Show Java - A java/apk decompiler for android - * Copyright (c) 2018 Niranjan Rajendran - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.njlabs.showjava.activities.explorer.viewer - -import android.graphics.Color -import android.os.Bundle -import android.os.Environment -import android.view.Menu -import android.view.MenuItem -import com.davemorrissey.labs.subscaleview.ImageSource -import com.davemorrissey.labs.subscaleview.ImageViewState -import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView -import com.njlabs.showjava.R -import com.njlabs.showjava.activities.BaseActivity -import kotlinx.android.synthetic.main.activity_image_viewer.* -import org.apache.commons.io.FilenameUtils - - -class ImageViewerActivity : BaseActivity() { - private var isBlack: Boolean = true - private val bundleState = "ImageViewState" - - override fun init(savedInstanceState: Bundle?) { - setupLayout(R.layout.activity_image_viewer) - window.decorView.setBackgroundColor(Color.BLACK) - toolbar.popupTheme = R.style.AppTheme_DarkPopupOverlay - - val extras = intent.extras - extras?.let { - - var imageViewState: ImageViewState? = null - if (savedInstanceState != null && savedInstanceState.containsKey(bundleState)) { - imageViewState = savedInstanceState.getSerializable(bundleState) as ImageViewState - } - - val filePath = it.getString("filePath") - val packageName = it.getString("name") - val fileName = FilenameUtils.getName(filePath) - supportActionBar?.title = fileName - val subtitle = FilenameUtils - .getFullPath(filePath) - .replace( - "${Environment.getExternalStorageDirectory()}/show-java/sources/$packageName/", - "" - ) - - if (fileName.trim().equals("icon.png", true)) { - setSubtitle(packageName) - } else { - setSubtitle(subtitle) - } - - imageView.setImage(ImageSource.uri(filePath!!), imageViewState) - imageView.orientation = SubsamplingScaleImageView.ORIENTATION_USE_EXIF - imageView.setPanLimit(SubsamplingScaleImageView.PAN_LIMIT_CENTER) - imageView.setMinimumScaleType(SubsamplingScaleImageView.SCALE_TYPE_CUSTOM) - imageView.setMinimumDpi(100) - imageView.setMaximumDpi(600) - } - - } - - override fun onCreateOptionsMenu(menu: Menu): Boolean { - menuInflater.inflate(R.menu.menu_main, menu) - menu.findItem(R.id.invert_colors).isVisible = true - return true - } - - override fun onOptionsItemSelected(item: MenuItem): Boolean { - when (item.itemId) { - R.id.invert_colors -> { - if (isBlack) { - window.decorView.setBackgroundColor(Color.WHITE) - } else { - window.decorView.setBackgroundColor(Color.BLACK) - } - isBlack = !isBlack - return true - } - } - return super.onOptionsItemSelected(item) - } - - public override fun onSaveInstanceState(outState: Bundle) { - super.onSaveInstanceState(outState) - val state = imageView.state - if (state != null) { - outState.putSerializable(bundleState, imageView.state) - } - } -} \ No newline at end of file diff --git a/app/src/main/kotlin/com/njlabs/showjava/activities/landing/LandingActivity.kt b/app/src/main/kotlin/com/njlabs/showjava/activities/landing/LandingActivity.kt deleted file mode 100644 index a37bc947..00000000 --- a/app/src/main/kotlin/com/njlabs/showjava/activities/landing/LandingActivity.kt +++ /dev/null @@ -1,244 +0,0 @@ -/* - * Show Java - A java/apk decompiler for android - * Copyright (c) 2018 Niranjan Rajendran - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.njlabs.showjava.activities.landing - -import android.content.Intent -import android.content.res.Configuration -import android.os.Bundle -import android.os.Environment -import android.view.MenuItem -import android.view.View -import androidx.appcompat.app.ActionBarDrawerToggle -import androidx.recyclerview.widget.LinearLayoutManager -import com.github.angads25.filepicker.model.DialogConfigs -import com.github.angads25.filepicker.model.DialogProperties -import com.github.angads25.filepicker.view.FilePickerDialog -import com.google.ads.consent.ConsentStatus -import com.google.android.gms.ads.AdView -import com.njlabs.showjava.R -import com.njlabs.showjava.activities.BaseActivity -import com.njlabs.showjava.activities.apps.AppsActivity -import com.njlabs.showjava.activities.decompiler.DecompilerActivity -import com.njlabs.showjava.activities.explorer.navigator.NavigatorActivity -import com.njlabs.showjava.activities.landing.adapters.HistoryListAdapter -import com.njlabs.showjava.data.PackageInfo -import com.njlabs.showjava.data.SourceInfo -import com.njlabs.showjava.utils.Ads -import com.njlabs.showjava.utils.secure.PurchaseUtils -import io.reactivex.android.schedulers.AndroidSchedulers -import io.reactivex.schedulers.Schedulers -import kotlinx.android.synthetic.main.activity_landing.* -import timber.log.Timber -import java.io.File - - -class LandingActivity : BaseActivity() { - - private lateinit var drawerToggle: ActionBarDrawerToggle - private lateinit var landingHandler: LandingHandler - private lateinit var filePickerDialog: FilePickerDialog - private lateinit var purchaseUtils: PurchaseUtils - - private var historyListAdapter: HistoryListAdapter? = null - private var historyItems = ArrayList() - - private var shouldLoadHistory = true - - override fun init(savedInstanceState: Bundle?) { - setupLayout(R.layout.activity_landing) - drawerToggle = ActionBarDrawerToggle( - this, - drawerLayout, - R.string.drawerOpen, - R.string.drawerClose - ) - navigationView.setNavigationItemSelectedListener { - onOptionsItemSelected(it) - } - - if (!isPro()) { - navigationView.menu.findItem(R.id.get_pro_option).isVisible = true - } - - drawerLayout.addDrawerListener(drawerToggle) - landingHandler = LandingHandler(context) - setupFab() - - if (savedInstanceState != null) { - savedInstanceState.getParcelableArrayList("historyItems")?.let { - this.historyItems = it - shouldLoadHistory = false - setupList() - } - } - - val properties = DialogProperties() - properties.selection_mode = DialogConfigs.SINGLE_MODE - properties.selection_type = DialogConfigs.FILE_SELECT - properties.root = Environment.getExternalStorageDirectory() - properties.error_dir = properties.root - properties.offset = properties.root - properties.extensions = arrayOf("apk", "jar", "dex", "odex") - - filePickerDialog = FilePickerDialog(this, properties) - filePickerDialog.setTitle(getString(R.string.selectFile)) - - filePickerDialog.setDialogSelectionListener { files -> - if (files.isNotEmpty()) { - val selectedFile = File(files.first()) - if (selectedFile.exists() && selectedFile.isFile) { - PackageInfo.fromFile(context, selectedFile) ?. let { - val i = Intent(context, DecompilerActivity::class.java) - i.putExtra("packageInfo", it) - startActivity(i) - } - } - } - } - - swipeRefresh.setOnRefreshListener { - populateHistory(true) - } - - purchaseUtils = PurchaseUtils(this, secureUtils) - purchaseUtils.doOnComplete { - if (isPro()) { - supportActionBar?.title = "${getString(R.string.appName)} Pro" - findViewById(R.id.adView)?.visibility = View.GONE - navigationView.menu.findItem(R.id.get_pro_option)?.isVisible = false - } - } - purchaseUtils.initializeCheckout(false, true) - if (inEea && userPreferences.consentStatus == ConsentStatus.UNKNOWN.ordinal) { - Ads(context).loadConsentScreen() - } - } - - public override fun onResume() { - super.onResume() - if (hasValidPermissions()) { - populateHistory(true) - } - if (isPro()) { - supportActionBar?.title = "${getString(R.string.appName)} Pro" - findViewById(R.id.adView)?.visibility = View.GONE - navigationView.menu.findItem(R.id.get_pro_option)?.isVisible = false - } - } - - private fun setupFab() { - selectionFab.addOnMenuItemClickListener { _, _, itemId -> - when (itemId) { - R.id.action_pick_installed -> { - startActivity( - Intent(context, AppsActivity::class.java) - ) - } - R.id.action_pick_sdcard -> { - pickFile() - } - } - } - } - - private fun pickFile() { - filePickerDialog.show() - } - - override fun postPermissionsGrant() { - if (shouldLoadHistory) { - populateHistory() - } - } - - private fun populateHistory(resume: Boolean = false) { - swipeRefresh.isRefreshing = true - disposables.add(landingHandler.loadHistory() - .subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .onErrorReturn { - Timber.e(it) - ArrayList() - } - .subscribe { - historyItems = it - swipeRefresh.isRefreshing = false - if (resume && historyListAdapter != null) { - historyListAdapter?.updateData(historyItems) - setListVisibility(!historyItems.isEmpty()) - } else { - setupList() - } - } - ) - } - - private fun setListVisibility(isListVisible: Boolean = true) { - val listGroupVisibility = if (isListVisible) View.VISIBLE else View.GONE - val defaultGroupVisibility = if (isListVisible) View.GONE else View.VISIBLE - historyListView.visibility = listGroupVisibility - swipeRefresh.visibility = listGroupVisibility - pickAppText.visibility = listGroupVisibility - welcomeLayout.visibility = defaultGroupVisibility - } - - - private fun setupList() { - if (historyItems.isEmpty()) { - setListVisibility(false) - } else { - setListVisibility(true) - historyListView.setHasFixedSize(true) - historyListView.layoutManager = LinearLayoutManager(context) - historyListAdapter = HistoryListAdapter(historyItems) { selectedHistoryItem -> - val intent = Intent(context, NavigatorActivity::class.java) - intent.putExtra("selectedApp", selectedHistoryItem) - startActivity(intent) - } - historyListView.adapter = historyListAdapter - } - } - - override fun onSaveInstanceState(bundle: Bundle) { - super.onSaveInstanceState(bundle) - bundle.putParcelableArrayList("historyItems", historyItems) - } - - override fun onPostCreate(savedInstanceState: Bundle?) { - super.onPostCreate(savedInstanceState) - drawerToggle.syncState() - } - - override fun onConfigurationChanged(newConfig: Configuration?) { - super.onConfigurationChanged(newConfig) - drawerToggle.onConfigurationChanged(newConfig) - } - - override fun onOptionsItemSelected(item: MenuItem): Boolean { - if (drawerToggle.onOptionsItemSelected(item)) { - return true - } - return super.onOptionsItemSelected(item) - } - - override fun onDestroy() { - super.onDestroy() - purchaseUtils.onDestroy() - } -} diff --git a/app/src/main/kotlin/com/njlabs/showjava/activities/landing/LandingHandler.kt b/app/src/main/kotlin/com/njlabs/showjava/activities/landing/LandingHandler.kt deleted file mode 100644 index 8d0366a5..00000000 --- a/app/src/main/kotlin/com/njlabs/showjava/activities/landing/LandingHandler.kt +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Show Java - A java/apk decompiler for android - * Copyright (c) 2018 Niranjan Rajendran - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.njlabs.showjava.activities.landing - -import android.content.Context -import androidx.work.WorkManager -import com.njlabs.showjava.data.SourceInfo -import com.njlabs.showjava.utils.ktx.appStorage -import io.reactivex.Observable -import timber.log.Timber -import java.io.File -import java.io.IOException - -class LandingHandler(private var context: Context) { - - - private fun isDecompilerRunning(): Boolean { - return WorkManager.getInstance().getWorkInfosByTagLiveData("decompiler").value?.any { - !it.state.isFinished - } ?: false - } - - fun loadHistory(): Observable> { - return Observable.fromCallable { - val historyItems = ArrayList() - appStorage.mkdirs() - val nomedia = File(appStorage, ".nomedia") - if (!nomedia.exists() || !nomedia.isFile) { - try { - nomedia.createNewFile() - } catch (e: IOException) { - Timber.e(e) - } - } - val sourcesDir = appStorage.resolve("sources") - if (sourcesDir.exists()) { - val files = sourcesDir.listFiles() - if (files != null && files.isNotEmpty()) - files.forEach { file -> - if (SourceInfo.exists(file)) { - SourceInfo.from(file).let { - historyItems.add(it) - } - } else { -/* // Not deleting directories. - if (!isDecompilerRunning()) { - try { - if (file.exists()) { - if (file.isDirectory) { - FileUtils.deleteDirectory(file) - } else { - file.delete() - } - } - - } catch (e: Exception) { - Timber.d(e) - } - if (file.exists() && !file.isDirectory) { - file.delete() - } - } -*/ - } - } - } - historyItems - } - } -} diff --git a/app/src/main/kotlin/com/njlabs/showjava/activities/landing/adapters/HistoryListAdapter.kt b/app/src/main/kotlin/com/njlabs/showjava/activities/landing/adapters/HistoryListAdapter.kt deleted file mode 100644 index ef08099b..00000000 --- a/app/src/main/kotlin/com/njlabs/showjava/activities/landing/adapters/HistoryListAdapter.kt +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Show Java - A java/apk decompiler for android - * Copyright (c) 2018 Niranjan Rajendran - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.njlabs.showjava.activities.landing.adapters - -import android.graphics.BitmapFactory -import android.graphics.drawable.BitmapDrawable -import android.os.Environment -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import com.njlabs.showjava.R -import com.njlabs.showjava.data.SourceInfo -import kotlinx.android.synthetic.main.layout_app_list_item.view.* -import java.io.File - -class HistoryListAdapter( - private var historyItems: List, - private val itemClick: (SourceInfo) -> Unit -) : androidx.recyclerview.widget.RecyclerView.Adapter() { - - class ViewHolder(view: View, private val itemClick: (SourceInfo) -> Unit) : - androidx.recyclerview.widget.RecyclerView.ViewHolder(view) { - - fun bindSourceInfo(sourceInfo: SourceInfo) { - with(sourceInfo) { - itemView.itemLabel.text = sourceInfo.packageLabel - itemView.itemSecondaryLabel.text = sourceInfo.packageName - val iconPath = - "${Environment.getExternalStorageDirectory()}/show-java/sources/${sourceInfo.packageName}/icon.png" - if (File(iconPath).exists()) { - val iconBitmap = BitmapFactory.decodeFile(iconPath) - itemView.itemIcon.setImageDrawable( - BitmapDrawable( - itemView.context.resources, - iconBitmap - ) - ) - } else { - itemView.itemIcon.setImageResource(R.drawable.ic_list_generic) - } - itemView.itemCard.cardElevation = 1F - itemView.itemCard.setOnClickListener { itemClick(this) } - } - } - } - - fun updateData(historyItems: List) { - this.historyItems = historyItems - notifyDataSetChanged() - } - - override fun onCreateViewHolder( - parent: ViewGroup, - viewType: Int - ): ViewHolder { - val view = LayoutInflater.from(parent.context) - .inflate(R.layout.layout_app_list_item, parent, false) - return ViewHolder(view, itemClick) - } - - override fun onBindViewHolder(holder: HistoryListAdapter.ViewHolder, position: Int) { - holder.bindSourceInfo(historyItems[position]) - } - - override fun getItemCount(): Int { - return historyItems.size - } -} diff --git a/app/src/main/kotlin/com/njlabs/showjava/activities/purchase/PurchaseActivity.kt b/app/src/main/kotlin/com/njlabs/showjava/activities/purchase/PurchaseActivity.kt deleted file mode 100644 index 4844cf7d..00000000 --- a/app/src/main/kotlin/com/njlabs/showjava/activities/purchase/PurchaseActivity.kt +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Show Java - A java/apk decompiler for android - * Copyright (c) 2018 Niranjan Rajendran - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.njlabs.showjava.activities.purchase - -import android.content.Intent -import android.os.Bundle -import android.view.View -import android.widget.Toast -import com.google.firebase.analytics.FirebaseAnalytics -import com.njlabs.showjava.R -import com.njlabs.showjava.activities.BaseActivity -import com.njlabs.showjava.utils.secure.PurchaseUtils -import kotlinx.android.synthetic.main.activity_purchase.* -import org.solovyev.android.checkout.* -import timber.log.Timber - - -class PurchaseActivity : BaseActivity() { - - private lateinit var purchaseUtils: PurchaseUtils - - private fun isLoading(loading: Boolean) { - buttonProgressBar.visibility = if (!loading) View.GONE else View.VISIBLE - buyButton.visibility = if (loading) View.GONE else View.VISIBLE - } - - override fun init(savedInstanceState: Bundle?) { - setupLayout(R.layout.activity_purchase, getString(R.string.appNameGetPro)) - Timber.d("[pa] init") - - secureUtils.isSafeExtended( - { // allow - runOnUiThread { - isLoading(false) - purchaseUtils = PurchaseUtils(this, secureUtils) { - isLoading(it) - } - purchaseUtils.doOnComplete { - finish() - } - purchaseUtils.initializeCheckout(true) - buyButton.setOnClickListener { - isLoading(true) - makePurchase() - } - } - }, - { err, app ->// Do not allow - runOnUiThread { - isLoading(false) - buyButton.visibility = View.GONE - if (app != null) { - Toast.makeText( - context, - getString(R.string.deviceVerificationFailedPirateApp, "${app.name} (${app.packageName})"), - Toast.LENGTH_LONG - ).show() - } else { - Toast.makeText( - context, - getString(R.string.deviceVerificationFailed, err.name), - Toast.LENGTH_SHORT - ).show() - } - } - }, - { // On Error - runOnUiThread { - isLoading(false) - buyButton.visibility = View.GONE - Toast.makeText(context, R.string.purchaseInitError, Toast.LENGTH_SHORT).show() - } - } - ) - - Timber.d("[pa] initComplete") - - } - - private fun makePurchase() { - firebaseAnalytics.logEvent(FirebaseAnalytics.Event.BEGIN_CHECKOUT, null) - purchaseUtils.checkout.whenReady(object : Checkout.EmptyListener() { - override fun onReady(requests: BillingRequests) { - firebaseAnalytics.logEvent(FirebaseAnalytics.Event.CHECKOUT_PROGRESS, null) - requests.purchase( - ProductTypes.IN_APP, - secureUtils.iapProductId, - null, - purchaseUtils.checkout.purchaseFlow - ) - } - }) - } - - override fun onDestroy() { - if (::purchaseUtils.isInitialized) { - purchaseUtils.onDestroy() - } - super.onDestroy() - } - - override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { - super.onActivityResult(requestCode, resultCode, data) - if (::purchaseUtils.isInitialized) { - purchaseUtils.checkout.onActivityResult(requestCode, resultCode, data) - } - } -} \ No newline at end of file diff --git a/app/src/main/kotlin/com/njlabs/showjava/activities/settings/SettingsActivity.kt b/app/src/main/kotlin/com/njlabs/showjava/activities/settings/SettingsActivity.kt deleted file mode 100644 index 094b9f82..00000000 --- a/app/src/main/kotlin/com/njlabs/showjava/activities/settings/SettingsActivity.kt +++ /dev/null @@ -1,208 +0,0 @@ -/* - * Show Java - A java/apk decompiler for android - * Copyright (c) 2018 Niranjan Rajendran - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.njlabs.showjava.activities.settings - -import android.content.Context -import android.content.Intent -import android.os.Bundle -import android.view.Menu -import android.view.View -import android.widget.Toast -import androidx.preference.ListPreference -import androidx.appcompat.app.AlertDialog -import androidx.appcompat.app.AppCompatDelegate -import androidx.preference.Preference -import androidx.preference.PreferenceFragmentCompat -import com.google.firebase.analytics.FirebaseAnalytics -import com.njlabs.showjava.Constants -import com.njlabs.showjava.R -import com.njlabs.showjava.activities.BaseActivity -import com.njlabs.showjava.utils.Ads -import com.njlabs.showjava.utils.UserPreferences -import io.reactivex.android.schedulers.AndroidSchedulers -import io.reactivex.disposables.Disposable -import io.reactivex.schedulers.Schedulers - - -class SettingsActivity : BaseActivity() { - - override fun init(savedInstanceState: Bundle?) { - setupLayout(R.layout.activity_settings) - supportFragmentManager - .beginTransaction() - .replace(R.id.container, PrefsFragment()) - .commit() - } - - - class PrefsFragment : PreferenceFragmentCompat() { - - private lateinit var settingsHandler: SettingsHandler - private lateinit var deleteSubscription: Disposable - - private var progressBarView: View? = null - private var containerView: View? = null - - private val numericKeys = arrayOf("chunkSize", "maxAttempts", "memoryThreshold") - - override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) { - preferenceManager.sharedPreferencesName = UserPreferences.NAME - preferenceManager.sharedPreferencesMode = Context.MODE_PRIVATE - - val activity = activity as SettingsActivity - - progressBarView = activity.findViewById(R.id.progressBar) - containerView = activity.findViewById(R.id.container) - - settingsHandler = SettingsHandler(context!!) - - setPreferencesFromResource(R.xml.preferences, rootKey) - - bindPreferenceSummaryToValue(findPreference("chunkSize")) - bindPreferenceSummaryToValue(findPreference("maxAttempts")) - bindPreferenceSummaryToValue(findPreference("memoryThreshold")) - - val adPreferences = findPreference("adPreferences") - - if (!activity.inEea || activity.isPro()) { - adPreferences.parent?.removePreference(adPreferences) - } else { - adPreferences.setOnPreferenceClickListener { - Ads(activity).loadConsentScreen() - return@setOnPreferenceClickListener true - } - } - - findPreference("clearSourceHistory").setOnPreferenceClickListener { - activity.firebaseAnalytics.logEvent(Constants.EVENTS.CLEAR_SOURCE_HISTORY, null) - AlertDialog.Builder(context!!) - .setTitle(getString(R.string.deleteSourceHistory)) - .setMessage(getString(R.string.deleteSourceHistoryConfirm)) - .setIcon(R.drawable.ic_error_outline_black) - .setPositiveButton( - android.R.string.yes - ) { _, _ -> - deleteSources() - } - .setNegativeButton(android.R.string.no, null) - .show() - true - } - - findPreference("customFont").setOnPreferenceChangeListener { _, newValue -> - val bundle = Bundle() - bundle.putString(FirebaseAnalytics.Param.VALUE, newValue.toString()) - activity.firebaseAnalytics.logEvent(Constants.EVENTS.CHANGE_FONT, bundle) - Toast.makeText(context, R.string.themeChangeCloseInfo, Toast.LENGTH_SHORT).show() - activity.let { - it.startActivity(Intent(it, SettingsActivity::class.java)) - it.finish() - } - true - } - - findPreference("darkMode").setOnPreferenceChangeListener { _, newValue -> - val bundle = Bundle() - bundle.putString(FirebaseAnalytics.Param.VALUE, newValue.toString()) - activity.firebaseAnalytics.logEvent(Constants.EVENTS.TOGGLE_DARK_MODE, bundle) - - AppCompatDelegate.setDefaultNightMode( - if (newValue as Boolean) - AppCompatDelegate.MODE_NIGHT_YES - else - AppCompatDelegate.MODE_NIGHT_NO - ) - - Toast.makeText(context, R.string.themeChangeCloseInfo, Toast.LENGTH_SHORT).show() - - activity.let { - it.startActivity(Intent(it, SettingsActivity::class.java)) - it.finish() - } - - true - } - } - - private fun deleteSources() { - progressBarView?.visibility = View.VISIBLE - containerView?.visibility = View.INVISIBLE - deleteSubscription = settingsHandler.deleteHistory() - .subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe { - Toast.makeText( - context, - getString(R.string.sourceHistoryDeleted), - Toast.LENGTH_SHORT - ).show() - progressBarView?.visibility = View.GONE - containerView?.visibility = View.VISIBLE - } - } - - override fun onDestroy() { - super.onDestroy() - if (::deleteSubscription.isInitialized && !deleteSubscription.isDisposed) { - deleteSubscription.dispose() - } - } - - private fun numberCheck(newValue: Any): Boolean { - return if (newValue.toString().trim() != "" && newValue.toString().trim().matches("\\d*".toRegex())) { - true - } else { - Toast.makeText(activity, R.string.onlyPositiveIntegersAllowed, Toast.LENGTH_SHORT).show() - false - } - } - - private val bindPreferenceSummaryToValueListener = - Preference.OnPreferenceChangeListener { preference, value -> - if (numericKeys.contains(preference.key) && !numberCheck(value)) { - return@OnPreferenceChangeListener false - } - - var stringValue = value.toString() - if (preference is ListPreference) { - val index = preference.findIndexOfValue(stringValue) - stringValue = if (index >= 0) preference.entries[index].toString() else "" - } - if (stringValue != "") { - preference.summary = stringValue.trim() - return@OnPreferenceChangeListener true - } - preference.summary = null - true - } - - private fun bindPreferenceSummaryToValue(preference: Preference) { - preference.onPreferenceChangeListener = bindPreferenceSummaryToValueListener - bindPreferenceSummaryToValueListener.onPreferenceChange( - preference, - preference.context.getSharedPreferences(UserPreferences.NAME, Context.MODE_PRIVATE) - .getString(preference.key, "")!! - ) - } - } - - override fun onCreateOptionsMenu(menu: Menu): Boolean { - return true - } -} \ No newline at end of file diff --git a/app/src/main/kotlin/com/njlabs/showjava/activities/settings/SettingsHandler.kt b/app/src/main/kotlin/com/njlabs/showjava/activities/settings/SettingsHandler.kt deleted file mode 100644 index 92119595..00000000 --- a/app/src/main/kotlin/com/njlabs/showjava/activities/settings/SettingsHandler.kt +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Show Java - A java/apk decompiler for android - * Copyright (c) 2018 Niranjan Rajendran - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.njlabs.showjava.activities.settings - -import android.content.Context -import com.njlabs.showjava.utils.ktx.appStorage -import io.reactivex.Observable - -class SettingsHandler(private var context: Context) { - - /** - * Delete all decompiled sources recursively - */ - fun deleteHistory(): Observable { - return Observable.fromCallable { - appStorage.resolve("sources") - .deleteRecursively() - } - } -} \ No newline at end of file diff --git a/app/src/main/kotlin/com/njlabs/showjava/data/FileItem.kt b/app/src/main/kotlin/com/njlabs/showjava/data/FileItem.kt deleted file mode 100644 index a41717a4..00000000 --- a/app/src/main/kotlin/com/njlabs/showjava/data/FileItem.kt +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Show Java - A java/apk decompiler for android - * Copyright (c) 2018 Niranjan Rajendran - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.njlabs.showjava.data - -import android.os.Parcel -import android.os.Parcelable -import com.njlabs.showjava.R -import org.apache.commons.io.FilenameUtils -import java.io.File - -/** - * Each file/folder item displayed in [com.njlabs.showjava.activities.explorer.navigator.NavigatorActivity] - */ -class FileItem() : Parcelable { - - var file: File = File("/") - var fileSize: String = "" - var metaInfo: String? = "" - - val name: String? - get() = if (metaInfo == "parent") ".." else file.name - - /** - * Returns the appropriate icon resource based on the file extension via reflection - */ - val iconResource: Int - get() { - if (metaInfo == "parent") { - return R.drawable.previous - } - if (file.isDirectory) { - return R.drawable.type_folder - } - var extension = FilenameUtils.getExtension(file.name) ?: return R.drawable.type_file - extension = if (extension === "jpeg") "jpg" else extension - return try { - val res = R.drawable::class.java - val drawableField = res.getField("type_$extension") - drawableField.getInt(null) - } catch (e: Exception) { - R.drawable.type_file - } - } - - - constructor(parcel: Parcel) : this() { - file = File(parcel.readString()) - fileSize = parcel.readString() as String - metaInfo = parcel.readString() as String - } - - constructor(file: File, fileSize: String, metaInfo: String) : this() { - this.file = file - this.fileSize = fileSize - this.metaInfo = metaInfo - } - - override fun writeToParcel(parcel: Parcel, flags: Int) { - parcel.writeString(file.canonicalPath) - parcel.writeString(fileSize) - parcel.writeString(metaInfo) - } - - override fun describeContents(): Int { - return 0 - } - - companion object CREATOR : Parcelable.Creator { - override fun createFromParcel(parcel: Parcel): FileItem { - return FileItem(parcel) - } - - override fun newArray(size: Int): Array { - return arrayOfNulls(size) - } - } -} \ No newline at end of file diff --git a/app/src/main/kotlin/com/njlabs/showjava/data/PackageInfo.kt b/app/src/main/kotlin/com/njlabs/showjava/data/PackageInfo.kt deleted file mode 100644 index 455f5b71..00000000 --- a/app/src/main/kotlin/com/njlabs/showjava/data/PackageInfo.kt +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Show Java - A java/apk decompiler for android - * Copyright (c) 2018 Niranjan Rajendran - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.njlabs.showjava.data - -import android.content.Context -import android.graphics.drawable.BitmapDrawable -import android.graphics.drawable.Drawable -import android.os.Parcel -import android.os.Parcelable -import com.njlabs.showjava.utils.Identicon -import com.njlabs.showjava.utils.ktx.getVersion -import com.njlabs.showjava.utils.ktx.isSystemPackage -import com.njlabs.showjava.utils.ktx.jarPackageName -import java.io.File -import java.lang.NullPointerException - -/** - * [PackageInfo] holds information about an apk/jar/dex file in preparation for sending it for - * decompilation. It also providers helpers to auto-generate an instance from a given [File] - */ -class PackageInfo() : Parcelable { - var label = "" - var name = "" - var version = "" - var filePath = "" - var file: File = File("") - var icon: Drawable? = null - var type = Type.APK - var isSystemPackage = false - - constructor(parcel: Parcel) : this() { - label = parcel.readString()!! - name = parcel.readString()!! - version = parcel.readString()!! - filePath = parcel.readString()!! - type = Type.values()[parcel.readInt()] - isSystemPackage = parcel.readInt() == 1 - file = File(filePath) - } - - constructor(label: String, name: String, version: String, filePath: String, type: Type, isSystemPackage: Boolean = false) : this() { - this.label = label - this.name = name - this.version = version - this.filePath = filePath - this.type = type - this.isSystemPackage = isSystemPackage - file = File(filePath) - } - - constructor(label: String, name: String) : this() { - this.label = label - this.name = name - } - - override fun writeToParcel(parcel: Parcel, flags: Int) { - parcel.writeString(label) - parcel.writeString(name) - parcel.writeString(version) - parcel.writeString(filePath) - parcel.writeInt(type.ordinal) - parcel.writeInt(if (isSystemPackage) 1 else 0) - } - - fun loadIcon(context: Context): Drawable { - return when(type) { - Type.APK -> context.packageManager.getPackageArchiveInfo(filePath, 0) - .applicationInfo.loadIcon(context.packageManager) - Type.JAR, Type.DEX -> - BitmapDrawable(context.resources, Identicon.createFromObject(this.name + this.label)) - } - } - - override fun describeContents(): Int { - return 0 - } - - override fun toString(): String { - return String.format("filePath: %s", filePath) - } - - enum class Type { - APK, JAR, DEX - } - - companion object CREATOR : Parcelable.Creator { - - /** - * Get [PackageInfo] for an apk using the [context] and [android.content.pm.PackageInfo] instance. - */ - fun fromApkPackageInfo(context: Context, pack: android.content.pm.PackageInfo): PackageInfo { - return PackageInfo( - pack.applicationInfo.loadLabel(context.packageManager).toString(), - pack.packageName, - getVersion(pack), - pack.applicationInfo.publicSourceDir, - Type.APK, - isSystemPackage(pack) - ) - } - - /** - * Get [PackageInfo] for an apk using the [context] and the [file]. - */ - private fun fromApk(context: Context, file: File): PackageInfo? { - val pack = context.packageManager.getPackageArchiveInfo(file.canonicalPath, 0) - return PackageInfo( - pack.applicationInfo.loadLabel(context.packageManager).toString(), - pack.packageName, - getVersion(pack), - file.canonicalPath, - Type.APK, - isSystemPackage(pack) - ) - } - - /** - * Get [PackageInfo] for a jar from the [file]. - */ - private fun fromJar(file: File, type: Type = Type.JAR): PackageInfo? { - return PackageInfo( - file.name, - jarPackageName(file.name), - (System.currentTimeMillis() / 1000).toString(), - file.canonicalPath, - type - ) - } - - /** - * Get [PackageInfo] for a dex from the [file]. - */ - private fun fromDex(file: File): PackageInfo? { - return fromJar(file, Type.DEX) - } - - - /** - * Get [PackageInfo] from a [file]. - */ - fun fromFile(context: Context, file: File): PackageInfo? { - return try { - when(file.extension) { - "apk" -> fromApk(context, file) - "jar" -> fromJar(file) - "dex", "odex" -> fromDex(file) - else -> null - } - } catch (e: NullPointerException) { - null - } - } - - override fun createFromParcel(parcel: Parcel): PackageInfo { - return PackageInfo(parcel) - } - - override fun newArray(size: Int): Array { - return arrayOfNulls(size) - } - } -} diff --git a/app/src/main/kotlin/com/njlabs/showjava/data/SourceInfo.kt b/app/src/main/kotlin/com/njlabs/showjava/data/SourceInfo.kt deleted file mode 100644 index 48ad0fbd..00000000 --- a/app/src/main/kotlin/com/njlabs/showjava/data/SourceInfo.kt +++ /dev/null @@ -1,200 +0,0 @@ -/* - * Show Java - A java/apk decompiler for android - * Copyright (c) 2018 Niranjan Rajendran - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.njlabs.showjava.data - -import android.os.Parcel -import android.os.Parcelable -import com.njlabs.showjava.utils.ktx.getDate -import com.njlabs.showjava.utils.ktx.sourceDir -import org.apache.commons.io.FileUtils -import org.json.JSONException -import org.json.JSONObject -import timber.log.Timber -import java.io.File -import java.io.IOException - -/** - * [SourceInfo] holds information about a specific decompiled source on the app storage. - * The source info is persisted to disk as a simple json file at the root of each package's - * decompiled source folder. - */ -class SourceInfo() : Parcelable { - - lateinit var packageLabel: String - lateinit var packageName: String - - var hasJavaSource: Boolean = false - var hasXmlSource: Boolean = false - - var createdAt: String = getDate() - var updatedAt: String = getDate() - - var sourceSize: Long = 0 - - lateinit var sourceDirectory: File - - constructor(parcel: Parcel) : this() { - packageLabel = parcel.readString()!! - packageName = parcel.readString()!! - hasJavaSource = parcel.readInt() == 1 - hasXmlSource = parcel.readInt() == 1 - createdAt = parcel.readString()!! - updatedAt = parcel.readString()!! - sourceSize = parcel.readLong() - sourceDirectory = sourceDir(packageName) - } - - constructor(packageLabel: String, packageName: String, hasJavaSource: Boolean, hasXmlSource:Boolean, createdAt: String, updatedAt: String, sourceSize: Long) : this() { - this.packageLabel = packageLabel - this.packageName = packageName - this.hasJavaSource = hasJavaSource - this.hasXmlSource = hasXmlSource - this.createdAt = createdAt - this.updatedAt = updatedAt - this.sourceSize = sourceSize - sourceDirectory = sourceDir(packageName) - } - - override fun writeToParcel(parcel: Parcel, flags: Int) { - parcel.writeString(packageLabel) - parcel.writeString(packageName) - parcel.writeInt(if (hasJavaSource) 1 else 0) - parcel.writeInt(if (hasXmlSource) 1 else 0) - parcel.writeString(createdAt) - parcel.writeString(updatedAt) - parcel.writeLong(sourceSize) - } - - override fun describeContents(): Int { - return 0 - } - - fun setPackageLabel(packageLabel: String): SourceInfo { - this.packageLabel = packageLabel - return this - } - - fun setPackageName(packageName: String): SourceInfo { - this.packageName = packageName - this.sourceDirectory = sourceDir(packageName) - return this - } - - fun setJavaSourcePresence(hasJavaSource: Boolean): SourceInfo { - this.hasJavaSource = hasJavaSource - return this - } - - fun setXmlSourcePresence(hasXmlSource: Boolean): SourceInfo { - this.hasXmlSource = hasXmlSource - return this - } - - fun setSourceSize(sourceSize: Long): SourceInfo { - this.sourceSize = sourceSize - return this - } - - fun persist(): SourceInfo { - synchronized(this) { - updatedAt = getDate() - try { - val infoFile = getInfoFile(sourceDirectory) - val json = JSONObject() - json.put("package_label", packageLabel) - json.put("package_name", packageName) - json.put("has_java_sources", hasJavaSource) - json.put("has_xml_sources", hasXmlSource) - json.put("created_at", createdAt) - json.put("updated_at", updatedAt) - json.put("source_size", sourceSize) - FileUtils.writeStringToFile( - infoFile, - json.toString(2), - "UTF-8" - ) - } catch (e: IOException) { - Timber.e(e) - } catch (e: JSONException) { - Timber.e(e) - } - return this - } - } - - fun exists(): Boolean { - return hasJavaSource || hasXmlSource - } - - companion object CREATOR : Parcelable.Creator { - private fun getInfoFile(source: File): File { - if (!source.exists() || source.isFile) { - return source - } - return source.resolve("info.json") - } - - fun exists(sourceDir: File): Boolean { - if (sourceDir.exists() && sourceDir.isDirectory) { - val infoFile = sourceDir.resolve("info.json") - if (infoFile.exists() && infoFile.isFile) { - val sourceInfo = from(sourceDir) - if (sourceInfo.hasJavaSource || sourceInfo.hasXmlSource) { - return true - } - } - } - return false - } - - fun from(source: File): SourceInfo { - return try { - val infoFile = getInfoFile(source) - if (!infoFile.exists()) { - return SourceInfo() - } - val json = JSONObject(FileUtils.readFileToString(infoFile, "UTF-8")) - if (json.getBoolean("has_java_sources") || json.getBoolean("has_xml_sources")) { - SourceInfo( - json.getString("package_label"), - json.getString("package_name"), - json.getBoolean("has_java_sources"), - json.getBoolean("has_xml_sources"), - json.getString("created_at"), - json.getString("updated_at"), - json.getLong("source_size") - ) - } else { - SourceInfo() - } - } catch (e: IOException) { - SourceInfo() - } catch (e: JSONException) { - SourceInfo() - } - } - - override fun createFromParcel(parcel: Parcel): SourceInfo { - return SourceInfo(parcel) - } - override fun newArray(size: Int): Array { - return arrayOfNulls(size) - } - } -} diff --git a/app/src/main/kotlin/com/njlabs/showjava/decompilers/BaseDecompiler.kt b/app/src/main/kotlin/com/njlabs/showjava/decompilers/BaseDecompiler.kt deleted file mode 100644 index e292ebe1..00000000 --- a/app/src/main/kotlin/com/njlabs/showjava/decompilers/BaseDecompiler.kt +++ /dev/null @@ -1,302 +0,0 @@ -/* - * Show Java - A java/apk decompiler for android - * Copyright (c) 2018 Niranjan Rajendran - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.njlabs.showjava.decompilers - -import android.content.Context -import android.content.Intent -import android.os.Build -import androidx.work.* -import com.njlabs.showjava.BuildConfig -import com.njlabs.showjava.Constants -import com.njlabs.showjava.R -import com.njlabs.showjava.data.PackageInfo -import com.njlabs.showjava.utils.ProcessNotifier -import com.njlabs.showjava.utils.UserPreferences -import com.njlabs.showjava.utils.ktx.appStorage -import com.njlabs.showjava.utils.ktx.cleanMemory -import com.njlabs.showjava.utils.streams.ProgressStream -import com.njlabs.showjava.workers.DecompilerWorker -import io.reactivex.Observable -import io.reactivex.disposables.CompositeDisposable -import io.reactivex.schedulers.Schedulers -import org.apache.commons.io.FileUtils -import timber.log.Timber -import java.io.File -import java.io.PrintStream -import java.util.concurrent.TimeUnit - -/** - * The base decompiler. This reads the input [Data] into easy to use properties of the class. - * All other components of the decompiler will extend this one. - */ -abstract class BaseDecompiler(val context: Context, val data: Data) { - var printStream: PrintStream? = null - - private var id = data.getString("id") - private var processNotifier: ProcessNotifier? = null - private var runAttemptCount: Int = 0 - protected var outOfMemory = false - - protected val decompiler = data.getString("decompiler") - protected val type = PackageInfo.Type.values()[data.getInt("type", 0)] - private val maxAttempts = data.getInt("maxAttempts", UserPreferences.DEFAULTS.MAX_ATTEMPTS) - private val memoryThreshold = data.getInt("memoryThreshold", 80) - - protected val packageName = data.getString("name").toString() - protected val packageLabel = data.getString("label").toString() - - protected val keepIntermediateFiles = data.getBoolean("keepIntermediateFiles", UserPreferences.DEFAULTS.KEEP_INTERMEDIATE_FILES) - - protected val workingDirectory: File = appStorage.resolve("sources/$packageName/") - protected val cacheDirectory: File = appStorage.resolve("sources/.cache/") - - protected val inputPackageFile: File = File(data.getString("inputPackageFile")) - - protected val outputDexFiles: File = workingDirectory.resolve("dex-files") - protected val outputJarFiles: File = workingDirectory.resolve("jar-files") - protected val outputSrcDirectory: File = workingDirectory.resolve("src") - protected val outputJavaSrcDirectory: File = outputSrcDirectory.resolve("java") - - private val disposables = CompositeDisposable() - private var onLowMemory: ((Boolean) -> Unit)? = null - private var memoryThresholdCrossCount = 0 - protected open val maxMemoryAdjustmentFactor = 1.25 - - init { - @Suppress("LeakingThis") - printStream = PrintStream(ProgressStream(this)) - System.setErr(printStream) - System.setOut(printStream) - } - - /** - * Prepare the required directories. - * All child classes must call this method on override. - */ - open fun doWork(): ListenableWorker.Result { - cleanMemory() - monitorMemory() - outputJavaSrcDirectory.mkdirs() - - if (BuildConfig.DEBUG && Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { - data.keyValueMap.forEach { t, u -> - Timber.d("[WORKER] [INPUT] $t: $u") - } - } - - return ListenableWorker.Result.success() - } - - fun withAttempt(attempt: Int = 0): ListenableWorker.Result { - this.runAttemptCount = attempt - return this.doWork() - } - - fun withNotifier(notifier: ProcessNotifier): BaseDecompiler { - this.processNotifier = notifier - return this - } - - fun withLowMemoryCallback(onLowMemory: ((Boolean) -> Unit)): BaseDecompiler { - this.onLowMemory = onLowMemory - return this - } - - private fun monitorMemory() { - disposables.add( - Observable.interval(1000, TimeUnit.MILLISECONDS) - .subscribeOn(Schedulers.io()) - .observeOn(Schedulers.io()) - .subscribe { - val maxAdjusted = Runtime.getRuntime().maxMemory() / maxMemoryAdjustmentFactor - val used = (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()).toDouble().let { m -> - if (m > maxAdjusted) maxAdjusted else m - } - val usedPercentage = (used / maxAdjusted) * 100 - - Timber.d("[mem] ----") - Timber.d("[mem] Used: ${FileUtils.byteCountToDisplaySize(used.toLong())}") - Timber.d("[mem] Max: ${FileUtils.byteCountToDisplaySize(maxAdjusted.toLong())} at factor $maxMemoryAdjustmentFactor") - Timber.d("[mem] Used %: $usedPercentage") - - broadcastStatus("memory", "%.2f".format(usedPercentage), "memory") - - if (usedPercentage > memoryThreshold) { - if (memoryThresholdCrossCount > 2) { - onLowMemory?.invoke(true) - } else { - memoryThresholdCrossCount++ - } - } else { - memoryThresholdCrossCount = 0 - } - } - ) - } - - /** - * Update the notification and broadcast status - */ - protected fun sendStatus(title: String, message: String, forceSet: Boolean = false) { - processNotifier?.updateTitleText(title, message, forceSet) - this.broadcastStatus(title, message) - } - - fun sendStatus(message: String, forceSet: Boolean = false) { - processNotifier?.updateText(message, forceSet) - this.broadcastStatus(null, message) - } - - /** - * Set the current decompilation step - */ - fun setStep(title: String) { - sendStatus(title, context.getString(R.string.initializing), true) - } - - /** - * Clear the notification and exit marking the work job as failed - */ - protected fun exit(exception: Exception?): ListenableWorker.Result { - Timber.e(exception) - onStopped() - disposables.clear() - return if (runAttemptCount >= (maxAttempts - 1)) - ListenableWorker.Result.failure() - else - ListenableWorker.Result.retry() - } - - /** - * Return a success only if the conditions is true. Else exit with an exception. - */ - protected fun successIf(condition: Boolean): ListenableWorker.Result { - disposables.clear() - return if (condition) - ListenableWorker.Result.success() - else - exit(Exception("Success condition failed")) - } - - /** - * Broadcast the status to the receiver - */ - private fun broadcastStatus(title: String?, message: String, type: String = "progress") { - context.sendBroadcast( - Intent(Constants.WORKER.ACTION.BROADCAST + packageName) - .putExtra(Constants.WORKER.STATUS_TITLE, title) - .putExtra(Constants.WORKER.STATUS_MESSAGE, message) - .putExtra(Constants.WORKER.STATUS_TYPE, type) - ) - } - - /** - * Build a persistent notification - */ - protected fun buildNotification(title: String) { - if (processNotifier == null) { - processNotifier = ProcessNotifier(context, id) - } - processNotifier!!.buildFor( - title, - packageName, - packageLabel, - inputPackageFile, - context.resources.getStringArray(R.array.decompilersValues).indexOf(decompiler) - ) - } - - /** - * Clear notifications and show a success notification. - */ - fun onCompleted() { - processNotifier?.success() - broadcastStatus( - context.getString(R.string.appHasBeenDecompiled, packageLabel), - "" - ) - } - - /** - * Cancel notification on worker stop - */ - open fun onStopped() { - Timber.d("[cancel-request] cancelled") - disposables.clear() - processNotifier?.cancel() - } - - companion object { - - /** - * Check if the specified decompiler is available on the device based on the android version - */ - fun isAvailable(decompiler: String): Boolean { - return when (decompiler) { - "cfr" -> true - "jadx" -> Build.VERSION.SDK_INT >= Build.VERSION_CODES.N - "fernflower" -> Build.VERSION.SDK_INT >= Build.VERSION_CODES.N - else -> false - } - } - - /** - * For the WorkManager compatible Data object from the given map - */ - fun formData(dataMap: Map): Data { - val id = dataMap["name"] as String - return Data.Builder() - .putAll(dataMap) - .putString("id", id) - .build() - } - - /** - * Start the jobs using the given map - */ - fun start(dataMap: Map): String { - - val data = formData(dataMap) - val id = data.getString("id")!! - - fun buildWorkRequest(type: String): OneTimeWorkRequest { - return OneTimeWorkRequestBuilder() - .addTag("decompile") - .addTag(type) - .addTag(id) - .setBackoffCriteria(BackoffPolicy.LINEAR, 0, TimeUnit.SECONDS) - .setInputData(data) - .build() - } - - WorkManager.getInstance() - .beginUniqueWork( - id, - ExistingWorkPolicy.REPLACE, - buildWorkRequest("jar-extraction") - ) - .then(buildWorkRequest("java-extraction")) - .then(buildWorkRequest("resources-extraction")) - .enqueue() - return id - } - } - - class OutOfMemoryError: Exception() -} \ No newline at end of file diff --git a/app/src/main/kotlin/com/njlabs/showjava/decompilers/JarExtractionWorker.kt b/app/src/main/kotlin/com/njlabs/showjava/decompilers/JarExtractionWorker.kt deleted file mode 100644 index bce6a171..00000000 --- a/app/src/main/kotlin/com/njlabs/showjava/decompilers/JarExtractionWorker.kt +++ /dev/null @@ -1,295 +0,0 @@ -/* - * Show Java - A java/apk decompiler for android - * Copyright (c) 2018 Niranjan Rajendran - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.njlabs.showjava.decompilers - -import android.content.Context -import androidx.work.Data -import androidx.work.ListenableWorker -import com.googlecode.dex2jar.Method -import com.googlecode.dex2jar.ir.IrMethod -import com.googlecode.dex2jar.reader.DexFileReader -import com.googlecode.dex2jar.v3.Dex2jar -import com.googlecode.dex2jar.v3.DexExceptionHandler -import com.njlabs.showjava.R -import com.njlabs.showjava.data.PackageInfo -import com.njlabs.showjava.utils.UserPreferences -import com.njlabs.showjava.utils.ktx.cleanMemory -import com.njlabs.showjava.utils.ktx.toClassName -import org.apache.commons.io.FilenameUtils -import org.jf.dexlib2.DexFileFactory -import org.jf.dexlib2.Opcodes -import org.jf.dexlib2.dexbacked.DexBackedDexFile -import org.jf.dexlib2.dexbacked.DexBackedOdexFile -import org.jf.dexlib2.iface.ClassDef -import org.jf.dexlib2.immutable.ImmutableDexFile -import org.objectweb.asm.tree.MethodNode -import timber.log.Timber -import java.io.BufferedInputStream -import java.io.InputStream -import java.util.zip.ZipFile - -/** - * The [JarExtractionWorker] worker handles optimization and extraction of the jar/dex file from the source - * - * a. For APKs & Dex files: - * 1. All the classes within the input are read - * 2. Classes are checked against the ignore list. - * 3. Multiple dex files are created with the classes that are not ignored. - * 4. For inputs with a large number of classes, creating a single dex file causes devices to - * run out of memory. So, we chunk them to smaller dex files containing lesser number - * of classes. - * 5. The dex files are then converted to jar. (With the exception of JaDX which prefers dex files) - * - * b. For Jar files: - * 1. They are directly passed to the next step. (With the exception of JaDX where the jar is - * read and converted into dex chunks and then passed on to JaDX) - */ -class JarExtractionWorker(context: Context, data: Data) : BaseDecompiler(context, data) { - - private var ignoredLibs: ArrayList = ArrayList() - - // Set a lower max memory than available. - // Creating a dex file can easily use up memory before we get a chance to exit gracefully - override val maxMemoryAdjustmentFactor = 1.5 - - /** - * Load a list of library classes that are to be ignored from the assets - */ - private fun loadIgnoredLibs() { - context.assets.open("ignored.basic.list").bufferedReader().useLines { - it.forEach { line -> ignoredLibs.add(toClassName(line)) } - } - if (data.getBoolean("shouldIgnoreLibs", true)) { - context.assets.open("ignored.list").bufferedReader().useLines { - it.forEach { line -> ignoredLibs.add(toClassName(line)) } - } - if (!packageName.contains("facebook", true)) { - ignoredLibs.add(toClassName("com.facebook")) - } - } - Timber.d("Total libs to ignore: ${ignoredLibs.size}") - } - - /** - * Check if the given class name is in the ignore-list - */ - private fun isIgnored(className: String): Boolean { - return ignoredLibs.any { className.startsWith(it) } - } - - /** - * Convert the apk to a dex file. - * During the generation of the dex-file, any ignored classes will be stripped. - */ - @Throws(Exception::class) - private fun convertApkToDex() { - cleanMemory() - - Timber.i("Starting APK to DEX Conversion") - sendStatus(context.getString(R.string.optimizing)) - - val classes = ArrayList() - - fun addClassesFromDex(inputStream: InputStream, type: String = "dex") { - val dexFile = - if (type == "dex") - DexBackedDexFile.fromInputStream( - Opcodes.getDefault(), - BufferedInputStream(inputStream) - ) - else - DexBackedOdexFile.fromInputStream( - Opcodes.getDefault(), - BufferedInputStream(inputStream) - ) - for (classDef in dexFile.classes) { - if (!isIgnored(classDef.type)) { - val currentClass = classDef.type - sendStatus( - context.getString(R.string.optimizingClasses), - currentClass.replace("Processing ", "") - ) - classes.add(classDef) - } - } - } - - if (type == PackageInfo.Type.APK) { - val zipFile = ZipFile(inputPackageFile) - val entries = zipFile.entries() - - // In the case of APKs with multiple dex files, ensure all dex files are loaded - while (entries.hasMoreElements()) { - val zipEntry = entries.nextElement() - if (!zipEntry.isDirectory) { - val extension = FilenameUtils.getExtension(zipEntry.name).toLowerCase() - if (arrayOf("dex", "odex").contains(extension)) { - addClassesFromDex(zipFile.getInputStream(zipEntry), extension) - } - } - } - zipFile.close() - } - - if (type == PackageInfo.Type.DEX) { - addClassesFromDex(inputPackageFile.inputStream(), inputPackageFile.extension) - } - - Timber.d("Output directory: $workingDirectory") - setStep(context.getString(R.string.mergingClasses)) - Timber.d("Total class to write ${classes.size}") - setStep(context.getString(R.string.writingDexFile)) - - val chunkedClasses = classes.chunked( - data.getInt("chunkSize", UserPreferences.DEFAULTS.CHUNK_SIZE) - ) - - chunkedClasses.forEachIndexed { index, list -> - Timber.d("Chunk $index with classes: ${list.size}") - sendStatus(context.getString(R.string.chunk, index + 1, chunkedClasses.size), true) - val dexFile = ImmutableDexFile(Opcodes.getDefault(), list) - DexFileFactory.writeDexFile( - outputDexFiles.resolve("$index.dex").canonicalPath, - dexFile - ) - Timber.d("DEX file location: ${this.outputDexFiles}") - } - } - - @Throws(Exception::class) - private fun convertJarToDex() { - cleanMemory() - - xyz.codezero.android.dx.command.dexer.Main.main( - arrayOf( - "--output", - outputDexFiles.resolve("0.dex").canonicalPath, - inputPackageFile.canonicalPath - ) - ) - } - - /** - * Convert the dex file to jar for CFR or Fernflower to use. - * JaDX can directly make use of the dex file. - */ - @Throws(Exception::class) - private fun convertDexToJar() { - cleanMemory() - - setStep(context.getString(R.string.startingDexToJar)) - - val reuseReg = false // reuse register while generate java .class file - val topologicalSort1 = false // same with --topological-sort/-ts - val topologicalSort = false // sort block by topological, results in more readable code - val verbose = true // show progress - val debugInfo = false // translate debug info - val printIR = false // print ir to System.out - val optimizeSynchronized = true // Optimise-synchronised - - if (outputDexFiles.exists() && outputDexFiles.isDirectory) { - - setStep(context.getString(R.string.writingJarFile)) - - outputDexFiles.listFiles().forEachIndexed { index, outputDexFile -> - if (outputDexFile.exists() && outputDexFile.isFile) { - val dexExceptionHandlerMod = DexExceptionHandlerMod() - val reader = DexFileReader(outputDexFile) - val dex2jar = Dex2jar.from(reader) - .reUseReg(reuseReg) - .topoLogicalSort(topologicalSort || topologicalSort1) - .skipDebug(!debugInfo) - .optimizeSynchronized(optimizeSynchronized) - .printIR(printIR) - .verbose(verbose) - dex2jar.exceptionHandler = dexExceptionHandlerMod - dex2jar.to(outputJarFiles.resolve("$index.jar")) - - if (!keepIntermediateFiles) { - outputDexFile.delete() - } - } - } - } - - } - - /** - * Handle dex2jar exception gracefully without causing a full crash - */ - private inner class DexExceptionHandlerMod : DexExceptionHandler { - override fun handleFileException(e: Exception) { - Timber.d("Dex2Jar Exception $e") - } - - override fun handleMethodTranslateException( - method: Method, - irMethod: IrMethod, - methodNode: MethodNode, - e: Exception - ) { - Timber.d("Dex2Jar Exception $e") - } - } - - override fun doWork(): ListenableWorker.Result { - Timber.tag("JarExtraction") - context.getString(R.string.extractingJar).let { - buildNotification(it) - setStep(it) - } - - super.doWork() - - outputDexFiles.mkdirs() - outputJarFiles.mkdirs() - - try { - when (type) { - PackageInfo.Type.APK, PackageInfo.Type.DEX -> { - loadIgnoredLibs() - convertApkToDex() - if (decompiler != "jadx") { - convertDexToJar() - } - } - PackageInfo.Type.JAR -> { - if (decompiler == "jadx") { - convertJarToDex() - } else { - inputPackageFile.copyTo( - outputJarFiles.resolve("0.jar"), - true - ) - } - } - } - } catch (e: Exception) { - return exit(e) - } - - return successIf( - try { - outputJarFiles.listFiles().isNotEmpty() || outputDexFiles.listFiles().isNotEmpty() - } catch (e: IllegalStateException) { - false - } - ) - } -} diff --git a/app/src/main/kotlin/com/njlabs/showjava/decompilers/JavaExtractionWorker.kt b/app/src/main/kotlin/com/njlabs/showjava/decompilers/JavaExtractionWorker.kt deleted file mode 100644 index d48501b7..00000000 --- a/app/src/main/kotlin/com/njlabs/showjava/decompilers/JavaExtractionWorker.kt +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Show Java - A java/apk decompiler for android - * Copyright (c) 2018 Niranjan Rajendran - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.njlabs.showjava.decompilers - -import android.content.Context -import androidx.work.Data -import androidx.work.ListenableWorker -import com.njlabs.showjava.R -import com.njlabs.showjava.data.SourceInfo -import com.njlabs.showjava.utils.ZipUtils -import com.njlabs.showjava.utils.ktx.cleanMemory -import jadx.api.JadxArgs -import jadx.api.JadxDecompiler -import org.apache.commons.io.FileUtils -import org.benf.cfr.reader.api.CfrDriver -import org.jetbrains.java.decompiler.main.decompiler.ConsoleDecompiler -import timber.log.Timber -import java.io.File -import java.io.FileNotFoundException - -/** - * The [JavaExtractionWorker] does the actual decompilation of extracting the `java` source from - * the inputs. All of the three decompiler that we support, allow passing in multiple input files. - * So, we pass in all of the chunks of either dex (in case of JaDX) or jar files (in case of CFR & - * fernflower) as the input. - */ -class JavaExtractionWorker(context: Context, data: Data) : BaseDecompiler(context, data) { - - /** - * Do the decompilation using the CFR decompiler. - * - * We set the `lowmem` flag as true to let CFR know that it has to be more aggressive in terms - * of garbage collection and less-aggressive caching. This results in reduced performance. But - * increase success rates for large inputs. Which is a good trade-off. - */ - @Throws(Exception::class) - private fun decompileWithCFR(jarInputFiles: File, javaOutputDir: File) { - cleanMemory() - val jarFiles = jarInputFiles.listFiles() - val options = mapOf( - "outputdir" to javaOutputDir.canonicalPath, - "lomem" to "true" - ) - val cfrDriver = CfrDriver.Builder().withOptions(options).build() - cfrDriver.analyse(jarFiles.map { it.canonicalPath }) - } - - /** - * Do the decompilation using the JaDX decompiler. - * - * We set `threadsCount` as 1. This instructs JaDX to not spawn additional threads to prevent - * issues on some devices. - */ - @Throws(Exception::class) - private fun decompileWithJaDX(dexInputFiles: File, javaOutputDir: File) { - cleanMemory() - - val args = JadxArgs() - args.outDirSrc = javaOutputDir - args.inputFiles = dexInputFiles.listFiles().toMutableList() - args.threadsCount = 1 - - val jadx = JadxDecompiler(args) - jadx.load() - jadx.saveSources() - if (dexInputFiles.exists() && dexInputFiles.isDirectory && !keepIntermediateFiles) { - dexInputFiles.deleteRecursively() - } - } - - /** - * Do the decompilation using FernFlower decompiler. - * - * The out of the decompiler is a jar archive containing the decompiled java files. So, we look - * for and extract the archive after the decompilation. - */ - @Throws(Exception::class) - private fun decompileWithFernFlower(jarInputFiles: File, javaOutputDir: File) { - cleanMemory() - - ConsoleDecompiler.main( - arrayOf( - jarInputFiles.canonicalPath, javaOutputDir.canonicalPath - ) - ) - - javaOutputDir.listFiles().forEach { decompiledJarFile -> - if (decompiledJarFile.exists() && decompiledJarFile.isFile && decompiledJarFile.extension == "jar") { - ZipUtils.unzip(decompiledJarFile, javaOutputDir, printStream!!) - decompiledJarFile.delete() - } else { - throw FileNotFoundException("Decompiled jar does not exist") - } - } - } - - override fun doWork(): ListenableWorker.Result { - Timber.tag("JavaExtraction") - context.getString(R.string.decompilingToJava).let { - buildNotification(it) - setStep(it) - } - - super.doWork() - - val sourceInfo = SourceInfo.from(workingDirectory) - .setPackageLabel(packageLabel) - .setPackageName(packageName) - .persist() - - try { - when (decompiler) { - "jadx" -> decompileWithJaDX(outputDexFiles, outputJavaSrcDirectory) - "cfr" -> decompileWithCFR(outputJarFiles, outputJavaSrcDirectory) - "fernflower" -> decompileWithFernFlower(outputJarFiles, outputJavaSrcDirectory) - } - } catch (e: Exception) { - return exit(e) - } - - if (outputDexFiles.exists() && outputDexFiles.isDirectory && !keepIntermediateFiles) { - outputDexFiles.deleteRecursively() - } - - if (outputJarFiles.exists() && outputJarFiles.isDirectory && !keepIntermediateFiles) { - outputJarFiles.deleteRecursively() - } - - sourceInfo - .setJavaSourcePresence(true) - .setSourceSize(FileUtils.sizeOfDirectory(workingDirectory)) - .persist() - - return successIf(!outputJavaSrcDirectory.list().isNullOrEmpty()) - } -} diff --git a/app/src/main/kotlin/com/njlabs/showjava/decompilers/ResourcesExtractionWorker.kt b/app/src/main/kotlin/com/njlabs/showjava/decompilers/ResourcesExtractionWorker.kt deleted file mode 100644 index 875f400b..00000000 --- a/app/src/main/kotlin/com/njlabs/showjava/decompilers/ResourcesExtractionWorker.kt +++ /dev/null @@ -1,262 +0,0 @@ -/* - * Show Java - A java/apk decompiler for android - * Copyright (c) 2018 Niranjan Rajendran - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.njlabs.showjava.decompilers - -import android.content.Context -import android.graphics.Bitmap -import android.graphics.Canvas -import android.graphics.drawable.Drawable -import android.os.Build -import androidx.annotation.RequiresApi -import androidx.work.Data -import androidx.work.ListenableWorker -import com.njlabs.showjava.R -import com.njlabs.showjava.data.PackageInfo -import com.njlabs.showjava.data.SourceInfo -import com.njlabs.showjava.utils.ktx.cleanMemory -import com.njlabs.showjava.utils.ktx.toFile -import jadx.api.JadxArgs -import jadx.api.JadxDecompiler -import net.dongliu.apk.parser.AbstractApkFile -import net.dongliu.apk.parser.ApkFile -import net.dongliu.apk.parser.exception.ParserException -import net.dongliu.apk.parser.struct.resource.ResourcePackage -import net.dongliu.apk.parser.struct.resource.ResourceTable -import org.apache.commons.io.FileUtils -import org.apache.commons.io.FilenameUtils -import timber.log.Timber -import java.io.File -import java.io.FileOutputStream -import java.io.InputStream -import java.nio.charset.Charset -import java.util.zip.ZipFile - - -class ResourcesExtractionWorker(context: Context, data: Data) : BaseDecompiler(context, data) { - - private lateinit var parsedInputApkFile: ApkFile - private val images = listOf("jpg", "png", "gif", "jpeg", "webp", "tiff", "bmp") - - /** - * Extract xml & image resources using JaDX. JaDX has a better resources decompiler compared - * to others. But sadly, JaDX also uses javax.imageio classes that are not available in android - * at present. So, we don't use it. - * - * TODO Figure out how to use it only for XML though. - * - * @experimental - */ - @Throws(Exception::class) - private fun extractResourcesWithJadx() { - cleanMemory() - val resDir = outputSrcDirectory - val args = JadxArgs() - args.outDirRes = resDir - args.inputFiles = mutableListOf(inputPackageFile) - val jadx = JadxDecompiler(args) - jadx.load() - jadx.saveResources() - } - - /** - * Read the APK as zip, and extract XML resources using the apk-parser and image/other resources - * by just extracting it from the zip. - */ - @Throws(Exception::class) - private fun extractResourcesWithParser() { - cleanMemory() - writeManifest() - val zipFile = ZipFile(inputPackageFile) - val entries = zipFile.entries() - while (entries.hasMoreElements()) { - val zipEntry = entries.nextElement() - - try { - if (!zipEntry.isDirectory && zipEntry.name != "AndroidManifest.xml") { - sendStatus(zipEntry.name) - if (FilenameUtils.isExtension(zipEntry.name, "xml") && !zipEntry.name.startsWith("assets")) { - writeXML(zipEntry.name) - } else if (FilenameUtils.isExtension(zipEntry.name, images) || zipEntry.name.startsWith("assets")) { - writeFile(zipFile.getInputStream(zipEntry), zipEntry.name) - } - } - } catch (e: java.lang.Exception) { - sendStatus("Skipped ${zipEntry.name}") - } - } - zipFile.close() - } - - /** - * Currently the extracted XML resources, refer to the resource used within them via their - * numeric ID. This is an experiment to parse the resource table in the APK and get the human - * readable names from the numeric ID. - * - * @experimental - */ - @Suppress("UNCHECKED_CAST") - @RequiresApi(Build.VERSION_CODES.N) - @Throws(Exception::class) - private fun loadResourcesTable() { - cleanMemory() - val resourceTableField = AbstractApkFile::class.java.getDeclaredField("resourceTable") - resourceTableField.isAccessible = true - val resourceTable = resourceTableField.get(parsedInputApkFile) as ResourceTable - val packageMapField = resourceTable.javaClass.getDeclaredField("packageMap") - packageMapField.isAccessible = true - val packageMap = packageMapField.get(resourceTable) as Map - packageMap.forEach { _, u -> - Timber.d("[res] ID: ${u.id} Name: ${u.name}") - u.typesMap.forEach { _, iu -> - iu.forEach { - Timber.d("[res] Inner ID: ${it.id} Inner Name: ${it.name}") - } - } - } - } - - /** - * Write a file at the appropriate output path within the source directory - */ - @Throws(Exception::class) - private fun writeFile(fileStream: InputStream, path: String) { - val fileFolderPath = - outputSrcDirectory.canonicalPath + "/" + path.replace( - FilenameUtils.getName( - path - ), "" - ) - val fileFolder = File(fileFolderPath) - if (!fileFolder.exists() || !fileFolder.isDirectory) { - fileFolder.mkdirs() - } - fileStream.toFile(File(fileFolderPath, FilenameUtils.getName(path))) - } - - /** - * Read and decompile an XML resource from the APK and write it to the source directory. - */ - @Throws(ParserException::class) - private fun writeXML(path: String) { - val xml = parsedInputApkFile.transBinaryXml(path) - val fileFolderPath = - outputSrcDirectory.canonicalPath + "/" + path.replace( - FilenameUtils.getName( - path - ), "" - ) - val fileFolder = File(fileFolderPath) - if (!fileFolder.exists() || !fileFolder.isDirectory) { - fileFolder.mkdirs() - } - FileUtils.writeStringToFile( - File(fileFolderPath + FilenameUtils.getName(path)), - xml, - Charset.defaultCharset() - ) - } - - /** - * Write the AndroidManifest file to the source directory - */ - @Throws(Exception::class) - private fun writeManifest() { - val manifestXml = parsedInputApkFile.manifestXml - FileUtils.writeStringToFile( - workingDirectory.resolve("AndroidManifest.xml"), - manifestXml, - Charset.defaultCharset() - ) - } - - /** - * Get bitmap from drawable. This is used to read the app icon and save to the source directory. - */ - // Borrowed from from https://stackoverflow.com/a/52453231/1562480 - private fun getBitmapFromDrawable(drawable: Drawable): Bitmap { - val bmp = Bitmap.createBitmap( - drawable.intrinsicWidth, - drawable.intrinsicHeight, - Bitmap.Config.ARGB_8888 - ) - val canvas = Canvas(bmp) - drawable.setBounds(0, 0, canvas.width, canvas.height) - drawable.draw(canvas) - return bmp - } - - /** - * Save the app icon to the source directory - */ - @Throws(Exception::class) - private fun saveIcon() { - val packageInfo = context.packageManager.getPackageArchiveInfo(inputPackageFile.canonicalPath, 0) - val bitmap = getBitmapFromDrawable(packageInfo.applicationInfo.loadIcon(context.packageManager)) - val iconOutput = FileOutputStream(workingDirectory.resolve("icon.png")) - bitmap.compress(Bitmap.CompressFormat.PNG, 100, iconOutput) - iconOutput.close() - } - - override fun doWork(): ListenableWorker.Result { - Timber.tag("ResourcesExtraction") - - if (type == PackageInfo.Type.APK) { - context.getString(R.string.extractingResources).let { - buildNotification(it) - setStep(it) - } - } - - super.doWork() - - /* when (decompiler) { - "jadx" -> extractResourcesWithJadx() - else -> extractResourcesWithParser() - } */ - - // Not using JaDX for resource extraction. - // Due to its dependency on the javax.imageio.ImageIO class which is unavailable on android - - val sourceInfo = SourceInfo.from(workingDirectory) - .setPackageLabel(packageLabel) - .setPackageName(packageName) - - if (type == PackageInfo.Type.APK) { - parsedInputApkFile = ApkFile(inputPackageFile) - try { - extractResourcesWithParser() - saveIcon() - } catch (e: Exception) { - return exit(e) - } - - sourceInfo - .setXmlSourcePresence(true) - .persist() - } - - sourceInfo - .setSourceSize(FileUtils.sizeOfDirectory(workingDirectory)) - .persist() - - onCompleted() - - return ListenableWorker.Result.success() - } -} diff --git a/app/src/main/kotlin/com/njlabs/showjava/receivers/DecompilerActionReceiver.kt b/app/src/main/kotlin/com/njlabs/showjava/receivers/DecompilerActionReceiver.kt deleted file mode 100644 index 8bd67321..00000000 --- a/app/src/main/kotlin/com/njlabs/showjava/receivers/DecompilerActionReceiver.kt +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Show Java - A java/apk decompiler for android - * Copyright (c) 2018 Niranjan Rajendran - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.njlabs.showjava.receivers - -import android.content.BroadcastReceiver -import android.content.Context -import android.content.Intent -import com.njlabs.showjava.Constants -import com.njlabs.showjava.workers.DecompilerWorker -import timber.log.Timber - -/** - * [DecompilerActionReceiver] is used to receive the cancel request from the notification action, - * and cancel the decompilation process. - */ -class DecompilerActionReceiver : BroadcastReceiver() { - - override fun onReceive(context: Context?, intent: Intent?) { - when (intent?.action) { - Constants.WORKER.ACTION.STOP -> { - val id = intent.getStringExtra("id") - Timber.d("[cancel-request] ID: $id") - context?.let { - DecompilerWorker.cancel(it, id) - } - } - else -> { - Timber.i("Received an unknown action.") - } - } - } - -} \ No newline at end of file diff --git a/app/src/main/kotlin/com/njlabs/showjava/utils/Ads.kt b/app/src/main/kotlin/com/njlabs/showjava/utils/Ads.kt deleted file mode 100644 index 2c2dffa1..00000000 --- a/app/src/main/kotlin/com/njlabs/showjava/utils/Ads.kt +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Show Java - A java/apk decompiler for android - * Copyright (c) 2018 Niranjan Rajendran - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.njlabs.showjava.utils - -import android.annotation.SuppressLint -import android.app.Activity -import android.content.Context -import android.content.Intent -import android.content.SharedPreferences -import com.google.ads.consent.* -import com.google.android.gms.ads.MobileAds -import com.njlabs.showjava.R -import com.njlabs.showjava.activities.purchase.PurchaseActivity -import timber.log.Timber -import java.net.URL - -/** - * Initialize the ads library. Also, takes care of showing a consent screen for users within EU - * and persisting the consent. - */ -class Ads(val context: Context) { - private val consentInformation: ConsentInformation = ConsentInformation.getInstance(context) - private lateinit var consentForm: ConsentForm - - fun getPreferences(): SharedPreferences { - return context.getSharedPreferences(UserPreferences.NAME, Context.MODE_PRIVATE) - } - - @SuppressLint("ApplySharedPref") - fun init() { - MobileAds.initialize(context, context.getString(R.string.admobAppId)) - val publisherIds = arrayOf(context.getString(R.string.admobPublisherId)) - consentInformation.requestConsentInfoUpdate( - publisherIds, - object : ConsentInfoUpdateListener { - override fun onConsentInfoUpdated(consentStatus: ConsentStatus) { - getPreferences().edit() - .putInt("consentStatus", consentStatus.ordinal) - .commit() - } - override fun onFailedToUpdateConsentInfo(errorDescription: String) { - getPreferences().edit() - .putInt("consentStatus", ConsentStatus.UNKNOWN.ordinal) - .commit() - } - }) - } - - /** - * Load the consent screen and prepare to display. - */ - fun loadConsentScreen(): ConsentForm? { - consentForm = ConsentForm.Builder(context, URL(context.getString(R.string.privacyPolicyUrl))) - .withListener(object : ConsentFormListener() { - override fun onConsentFormLoaded() { - if (context is Activity && !context.isFinishing) { - consentForm.show() - } - } - - override fun onConsentFormOpened() { - Timber.d("[consent-screen] onConsentFormOpened") - } - - override fun onConsentFormClosed(consentStatus: ConsentStatus?, userPrefersAdFree: Boolean?) { - consentStatus?.let { - ConsentInformation.getInstance(context).consentStatus = it - getPreferences().edit().putInt("consentStatus", consentStatus.ordinal).apply() - } - if (userPrefersAdFree != null && userPrefersAdFree) { - context.startActivity(Intent(context, PurchaseActivity::class.java)) - } - } - - override fun onConsentFormError(errorDescription: String?) { - Timber.d("[consent-screen] onConsentFormError: $errorDescription") - } - }) - .withPersonalizedAdsOption() - .withNonPersonalizedAdsOption() - .withAdFreeOption() - .build() - consentForm.load() - return consentForm - } -} \ No newline at end of file diff --git a/app/src/main/kotlin/com/njlabs/showjava/utils/Identicon.kt b/app/src/main/kotlin/com/njlabs/showjava/utils/Identicon.kt deleted file mode 100644 index f3a06fa1..00000000 --- a/app/src/main/kotlin/com/njlabs/showjava/utils/Identicon.kt +++ /dev/null @@ -1,183 +0,0 @@ -package com.njlabs.showjava.utils - -import android.graphics.* -import androidx.annotation.Nullable -import com.njlabs.showjava.utils.ktx.getCircularBitmap -import java.security.MessageDigest -import kotlin.experimental.and - -/** - * Generate an Identicon [Bitmap] from the given seed [String] - * - * Borrowed from: https://gist.github.com/misakuo/6faa9a342cd63b43d8830b85fe4716cb (moxun - @misakuo) - */ -object Identicon { - - fun createFromObject(seed: Any): Bitmap { - return create(Integer.toHexString(seed.hashCode()), Options.DEFAULT) - } - - fun createFromObject(seed: Any, options: Options): Bitmap { - return create(Integer.toHexString(seed.hashCode()), options) - } - - @JvmOverloads - fun create(seed: String, config: Options = Options.DEFAULT): Bitmap { - return createBitmap(seed, config.rows, config.size, config.blankColor) - } - - private fun createBitmap(seed: String, rows: Int, size: Int, blankColor: Int): Bitmap { - var bmSize = size - if (bmSize % rows != 0) { - bmSize += (rows - bmSize % rows) - } - val bitmap = Bitmap.createBitmap(bmSize, bmSize, Bitmap.Config.RGB_565) - val block = bmSize / rows - val mapping = mapToBit(seed, rows) ?: return bitmap - val tintColor = getColor(seed) - val pixels = IntArray(block * block) - val blankPixels = IntArray(block * block) - - for (p in 0 until block * block) { - pixels[p] = tintColor - blankPixels[p] = blankColor - } - - for (i in 0 until rows) { - for (j in 0 until rows) { - if (mapping[i][j]) { - bitmap.setPixels(pixels, 0, block, j * block, i * block, block, block) - } else { - bitmap.setPixels(blankPixels, 0, block, j * block, i * block, block, block) - } - } - } - return bitmap.getCircularBitmap() - } - - fun mapToBit(seed: String, rows: Int): Array? { - checkRows(rows) - val mapping = Array(rows) { BooleanArray(rows) } - val bits = getHash(seed) ?: return null - val stride = getStride(rows) - var index = stride - for (i in 0 until rows) { - for (j in 0 until (rows + 1) / 2) { - val c = bits[index] - val b = c == '1' - mapping[i][j] = b - mapping[i][rows - j - 1] = b - index += stride - } - } - return mapping - } - - private fun checkRows(rows: Int) { - if (rows and 0x1 == 0) { - throw IllegalArgumentException("Argument 'rows' must be an odd number") - } else if (rows < 5 || rows > 11) { - throw IllegalArgumentException("Argument 'rows' must be between 5 and 11") - } - } - - @Nullable - private fun getHash(src: String): CharArray? { - val md5 = getBinMd5(src) - return md5?.toCharArray() - } - - private fun getBinMd5(src: String): String? { - val encryption = md5(src) ?: return null - val buffer = StringBuilder() - for (b in encryption) { - buffer.append(Integer.toBinaryString((b and 0xFF.toByte()) + 0x100).substring(1)) - } - return buffer.toString() - } - - private fun getStride(rows: Int): Int { - return 128 / (rows * ((rows + 1) / 2)) - } - - private fun md5(src: String): ByteArray? { - try { - val md5 = MessageDigest.getInstance("MD5") - md5.update(src.toByteArray(charset("UTF-8"))) - return md5.digest() - } catch (e: Exception) { - e.printStackTrace() - } - - return null - } - - private fun getHexMd5(src: String): String? { - val encryption = md5(src) ?: return null - val sb = StringBuilder() - for (i in encryption.indices) { - if (Integer.toHexString(0xFF and encryption[i].toInt()).length == 1) { - sb.append("0").append(Integer.toHexString(0xFF and encryption[i].toInt())) - } else { - sb.append(Integer.toHexString(0xFF and encryption[i].toInt())) - } - } - return sb.toString() - } - - private fun getColor(src: String): Int { - val md5 = getHexMd5(src) - if (md5 != null) { - val rgb = md5.substring(md5.length - 6, md5.length) - return Color.parseColor("#" + rgb.toUpperCase()) - } - - return Color.BLACK - } - - class Options private constructor( - internal var blankColor: Int, - internal var rows: Int, - internal var size: Int - ) { - - class Builder { - private var bColor = Color.LTGRAY - private var bRows = 5 - private var bSize = 100 - - fun setBlankColor(color: Int): Builder { - bColor = color - return this - } - - fun setRows(rows: Int): Builder { - checkRows(rows) - bRows = rows - return this - } - - fun setSize(size: Int): Builder { - bSize = size - return this - } - - fun create(): Options { - return Options(bColor, bRows, bSize) - } - - private fun checkRows(rows: Int) { - if (rows and 0x1 == 0) { - throw IllegalArgumentException("Argument 'rows' must be an odd number") - } else if (rows < 5 || rows > 11) { - throw IllegalArgumentException("Argument 'rows' must be between 5 and 11") - } - } - } - - companion object { - - val DEFAULT = Options(Color.LTGRAY, 5, 50) - } - } -} \ No newline at end of file diff --git a/app/src/main/kotlin/com/njlabs/showjava/utils/ProcessNotifier.kt b/app/src/main/kotlin/com/njlabs/showjava/utils/ProcessNotifier.kt deleted file mode 100644 index 0f502de2..00000000 --- a/app/src/main/kotlin/com/njlabs/showjava/utils/ProcessNotifier.kt +++ /dev/null @@ -1,240 +0,0 @@ -/* - * Show Java - A java/apk decompiler for android - * Copyright (c) 2018 Niranjan Rajendran - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.njlabs.showjava.utils - -import android.app.Notification -import android.app.NotificationChannel -import android.app.NotificationManager -import android.app.PendingIntent -import android.content.Context -import android.content.Intent -import android.graphics.BitmapFactory -import android.os.Build -import androidx.core.app.NotificationCompat -import com.njlabs.showjava.Constants -import com.njlabs.showjava.R -import com.njlabs.showjava.activities.decompiler.DecompilerActivity -import com.njlabs.showjava.activities.decompiler.DecompilerProcessActivity -import com.njlabs.showjava.activities.decompiler.LowMemoryActivity -import com.njlabs.showjava.activities.explorer.navigator.NavigatorActivity -import com.njlabs.showjava.data.PackageInfo -import com.njlabs.showjava.data.SourceInfo -import com.njlabs.showjava.receivers.DecompilerActionReceiver -import com.njlabs.showjava.utils.ktx.sourceDir -import java.io.File - - -/** - * Takes care of creating, updates progress notifications along with success and failure notifications - * for the decompiler process. - */ -class ProcessNotifier( - private val context: Context, - private val notificationTag: String?, - private val notificationId: Int = Constants.WORKER.PROGRESS_NOTIFICATION_ID -) { - private var time: Long = 0 - private var isCancelled: Boolean = false - - private var manager: NotificationManager = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager - - private lateinit var builder: NotificationCompat.Builder - private lateinit var notification: Notification - private lateinit var packageName: String - private lateinit var packageLabel: String - private lateinit var packageFile: File - - fun withPackageInfo(packageName: String, packageLabel: String, packageFile: File): ProcessNotifier { - this.packageName = packageName - this.packageFile = packageFile - this.packageLabel = packageLabel - return this - } - - fun buildFor(title: String, packageName: String, packageLabel: String, packageFile: File, decompilerIndex: Int): ProcessNotifier { - - this.packageName = packageName - this.packageFile = packageFile - this.packageLabel = packageLabel - - val stopIntent = Intent(context, DecompilerActionReceiver::class.java) - stopIntent.action = Constants.WORKER.ACTION.STOP - stopIntent.putExtra("id", packageName) - stopIntent.putExtra("packageFilePath", packageFile.canonicalFile) - stopIntent.putExtra("packageName", packageName) - val pendingIntentForStop = PendingIntent.getBroadcast(context, 0, stopIntent, PendingIntent.FLAG_UPDATE_CURRENT) - - val viewIntent = Intent(context, DecompilerProcessActivity::class.java) - viewIntent.putExtra("packageInfo", PackageInfo(packageLabel, packageName)) - viewIntent.putExtra("decompilerIndex", decompilerIndex) - - val manager: NotificationManager = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager - val pendingIntentForView = PendingIntent.getActivity( - context, - 0, - viewIntent, - PendingIntent.FLAG_UPDATE_CURRENT - ) - - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - val channel = NotificationChannel( - Constants.WORKER.PROGRESS_NOTIFICATION_CHANNEL, - "Decompiler notification", - NotificationManager.IMPORTANCE_LOW - ) - channel.setSound(null, null) - channel.enableVibration(false) - manager.createNotificationChannel(channel) - } - - val actionIcon = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) - R.drawable.ic_stop_black else R.drawable.ic_stat_stop - - builder = NotificationCompat.Builder(context, Constants.WORKER.PROGRESS_NOTIFICATION_CHANNEL) - .setDefaults(NotificationCompat.DEFAULT_ALL) - .setContentTitle(packageLabel) - .setContentText(title) - .setSmallIcon(R.drawable.ic_stat_code) - .setContentIntent(pendingIntentForView) - .setLargeIcon(BitmapFactory.decodeResource(context.resources, R.mipmap.ic_launcher)) - .addAction(actionIcon, "Stop decompiler", pendingIntentForStop) - .setOngoing(true) - .setSound(null) - .setAutoCancel(false) - .setPriority(NotificationCompat.PRIORITY_LOW) - - manager.notify( - notificationTag, - Constants.WORKER.PROGRESS_NOTIFICATION_ID, - silence(builder.build()) - ) - return this - } - - private fun silence(notification: Notification): Notification { - notification.sound = null - notification.vibrate = null - notification.defaults = notification.defaults and NotificationCompat.DEFAULT_SOUND.inv() - notification.defaults = notification.defaults and NotificationCompat.DEFAULT_VIBRATE.inv() - return notification - } - - fun updateTitle(title: String, forceSet: Boolean = false) { - val currentTime = System.currentTimeMillis() - if (!isCancelled && (currentTime - time >= 500 || forceSet) && ::builder.isInitialized) { - builder.setContentTitle(title) - manager.notify(notificationTag, notificationId, silence(builder.build())) - time = currentTime - } - } - - fun updateText(text: String, forceSet: Boolean = false) { - val currentTime = System.currentTimeMillis() - if (!isCancelled && (currentTime - time >= 500 || forceSet) && ::builder.isInitialized) { - builder.setContentText(text) - manager.notify(notificationTag, notificationId, silence(builder.build())) - time = currentTime - } - } - - fun updateTitleText(title: String, text: String, forceSet: Boolean = false) { - val currentTime = System.currentTimeMillis() - if (!isCancelled && (currentTime - time >= 500 || forceSet) && ::builder.isInitialized) { - builder.setContentTitle(title) - builder.setContentText(text) - manager.notify(notificationTag, notificationId, silence(builder.build())) - time = currentTime - } - } - - fun cancel() { - isCancelled = true - manager.cancel(notificationTag, notificationId) - } - - private fun complete(intent: Intent, title: String, text: String, icon: Int) { - val manager: NotificationManager = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager - val resultPendingIntent = PendingIntent.getActivity( - context, - 0, - intent, - PendingIntent.FLAG_UPDATE_CURRENT - ) - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - val channel = NotificationChannel( - Constants.WORKER.COMPLETION_NOTIFICATION_CHANNEL, - "Decompile complete notification", - NotificationManager.IMPORTANCE_HIGH - ) - manager.createNotificationChannel(channel) - } - val builder = NotificationCompat.Builder(context, Constants.WORKER.COMPLETION_NOTIFICATION_CHANNEL) - .setContentTitle(title) - .setContentText(text) - .setSmallIcon(icon) - .setContentIntent(resultPendingIntent) - .setLargeIcon(BitmapFactory.decodeResource(context.resources, R.mipmap.ic_launcher)) - .setAutoCancel(true) - manager.notify( - packageName, - Constants.WORKER.COMPLETED_NOTIFICATION_ID, - builder.build() - ) - - } - - fun error() { - val intent = Intent(context, DecompilerActivity::class.java) - intent.putExtra("packageInfo", PackageInfo.fromFile(context, packageFile)) - complete( - intent, - context.getString(R.string.errorDecompilingApp, packageLabel), - context.getString(R.string.tapToRetry), - R.drawable.ic_stat_error - ) - } - - fun lowMemory(decompiler: String) { - val intent = Intent(context, LowMemoryActivity::class.java) - val packageInfo = PackageInfo.fromFile(context, packageFile) - intent.putExtra("packageInfo", packageInfo) - intent.putExtra("decompiler", decompiler) - complete( - intent, - context.getString(R.string.errorDecompilingApp, packageLabel), - context.getString(R.string.lowMemoryStatusInfo), - R.drawable.ic_stat_error - ) - } - - fun success() { - val intent = Intent(context, NavigatorActivity::class.java) - intent.putExtra("selectedApp", SourceInfo.from( - sourceDir( - packageName - ) - )) - complete( - intent, - context.getString(R.string.appHasBeenDecompiled, packageLabel), - context.getString(R.string.tapToViewSource), - R.drawable.ic_stat_code - ) - } -} \ No newline at end of file diff --git a/app/src/main/kotlin/com/njlabs/showjava/utils/RequestQueue.kt b/app/src/main/kotlin/com/njlabs/showjava/utils/RequestQueue.kt deleted file mode 100644 index 5e56c782..00000000 --- a/app/src/main/kotlin/com/njlabs/showjava/utils/RequestQueue.kt +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Show Java - A java/apk decompiler for android - * Copyright (c) 2018 Niranjan Rajendran - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.njlabs.showjava.utils - -import android.content.Context -import com.android.volley.Request -import com.android.volley.RequestQueue as VolleyRequestQueue -import com.android.volley.toolbox.Volley - -/** - * A singleton request queue to use with Volley for all network requests. - */ -class RequestQueue constructor(context: Context) { - companion object { - @Volatile - private var INSTANCE: RequestQueue? = null - fun getInstance(context: Context) = - INSTANCE ?: synchronized(this) { - INSTANCE ?: RequestQueue(context).also { - INSTANCE = it - } - } - } - private val requestQueue: VolleyRequestQueue by lazy { - // applicationContext is key, it keeps you from leaking the - // Activity or BroadcastReceiver if someone passes one in. - Volley.newRequestQueue(context.applicationContext) - } - fun addToRequestQueue(req: Request) { - requestQueue.add(req) - } -} diff --git a/app/src/main/kotlin/com/njlabs/showjava/utils/SingletonHolder.kt b/app/src/main/kotlin/com/njlabs/showjava/utils/SingletonHolder.kt deleted file mode 100644 index b29ab4c6..00000000 --- a/app/src/main/kotlin/com/njlabs/showjava/utils/SingletonHolder.kt +++ /dev/null @@ -1,28 +0,0 @@ -package com.njlabs.showjava.utils - -/* - * Code borrowed from https://medium.com/@BladeCoder/kotlin-singletons-with-argument-194ef06edd9e - * Copyright (C) 2018 Christophe Beyls - */ -open class SingletonHolder(creator: (A) -> T) { - private var creator: ((A) -> T)? = creator - @Volatile private var instance: T? = null - - fun getInstance(arg: A): T { - val i = instance - if (i != null) { - return i - } - return synchronized(this) { - val i2 = instance - if (i2 != null) { - i2 - } else { - val created = creator!!(arg) - instance = created - creator = null - created - } - } - } -} diff --git a/app/src/main/kotlin/com/njlabs/showjava/utils/UserPreferences.kt b/app/src/main/kotlin/com/njlabs/showjava/utils/UserPreferences.kt deleted file mode 100644 index b288960d..00000000 --- a/app/src/main/kotlin/com/njlabs/showjava/utils/UserPreferences.kt +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Show Java - A java/apk decompiler for android - * Copyright (c) 2018 Niranjan Rajendran - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.njlabs.showjava.utils - -import android.content.SharedPreferences -import com.google.ads.consent.ConsentStatus - -/** - * A thin-wrapper around [SharedPreferences] to expose preferences as getters. - */ -class UserPreferences(private val prefs: SharedPreferences) { - - companion object { - const val NAME = "user_preferences" - } - - interface DEFAULTS { - companion object { - const val CUSTOM_FONT = true - const val DARK_MODE = false - const val SHOW_MEMORY_USAGE = true - const val SHOW_SYSTEM_APPS = false - const val MEMORY_THRESHOLD = 80 - const val IGNORE_LIBRARIES = true - const val KEEP_INTERMEDIATE_FILES = false - const val CHUNK_SIZE = 500 - const val MAX_ATTEMPTS = 2 - } - } - - val ignoreLibraries: Boolean - get() = prefs.getBoolean("ignoreLibraries", DEFAULTS.IGNORE_LIBRARIES) - - val keepIntermediateFiles: Boolean - get() = prefs.getBoolean("keepIntermediateFiles", DEFAULTS.KEEP_INTERMEDIATE_FILES) - - val customFont: Boolean - get() = prefs.getBoolean("customFont", DEFAULTS.CUSTOM_FONT) - - val darkMode: Boolean - get() = prefs.getBoolean("darkMode", DEFAULTS.DARK_MODE) - - val showMemoryUsage: Boolean - get() = prefs.getBoolean("showMemoryUsage", DEFAULTS.SHOW_MEMORY_USAGE) - - val showSystemApps: Boolean - get() = prefs.getBoolean("showSystemApps", DEFAULTS.SHOW_SYSTEM_APPS) - - val chunkSize: Int - get() = try { - prefs.getString("chunkSize", DEFAULTS.CHUNK_SIZE.toString())?.trim()?.toInt() - ?: DEFAULTS.CHUNK_SIZE - } catch (ignored: Exception) { - DEFAULTS.CHUNK_SIZE - } - - val maxAttempts: Int - get() = try { - prefs.getString("maxAttempts", DEFAULTS.MAX_ATTEMPTS.toString())?.trim()?.toInt() - ?: DEFAULTS.MAX_ATTEMPTS - } catch (ignored: Exception) { - DEFAULTS.MAX_ATTEMPTS - } - - val memoryThreshold: Int - get() = try { - prefs.getString( - "memoryThreshold", - DEFAULTS.MEMORY_THRESHOLD.toString() - )?.trim()?.toInt() - ?: DEFAULTS.MEMORY_THRESHOLD - } catch (ignored: Exception) { - DEFAULTS.MEMORY_THRESHOLD - } - - val consentStatus: Int - get() = prefs.getInt("consentStatus", ConsentStatus.UNKNOWN.ordinal) -} \ No newline at end of file diff --git a/app/src/main/kotlin/com/njlabs/showjava/utils/ZipUtils.kt b/app/src/main/kotlin/com/njlabs/showjava/utils/ZipUtils.kt deleted file mode 100644 index d5eff20c..00000000 --- a/app/src/main/kotlin/com/njlabs/showjava/utils/ZipUtils.kt +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Show Java - A java/apk decompiler for android - * Copyright (c) 2018 Niranjan Rajendran - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.njlabs.showjava.utils - - -import com.njlabs.showjava.utils.ktx.appStorage -import timber.log.Timber -import java.io.* -import java.util.zip.ZipEntry -import java.util.zip.ZipInputStream -import java.util.zip.ZipOutputStream - -/** - * [ZipUtils] to extract and compress directories - */ -object ZipUtils { - - fun zipDir(dir: File, packageId: String): File { - val zipIntoDir = appStorage.resolve("archives") - if (!zipIntoDir.exists() || !zipIntoDir.isDirectory) { - zipIntoDir.mkdirs() - } - val zipFile = File(zipIntoDir, "$packageId.zip") - if (zipFile.exists()) { - zipFile.delete() - } - try { - val zip: ZipOutputStream - val fileWriter = FileOutputStream(zipFile) - zip = ZipOutputStream(fileWriter) - addFolderToZip("", dir.toString(), zip) - zip.flush() - zip.close() - } catch (e: Exception) { - Timber.e(e) - } - - return zipFile - } - - @Throws(Exception::class) - private fun addFileToZip(path: String, srcFile: String, zip: ZipOutputStream) { - val folder = File(srcFile) - if (folder.isDirectory) { - addFolderToZip(path, srcFile, zip) - } else { - val buffer = ByteArray(1024) - val fileInputStream = FileInputStream(srcFile) - zip.putNextEntry(ZipEntry(path + "/" + folder.name)) - - while (true) { - val len = fileInputStream.read(buffer) - if (len <= 0) { - break - } - zip.write(buffer, 0, len) - } - } - } - - @Throws(Exception::class) - private fun addFolderToZip(path: String, srcFolder: String, zip: ZipOutputStream) { - val folder = File(srcFolder) - for (fileName in folder.list()) { - if (path == "") { - addFileToZip(folder.name, "$srcFolder/$fileName", zip) - } else { - addFileToZip(path + "/" + folder.name, "$srcFolder/$fileName", zip) - } - } - } - - @Throws(IOException::class) - @JvmOverloads - fun unzip(zipFile: File, targetDirectory: File, printStream: PrintStream = System.out) { - val zipInputStream = ZipInputStream(BufferedInputStream(FileInputStream(zipFile))) - zipInputStream.use { zis -> - val buffer = ByteArray(8192) - while (true) { - val zipEntry = zis.nextEntry ?: break - val file = File(targetDirectory, zipEntry.name) - printStream.println(zipEntry.name) - val dir = if (zipEntry.isDirectory) file else file.parentFile - if (!dir.isDirectory && !dir.mkdirs()) { - throw FileNotFoundException("Failed to ensure directory: " + dir.canonicalPath) - } - - if (zipEntry.isDirectory) { - continue - } - - val fileOutputStream = FileOutputStream(file) - fileOutputStream.use { out -> - while (true) { - val count = zis.read(buffer) - if (count <= 0) { - break - } - out.write(buffer, 0, count) - } - } - val time = zipEntry.time - if (time > 0) { - file.setLastModified(time) - } - } - } - } -} \ No newline at end of file diff --git a/app/src/main/kotlin/com/njlabs/showjava/utils/ktx/Extensions.kt b/app/src/main/kotlin/com/njlabs/showjava/utils/ktx/Extensions.kt deleted file mode 100644 index 7fd9d0f6..00000000 --- a/app/src/main/kotlin/com/njlabs/showjava/utils/ktx/Extensions.kt +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Show Java - A java/apk decompiler for android - * Copyright (c) 2018 Niranjan Rajendran - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.njlabs.showjava.utils.ktx - -import android.graphics.Bitmap -import android.graphics.Paint -import android.graphics.Canvas -import android.graphics.Rect -import android.graphics.PorterDuff -import android.graphics.PorterDuffXfermode -import android.os.Build -import android.os.Bundle -import android.os.IBinder -import android.os.Parcelable -import java.io.File -import java.io.InputStream -import java.io.Serializable - -/** - * Convert an [InputStream] to a file given a path as a [String] - */ -fun InputStream.toFile(path: String) { - toFile(File(path)) -} - -/** - * Convert an [InputStream] to a file given the destination [File] - */ -fun InputStream.toFile(file: File) { - file.outputStream().use { this.copyTo(it) } -} - -/** - * Convert a [Map] to a bundle by iterating through the map entries - */ -fun Map.toBundle(bundle: Bundle = Bundle()): Bundle = bundle.apply { - forEach { - val k = it.key - val v = it.value - when (v) { - is IBinder -> { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { - putBinder(k, v) - } - } - is Bundle -> putBundle(k, v) - is Byte -> putByte(k, v) - is ByteArray -> putByteArray(k, v) - is String -> putString(k, v) - is Char -> putChar(k, v) - is CharArray -> putCharArray(k, v) - is CharSequence -> putCharSequence(k, v) - is Float -> putFloat(k, v) - is FloatArray -> putFloatArray(k, v) - is Parcelable -> putParcelable(k, v) - is Serializable -> putSerializable(k, v) - is Short -> putShort(k, v) - is ShortArray -> putShortArray(k, v) - is Boolean -> putBoolean(k, v) - is Int -> putInt(k, v) - is IntArray -> putIntArray(k, v) - } - } -} - -/** - * Get a circular [Bitmap] from the original - * - * Borrowed from: https://stackoverflow.com/a/46613094/1562480 (Yuriy Seredyuk) - */ -fun Bitmap.getCircularBitmap(config: Bitmap.Config = Bitmap.Config.ARGB_8888): Bitmap { - // circle configuration - val circlePaint = Paint().apply { isAntiAlias = true } - val circleRadius = Math.max(width, height) / 2f - - // output bitmap - val outputBitmapPaint = Paint(circlePaint).apply { xfermode = PorterDuffXfermode(PorterDuff.Mode.SRC_IN) } - val outputBounds = Rect(0, 0, width, height) - val output = Bitmap.createBitmap(width, height, config) - - return Canvas(output).run { - drawCircle(circleRadius, circleRadius, circleRadius, circlePaint) - drawBitmap(this@getCircularBitmap, outputBounds, outputBounds, outputBitmapPaint) - output - } -} - diff --git a/app/src/main/kotlin/com/njlabs/showjava/utils/ktx/PackageSourceTools.kt b/app/src/main/kotlin/com/njlabs/showjava/utils/ktx/PackageSourceTools.kt deleted file mode 100644 index 6600bdf4..00000000 --- a/app/src/main/kotlin/com/njlabs/showjava/utils/ktx/PackageSourceTools.kt +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Show Java - A java/apk decompiler for android - * Copyright (c) 2018 Niranjan Rajendran - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.njlabs.showjava.utils.ktx - -import android.content.pm.ApplicationInfo -import android.content.pm.PackageInfo -import android.os.Environment -import java.io.File - -/** - * Path to the priamry storage directory on the user's internal memory - */ -val appStorage: File = File(Environment.getExternalStorageDirectory(), "show-java") - -/** - * Check if the given packageInfo points to a system application - */ -fun isSystemPackage(pkgInfo: PackageInfo): Boolean { - return pkgInfo.applicationInfo.flags and ApplicationInfo.FLAG_SYSTEM != 0 -} - -/** - * Get the source directory for a given package name - */ -fun sourceDir(packageName: String): File { - return appStorage.resolve("sources/$packageName") -} - -/** - * Convert an arbitrary file name into a generated package name that we can use - */ -fun jarPackageName(jarFileName: String): String { - val slug = toSlug(jarFileName) - return "$slug-${hashString("SHA-1", slug).slice(0..7)}".toLowerCase() -} \ No newline at end of file diff --git a/app/src/main/kotlin/com/njlabs/showjava/utils/ktx/Tools.kt b/app/src/main/kotlin/com/njlabs/showjava/utils/ktx/Tools.kt deleted file mode 100644 index 6c605b9f..00000000 --- a/app/src/main/kotlin/com/njlabs/showjava/utils/ktx/Tools.kt +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Show Java - A java/apk decompiler for android - * Copyright (c) 2018 Niranjan Rajendran - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.njlabs.showjava.utils.ktx - -import android.content.Context -import android.content.pm.PackageInfo -import android.net.ConnectivityManager -import android.os.Build -import java.security.MessageDigest -import java.text.Normalizer -import java.text.SimpleDateFormat -import java.util.* -import java.util.regex.Pattern - -private val NON_LATIN = Pattern.compile("[^\\w-]") -private val WHITESPACE = Pattern.compile("[\\s]") - -/** - * Convert a [packageName] in dot.notation to a class reference (Eg. Lclass/reference) - */ -fun toClassName(packageName: String): String { - return "L" + packageName.trim().replace(".", "/") -} - -/** - * Convert the [input] to a slug. - */ -fun toSlug(input: String): String { - val noWhiteSpace = WHITESPACE.matcher(input).replaceAll("-") - val normalized = Normalizer.normalize(noWhiteSpace, Normalizer.Form.NFD) - val slug = NON_LATIN.matcher(normalized).replaceAll("") - return slug.toLowerCase(Locale.ENGLISH) -} - -/** - * Hash the given [input] string using the specified [algorithm] - */ -fun hashString(algorithm: String, input: String): String { - val hexChars = "0123456789ABCDEF" - val bytes = MessageDigest - .getInstance(algorithm) - .digest(input.toByteArray()) - val result = StringBuilder(bytes.size * 2) - bytes.forEach { - val i = it.toInt() - result.append(hexChars[i shr 4 and 0x0f]) - result.append(hexChars[i and 0x0f]) - } - return result.toString() -} - -/** - * Check if the device is connected to a network. - */ -fun checkDataConnection(context: Context): Boolean { - val connectivityMgr = - context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager - return (connectivityMgr.activeNetworkInfo != null && - connectivityMgr.activeNetworkInfo.isAvailable && - connectivityMgr.activeNetworkInfo.isConnected) -} - -/** - * Get the current date as ISO 8601 [String] - */ -fun getDate(): String { - val date = Date(System.currentTimeMillis()) - val formatter = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ", Locale.US) - formatter.timeZone = TimeZone.getTimeZone("UTC") - return formatter.format(date) -} - -/** - * Request JVM to run the garbage collector. - * Don't think this would do much good. But okay. - */ -fun cleanMemory() { - Runtime.getRuntime().gc() - Thread.sleep(500) -} - -/** - * Get either version name or version code form [packageInfo]. - */ -fun getVersion(packageInfo: PackageInfo): String { - return if (packageInfo.versionName != null) - packageInfo.versionName - else - getVersionCode(packageInfo).toString() -} - -/** - * Get version code from [packageInfo] using the correct method depending on Android version. - */ -fun getVersionCode(packageInfo: PackageInfo): Number { - return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) - packageInfo.longVersionCode - else - packageInfo.versionCode -} diff --git a/app/src/main/kotlin/com/njlabs/showjava/utils/logging/ProductionTree.kt b/app/src/main/kotlin/com/njlabs/showjava/utils/logging/ProductionTree.kt deleted file mode 100644 index da7bba06..00000000 --- a/app/src/main/kotlin/com/njlabs/showjava/utils/logging/ProductionTree.kt +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Show Java - A java/apk decompiler for android - * Copyright (c) 2018 Niranjan Rajendran - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.njlabs.showjava.utils.logging - -import android.util.Log -import com.crashlytics.android.Crashlytics -import timber.log.Timber - -/** - * Logs all exceptions and anything with priority higher than [Log.WARN] to [Crashlytics] and ignores - * the rest. - */ -class ProductionTree : Timber.Tree() { - override fun log(priority: Int, tag: String?, message: String, t: Throwable?) { - if (priority == Log.VERBOSE || priority == Log.DEBUG || priority == Log.INFO) { - return - } - - if (t !== null && t !is OutOfMemoryError && t !is StackOverflowError && t !is NoClassDefFoundError) { - if (message.isNotEmpty()) { - Crashlytics.log("[$tag] $message") - } - Crashlytics.logException(t) - return - } - - if (priority > Log.WARN) { - Crashlytics.logException(Throwable("[$tag] $message")) - } - } -} diff --git a/app/src/main/kotlin/com/njlabs/showjava/utils/rx/ProcessStatus.kt b/app/src/main/kotlin/com/njlabs/showjava/utils/rx/ProcessStatus.kt deleted file mode 100644 index 4f818caf..00000000 --- a/app/src/main/kotlin/com/njlabs/showjava/utils/rx/ProcessStatus.kt +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Show Java - A java/apk decompiler for android - * Copyright (c) 2018 Niranjan Rajendran - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.njlabs.showjava.utils.rx - -class ProcessStatus { - - val status: String? - val secondaryStatus: String? - val progress: Float - val result: T? - - constructor(progress: Float, status: String, secondaryStatus: String) { - this.progress = progress - this.result = null - this.status = status - this.secondaryStatus = secondaryStatus - } - - constructor(progress: Float, status: String) { - this.progress = progress - this.result = null - this.status = status - this.secondaryStatus = "" - } - - constructor(result: T) { - this.progress = 1f - this.status = "" - this.secondaryStatus = "" - this.result = result - } - - val isDone: Boolean - get() = result != null -} diff --git a/app/src/main/kotlin/com/njlabs/showjava/utils/secure/PurchaseUtils.kt b/app/src/main/kotlin/com/njlabs/showjava/utils/secure/PurchaseUtils.kt deleted file mode 100644 index 7383dd60..00000000 --- a/app/src/main/kotlin/com/njlabs/showjava/utils/secure/PurchaseUtils.kt +++ /dev/null @@ -1,183 +0,0 @@ -/* - * Show Java - A java/apk decompiler for android - * Copyright (c) 2018 Niranjan Rajendran - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.njlabs.showjava.utils.secure - -import android.app.Activity -import android.widget.Toast -import com.google.firebase.analytics.FirebaseAnalytics -import com.njlabs.showjava.R -import com.njlabs.showjava.activities.BaseActivity -import io.michaelrocks.paranoid.Obfuscate -import io.reactivex.android.schedulers.AndroidSchedulers -import io.reactivex.disposables.CompositeDisposable -import io.reactivex.schedulers.Schedulers -import org.solovyev.android.checkout.* -import timber.log.Timber - -@Obfuscate -class PurchaseUtils( - private val activityContext: BaseActivity, - val secureUtils: SecureUtils, - val isLoading: (Boolean) -> Unit = {} -) { - - private val disposables: CompositeDisposable = CompositeDisposable() - private var completeCallback: () -> Unit = {} - - lateinit var checkout: ActivityCheckout - private lateinit var inventory: Inventory - private var lessVerbose: Boolean = false - - fun doOnComplete(completeCallback: () -> Unit) { - this.completeCallback = completeCallback - } - - fun initializeCheckout( - withPurchaseFlow: Boolean = false, - lessVerbose: Boolean = false - ): ActivityCheckout { - this.lessVerbose = lessVerbose - checkout = Checkout.forActivity(activityContext, secureUtils.getBilling()) - checkout.start() - - if (withPurchaseFlow) { - checkout.createPurchaseFlow(PurchaseListener()) - } - - inventory = checkout.makeInventory() - inventory.load( - Inventory.Request.create() - .loadAllPurchases() - .loadSkus(ProductTypes.IN_APP, secureUtils.iapProductId), - InventoryCallback() - ) - - return checkout - } - - inner class PurchaseListener : EmptyRequestListener() { - override fun onSuccess(purchase: Purchase) { - if (purchase.sku == secureUtils.iapProductId && purchase.state == Purchase.State.PURCHASED) { - onPurchaseComplete(purchase) - } - } - - override fun onError(response: Int, e: Exception) { - val messageKey = when (response) { - ResponseCodes.USER_CANCELED -> R.string.errorUserCancelled - ResponseCodes.ITEM_ALREADY_OWNED -> R.string.errorAlreadyOwned - ResponseCodes.ITEM_UNAVAILABLE -> R.string.errorItemUnavailable - ResponseCodes.ACCOUNT_ERROR -> R.string.errorAccount - ResponseCodes.ERROR -> R.string.errorPayment - else -> R.string.errorRequest - } - isLoading(false) - Toast.makeText( - activityContext, - activityContext.getString(messageKey), - Toast.LENGTH_SHORT - ).show() - } - } - - inner class InventoryCallback : Inventory.Callback { - override fun onLoaded(products: Inventory.Products) { - var wasAnyPurchased = false - products.forEach { - val isPurchased = it.isPurchased(secureUtils.iapProductId) - if (isPurchased) { - it.getPurchaseInState( - secureUtils.iapProductId, - Purchase.State.PURCHASED - )?.let { purchase -> - onPurchaseComplete(purchase) - wasAnyPurchased = true - } - } - } - if (!wasAnyPurchased) { - secureUtils.onPurchaseRevert() - } - } - } - - private fun onPurchaseComplete(purchase: Purchase) { - Timber.d("Purchase complete: %s", purchase.sku) - isLoading(true) - disposables.add( - secureUtils.makeJsonRequest( - secureUtils.purchaseVerifierPath, mapOf( - "packageName" to activityContext.packageName, - "productId" to purchase.sku, - "token" to purchase.token - ) - ).subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe( - { - isLoading(false) - Timber.d("Verification done: %s", it.toString()) - if (secureUtils.isPurchaseValid(purchase, it)) { - if (!secureUtils.hasPurchasedPro()) { - activityContext.firebaseAnalytics.logEvent( - FirebaseAnalytics.Event.ECOMMERCE_PURCHASE, null - ) - Toast.makeText( - activityContext, - R.string.purchaseSuccess, - Toast.LENGTH_LONG - ) - .show() - } - secureUtils.onPurchaseComplete(purchase) - completeCallback() - } else { - if (!lessVerbose) { - Toast.makeText( - activityContext, - R.string.purchaseVerificationFailed, - Toast.LENGTH_LONG - ).show() - } - secureUtils.onPurchaseRevert() - } - }, { - isLoading(false) - Timber.e(it) - if (!lessVerbose) { - Toast.makeText( - activityContext, - R.string.purchaseVerificationFailed, - Toast.LENGTH_LONG - ).show() - } - } - ) - ) - secureUtils.onPurchaseComplete(purchase) - } - - fun onDestroy() { - disposables.clear() - if (this::checkout.isInitialized) { - checkout.stop() - } - } - -} \ No newline at end of file diff --git a/app/src/main/kotlin/com/njlabs/showjava/utils/secure/SecureUtils.kt b/app/src/main/kotlin/com/njlabs/showjava/utils/secure/SecureUtils.kt deleted file mode 100644 index c4e5b9ed..00000000 --- a/app/src/main/kotlin/com/njlabs/showjava/utils/secure/SecureUtils.kt +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Show Java - A java/apk decompiler for android - * Copyright (c) 2018 Niranjan Rajendran - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.njlabs.showjava.utils.secure - -import android.annotation.SuppressLint -import android.content.Context -import android.content.pm.PackageManager -import android.util.Base64 -import com.android.volley.Response -import com.android.volley.toolbox.JsonObjectRequest -import com.github.javiersantos.piracychecker.* -import com.github.javiersantos.piracychecker.enums.InstallerID -import com.github.javiersantos.piracychecker.enums.PiracyCheckerError -import com.github.javiersantos.piracychecker.enums.PirateApp -import com.njlabs.showjava.BuildConfig -import com.njlabs.showjava.utils.RequestQueue -import com.njlabs.showjava.utils.SingletonHolder -import com.securepreferences.SecurePreferences -import io.michaelrocks.paranoid.Obfuscate -import io.reactivex.Observable -import io.reactivex.ObservableEmitter -import org.json.JSONObject -import org.solovyev.android.checkout.Billing -import org.solovyev.android.checkout.Purchase -import timber.log.Timber -import java.security.MessageDigest - - -@Obfuscate -class SecureUtils(val context: Context) { - - private val packageName = "com.njlabs.showjava" - private val backendUrl = BuildConfig.BACKEND_URL - private var hasPurchasedPro: Boolean? = null - private var preferences: SecurePreferences? = null - - val iapProductId = BuildConfig.IAP_PRODUCT_ID - - val purchaseVerifierPath = BuildConfig.PURCHASE_VERIFIER_PATH - - private fun getPreferences(): SecurePreferences { - if (preferences == null) { - preferences = SecurePreferences(context) - } - return preferences as SecurePreferences - } - - fun isSafeExtended(allow: (() -> Unit), doNotAllow: ((PiracyCheckerError, PirateApp?) -> Unit), onError: (() -> Unit)) { - Timber.d("[pa] isSafeExtended") - context.piracyChecker { - enableGooglePlayLicensing(BuildConfig.PLAY_LICENSE_KEY) - if (BuildConfig.EXTENDED_VALIDATION) { - enableInstallerId(InstallerID.GOOGLE_PLAY) - enableUnauthorizedAppsCheck() - enableDebugCheck() - } - callback { - doNotAllow { a, b -> - Timber.d("[isSafeExtended][doNotAllow] ${a.name} $b") - doNotAllow(a, b) - } - allow { allow() } - onError { - Timber.d("[isSafeExtended][doNotAllow] ${it.name}") - onError() - } - } - }.start() - } - - fun getBilling(): Billing { - return Billing(context, object : Billing.DefaultConfiguration() { - override fun getPublicKey(): String { - return BuildConfig.PLAY_LICENSE_KEY - } - }) - } - - fun hasPurchasedPro(): Boolean { - if (hasPurchasedPro != null) { - return hasPurchasedPro as Boolean - } - return getPreferences().getBoolean(iapProductId, false) - } - - fun isPurchaseValid(purchase: Purchase, jsonObject: JSONObject): Boolean { - if (jsonObject.has("isPurchased") && jsonObject.has("orderId")) { - return jsonObject.getBoolean("isPurchased") && jsonObject.getString("orderId") == purchase.orderId - } - return false - } - - fun onPurchaseComplete(purchase: Purchase) { - hasPurchasedPro = true - getPreferences().edit().putBoolean(purchase.sku, true).commit() - } - - fun onPurchaseRevert() { - hasPurchasedPro = false - getPreferences().edit().putBoolean(iapProductId, false).commit() - } - - @SuppressLint("PrivateApi") - @Throws(Exception::class) - fun getSystemProperty(name: String): String { - val systemPropertyClass = Class.forName("android.os.SystemProperties") - return systemPropertyClass - .getMethod("get", String::class.java) - .invoke(systemPropertyClass, name) as String - } - - @Suppress("DEPRECATION") - @SuppressLint("PackageManagerGetSignatures") - fun checkAppSignature() { - val packageInfo = context.packageManager.getPackageInfo( - context.packageName, PackageManager.GET_SIGNATURES - ) - packageInfo.signatures.forEach { signature -> - val signatureBytes = signature.toByteArray() - val md = MessageDigest.getInstance("SHA") - md.update(signatureBytes) - val currentSignature = Base64.encodeToString(md.digest(), Base64.DEFAULT) - Timber.d("[currentSignature] %s", currentSignature) - } - } - - /** - * Make a JSON Request to the backend and return and observable - */ - fun makeJsonRequest(requestPath: String, payload: Map): Observable { - return Observable.create { emitter: ObservableEmitter -> - val jsonBody = JSONObject() - var backendUrl = this.backendUrl - var path = requestPath - if (!backendUrl.endsWith("/")) { - backendUrl += "/" - } - if (path.startsWith("/")) { - path = path.removePrefix("/") - } - payload.entries.forEach { - jsonBody.put(it.key, it.value) - } - val request = JsonObjectRequest( - backendUrl + path, - jsonBody, - Response.Listener { - emitter.onNext(it) - emitter.onComplete() - }, Response.ErrorListener { - if (!emitter.isDisposed) { - emitter.onError(it) - emitter.onComplete() - } - } - ) - RequestQueue.getInstance(context).addToRequestQueue(request) - } - } - - companion object : SingletonHolder(::SecureUtils) -} \ No newline at end of file diff --git a/app/src/main/kotlin/com/njlabs/showjava/utils/streams/Logger.kt b/app/src/main/kotlin/com/njlabs/showjava/utils/streams/Logger.kt deleted file mode 100644 index 80b57d94..00000000 --- a/app/src/main/kotlin/com/njlabs/showjava/utils/streams/Logger.kt +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Show Java - A java/apk decompiler for android - * Copyright (c) 2018 Niranjan Rajendran - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.njlabs.showjava.utils.streams - -import jadx.api.JadxArgs -import jadx.core.dex.nodes.ClassNode -import java.io.File - - -object Logger { - - /** - * This method will be invoked by a JaDX method that is used to save classes. - */ - @Suppress("UNUSED_PARAMETER") - @JvmStatic - fun logJadxClassWrite(dir: File, args: JadxArgs, cls: ClassNode) { - println("Decompiling " + cls.fullName) - } -} diff --git a/app/src/main/kotlin/com/njlabs/showjava/utils/streams/ProgressStream.kt b/app/src/main/kotlin/com/njlabs/showjava/utils/streams/ProgressStream.kt deleted file mode 100644 index feb2748e..00000000 --- a/app/src/main/kotlin/com/njlabs/showjava/utils/streams/ProgressStream.kt +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Show Java - A java/apk decompiler for android - * Copyright (c) 2018 Niranjan Rajendran - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.njlabs.showjava.utils.streams - -import androidx.annotation.NonNull -import com.njlabs.showjava.decompilers.BaseDecompiler -import timber.log.Timber -import java.io.OutputStream -import java.nio.charset.Charset -import java.util.Arrays - - -/** - * A custom output stream that strips unnecessary stuff from raw input stream - */ -class ProgressStream(val decompiler: BaseDecompiler) : OutputStream() { - - private val validProgressRegex = Regex("^[^.][a-zA-Z/\$;\\s0-9.]+\$") - - private fun shouldIgnore(string: String): Boolean { - if (string.startsWith("[ignored]")) { - return true - } - for (part in arrayOf( - "TRYBLOCK", "stack info", "Produces", "ASTORE", "targets", - "WARN jadx", "thread-1", "ERROR jadx", "JadxRuntimeException", - "java.lang")) { - if (string.contains(part, true)) { - return true - } - } - - return !validProgressRegex.matches(string) - } - - override fun write(@NonNull data: ByteArray, offset: Int, length: Int) { - var str = String( - Arrays.copyOfRange(data, offset, length), - Charset.forName("UTF-8") - ) - .replace("\n", "") - .replace("\r", "") - .replace("INFO:".toRegex(RegexOption.IGNORE_CASE), "") - .replace("ERROR:".toRegex(RegexOption.IGNORE_CASE), "") - .replace("WARN:".toRegex(RegexOption.IGNORE_CASE), "") - .replace("\n\r", "") - .replace("... done", "") - .replace("at", "") - .replace("Processing ".toRegex(RegexOption.IGNORE_CASE), "") - .replace("Decompiling ".toRegex(RegexOption.IGNORE_CASE), "") - .replace("Extracting ".toRegex(RegexOption.IGNORE_CASE), "") - .trim() - - if (shouldIgnore(str)) { - return - } - - if (str.startsWith("[stdout]")) { - str = str.removePrefix("[stdout] ") - } - - if (str.isNotEmpty()) { - Timber.d("[stdout] %s", str) - decompiler.sendStatus(str) - } - } - - override fun write(byte: Int) { - // Just a stub. We aren't implementing this. - } -} \ No newline at end of file diff --git a/app/src/main/kotlin/com/njlabs/showjava/utils/views/CodeView.kt b/app/src/main/kotlin/com/njlabs/showjava/utils/views/CodeView.kt deleted file mode 100644 index 6681d21d..00000000 --- a/app/src/main/kotlin/com/njlabs/showjava/utils/views/CodeView.kt +++ /dev/null @@ -1,313 +0,0 @@ -/* - * Original code borrowed from tiagohm/CodeView project - * https://github.com/tiagohm/CodeView/blob/053a827e629089ae8fdd4787d42f2257a856a4c6/library/src/main/java/br/tiagohm/codeview/CodeView.java - * - * Copyright (c) 2016-2017 Tiago Melo - * - * Originally licensed under the MIT Licence, now modified and re-licenced under GPL 3.0 - */ - -/* - * Show Java - A java/apk decompiler for android - * Copyright (c) 2018 Niranjan Rajendran - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.njlabs.showjava.utils.views - -import android.annotation.SuppressLint -import android.content.Context -import android.os.Build -import android.text.Html -import android.util.AttributeSet -import android.view.MotionEvent -import android.view.ScaleGestureDetector -import android.webkit.JavascriptInterface -import android.webkit.WebChromeClient -import android.webkit.WebSettings -import android.webkit.WebView -import com.njlabs.showjava.BuildConfig -import java.util.* -import java.util.regex.Pattern - -class CodeView @JvmOverloads constructor( - context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0 -) : WebView(context, attrs, defStyleAttr) { - - private var code = "" - private var escapeCode: String? = null - private var language: String? = null - private var fontSize = 16f - private var wrapLine = false - private var darkMode = true - private var onHighlightListener: OnHighlightListener? = null - private var pinchDetector: ScaleGestureDetector? = null - private var zoomEnabled = false - private var showLineNumber = false - private var startLineNumber = 1 - private var lineCount = 0 - private var highlightLineNumber = -1 - - interface OnHighlightListener { - fun onStartCodeHighlight() - fun onFinishCodeHighlight() - fun onFontSizeChanged(sizeInPx: Int) - fun onLineClicked(lineNumber: Int, content: String) - } - - init { init(context) } - - @SuppressLint("ClickableViewAccessibility") - override fun onTouchEvent(event: MotionEvent): Boolean { - if (zoomEnabled) { - pinchDetector!!.onTouchEvent(event) - } - return super.onTouchEvent(event) - } - - @SuppressLint("SetJavaScriptEnabled") - private fun init(context: Context) { - pinchDetector = ScaleGestureDetector(context, PinchListener()) - webChromeClient = WebChromeClient() - settings.javaScriptEnabled = true - settings.cacheMode = WebSettings.LOAD_NO_CACHE - settings.setRenderPriority(WebSettings.RenderPriority.HIGH) - settings.loadWithOverviewMode = true - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && BuildConfig.DEBUG) { - WebView.setWebContentsDebuggingEnabled(true) - } - } - - @SuppressLint("AddJavascriptInterface") - fun setOnHighlightListener(listener: OnHighlightListener?): CodeView { - if (listener != null) { - if (onHighlightListener !== listener) { - onHighlightListener = listener - /* - For applications built for API levels below 17, WebView#addJavascriptInterface presents a security hazard as - JavaScript on the target web page has the ability to use reflection to access the injected object's public fields - and thus manipulate the host application in unintended ways. - - Issue id: AddJavascriptInterface - - Ref: https://labs.mwrinfosecurity.com/blog/2013/09/24/webview-addjavascriptinterface-remote-code-execution/ - */ - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { - addJavascriptInterface(object : Any() { - @JavascriptInterface - fun onStartCodeHighlight() { - onHighlightListener?.onStartCodeHighlight() - } - @JavascriptInterface - fun onFinishCodeHighlight() { - onHighlightListener?.onFinishCodeHighlight() - } - @JavascriptInterface - fun onLineClicked(lineNumber: Int, content: String) { - onHighlightListener?.onLineClicked(lineNumber, content) - } - }, "android") - } - } - } else { - removeJavascriptInterface("android") - } - return this - } - - fun setFontSize(fontSize: Float): CodeView { - if (fontSize < 8) this.fontSize = 8f - else this.fontSize = fontSize - if (onHighlightListener != null) { - onHighlightListener!!.onFontSizeChanged(this.fontSize.toInt()) - } - return this - } - - fun setCode(code: String?): CodeView { - if (code == null) this.code = "" - else this.code = code + "\n" - this.escapeCode = Html.escapeHtml(this.code) - return this - } - - fun setLanguage(language: String): CodeView { - this.language = language - return this - } - - fun setWrapLine(wrapLine: Boolean): CodeView { - this.wrapLine = wrapLine - return this - } - - fun setZoomEnabled(zoomEnabled: Boolean): CodeView { - this.zoomEnabled = zoomEnabled - return this - } - - fun setDarkMode(darkMode: Boolean): CodeView { - this.darkMode = darkMode - return this - } - - fun setShowLineNumber(showLineNumber: Boolean): CodeView { - this.showLineNumber = showLineNumber - return this - } - - fun setStartLineNumber(startLineNumber: Int): CodeView { - if (startLineNumber < 0) this.startLineNumber = 1 - else this.startLineNumber = startLineNumber - return this - } - - fun toggleLineNumber() { - showLineNumber = !showLineNumber - showHideLineNumber(showLineNumber) - } - - fun load() { reload() } - - override fun reload() { - loadDataWithBaseURL( - "", - toHtml(), - "text/html", - "UTF-8", - "" - ) - } - - private fun getStyleAndClass(): Pair { - var bodyClass = "dark" - var style = "androidstudio" - if (!darkMode) { - bodyClass = "light" - style = "github-gist" - } - if (wrapLine) { - bodyClass += " wrapped" - } - return Pair("file:///android_asset/codeview/highlightjs/styles/$style.css", bodyClass) - } - - fun apply() { - val (styleUri, bodyClass) = getStyleAndClass() - executeJavaScript("updateStyleAndClasses('$styleUri', '$bodyClass')") - showHideLineNumber(showLineNumber) - } - - private fun toHtml(): String { - val (styleUri, bodyClass) = getStyleAndClass() - return """ - - - - - - - - - - -
${insertLineNumber(escapeCode)}
- - - -""" - } - - private fun insertLineNumber(code: String?): String { - val m = Pattern.compile("(.*?) ").matcher(code ?: "") - val sb = StringBuffer() - var pos = startLineNumber - lineCount = 0 - while (m.find()) { - m.appendReplacement( - sb, - String.format( - Locale.ENGLISH, - "$1 ", - pos, pos, pos - ) - ) - pos++ - lineCount++ - } - return "\n" + sb.toString().trim { it <= ' ' } + "
\n" - } - - private inner class PinchListener : ScaleGestureDetector.SimpleOnScaleGestureListener() { - - private var fontSize: Float = 0.toFloat() - private var oldFontSize: Int = 0 - - override fun onScaleBegin(detector: ScaleGestureDetector): Boolean { - fontSize = this@CodeView.fontSize - oldFontSize = fontSize.toInt() - return super.onScaleBegin(detector) - } - - override fun onScaleEnd(detector: ScaleGestureDetector) { - this@CodeView.fontSize = fontSize - super.onScaleEnd(detector) - } - - override fun onScale(detector: ScaleGestureDetector): Boolean { - fontSize = this@CodeView.fontSize * detector.scaleFactor - if (fontSize >= 8) { - changeFontSize(fontSize.toInt()) - if (oldFontSize != fontSize.toInt()) { - onHighlightListener?.onFontSizeChanged(fontSize.toInt()) - } - oldFontSize = fontSize.toInt() - } else { - fontSize = 8f - } - return false - } - } - - private fun executeJavaScript(js: String) { - if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) { - evaluateJavascript("javascript:$js", null) - } else { - loadUrl("javascript:$js") - } - } - - private fun changeFontSize(sizeInPx: Int) { - executeJavaScript("changeFontSize($sizeInPx)") - } - - private fun showHideLineNumber(show: Boolean) { - executeJavaScript("showHideLineNumber($show)") - } - - fun highlightLineNumber(lineNumber: Int) { - this.highlightLineNumber = lineNumber - executeJavaScript("highlightLineNumber($lineNumber)") - } -} \ No newline at end of file diff --git a/app/src/main/kotlin/com/njlabs/showjava/workers/DecompilerWorker.kt b/app/src/main/kotlin/com/njlabs/showjava/workers/DecompilerWorker.kt deleted file mode 100644 index 4367f605..00000000 --- a/app/src/main/kotlin/com/njlabs/showjava/workers/DecompilerWorker.kt +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Show Java - A java/apk decompiler for android - * Copyright (c) 2018 Niranjan Rajendran - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.njlabs.showjava.workers - -import android.content.Context -import androidx.work.Data -import androidx.work.WorkManager -import androidx.work.Worker -import androidx.work.WorkerParameters -import com.crashlytics.android.Crashlytics -import com.njlabs.showjava.decompilers.BaseDecompiler -import com.njlabs.showjava.decompilers.JarExtractionWorker -import com.njlabs.showjava.decompilers.JavaExtractionWorker -import com.njlabs.showjava.decompilers.ResourcesExtractionWorker -import com.njlabs.showjava.utils.ProcessNotifier -import com.njlabs.showjava.utils.UserPreferences -import timber.log.Timber -import java.io.File -import java.util.concurrent.CountDownLatch -import java.util.concurrent.ExecutorService -import java.util.concurrent.Executors -import java.util.concurrent.TimeUnit - -/** - * A wrapper for each of the 3 extractors to be able to use with Android WorkManager - */ -class DecompilerWorker(val context: Context, params: WorkerParameters) : Worker(context, params) { - - private var worker: BaseDecompiler? = null - private lateinit var step: String - private val maxAttempts = params.inputData.getInt("maxAttempts", UserPreferences.DEFAULTS.MAX_ATTEMPTS) - - private val id: String = params.inputData.getString("id").toString() - private val packageName: String = params.inputData.getString("name").toString() - private val packageLabel: String = params.inputData.getString("label").toString() - private val decompiler: String = params.inputData.getString("decompiler").toString() - private val chunkSize: Int = params.inputData.getInt("chunkSize", UserPreferences.DEFAULTS.CHUNK_SIZE) - private val memoryThreshold: Int = params.inputData.getInt("memoryThreshold", UserPreferences.DEFAULTS.MEMORY_THRESHOLD) - private val inputPackageFile: File = File(params.inputData.getString("inputPackageFile")) - - private val decompilerExecutor: ExecutorService = Executors.newSingleThreadExecutor() - - /** - * Initialize the appropriate extractor based on the current step of the job - */ - init { - if (tags.contains("jar-extraction")) { - step = "jar-extraction" - worker = JarExtractionWorker(context, params.inputData) - } - if (tags.contains("java-extraction")) { - step = "java-extraction" - worker = JavaExtractionWorker(context, params.inputData) - } - if (tags.contains("resources-extraction")) { - step = "resources-extraction" - worker = ResourcesExtractionWorker(context, params.inputData) - } - } - - /** - * Execute the extractor. Also handles - * - * - Retries based on the set max attempts and failure status. - * - Stopping of the job when memory usage reaches the given threshold - * - * Every extractor is run within an executor thread. This allows us to force kill the thread - * via [ExecutorService.shutdownNow] method when memory usage exceeds set threshold. - * - */ - override fun doWork(): Result { - var result = if (runAttemptCount >= (maxAttempts - 1)) Result.failure() else Result.retry() - var ranOutOfMemory = false - val notifier = ProcessNotifier(context, id) - .withPackageInfo(packageName, packageLabel, inputPackageFile) - - Crashlytics.setString("decompilation_step", step) - Crashlytics.setString("decompilation_decompiler", decompiler) - Crashlytics.setString("decompilation_package_name", packageName) - Crashlytics.setString("decompilation_package_label", packageLabel) - Crashlytics.setInt("decompilation_chunk_size", chunkSize) - Crashlytics.setInt("decompilation_memory_threshold", memoryThreshold) - - var outputData = Data.Builder().build() - - worker ?.let { - try { - val latch = CountDownLatch(1) - decompilerExecutor.execute { - result = it.withNotifier(notifier) - .withLowMemoryCallback { isLowMemory -> - ranOutOfMemory = isLowMemory - outputData = Data.Builder() - .putBoolean("ranOutOfMemory", isLowMemory) - .build() - - if (isLowMemory) { - latch.countDown() - decompilerExecutor.shutdownNow() - } - } - .withAttempt(runAttemptCount) - latch.countDown() - } - latch.await() - decompilerExecutor.shutdownNow() - decompilerExecutor.awaitTermination(2, TimeUnit.SECONDS) - } catch (e: Exception) { - Timber.e(e) - } - it.onStopped() - } - - if (ranOutOfMemory) { - result = Result.failure(outputData) - } - - if (result == Result.failure()) { - try { - if (ranOutOfMemory) { - notifier.lowMemory(decompiler) - } else { - notifier.error() - } - } catch (e: Exception) { - Timber.e(e) - } - } - - Crashlytics.setString("decompilation_step", "") - Crashlytics.setString("decompilation_decompiler", "") - Crashlytics.setString("decompilation_package_name", "") - Crashlytics.setString("decompilation_package_label", "") - Crashlytics.setInt("decompilation_chunk_size", -1) - Crashlytics.setInt("decompilation_memory_threshold", -1) - - return result - } - - /** - * Called when the job is stopped. (Either by user-initiated cancel or when complete) - * We clean up the notifications and caches if any on shutdown. - * - */ - override fun onStopped() { - super.onStopped() - worker?.onStopped() - } - - companion object { - /** - * A helper method to cancel a decompilation job by packageName ([id]) - */ - fun cancel(context: Context, id: String) { - ProcessNotifier(context, id).cancel() - WorkManager.getInstance().cancelUniqueWork(id) - } - } -} diff --git a/app/src/main/res/drawable-hdpi/ic_list_generic.png b/app/src/main/res/drawable-hdpi/ic_list_generic.png deleted file mode 100644 index fdbaec92..00000000 Binary files a/app/src/main/res/drawable-hdpi/ic_list_generic.png and /dev/null differ diff --git a/app/src/main/res/drawable-hdpi/ic_stat_code.png b/app/src/main/res/drawable-hdpi/ic_stat_code.png deleted file mode 100644 index 7ae32d00..00000000 Binary files a/app/src/main/res/drawable-hdpi/ic_stat_code.png and /dev/null differ diff --git a/app/src/main/res/drawable-hdpi/ic_stat_error.png b/app/src/main/res/drawable-hdpi/ic_stat_error.png deleted file mode 100644 index 5c391cde..00000000 Binary files a/app/src/main/res/drawable-hdpi/ic_stat_error.png and /dev/null differ diff --git a/app/src/main/res/drawable-hdpi/ic_stat_stop.png b/app/src/main/res/drawable-hdpi/ic_stat_stop.png deleted file mode 100644 index 28521ffe..00000000 Binary files a/app/src/main/res/drawable-hdpi/ic_stat_stop.png and /dev/null differ diff --git a/app/src/main/res/drawable-hdpi/sad_ram.png b/app/src/main/res/drawable-hdpi/sad_ram.png deleted file mode 100644 index 65f24941..00000000 Binary files a/app/src/main/res/drawable-hdpi/sad_ram.png and /dev/null differ diff --git a/app/src/main/res/drawable-mdpi/ic_list_generic.png b/app/src/main/res/drawable-mdpi/ic_list_generic.png deleted file mode 100644 index 64a3ba35..00000000 Binary files a/app/src/main/res/drawable-mdpi/ic_list_generic.png and /dev/null differ diff --git a/app/src/main/res/drawable-mdpi/ic_stat_code.png b/app/src/main/res/drawable-mdpi/ic_stat_code.png deleted file mode 100644 index 3d6b665f..00000000 Binary files a/app/src/main/res/drawable-mdpi/ic_stat_code.png and /dev/null differ diff --git a/app/src/main/res/drawable-mdpi/ic_stat_error.png b/app/src/main/res/drawable-mdpi/ic_stat_error.png deleted file mode 100644 index b0462f0e..00000000 Binary files a/app/src/main/res/drawable-mdpi/ic_stat_error.png and /dev/null differ diff --git a/app/src/main/res/drawable-mdpi/ic_stat_stop.png b/app/src/main/res/drawable-mdpi/ic_stat_stop.png deleted file mode 100644 index ad8c55ad..00000000 Binary files a/app/src/main/res/drawable-mdpi/ic_stat_stop.png and /dev/null differ diff --git a/app/src/main/res/drawable-mdpi/sad_ram.png b/app/src/main/res/drawable-mdpi/sad_ram.png deleted file mode 100644 index b76ce337..00000000 Binary files a/app/src/main/res/drawable-mdpi/sad_ram.png and /dev/null differ diff --git a/app/src/main/res/drawable-xhdpi/ic_list_generic.png b/app/src/main/res/drawable-xhdpi/ic_list_generic.png deleted file mode 100644 index 10c4f2e9..00000000 Binary files a/app/src/main/res/drawable-xhdpi/ic_list_generic.png and /dev/null differ diff --git a/app/src/main/res/drawable-xhdpi/ic_stat_code.png b/app/src/main/res/drawable-xhdpi/ic_stat_code.png deleted file mode 100644 index 2a38c75e..00000000 Binary files a/app/src/main/res/drawable-xhdpi/ic_stat_code.png and /dev/null differ diff --git a/app/src/main/res/drawable-xhdpi/ic_stat_error.png b/app/src/main/res/drawable-xhdpi/ic_stat_error.png deleted file mode 100644 index b6ef064a..00000000 Binary files a/app/src/main/res/drawable-xhdpi/ic_stat_error.png and /dev/null differ diff --git a/app/src/main/res/drawable-xhdpi/ic_stat_stop.png b/app/src/main/res/drawable-xhdpi/ic_stat_stop.png deleted file mode 100644 index 76b68a42..00000000 Binary files a/app/src/main/res/drawable-xhdpi/ic_stat_stop.png and /dev/null differ diff --git a/app/src/main/res/drawable-xhdpi/sad_ram.png b/app/src/main/res/drawable-xhdpi/sad_ram.png deleted file mode 100644 index e693b9fc..00000000 Binary files a/app/src/main/res/drawable-xhdpi/sad_ram.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_list_generic.png b/app/src/main/res/drawable-xxhdpi/ic_list_generic.png deleted file mode 100644 index fb3130c3..00000000 Binary files a/app/src/main/res/drawable-xxhdpi/ic_list_generic.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_stat_code.png b/app/src/main/res/drawable-xxhdpi/ic_stat_code.png deleted file mode 100644 index 755d7a61..00000000 Binary files a/app/src/main/res/drawable-xxhdpi/ic_stat_code.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_stat_error.png b/app/src/main/res/drawable-xxhdpi/ic_stat_error.png deleted file mode 100644 index 71317865..00000000 Binary files a/app/src/main/res/drawable-xxhdpi/ic_stat_error.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_stat_stop.png b/app/src/main/res/drawable-xxhdpi/ic_stat_stop.png deleted file mode 100644 index d6294b1e..00000000 Binary files a/app/src/main/res/drawable-xxhdpi/ic_stat_stop.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxhdpi/sad_ram.png b/app/src/main/res/drawable-xxhdpi/sad_ram.png deleted file mode 100644 index 6c8b8cd9..00000000 Binary files a/app/src/main/res/drawable-xxhdpi/sad_ram.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_stat_code.png b/app/src/main/res/drawable-xxxhdpi/ic_stat_code.png deleted file mode 100644 index 73e65057..00000000 Binary files a/app/src/main/res/drawable-xxxhdpi/ic_stat_code.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_stat_error.png b/app/src/main/res/drawable-xxxhdpi/ic_stat_error.png deleted file mode 100644 index d36e37bf..00000000 Binary files a/app/src/main/res/drawable-xxxhdpi/ic_stat_error.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_stat_stop.png b/app/src/main/res/drawable-xxxhdpi/ic_stat_stop.png deleted file mode 100644 index 5c128a7c..00000000 Binary files a/app/src/main/res/drawable-xxxhdpi/ic_stat_stop.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxxhdpi/sad_ram.png b/app/src/main/res/drawable-xxxhdpi/sad_ram.png deleted file mode 100644 index d1d20d01..00000000 Binary files a/app/src/main/res/drawable-xxxhdpi/sad_ram.png and /dev/null differ diff --git a/app/src/main/res/drawable/fab_label.xml b/app/src/main/res/drawable/fab_label.xml deleted file mode 100644 index 85aa7eb8..00000000 --- a/app/src/main/res/drawable/fab_label.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/app/src/main/res/drawable/ic_apps_white.xml b/app/src/main/res/drawable/ic_apps_white.xml deleted file mode 100644 index b038c29c..00000000 --- a/app/src/main/res/drawable/ic_apps_white.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - diff --git a/app/src/main/res/drawable/ic_bug_report_black.xml b/app/src/main/res/drawable/ic_bug_report_black.xml deleted file mode 100644 index 9bebc700..00000000 --- a/app/src/main/res/drawable/ic_bug_report_black.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - diff --git a/app/src/main/res/drawable/ic_code_black.xml b/app/src/main/res/drawable/ic_code_black.xml deleted file mode 100644 index fd1b8df7..00000000 --- a/app/src/main/res/drawable/ic_code_black.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - diff --git a/app/src/main/res/drawable/ic_code_white.xml b/app/src/main/res/drawable/ic_code_white.xml deleted file mode 100644 index b2ce2db3..00000000 --- a/app/src/main/res/drawable/ic_code_white.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - diff --git a/app/src/main/res/drawable/ic_delete_white.xml b/app/src/main/res/drawable/ic_delete_white.xml deleted file mode 100644 index 7fde4f90..00000000 --- a/app/src/main/res/drawable/ic_delete_white.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - diff --git a/app/src/main/res/drawable/ic_error_outline_black.xml b/app/src/main/res/drawable/ic_error_outline_black.xml deleted file mode 100644 index 1ddb07a6..00000000 --- a/app/src/main/res/drawable/ic_error_outline_black.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - diff --git a/app/src/main/res/drawable/ic_gear_grey.xml b/app/src/main/res/drawable/ic_gear_grey.xml deleted file mode 100644 index e0cb2e04..00000000 --- a/app/src/main/res/drawable/ic_gear_grey.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - diff --git a/app/src/main/res/drawable/ic_info_black.xml b/app/src/main/res/drawable/ic_info_black.xml deleted file mode 100644 index 6c9dfc12..00000000 --- a/app/src/main/res/drawable/ic_info_black.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - diff --git a/app/src/main/res/drawable/ic_invert_colors_white.xml b/app/src/main/res/drawable/ic_invert_colors_white.xml deleted file mode 100644 index add5258a..00000000 --- a/app/src/main/res/drawable/ic_invert_colors_white.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - diff --git a/app/src/main/res/drawable/ic_sd_card_white.xml b/app/src/main/res/drawable/ic_sd_card_white.xml deleted file mode 100644 index 1c58ae7e..00000000 --- a/app/src/main/res/drawable/ic_sd_card_white.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - diff --git a/app/src/main/res/drawable/ic_search_white.xml b/app/src/main/res/drawable/ic_search_white.xml deleted file mode 100644 index b6335f9d..00000000 --- a/app/src/main/res/drawable/ic_search_white.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - diff --git a/app/src/main/res/drawable/ic_settings_black.xml b/app/src/main/res/drawable/ic_settings_black.xml deleted file mode 100644 index 3320267a..00000000 --- a/app/src/main/res/drawable/ic_settings_black.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - diff --git a/app/src/main/res/drawable/ic_share_white.xml b/app/src/main/res/drawable/ic_share_white.xml deleted file mode 100644 index 7dd4560c..00000000 --- a/app/src/main/res/drawable/ic_share_white.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - diff --git a/app/src/main/res/drawable/ic_stop_black.xml b/app/src/main/res/drawable/ic_stop_black.xml deleted file mode 100644 index 5c1ed74b..00000000 --- a/app/src/main/res/drawable/ic_stop_black.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - diff --git a/app/src/main/res/drawable/ic_whatshot_black.xml b/app/src/main/res/drawable/ic_whatshot_black.xml deleted file mode 100644 index ad3c112d..00000000 --- a/app/src/main/res/drawable/ic_whatshot_black.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - diff --git a/app/src/main/res/drawable/navbar_header.jpg b/app/src/main/res/drawable/navbar_header.jpg deleted file mode 100644 index 9461cced..00000000 Binary files a/app/src/main/res/drawable/navbar_header.jpg and /dev/null differ diff --git a/app/src/main/res/drawable/previous.png b/app/src/main/res/drawable/previous.png deleted file mode 100644 index d2c30763..00000000 Binary files a/app/src/main/res/drawable/previous.png and /dev/null differ diff --git a/app/src/main/res/drawable/showjava_logo.png b/app/src/main/res/drawable/showjava_logo.png deleted file mode 100644 index 4a768d41..00000000 Binary files a/app/src/main/res/drawable/showjava_logo.png and /dev/null differ diff --git a/app/src/main/res/drawable/type_css.png b/app/src/main/res/drawable/type_css.png deleted file mode 100644 index 063ee89c..00000000 Binary files a/app/src/main/res/drawable/type_css.png and /dev/null differ diff --git a/app/src/main/res/drawable/type_file.png b/app/src/main/res/drawable/type_file.png deleted file mode 100644 index 84bc7330..00000000 Binary files a/app/src/main/res/drawable/type_file.png and /dev/null differ diff --git a/app/src/main/res/drawable/type_folder.png b/app/src/main/res/drawable/type_folder.png deleted file mode 100644 index fff23b50..00000000 Binary files a/app/src/main/res/drawable/type_folder.png and /dev/null differ diff --git a/app/src/main/res/drawable/type_html.png b/app/src/main/res/drawable/type_html.png deleted file mode 100644 index bcd05cf1..00000000 Binary files a/app/src/main/res/drawable/type_html.png and /dev/null differ diff --git a/app/src/main/res/drawable/type_jar.png b/app/src/main/res/drawable/type_jar.png deleted file mode 100644 index 96b86c2d..00000000 Binary files a/app/src/main/res/drawable/type_jar.png and /dev/null differ diff --git a/app/src/main/res/drawable/type_java.png b/app/src/main/res/drawable/type_java.png deleted file mode 100644 index 322a37d1..00000000 Binary files a/app/src/main/res/drawable/type_java.png and /dev/null differ diff --git a/app/src/main/res/drawable/type_javascript.png b/app/src/main/res/drawable/type_javascript.png deleted file mode 100644 index 78df56ee..00000000 Binary files a/app/src/main/res/drawable/type_javascript.png and /dev/null differ diff --git a/app/src/main/res/drawable/type_jpg.png b/app/src/main/res/drawable/type_jpg.png deleted file mode 100644 index 8d84334a..00000000 Binary files a/app/src/main/res/drawable/type_jpg.png and /dev/null differ diff --git a/app/src/main/res/drawable/type_json.png b/app/src/main/res/drawable/type_json.png deleted file mode 100644 index ac447527..00000000 Binary files a/app/src/main/res/drawable/type_json.png and /dev/null differ diff --git a/app/src/main/res/drawable/type_png.png b/app/src/main/res/drawable/type_png.png deleted file mode 100644 index bcb12883..00000000 Binary files a/app/src/main/res/drawable/type_png.png and /dev/null differ diff --git a/app/src/main/res/drawable/type_txt.png b/app/src/main/res/drawable/type_txt.png deleted file mode 100644 index ffa0130b..00000000 Binary files a/app/src/main/res/drawable/type_txt.png and /dev/null differ diff --git a/app/src/main/res/drawable/type_xml.png b/app/src/main/res/drawable/type_xml.png deleted file mode 100644 index 8dea205a..00000000 Binary files a/app/src/main/res/drawable/type_xml.png and /dev/null differ diff --git a/app/src/main/res/drawable/type_zip.png b/app/src/main/res/drawable/type_zip.png deleted file mode 100644 index a96dea23..00000000 Binary files a/app/src/main/res/drawable/type_zip.png and /dev/null differ diff --git a/app/src/main/res/font/lato.xml b/app/src/main/res/font/lato.xml deleted file mode 100644 index 5994a1d7..00000000 --- a/app/src/main/res/font/lato.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - diff --git a/app/src/main/res/font/lato_bold.ttf b/app/src/main/res/font/lato_bold.ttf deleted file mode 100755 index 74343694..00000000 Binary files a/app/src/main/res/font/lato_bold.ttf and /dev/null differ diff --git a/app/src/main/res/font/lato_light.ttf b/app/src/main/res/font/lato_light.ttf deleted file mode 100755 index a958067a..00000000 Binary files a/app/src/main/res/font/lato_light.ttf and /dev/null differ diff --git a/app/src/main/res/font/lato_regular.ttf b/app/src/main/res/font/lato_regular.ttf deleted file mode 100755 index 04ea8efb..00000000 Binary files a/app/src/main/res/font/lato_regular.ttf and /dev/null differ diff --git a/app/src/main/res/layout/action_layout_checkbox.xml b/app/src/main/res/layout/action_layout_checkbox.xml deleted file mode 100644 index 66c4ea2c..00000000 --- a/app/src/main/res/layout/action_layout_checkbox.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/activity_about.xml b/app/src/main/res/layout/activity_about.xml deleted file mode 100644 index ee7b82c1..00000000 --- a/app/src/main/res/layout/activity_about.xml +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/activity_apps.xml b/app/src/main/res/layout/activity_apps.xml deleted file mode 100644 index 1c146f72..00000000 --- a/app/src/main/res/layout/activity_apps.xml +++ /dev/null @@ -1,121 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/src/main/res/layout/activity_code_viewer.xml b/app/src/main/res/layout/activity_code_viewer.xml deleted file mode 100644 index 9b72006b..00000000 --- a/app/src/main/res/layout/activity_code_viewer.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - diff --git a/app/src/main/res/layout/activity_decompiler.xml b/app/src/main/res/layout/activity_decompiler.xml deleted file mode 100644 index c008174f..00000000 --- a/app/src/main/res/layout/activity_decompiler.xml +++ /dev/null @@ -1,180 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/activity_decompiler_process.xml b/app/src/main/res/layout/activity_decompiler_process.xml deleted file mode 100644 index 96897906..00000000 --- a/app/src/main/res/layout/activity_decompiler_process.xml +++ /dev/null @@ -1,157 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/activity_image_viewer.xml b/app/src/main/res/layout/activity_image_viewer.xml deleted file mode 100644 index 789e27a7..00000000 --- a/app/src/main/res/layout/activity_image_viewer.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - diff --git a/app/src/main/res/layout/activity_landing.xml b/app/src/main/res/layout/activity_landing.xml deleted file mode 100644 index 632aee82..00000000 --- a/app/src/main/res/layout/activity_landing.xml +++ /dev/null @@ -1,159 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/src/main/res/layout/activity_low_memory.xml b/app/src/main/res/layout/activity_low_memory.xml deleted file mode 100644 index 8c8f4aa8..00000000 --- a/app/src/main/res/layout/activity_low_memory.xml +++ /dev/null @@ -1,92 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/activity_navigator.xml b/app/src/main/res/layout/activity_navigator.xml deleted file mode 100644 index 1aff782a..00000000 --- a/app/src/main/res/layout/activity_navigator.xml +++ /dev/null @@ -1,56 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/app/src/main/res/layout/activity_purchase.xml b/app/src/main/res/layout/activity_purchase.xml deleted file mode 100644 index ccad246d..00000000 --- a/app/src/main/res/layout/activity_purchase.xml +++ /dev/null @@ -1,100 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml deleted file mode 100644 index 86e342e9..00000000 --- a/app/src/main/res/layout/activity_settings.xml +++ /dev/null @@ -1,56 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/layout_admob.xml b/app/src/main/res/layout/layout_admob.xml deleted file mode 100644 index 29dabe6f..00000000 --- a/app/src/main/res/layout/layout_admob.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/layout_app_list_item.xml b/app/src/main/res/layout/layout_app_list_item.xml deleted file mode 100644 index 09fdd7e3..00000000 --- a/app/src/main/res/layout/layout_app_list_item.xml +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/src/main/res/layout/layout_drawer_header.xml b/app/src/main/res/layout/layout_drawer_header.xml deleted file mode 100644 index df7c3601..00000000 --- a/app/src/main/res/layout/layout_drawer_header.xml +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - - - - - diff --git a/app/src/main/res/layout/layout_pick_decompiler_list_item.xml b/app/src/main/res/layout/layout_pick_decompiler_list_item.xml deleted file mode 100644 index 7d3f2ef9..00000000 --- a/app/src/main/res/layout/layout_pick_decompiler_list_item.xml +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/app/src/main/res/layout/layout_toolbar.xml b/app/src/main/res/layout/layout_toolbar.xml deleted file mode 100644 index b02b39ba..00000000 --- a/app/src/main/res/layout/layout_toolbar.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - \ No newline at end of file diff --git a/app/src/main/res/menu/menu_app.xml b/app/src/main/res/menu/menu_app.xml deleted file mode 100644 index a0c62dcf..00000000 --- a/app/src/main/res/menu/menu_app.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/menu/menu_fab.xml b/app/src/main/res/menu/menu_fab.xml deleted file mode 100644 index e4d16515..00000000 --- a/app/src/main/res/menu/menu_fab.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - diff --git a/app/src/main/res/menu/menu_main.xml b/app/src/main/res/menu/menu_main.xml deleted file mode 100644 index d6401367..00000000 --- a/app/src/main/res/menu/menu_main.xml +++ /dev/null @@ -1,122 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png deleted file mode 100644 index 71d89846..00000000 Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher.png and /dev/null differ diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png deleted file mode 100644 index e627f787..00000000 Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher_round.png and /dev/null differ diff --git a/app/src/main/res/mipmap-hdpi/ic_logo_plain.png b/app/src/main/res/mipmap-hdpi/ic_logo_plain.png deleted file mode 100644 index 739245d3..00000000 Binary files a/app/src/main/res/mipmap-hdpi/ic_logo_plain.png and /dev/null differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png deleted file mode 100644 index e2265367..00000000 Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher.png and /dev/null differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png deleted file mode 100644 index 48b04d10..00000000 Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher_round.png and /dev/null differ diff --git a/app/src/main/res/mipmap-mdpi/ic_logo_plain.png b/app/src/main/res/mipmap-mdpi/ic_logo_plain.png deleted file mode 100644 index b2d1728d..00000000 Binary files a/app/src/main/res/mipmap-mdpi/ic_logo_plain.png and /dev/null differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png deleted file mode 100644 index 3441883e..00000000 Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher.png and /dev/null differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png deleted file mode 100644 index 7adad230..00000000 Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png and /dev/null differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_logo_plain.png b/app/src/main/res/mipmap-xhdpi/ic_logo_plain.png deleted file mode 100644 index 335982f1..00000000 Binary files a/app/src/main/res/mipmap-xhdpi/ic_logo_plain.png and /dev/null differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png deleted file mode 100644 index b5f69400..00000000 Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and /dev/null differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png deleted file mode 100644 index a49e98bc..00000000 Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png and /dev/null differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_logo_plain.png b/app/src/main/res/mipmap-xxhdpi/ic_logo_plain.png deleted file mode 100644 index 87fe728d..00000000 Binary files a/app/src/main/res/mipmap-xxhdpi/ic_logo_plain.png and /dev/null differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png deleted file mode 100644 index 43b18f33..00000000 Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and /dev/null differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png deleted file mode 100644 index 02a953b8..00000000 Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png and /dev/null differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_logo_plain.png b/app/src/main/res/mipmap-xxxhdpi/ic_logo_plain.png deleted file mode 100644 index 464a3f5b..00000000 Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_logo_plain.png and /dev/null differ diff --git a/app/src/main/res/transition/default_window_fade.xml b/app/src/main/res/transition/default_window_fade.xml deleted file mode 100644 index c8241d12..00000000 --- a/app/src/main/res/transition/default_window_fade.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - diff --git a/app/src/main/res/values-sw360dp-v13/values-preference.xml b/app/src/main/res/values-sw360dp-v13/values-preference.xml deleted file mode 100644 index 21cc96c2..00000000 --- a/app/src/main/res/values-sw360dp-v13/values-preference.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - false - 0dp - diff --git a/app/src/main/res/values-v21/styles.xml b/app/src/main/res/values-v21/styles.xml deleted file mode 100644 index 4e5950dd..00000000 --- a/app/src/main/res/values-v21/styles.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/values/array.xml b/app/src/main/res/values/array.xml deleted file mode 100644 index 28fa3454..00000000 --- a/app/src/main/res/values/array.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - @drawable/fab_label - @drawable/fab_label - @drawable/fab_label - @drawable/fab_label - @drawable/fab_label - - diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml deleted file mode 100644 index 050f1715..00000000 --- a/app/src/main/res/values/colors.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - #3F51B5 - #303F9F - #D32F2F - - @color/white - - #000000 - #212121 - #616161 - #BDBDBD - - #4CAF50 - #FFC107 - #FF9800 - #F44336 - - #ffffff - #22d32f2f - #282b2e - diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml deleted file mode 100644 index 761207ba..00000000 --- a/app/src/main/res/values/dimens.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - 16dp - diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml deleted file mode 100644 index f52e704f..00000000 --- a/app/src/main/res/values/strings.xml +++ /dev/null @@ -1,184 +0,0 @@ - - - - Settings - Close drawer - Open drawer - Decompiler settings - Select default decompiler - Speed up decompiling process - Speed up by ignoring common open sourced libraries - Show/Hide the decompiler selection dialog box - Don\'t ask to pick decompiler each time - Tap to rate this app on Play Store - Report a bug - Rate & Review - Ease of use - Help & Support - Tap to report any bug (or) issue found in this app - About - Invert background color - - Show Java - requires storage permission to store decompiled sources - - Welcome - tap the plus button to begin - - App icon - Pick an app to explore - Pick from SD Card - Pick from installed - Loading installed applications … - Loading gear - Loading %1$s - - %1$d of %2$d - - Waiting to start - Processing - Getting ready - Cancel - Decompile - View source - Pick a decompiler - You might want to checkout the source code on GitHub instead ;) - This Package has already been decompiled - This application has already been decompiled once and the source exists on your sdcard. What would you like to do ? - No supported applications for this file type. - Search apps - niranjan94 - \@niranjan94 - Failed to parse the selected apk file - Decompiling JAR files is unsupported. Will be available soon. - File is unsupported. - Building JAR from Input - Decompiling to java - Extracting resources - Optimizing - Optimizing classes - Merging classes - Wrap lines - Line numbers - Zoomable - The process was cancelled. - You already own this item. Please close and re-open the application to load your purchases. - This item is currently unavailable. Try again later. - There was an error with your account. - An error occurred while processing your payment. Please try again. - An error occurred while processing your request. - No advertisements - Early access to new features - Buy Now - - - CFR 0.140 - JaDX 0.9.0 - FernFlower a0a8f0a - - - - cfr - jadx - fernflower - - - - A fast decompiler that can decompile modern Java features up to and including much of Java 9, 10 and beyond - A decompiler optimised for working with Android dex/apk files - The first working analytical decompiler for Java - - - View Open source licenses - Open source licenses - Tap to view open source licenses - Starting DEX to JAR Conversion - Share source - Delete source - Decompiler Unavailable - JaDX and Fernflower use newer Java features such as some types of lambda\'s which are not available on pre-N versions of Android.\n\nPlease use CFR instead. - Delete source history - Are you sure you want to delete the decompiled source ? - Are you sure you want to delete source history ? - Compressing source - The source has been deleted from your device. - The sources have been deleted from your device. - Send source via - View previously decompiled source - Select a File - Writing dex file - Writing jar file - Chunk %1$d of %2$d - Experimental - Class definitions per dex chunk - Max attempts for decompilation - Cannot decompile the file selected - Clear source history - Delete previously decompiled sources - Tap to view source - %1$s has been decompiled - %1$s could not be decompiled - Tap to retry - Show System Apps - Allow decompiling system apps. (Buggy) - All - System - User - Warning: This is a system application. Successful decompilation may not be possible. - Memory usage - (waiting) - Advanced - Show memory usage - Display live app memory usage on the decompiler screen - Low memory - The selected decompiler ran out of RAM while attempting to decompile - Try reducing the classes per chunk or increasing memory threshold and/or pick another decompiler. - Ran out of RAM. Tap for more info. - Memory usage threshold (in %) - Dark mode (Beta) - Turn on/off dark mode for the app - Close and re-open app for the theme to take complete effect - File a bug report - Thanks for reporting :). The high memory usage will be investigated. - Purchase verification failed. Please try again. If issue persists, drop in an email at me\@niranjan.io - Thank you for purchasing Show Java Pro ! :) You are awesome ! - An error occurred while initializing purchase. Please try again later. - - Device failed the verification for making in-app purchases on Show Java. - (%1$s) - - - You cannot make in-app purchases on Show Java due to the presence of the app %1$s - which is flagged as one that is used for piracy. - - Ads Preferences - Change your personalization preferences for Ads - Initializing - Use custom font - Choose between lato or system default font - User interface - (ID: %1$s) - Only positive integers are allowed - Error loading input file - An unexpected error occurred - An error occurred while loading files - JaDX and Fernflower decompilers are available only on android devices running Android 7.0 and above. - Keep intermediate files - Do not delete dex & jar files created during the decompilation - diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml deleted file mode 100644 index 0a7cf481..00000000 --- a/app/src/main/res/values/styles.xml +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/src/main/res/xml/file_provider_paths.xml b/app/src/main/res/xml/file_provider_paths.xml deleted file mode 100644 index eb4fc83a..00000000 --- a/app/src/main/res/xml/file_provider_paths.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml deleted file mode 100644 index 3fd359a0..00000000 --- a/app/src/main/res/xml/preferences.xml +++ /dev/null @@ -1,155 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/xml/searchable.xml b/app/src/main/res/xml/searchable.xml deleted file mode 100644 index 25b59ad8..00000000 --- a/app/src/main/res/xml/searchable.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - \ No newline at end of file diff --git a/app/src/test/kotlin/com/njlabs/showjava/ExampleUnitTest.kt b/app/src/test/kotlin/com/njlabs/showjava/ExampleUnitTest.kt deleted file mode 100644 index 86a825e4..00000000 --- a/app/src/test/kotlin/com/njlabs/showjava/ExampleUnitTest.kt +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Show Java - A java/apk decompiler for android - * Copyright (c) 2018 Niranjan Rajendran - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.njlabs.showjava - -import org.junit.Assert.assertEquals -import org.junit.Test - -/** - * Example local unit test, which will execute on the development machine (host). - - * @see [Testing documentation](http://d.android.com/tools/testing) - */ -class ExampleUnitTest { - @Test - @Throws(Exception::class) - fun additionIsCorrect() { - assertEquals(4, (2 + 2).toLong()) - } -} \ No newline at end of file diff --git a/app/test-proguard-rules.pro b/app/test-proguard-rules.pro deleted file mode 100644 index be9330f1..00000000 --- a/app/test-proguard-rules.pro +++ /dev/null @@ -1,17 +0,0 @@ -# Proguard rules that are applied to your test apk/code. --ignorewarnings - --keepattributes *Annotation* - --dontnote junit.framework.** --dontnote junit.runner.** - --keep class androidx.test.** --keep class androidx.test.** { *; } --keep class com.njlabs.showjava.** { *; } --keep class com.android.dex.** { *; } - --dontwarn androidx.test.** --dontwarn androidx.** --dontwarn android.support.test.** --dontwarn org.junit.** diff --git a/build.gradle b/build.gradle deleted file mode 100644 index 4ab4c0bd..00000000 --- a/build.gradle +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Show Java - A java/apk decompiler for android - * Copyright (c) 2018 Niranjan Rajendran - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -// Top-level build file where you can add configuration options common to all sub-projects/modules. - -buildscript { - - ext.kotlin_version = '1.3.31' - - repositories { - google() - jcenter() - maven { url "https://maven.fabric.io/public" } - } - dependencies { - classpath 'com.android.tools.build:gradle:3.5.0-beta04' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - classpath "com.google.gms:google-services:4.2.0" - classpath "io.fabric.tools:gradle:1.27.1" - classpath "com.bryansharp:hibeaver:1.2.7" - classpath "io.michaelrocks:paranoid-gradle-plugin:0.2.4" - classpath "com.google.android.gms:oss-licenses-plugin:0.9.5" - classpath "ru.tinkoff.gradle:jarjar:1.1.0" - } -} - -plugins { - id "com.github.ben-manes.versions" version "0.21.0" -} - - -allprojects { - repositories { - google() - jcenter() - maven { url "https://jitpack.io" } - maven { url "https://maven.google.com/" } - } -} - -tasks.register("clean", Delete) { - delete rootProject.buildDir -} - diff --git a/gradle.properties b/gradle.properties deleted file mode 100644 index 7a91281b..00000000 --- a/gradle.properties +++ /dev/null @@ -1,18 +0,0 @@ -# Project-wide Gradle settings. - -# IDE (e.g. Android Studio) users: -# Gradle settings configured through the IDE *will override* -# any settings specified in this file. - -# For more details on how to configure your build environment visit -# http://www.gradle.org/docs/current/userguide/build_environment.html - -# AndroidX & Jetpack config - https://developer.android.com/jetpack/androidx/migrate -android.enableJetifier=true -android.useAndroidX=true - -# Specifies the JVM arguments used for the daemon process. -# The setting is particularly useful for tweaking memory settings. -org.gradle.jvmargs=-Xmx4608M - -# android.enableR8 = true \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index f6b961fd..00000000 Binary files a/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index f72d3e31..00000000 --- a/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,6 +0,0 @@ -#Sat Jun 22 16:57:42 IST 2019 -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip diff --git a/gradlew b/gradlew deleted file mode 100755 index cccdd3d5..00000000 --- a/gradlew +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/env sh - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn () { - echo "$*" -} - -die () { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=$(save "$@") - -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" - -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - -exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat deleted file mode 100755 index e95643d6..00000000 --- a/gradlew.bat +++ /dev/null @@ -1,84 +0,0 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/index.md b/index.md new file mode 100644 index 00000000..d468c88d --- /dev/null +++ b/index.md @@ -0,0 +1,68 @@ +[![Dependency Status](https://www.versioneye.com/user/projects/5749244fce8d0e004505f807/badge.svg?style=flat)](https://www.versioneye.com/user/projects/5749244fce8d0e004505f807) [![Build Status](https://img.shields.io/travis/niranjan94/show-java.svg?style=flat-square)](https://travis-ci.org/niranjan94/show-java) [![License Info](https://img.shields.io/badge/license-GNU_AGPLv3-blue.svg?style=flat-square)](https://github.com/niranjan94/show-java) [![Play Store Info](https://img.shields.io/badge/Play_Store-v2.1.0-36B0C1.svg?style=flat-square)](https://play.google.com/store/apps/details?id=com.njlabs.showjava) [![GitHub app version](https://img.shields.io/badge/GitHub-v2.1.0-yellow.svg?style=flat-square)](https://github.com/niranjan94/show-java) [![Play Store downloads](https://img.shields.io/badge/downloads-260k%20total-E04253.svg?style=flat-square)](https://play.google.com/store/apps/details?id=com.njlabs.showjava) + + +![ShowJava Banner v0.1](https://raw.githubusercontent.com/niranjan94/show-java/master/banner.png?v1) + +An apk decompiler for android. Built on Android Studio 1.5 with gradle 2.8 + +> The current GitHub master branch may be ahead of the Play Store version (and could be unstable/incomplete/buggy at some places) + +[Get Show Java on Google Play](https://play.google.com/store/apps/details?id=com.njlabs.showjava "Get Show Java on Google Play") +## About +This is a Decompiler that extracts the source code of an Android application (including XML files and image assets). Works directly from your android device. + +## Features + +- Select either **CFR 0.110**, **JaDX 0.6.1** or **FernFlower (analytical decompiler)** to use as the decompiler (more to come). +- Runs directly on an android device (4.x and above). +- Select apk from sdcard (or) from a list of installed applications. +- Easy to use. +- Decompiles resources too (layouts, Drawables, Menus, AndroidManifest, image assets). +- Displays code in a clean-syntax-highlighted form. +- The decompiled source can easily be copied from the sdcard (source is stored in ShowJava folder in the sdcard). +- Simple source browser with a summary of all decompilation errors. +- Each decompiled source file has commented references to classes that could not be decompiled. +- Share the decompiled source easily with the built in archive + share mechanism. + +## Known Issues +1. Does not work with system applications in most of the phones (especially ones that are not de-odexed). +2. Slow on phones with single core processors. + +## Contributing to ShowJava + +Head over [here](https://github.com/niranjan94/show-java/blob/master/CONTRIBUTING.md) to know more about how to contribute, report bugs and request feature additions. + +## Open Source License + +Unless explicitly stated otherwise all files in this repository are licensed under the [GNU Affero General Public License v3.0](https://www.gnu.org/licenses/agpl-3.0.txt). All projects **must** properly attribute [The Original Source](https://github.com/niranjan94/show-java). + + Show Java - A java/apk decompiler for android + Copyright (C) 2017 Niranjan Rajendran + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + +An unmodified copy of the above license text must be included in all forks. + +To obtain the software under a different license, please contact [Niranjan Rajendran](https://niranjan.io) at `me niranjan.io`. + +## External Credits + +1. A Big-Huge Thanks to Lee Benfield ([lee@benf.org](mailto:lee@benf.org)) for his awesome CFR - Class File Reader +2. Panxiaobo ([pxb1988@gmail.com](mailto:pxb1988@gmail.com)) for dex2jar. +3. [Liu Dong](https://github.com/xiaxiaocao) for apk-parser. +4. [Ben Gruver](https://github.com/JesusFreke/) for dexlib2. +5. [skylot](https://github.com/skylot) for JaDX. +6. [JetBrains](https://github.com/JetBrains) for FernFlower analytical decompiler. + +> Android, Google Play and the Google Play logo are trademarks of Google Inc. diff --git a/settings.gradle b/settings.gradle deleted file mode 100644 index ea169362..00000000 --- a/settings.gradle +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Show Java - A java/apk decompiler for android - * Copyright (c) 2018 Niranjan Rajendran - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -include ":app" diff --git a/stylesheets/github-light.css b/stylesheets/github-light.css new file mode 100644 index 00000000..d64ba5df --- /dev/null +++ b/stylesheets/github-light.css @@ -0,0 +1,124 @@ +/* +The MIT License (MIT) + +Copyright (c) 2015 GitHub, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +*/ + +.pl-c /* comment */ { + color: #969896; +} + +.pl-c1 /* constant, markup.raw, meta.diff.header, meta.module-reference, meta.property-name, support, support.constant, support.variable, variable.other.constant */, +.pl-s .pl-v /* string variable */ { + color: #0086b3; +} + +.pl-e /* entity */, +.pl-en /* entity.name */ { + color: #795da3; +} + +.pl-s .pl-s1 /* string source */, +.pl-smi /* storage.modifier.import, storage.modifier.package, storage.type.java, variable.other, variable.parameter.function */ { + color: #333; +} + +.pl-ent /* entity.name.tag */ { + color: #63a35c; +} + +.pl-k /* keyword, storage, storage.type */ { + color: #a71d5d; +} + +.pl-pds /* punctuation.definition.string, string.regexp.character-class */, +.pl-s /* string */, +.pl-s .pl-pse .pl-s1 /* string punctuation.section.embedded source */, +.pl-sr /* string.regexp */, +.pl-sr .pl-cce /* string.regexp constant.character.escape */, +.pl-sr .pl-sra /* string.regexp string.regexp.arbitrary-repitition */, +.pl-sr .pl-sre /* string.regexp source.ruby.embedded */ { + color: #183691; +} + +.pl-v /* variable */ { + color: #ed6a43; +} + +.pl-id /* invalid.deprecated */ { + color: #b52a1d; +} + +.pl-ii /* invalid.illegal */ { + background-color: #b52a1d; + color: #f8f8f8; +} + +.pl-sr .pl-cce /* string.regexp constant.character.escape */ { + color: #63a35c; + font-weight: bold; +} + +.pl-ml /* markup.list */ { + color: #693a17; +} + +.pl-mh /* markup.heading */, +.pl-mh .pl-en /* markup.heading entity.name */, +.pl-ms /* meta.separator */ { + color: #1d3e81; + font-weight: bold; +} + +.pl-mq /* markup.quote */ { + color: #008080; +} + +.pl-mi /* markup.italic */ { + color: #333; + font-style: italic; +} + +.pl-mb /* markup.bold */ { + color: #333; + font-weight: bold; +} + +.pl-md /* markup.deleted, meta.diff.header.from-file */ { + background-color: #ffecec; + color: #bd2c00; +} + +.pl-mi1 /* markup.inserted, meta.diff.header.to-file */ { + background-color: #eaffea; + color: #55a532; +} + +.pl-mdr /* meta.diff.range */ { + color: #795da3; + font-weight: bold; +} + +.pl-mo /* meta.output */ { + color: #1d3e81; +} + diff --git a/stylesheets/normalize.css b/stylesheets/normalize.css new file mode 100644 index 00000000..30366a6e --- /dev/null +++ b/stylesheets/normalize.css @@ -0,0 +1,424 @@ +/*! normalize.css v3.0.2 | MIT License | git.io/normalize */ + +/** + * 1. Set default font family to sans-serif. + * 2. Prevent iOS text size adjust after orientation change, without disabling + * user zoom. + */ + +html { + font-family: sans-serif; /* 1 */ + -ms-text-size-adjust: 100%; /* 2 */ + -webkit-text-size-adjust: 100%; /* 2 */ +} + +/** + * Remove default margin. + */ + +body { + margin: 0; +} + +/* HTML5 display definitions + ========================================================================== */ + +/** + * Correct `block` display not defined for any HTML5 element in IE 8/9. + * Correct `block` display not defined for `details` or `summary` in IE 10/11 + * and Firefox. + * Correct `block` display not defined for `main` in IE 11. + */ + +article, +aside, +details, +figcaption, +figure, +footer, +header, +hgroup, +main, +menu, +nav, +section, +summary { + display: block; +} + +/** + * 1. Correct `inline-block` display not defined in IE 8/9. + * 2. Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera. + */ + +audio, +canvas, +progress, +video { + display: inline-block; /* 1 */ + vertical-align: baseline; /* 2 */ +} + +/** + * Prevent modern browsers from displaying `audio` without controls. + * Remove excess height in iOS 5 devices. + */ + +audio:not([controls]) { + display: none; + height: 0; +} + +/** + * Address `[hidden]` styling not present in IE 8/9/10. + * Hide the `template` element in IE 8/9/11, Safari, and Firefox < 22. + */ + +[hidden], +template { + display: none; +} + +/* Links + ========================================================================== */ + +/** + * Remove the gray background color from active links in IE 10. + */ + +a { + background-color: transparent; +} + +/** + * Improve readability when focused and also mouse hovered in all browsers. + */ + +a:active, +a:hover { + outline: 0; +} + +/* Text-level semantics + ========================================================================== */ + +/** + * Address styling not present in IE 8/9/10/11, Safari, and Chrome. + */ + +abbr[title] { + border-bottom: 1px dotted; +} + +/** + * Address style set to `bolder` in Firefox 4+, Safari, and Chrome. + */ + +b, +strong { + font-weight: bold; +} + +/** + * Address styling not present in Safari and Chrome. + */ + +dfn { + font-style: italic; +} + +/** + * Address variable `h1` font-size and margin within `section` and `article` + * contexts in Firefox 4+, Safari, and Chrome. + */ + +h1 { + font-size: 2em; + margin: 0.67em 0; +} + +/** + * Address styling not present in IE 8/9. + */ + +mark { + background: #ff0; + color: #000; +} + +/** + * Address inconsistent and variable font size in all browsers. + */ + +small { + font-size: 80%; +} + +/** + * Prevent `sub` and `sup` affecting `line-height` in all browsers. + */ + +sub, +sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; +} + +sup { + top: -0.5em; +} + +sub { + bottom: -0.25em; +} + +/* Embedded content + ========================================================================== */ + +/** + * Remove border when inside `a` element in IE 8/9/10. + */ + +img { + border: 0; +} + +/** + * Correct overflow not hidden in IE 9/10/11. + */ + +svg:not(:root) { + overflow: hidden; +} + +/* Grouping content + ========================================================================== */ + +/** + * Address margin not present in IE 8/9 and Safari. + */ + +figure { + margin: 1em 40px; +} + +/** + * Address differences between Firefox and other browsers. + */ + +hr { + box-sizing: content-box; + height: 0; +} + +/** + * Contain overflow in all browsers. + */ + +pre { + overflow: auto; +} + +/** + * Address odd `em`-unit font size rendering in all browsers. + */ + +code, +kbd, +pre, +samp { + font-family: monospace, monospace; + font-size: 1em; +} + +/* Forms + ========================================================================== */ + +/** + * Known limitation: by default, Chrome and Safari on OS X allow very limited + * styling of `select`, unless a `border` property is set. + */ + +/** + * 1. Correct color not being inherited. + * Known issue: affects color of disabled elements. + * 2. Correct font properties not being inherited. + * 3. Address margins set differently in Firefox 4+, Safari, and Chrome. + */ + +button, +input, +optgroup, +select, +textarea { + color: inherit; /* 1 */ + font: inherit; /* 2 */ + margin: 0; /* 3 */ +} + +/** + * Address `overflow` set to `hidden` in IE 8/9/10/11. + */ + +button { + overflow: visible; +} + +/** + * Address inconsistent `text-transform` inheritance for `button` and `select`. + * All other form control elements do not inherit `text-transform` values. + * Correct `button` style inheritance in Firefox, IE 8/9/10/11, and Opera. + * Correct `select` style inheritance in Firefox. + */ + +button, +select { + text-transform: none; +} + +/** + * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio` + * and `video` controls. + * 2. Correct inability to style clickable `input` types in iOS. + * 3. Improve usability and consistency of cursor style between image-type + * `input` and others. + */ + +button, +html input[type="button"], /* 1 */ +input[type="reset"], +input[type="submit"] { + -webkit-appearance: button; /* 2 */ + cursor: pointer; /* 3 */ +} + +/** + * Re-set default cursor for disabled elements. + */ + +button[disabled], +html input[disabled] { + cursor: default; +} + +/** + * Remove inner padding and border in Firefox 4+. + */ + +button::-moz-focus-inner, +input::-moz-focus-inner { + border: 0; + padding: 0; +} + +/** + * Address Firefox 4+ setting `line-height` on `input` using `!important` in + * the UA stylesheet. + */ + +input { + line-height: normal; +} + +/** + * It's recommended that you don't attempt to style these elements. + * Firefox's implementation doesn't respect box-sizing, padding, or width. + * + * 1. Address box sizing set to `content-box` in IE 8/9/10. + * 2. Remove excess padding in IE 8/9/10. + */ + +input[type="checkbox"], +input[type="radio"] { + box-sizing: border-box; /* 1 */ + padding: 0; /* 2 */ +} + +/** + * Fix the cursor style for Chrome's increment/decrement buttons. For certain + * `font-size` values of the `input`, it causes the cursor style of the + * decrement button to change from `default` to `text`. + */ + +input[type="number"]::-webkit-inner-spin-button, +input[type="number"]::-webkit-outer-spin-button { + height: auto; +} + +/** + * 1. Address `appearance` set to `searchfield` in Safari and Chrome. + * 2. Address `box-sizing` set to `border-box` in Safari and Chrome + * (include `-moz` to future-proof). + */ + +input[type="search"] { + -webkit-appearance: textfield; /* 1 */ /* 2 */ + box-sizing: content-box; +} + +/** + * Remove inner padding and search cancel button in Safari and Chrome on OS X. + * Safari (but not Chrome) clips the cancel button when the search input has + * padding (and `textfield` appearance). + */ + +input[type="search"]::-webkit-search-cancel-button, +input[type="search"]::-webkit-search-decoration { + -webkit-appearance: none; +} + +/** + * Define consistent border, margin, and padding. + */ + +fieldset { + border: 1px solid #c0c0c0; + margin: 0 2px; + padding: 0.35em 0.625em 0.75em; +} + +/** + * 1. Correct `color` not being inherited in IE 8/9/10/11. + * 2. Remove padding so people aren't caught out if they zero out fieldsets. + */ + +legend { + border: 0; /* 1 */ + padding: 0; /* 2 */ +} + +/** + * Remove default vertical scrollbar in IE 8/9/10/11. + */ + +textarea { + overflow: auto; +} + +/** + * Don't inherit the `font-weight` (applied by a rule above). + * NOTE: the default cannot safely be changed in Chrome and Safari on OS X. + */ + +optgroup { + font-weight: bold; +} + +/* Tables + ========================================================================== */ + +/** + * Remove most spacing between table cells. + */ + +table { + border-collapse: collapse; + border-spacing: 0; +} + +td, +th { + padding: 0; +} diff --git a/stylesheets/styles.css b/stylesheets/styles.css new file mode 100644 index 00000000..2e1768e1 --- /dev/null +++ b/stylesheets/styles.css @@ -0,0 +1,324 @@ +@font-face { + font-family: 'Noto Sans'; + font-weight: 400; + font-style: normal; + src: url('../fonts/Noto-Sans-regular/Noto-Sans-regular.eot'); + src: url('../fonts/Noto-Sans-regular/Noto-Sans-regular.eot?#iefix') format('embedded-opentype'), + local('Noto Sans'), + local('Noto-Sans-regular'), + url('../fonts/Noto-Sans-regular/Noto-Sans-regular.woff2') format('woff2'), + url('../fonts/Noto-Sans-regular/Noto-Sans-regular.woff') format('woff'), + url('../fonts/Noto-Sans-regular/Noto-Sans-regular.ttf') format('truetype'), + url('../fonts/Noto-Sans-regular/Noto-Sans-regular.svg#NotoSans') format('svg'); +} + +@font-face { + font-family: 'Noto Sans'; + font-weight: 700; + font-style: normal; + src: url('../fonts/Noto-Sans-700/Noto-Sans-700.eot'); + src: url('../fonts/Noto-Sans-700/Noto-Sans-700.eot?#iefix') format('embedded-opentype'), + local('Noto Sans Bold'), + local('Noto-Sans-700'), + url('../fonts/Noto-Sans-700/Noto-Sans-700.woff2') format('woff2'), + url('../fonts/Noto-Sans-700/Noto-Sans-700.woff') format('woff'), + url('../fonts/Noto-Sans-700/Noto-Sans-700.ttf') format('truetype'), + url('../fonts/Noto-Sans-700/Noto-Sans-700.svg#NotoSans') format('svg'); +} + +@font-face { + font-family: 'Noto Sans'; + font-weight: 400; + font-style: italic; + src: url('../fonts/Noto-Sans-italic/Noto-Sans-italic.eot'); + src: url('../fonts/Noto-Sans-italic/Noto-Sans-italic.eot?#iefix') format('embedded-opentype'), + local('Noto Sans Italic'), + local('Noto-Sans-italic'), + url('../fonts/Noto-Sans-italic/Noto-Sans-italic.woff2') format('woff2'), + url('../fonts/Noto-Sans-italic/Noto-Sans-italic.woff') format('woff'), + url('../fonts/Noto-Sans-italic/Noto-Sans-italic.ttf') format('truetype'), + url('../fonts/Noto-Sans-italic/Noto-Sans-italic.svg#NotoSans') format('svg'); +} + +@font-face { + font-family: 'Noto Sans'; + font-weight: 700; + font-style: italic; + src: url('../fonts/Noto-Sans-700italic/Noto-Sans-700italic.eot'); + src: url('../fonts/Noto-Sans-700italic/Noto-Sans-700italic.eot?#iefix') format('embedded-opentype'), + local('Noto Sans Bold Italic'), + local('Noto-Sans-700italic'), + url('../fonts/Noto-Sans-700italic/Noto-Sans-700italic.woff2') format('woff2'), + url('../fonts/Noto-Sans-700italic/Noto-Sans-700italic.woff') format('woff'), + url('../fonts/Noto-Sans-700italic/Noto-Sans-700italic.ttf') format('truetype'), + url('../fonts/Noto-Sans-700italic/Noto-Sans-700italic.svg#NotoSans') format('svg'); +} + +body { + background-color: #fff; + padding:50px; + font: 14px/1.5 "Noto Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; + color:#727272; + font-weight:400; +} + +h1, h2, h3, h4, h5, h6 { + color:#222; + margin:0 0 20px; +} + +p, ul, ol, table, pre, dl { + margin:0 0 20px; +} + +h1, h2, h3 { + line-height:1.1; +} + +h1 { + font-size:28px; +} + +h2 { + color:#393939; +} + +h3, h4, h5, h6 { + color:#494949; +} + +a { + color:#39c; + text-decoration:none; +} + +a:hover { + color:#069; +} + +a small { + font-size:11px; + color:#777; + margin-top:-0.3em; + display:block; +} + +a:hover small { + color:#777; +} + +.wrapper { + width:860px; + margin:0 auto; +} + +blockquote { + border-left:1px solid #e5e5e5; + margin:0; + padding:0 0 0 20px; + font-style:italic; +} + +code, pre { + font-family:Monaco, Bitstream Vera Sans Mono, Lucida Console, Terminal, Consolas, Liberation Mono, DejaVu Sans Mono, Courier New, monospace; + color:#333; + font-size:12px; +} + +pre { + padding:8px 15px; + background: #f8f8f8; + border-radius:5px; + border:1px solid #e5e5e5; + overflow-x: auto; +} + +table { + width:100%; + border-collapse:collapse; +} + +th, td { + text-align:left; + padding:5px 10px; + border-bottom:1px solid #e5e5e5; +} + +dt { + color:#444; + font-weight:700; +} + +th { + color:#444; +} + +img { + max-width:100%; +} + +header { + width:270px; + float:left; + position:fixed; + -webkit-font-smoothing:subpixel-antialiased; +} + +header ul { + list-style:none; + height:40px; + padding:0; + background: #f4f4f4; + border-radius:5px; + border:1px solid #e0e0e0; + width:270px; +} + +header li { + width:89px; + float:left; + border-right:1px solid #e0e0e0; + height:40px; +} + +header li:first-child a { + border-radius:5px 0 0 5px; +} + +header li:last-child a { + border-radius:0 5px 5px 0; +} + +header ul a { + line-height:1; + font-size:11px; + color:#999; + display:block; + text-align:center; + padding-top:6px; + height:34px; +} + +header ul a:hover { + color:#999; +} + +header ul a:active { + background-color:#f0f0f0; +} + +strong { + color:#222; + font-weight:700; +} + +header ul li + li + li { + border-right:none; + width:89px; +} + +header ul a strong { + font-size:14px; + display:block; + color:#222; +} + +section { + width:500px; + float:right; + padding-bottom:50px; +} + +small { + font-size:11px; +} + +hr { + border:0; + background:#e5e5e5; + height:1px; + margin:0 0 20px; +} + +footer { + width:270px; + float:left; + position:fixed; + bottom:50px; + -webkit-font-smoothing:subpixel-antialiased; +} + +@media print, screen and (max-width: 960px) { + + div.wrapper { + width:auto; + margin:0; + } + + header, section, footer { + float:none; + position:static; + width:auto; + } + + header { + padding-right:320px; + } + + section { + border:1px solid #e5e5e5; + border-width:1px 0; + padding:20px 0; + margin:0 0 20px; + } + + header a small { + display:inline; + } + + header ul { + position:absolute; + right:50px; + top:52px; + } +} + +@media print, screen and (max-width: 720px) { + body { + word-wrap:break-word; + } + + header { + padding:0; + } + + header ul, header p.view { + position:static; + } + + pre, code { + word-wrap:normal; + } +} + +@media print, screen and (max-width: 480px) { + body { + padding:15px; + } + + header ul { + width:99%; + } + + header li, header ul li + li + li { + width:33%; + } +} + +@media print { + body { + padding:0.4in; + font-size:12pt; + color:#444; + } +} diff --git a/stylesheets/stylesheet.css b/stylesheets/stylesheet.css new file mode 100644 index 00000000..b5f20c23 --- /dev/null +++ b/stylesheets/stylesheet.css @@ -0,0 +1,245 @@ +* { + box-sizing: border-box; } + +body { + padding: 0; + margin: 0; + font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; + font-size: 16px; + line-height: 1.5; + color: #606c71; } + +a { + color: #1e6bb8; + text-decoration: none; } + a:hover { + text-decoration: underline; } + +.btn { + display: inline-block; + margin-bottom: 1rem; + color: rgba(255, 255, 255, 0.7); + background-color: rgba(255, 255, 255, 0.08); + border-color: rgba(255, 255, 255, 0.2); + border-style: solid; + border-width: 1px; + border-radius: 0.3rem; + transition: color 0.2s, background-color 0.2s, border-color 0.2s; } + .btn + .btn { + margin-left: 1rem; } + +.btn:hover { + color: rgba(255, 255, 255, 0.8); + text-decoration: none; + background-color: rgba(255, 255, 255, 0.2); + border-color: rgba(255, 255, 255, 0.3); } + +@media screen and (min-width: 64em) { + .btn { + padding: 0.75rem 1rem; } } + +@media screen and (min-width: 42em) and (max-width: 64em) { + .btn { + padding: 0.6rem 0.9rem; + font-size: 0.9rem; } } + +@media screen and (max-width: 42em) { + .btn { + display: block; + width: 100%; + padding: 0.75rem; + font-size: 0.9rem; } + .btn + .btn { + margin-top: 1rem; + margin-left: 0; } } + +.page-header { + color: #fff; + text-align: center; + background-color: #159957; + background-image: linear-gradient(120deg, #155799, #159957); } + +@media screen and (min-width: 64em) { + .page-header { + padding: 5rem 6rem; } } + +@media screen and (min-width: 42em) and (max-width: 64em) { + .page-header { + padding: 3rem 4rem; } } + +@media screen and (max-width: 42em) { + .page-header { + padding: 2rem 1rem; } } + +.project-name { + margin-top: 0; + margin-bottom: 0.1rem; } + +@media screen and (min-width: 64em) { + .project-name { + font-size: 3.25rem; } } + +@media screen and (min-width: 42em) and (max-width: 64em) { + .project-name { + font-size: 2.25rem; } } + +@media screen and (max-width: 42em) { + .project-name { + font-size: 1.75rem; } } + +.project-tagline { + margin-bottom: 2rem; + font-weight: normal; + opacity: 0.7; } + +@media screen and (min-width: 64em) { + .project-tagline { + font-size: 1.25rem; } } + +@media screen and (min-width: 42em) and (max-width: 64em) { + .project-tagline { + font-size: 1.15rem; } } + +@media screen and (max-width: 42em) { + .project-tagline { + font-size: 1rem; } } + +.main-content :first-child { + margin-top: 0; } +.main-content img { + max-width: 100%; } +.main-content h1, .main-content h2, .main-content h3, .main-content h4, .main-content h5, .main-content h6 { + margin-top: 2rem; + margin-bottom: 1rem; + font-weight: normal; + color: #159957; } +.main-content p { + margin-bottom: 1em; } +.main-content code { + padding: 2px 4px; + font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; + font-size: 0.9rem; + color: #383e41; + background-color: #f3f6fa; + border-radius: 0.3rem; } +.main-content pre { + padding: 0.8rem; + margin-top: 0; + margin-bottom: 1rem; + font: 1rem Consolas, "Liberation Mono", Menlo, Courier, monospace; + color: #567482; + word-wrap: normal; + background-color: #f3f6fa; + border: solid 1px #dce6f0; + border-radius: 0.3rem; } + .main-content pre > code { + padding: 0; + margin: 0; + font-size: 0.9rem; + color: #567482; + word-break: normal; + white-space: pre; + background: transparent; + border: 0; } +.main-content .highlight { + margin-bottom: 1rem; } + .main-content .highlight pre { + margin-bottom: 0; + word-break: normal; } +.main-content .highlight pre, .main-content pre { + padding: 0.8rem; + overflow: auto; + font-size: 0.9rem; + line-height: 1.45; + border-radius: 0.3rem; } +.main-content pre code, .main-content pre tt { + display: inline; + max-width: initial; + padding: 0; + margin: 0; + overflow: initial; + line-height: inherit; + word-wrap: normal; + background-color: transparent; + border: 0; } + .main-content pre code:before, .main-content pre code:after, .main-content pre tt:before, .main-content pre tt:after { + content: normal; } +.main-content ul, .main-content ol { + margin-top: 0; } +.main-content blockquote { + padding: 0 1rem; + margin-left: 0; + color: #819198; + border-left: 0.3rem solid #dce6f0; } + .main-content blockquote > :first-child { + margin-top: 0; } + .main-content blockquote > :last-child { + margin-bottom: 0; } +.main-content table { + display: block; + width: 100%; + overflow: auto; + word-break: normal; + word-break: keep-all; } + .main-content table th { + font-weight: bold; } + .main-content table th, .main-content table td { + padding: 0.5rem 1rem; + border: 1px solid #e9ebec; } +.main-content dl { + padding: 0; } + .main-content dl dt { + padding: 0; + margin-top: 1rem; + font-size: 1rem; + font-weight: bold; } + .main-content dl dd { + padding: 0; + margin-bottom: 1rem; } +.main-content hr { + height: 2px; + padding: 0; + margin: 1rem 0; + background-color: #eff0f1; + border: 0; } + +@media screen and (min-width: 64em) { + .main-content { + max-width: 64rem; + padding: 2rem 6rem; + margin: 0 auto; + font-size: 1.1rem; } } + +@media screen and (min-width: 42em) and (max-width: 64em) { + .main-content { + padding: 2rem 4rem; + font-size: 1.1rem; } } + +@media screen and (max-width: 42em) { + .main-content { + padding: 2rem 1rem; + font-size: 1rem; } } + +.site-footer { + padding-top: 2rem; + margin-top: 2rem; + border-top: solid 1px #eff0f1; } + +.site-footer-owner { + display: block; + font-weight: bold; } + +.site-footer-credits { + color: #819198; } + +@media screen and (min-width: 64em) { + .site-footer { + font-size: 1rem; } } + +@media screen and (min-width: 42em) and (max-width: 64em) { + .site-footer { + font-size: 1rem; } } + +@media screen and (max-width: 42em) { + .site-footer { + font-size: 0.9rem; } }