[
  {
    "path": ".github/taamarinbot.py",
    "content": "import asyncio\nimport os\nimport sys\nfrom telethon import TelegramClient\nfrom telethon.tl.functions.messages import GetMessagesRequest\n\nAPI_ID = os.environ.get(\"API_ID\")\nAPI_HASH = os.environ.get(\"API_HASH\")\n\nCHAT_ID = int(os.environ.get(\"CHAT_ID\"))\nMESSAGE_THREAD_ID = int(os.environ.get(\"MESSAGE_THREAD_ID\"))\nBOT_TOKEN = os.environ.get(\"BOT_TOKEN\")\nVERSION = os.environ.get(\"VERSION\")\nCOMMIT = os.environ.get(\"COMMIT\")\n# TAGS = os.environ.get(\"TAGS\")\nMSG_TEMPLATE = \"\"\"\n{version}\n\nCommit:\n{commit}\n\n[source](https://github.com/taamarin/box.manager)\n[module](https://github.com/taamarin/box_for_magisk)\n\n#apk #manager #BFR #root\n\"\"\".strip()\n\ndef get_caption():\n    msg = MSG_TEMPLATE.format(\n        version=VERSION,\n        # tags=TAGS,\n        commit=COMMIT\n    )\n    if len(msg) > 1024:\n        return COMMIT\n    return msg\n\ndef check_environ():\n    if BOT_TOKEN is None:\n        print(\"[-] Invalid BOT_TOKEN\")\n        exit(1)\n    if CHAT_ID is None:\n        print(\"[-] Invalid CHAT_ID\")\n        exit(1)\n    if MESSAGE_THREAD_ID is None:\n        print(\"[-] Invalid MESSAGE_THREAD_ID\")\n        exit(1)\n    if VERSION is None:\n        print(\"[-] Invalid VERSION\")\n        exit(1)\n    if COMMIT is None:\n        print(\"[-] Invalid COMMIT\")\n        exit(1)\n    # if TAGS is None:\n        # print(\"[-] Invalid TAGS\")\n        # exit(1)\n\nasync def main():\n    print(\"[+] Uploading to telegram\")\n    check_environ()\n    files = sys.argv[1:]\n    print(\"[+] Files:\", files)\n    if len(files) <= 0:\n        print(\"[-] No files to upload\")\n        exit(1)\n    print(\"[+] Logging in Telegram with bot\")\n    script_dir = os.path.dirname(os.path.abspath(sys.argv[0]))\n    session_dir = os.path.join(script_dir, \"bot.session\")\n    async with await TelegramClient(session=session_dir, api_id=API_ID, api_hash=API_HASH).start(bot_token=BOT_TOKEN) as bot:\n        caption = [\"\"] * len(files)\n        caption[-1] = get_caption()\n        print(\"[+] Caption: \")\n        print(\"---\")\n        print(caption)\n        print(\"---\")\n        print(\"[+] Sending\")\n        sent_messages = await bot.send_file(entity=CHAT_ID, file=files, caption=caption, reply_to=MESSAGE_THREAD_ID, parse_mode=\"markdown\")\n\n        # Pin the last sent message\n        if sent_messages:\n            last_message_id = sent_messages[-1].id\n            await bot.pin_message(entity=CHAT_ID, message=last_message_id)\n\n        print(\"[+] Done!\")\n\nif __name__ == \"__main__\":\n    try:\n        asyncio.run(main())\n    except Exception as e:\n        print(f\"[-] An error occurred: {e}\")\n"
  },
  {
    "path": ".github/workflows/build.yml",
    "content": "name: build android apps\non:\n  workflow_dispatch:\n  push:\n    paths-ignore:\n      - \"docs/**\"\n      - \"README.md\"\n      - \".github/ISSUE_TEMPLATE/**\"\n    branches:\n      - main\njobs:\n  build:\n    permissions: write-all\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v4\n        with:\n          fetch-depth: 0\n\n      - uses: actions/setup-node@v3\n        with:\n          node-version: '16.x'\n\n      - uses: actions/setup-java@v3\n        with:\n          java-version: '17'\n          distribution: 'zulu'\n\n      - name: update version\n        run: |\n          sed -i \"s|versionCode .*|versionCode $(date +%Y%m%d)|g\" app/build.gradle\n          sed -i \"s|versionName .*|versionName \\\"1.14-$(git rev-parse --short HEAD)\\\"|g\" app/build.gradle\n \n      - name: Build with Gradle\n        run: |\n          chmod +x gradlew\n          ./gradlew --no-daemon --no-configuration-cache -q app:assembleRelease\n\n      - name: checking release version\n        id: version\n        run: |\n          echo ::set-output name=release_version::$(cat app/build.gradle  | grep -o \"versionName \\\"[0-9.]*-[a-z,0-9]*\\\"\" | grep -o \"[0-9.]*-[a-z,0-9]*\")\n\n      - name: rename apks\n        run: |\n          APK=\"Box4Root-Manager_v${{ steps.version.outputs.release_version }}.apk\"\n          mv -f ./app/build/outputs/apk/release/*.apk ./app/build/outputs/apk/release/$APK\n\n      - name: upload artifact\n        uses: actions/upload-artifact@v3\n        if: ${{  success() }}\n        with:\n          name: b4r_manager\n          path: ./app/build/outputs/apk/release/*.apk\n\n      - uses: andreaswilli/delete-release-assets-action@v2.0.0\n        with:\n          github_token: ${{ secrets.GITHUB_TOKEN }}\n          tag: Prerelease\n          deleteOnlyFromDrafts: false\n        env:\n          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n\n      - uses: richardsimko/update-tag@v1.0.7\n        with:\n          tag_name: Prerelease\n        env:\n          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n\n      - uses: softprops/action-gh-release@v1\n        with:\n          tag_name: Prerelease\n          files: ${{ github.workspace }}/app/build/outputs/apk/release/*.apk\n          draft: false\n          prerelease: true\n          generate_release_notes: true\n\n      - name: upload to telegram\n        if: ${{  success() }}\n        env:\n          CHAT_ID: \"-1001597117128\"\n          MESSAGE_THREAD_ID: \"282263\"\n          API_ID: ${{ secrets.API_ID }}\n          API_HASH: ${{ secrets.API_HASH }}\n          BOT_TOKEN: ${{ secrets.BOT_TOKEN }}\n        run: |\n          if [ ! -z \"${{ secrets.BOT_TOKEN }}\" ]; then\n            export VERSION=\"v${{ steps.version.outputs.release_version }}\"\n            export COMMIT=$(git log --oneline -n 10 --no-decorate | sed 's/^[0-9a-f]* //' | sed 's/^/— /')\n            FILE=$(find app/build/outputs/apk/release -name \"*.apk\")\n            pip3 install telethon==1.31.1\n            python3 $GITHUB_WORKSPACE/.github/taamarinbot.py $FILE\n          fi\n"
  },
  {
    "path": ".gitignore",
    "content": "*.iml\n.gradle\n/local.properties\n/.idea/caches\n/.idea/libraries\n/.idea/modules.xml\n/.idea/workspace.xml\n/.idea/navEditor.xml\n/.idea/assetWizardSettings.xml\n.DS_Store\n/build\n/captures\n.externalNativeBuild\n.cxx\nlocal.properties\n.idea\n.gitmessage"
  },
  {
    "path": "LICENSE",
    "content": "                    GNU GENERAL PUBLIC LICENSE\n                       Version 3, 29 June 2007\n\n Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n                            Preamble\n\n  The GNU General Public License is a free, copyleft license for\nsoftware and other kinds of works.\n\n  The licenses for most software and other practical works are designed\nto take away your freedom to share and change the works.  By contrast,\nthe GNU General Public License is intended to guarantee your freedom to\nshare and change all versions of a program--to make sure it remains free\nsoftware for all its users.  We, the Free Software Foundation, use the\nGNU General Public License for most of our software; it applies also to\nany other work released this way by its authors.  You can apply it to\nyour programs, too.\n\n  When we speak of free software, we are referring to freedom, not\nprice.  Our General Public Licenses are designed to make sure that you\nhave the freedom to distribute copies of free software (and charge for\nthem if you wish), that you receive source code or can get it if you\nwant it, that you can change the software or use pieces of it in new\nfree programs, and that you know you can do these things.\n\n  To protect your rights, we need to prevent others from denying you\nthese rights or asking you to surrender the rights.  Therefore, you have\ncertain responsibilities if you distribute copies of the software, or if\nyou modify it: responsibilities to respect the freedom of others.\n\n  For example, if you distribute copies of such a program, whether\ngratis or for a fee, you must pass on to the recipients the same\nfreedoms that you received.  You must make sure that they, too, receive\nor can get the source code.  And you must show them these terms so they\nknow their rights.\n\n  Developers that use the GNU GPL protect your rights with two steps:\n(1) assert copyright on the software, and (2) offer you this License\ngiving you legal permission to copy, distribute and/or modify it.\n\n  For the developers' and authors' protection, the GPL clearly explains\nthat there is no warranty for this free software.  For both users' and\nauthors' sake, the GPL requires that modified versions be marked as\nchanged, so that their problems will not be attributed erroneously to\nauthors of previous versions.\n\n  Some devices are designed to deny users access to install or run\nmodified versions of the software inside them, although the manufacturer\ncan do so.  This is fundamentally incompatible with the aim of\nprotecting users' freedom to change the software.  The systematic\npattern of such abuse occurs in the area of products for individuals to\nuse, which is precisely where it is most unacceptable.  Therefore, we\nhave designed this version of the GPL to prohibit the practice for those\nproducts.  If such problems arise substantially in other domains, we\nstand ready to extend this provision to those domains in future versions\nof the GPL, as needed to protect the freedom of users.\n\n  Finally, every program is threatened constantly by software patents.\nStates should not allow patents to restrict development and use of\nsoftware on general-purpose computers, but in those that do, we wish to\navoid the special danger that patents applied to a free program could\nmake it effectively proprietary.  To prevent this, the GPL assures that\npatents cannot be used to render the program non-free.\n\n  The precise terms and conditions for copying, distribution and\nmodification follow.\n\n                       TERMS AND CONDITIONS\n\n  0. Definitions.\n\n  \"This License\" refers to version 3 of the GNU General Public License.\n\n  \"Copyright\" also means copyright-like laws that apply to other kinds of\nworks, such as semiconductor masks.\n\n  \"The Program\" refers to any copyrightable work licensed under this\nLicense.  Each licensee is addressed as \"you\".  \"Licensees\" and\n\"recipients\" may be individuals or organizations.\n\n  To \"modify\" a work means to copy from or adapt all or part of the work\nin a fashion requiring copyright permission, other than the making of an\nexact copy.  The resulting work is called a \"modified version\" of the\nearlier work or a work \"based on\" the earlier work.\n\n  A \"covered work\" means either the unmodified Program or a work based\non the Program.\n\n  To \"propagate\" a work means to do anything with it that, without\npermission, would make you directly or secondarily liable for\ninfringement under applicable copyright law, except executing it on a\ncomputer or modifying a private copy.  Propagation includes copying,\ndistribution (with or without modification), making available to the\npublic, and in some countries other activities as well.\n\n  To \"convey\" a work means any kind of propagation that enables other\nparties to make or receive copies.  Mere interaction with a user through\na computer network, with no transfer of a copy, is not conveying.\n\n  An interactive user interface displays \"Appropriate Legal Notices\"\nto the extent that it includes a convenient and prominently visible\nfeature that (1) displays an appropriate copyright notice, and (2)\ntells the user that there is no warranty for the work (except to the\nextent that warranties are provided), that licensees may convey the\nwork under this License, and how to view a copy of this License.  If\nthe interface presents a list of user commands or options, such as a\nmenu, a prominent item in the list meets this criterion.\n\n  1. Source Code.\n\n  The \"source code\" for a work means the preferred form of the work\nfor making modifications to it.  \"Object code\" means any non-source\nform of a work.\n\n  A \"Standard Interface\" means an interface that either is an official\nstandard defined by a recognized standards body, or, in the case of\ninterfaces specified for a particular programming language, one that\nis widely used among developers working in that language.\n\n  The \"System Libraries\" of an executable work include anything, other\nthan the work as a whole, that (a) is included in the normal form of\npackaging a Major Component, but which is not part of that Major\nComponent, and (b) serves only to enable use of the work with that\nMajor Component, or to implement a Standard Interface for which an\nimplementation is available to the public in source code form.  A\n\"Major Component\", in this context, means a major essential component\n(kernel, window system, and so on) of the specific operating system\n(if any) on which the executable work runs, or a compiler used to\nproduce the work, or an object code interpreter used to run it.\n\n  The \"Corresponding Source\" for a work in object code form means all\nthe source code needed to generate, install, and (for an executable\nwork) run the object code and to modify the work, including scripts to\ncontrol those activities.  However, it does not include the work's\nSystem Libraries, or general-purpose tools or generally available free\nprograms which are used unmodified in performing those activities but\nwhich are not part of the work.  For example, Corresponding Source\nincludes interface definition files associated with source files for\nthe work, and the source code for shared libraries and dynamically\nlinked subprograms that the work is specifically designed to require,\nsuch as by intimate data communication or control flow between those\nsubprograms and other parts of the work.\n\n  The Corresponding Source need not include anything that users\ncan regenerate automatically from other parts of the Corresponding\nSource.\n\n  The Corresponding Source for a work in source code form is that\nsame work.\n\n  2. Basic Permissions.\n\n  All rights granted under this License are granted for the term of\ncopyright on the Program, and are irrevocable provided the stated\nconditions are met.  This License explicitly affirms your unlimited\npermission to run the unmodified Program.  The output from running a\ncovered work is covered by this License only if the output, given its\ncontent, constitutes a covered work.  This License acknowledges your\nrights of fair use or other equivalent, as provided by copyright law.\n\n  You may make, run and propagate covered works that you do not\nconvey, without conditions so long as your license otherwise remains\nin force.  You may convey covered works to others for the sole purpose\nof having them make modifications exclusively for you, or provide you\nwith facilities for running those works, provided that you comply with\nthe terms of this License in conveying all material for which you do\nnot control copyright.  Those thus making or running the covered works\nfor you must do so exclusively on your behalf, under your direction\nand control, on terms that prohibit them from making any copies of\nyour copyrighted material outside their relationship with you.\n\n  Conveying under any other circumstances is permitted solely under\nthe conditions stated below.  Sublicensing is not allowed; section 10\nmakes it unnecessary.\n\n  3. Protecting Users' Legal Rights From Anti-Circumvention Law.\n\n  No covered work shall be deemed part of an effective technological\nmeasure under any applicable law fulfilling obligations under article\n11 of the WIPO copyright treaty adopted on 20 December 1996, or\nsimilar laws prohibiting or restricting circumvention of such\nmeasures.\n\n  When you convey a covered work, you waive any legal power to forbid\ncircumvention of technological measures to the extent such circumvention\nis effected by exercising rights under this License with respect to\nthe covered work, and you disclaim any intention to limit operation or\nmodification of the work as a means of enforcing, against the work's\nusers, your or third parties' legal rights to forbid circumvention of\ntechnological measures.\n\n  4. Conveying Verbatim Copies.\n\n  You may convey verbatim copies of the Program's source code as you\nreceive it, in any medium, provided that you conspicuously and\nappropriately publish on each copy an appropriate copyright notice;\nkeep intact all notices stating that this License and any\nnon-permissive terms added in accord with section 7 apply to the code;\nkeep intact all notices of the absence of any warranty; and give all\nrecipients a copy of this License along with the Program.\n\n  You may charge any price or no price for each copy that you convey,\nand you may offer support or warranty protection for a fee.\n\n  5. Conveying Modified Source Versions.\n\n  You may convey a work based on the Program, or the modifications to\nproduce it from the Program, in the form of source code under the\nterms of section 4, provided that you also meet all of these conditions:\n\n    a) The work must carry prominent notices stating that you modified\n    it, and giving a relevant date.\n\n    b) The work must carry prominent notices stating that it is\n    released under this License and any conditions added under section\n    7.  This requirement modifies the requirement in section 4 to\n    \"keep intact all notices\".\n\n    c) You must license the entire work, as a whole, under this\n    License to anyone who comes into possession of a copy.  This\n    License will therefore apply, along with any applicable section 7\n    additional terms, to the whole of the work, and all its parts,\n    regardless of how they are packaged.  This License gives no\n    permission to license the work in any other way, but it does not\n    invalidate such permission if you have separately received it.\n\n    d) If the work has interactive user interfaces, each must display\n    Appropriate Legal Notices; however, if the Program has interactive\n    interfaces that do not display Appropriate Legal Notices, your\n    work need not make them do so.\n\n  A compilation of a covered work with other separate and independent\nworks, which are not by their nature extensions of the covered work,\nand which are not combined with it such as to form a larger program,\nin or on a volume of a storage or distribution medium, is called an\n\"aggregate\" if the compilation and its resulting copyright are not\nused to limit the access or legal rights of the compilation's users\nbeyond what the individual works permit.  Inclusion of a covered work\nin an aggregate does not cause this License to apply to the other\nparts of the aggregate.\n\n  6. Conveying Non-Source Forms.\n\n  You may convey a covered work in object code form under the terms\nof sections 4 and 5, provided that you also convey the\nmachine-readable Corresponding Source under the terms of this License,\nin one of these ways:\n\n    a) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by the\n    Corresponding Source fixed on a durable physical medium\n    customarily used for software interchange.\n\n    b) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by a\n    written offer, valid for at least three years and valid for as\n    long as you offer spare parts or customer support for that product\n    model, to give anyone who possesses the object code either (1) a\n    copy of the Corresponding Source for all the software in the\n    product that is covered by this License, on a durable physical\n    medium customarily used for software interchange, for a price no\n    more than your reasonable cost of physically performing this\n    conveying of source, or (2) access to copy the\n    Corresponding Source from a network server at no charge.\n\n    c) Convey individual copies of the object code with a copy of the\n    written offer to provide the Corresponding Source.  This\n    alternative is allowed only occasionally and noncommercially, and\n    only if you received the object code with such an offer, in accord\n    with subsection 6b.\n\n    d) Convey the object code by offering access from a designated\n    place (gratis or for a charge), and offer equivalent access to the\n    Corresponding Source in the same way through the same place at no\n    further charge.  You need not require recipients to copy the\n    Corresponding Source along with the object code.  If the place to\n    copy the object code is a network server, the Corresponding Source\n    may be on a different server (operated by you or a third party)\n    that supports equivalent copying facilities, provided you maintain\n    clear directions next to the object code saying where to find the\n    Corresponding Source.  Regardless of what server hosts the\n    Corresponding Source, you remain obligated to ensure that it is\n    available for as long as needed to satisfy these requirements.\n\n    e) Convey the object code using peer-to-peer transmission, provided\n    you inform other peers where the object code and Corresponding\n    Source of the work are being offered to the general public at no\n    charge under subsection 6d.\n\n  A separable portion of the object code, whose source code is excluded\nfrom the Corresponding Source as a System Library, need not be\nincluded in conveying the object code work.\n\n  A \"User Product\" is either (1) a \"consumer product\", which means any\ntangible personal property which is normally used for personal, family,\nor household purposes, or (2) anything designed or sold for incorporation\ninto a dwelling.  In determining whether a product is a consumer product,\ndoubtful cases shall be resolved in favor of coverage.  For a particular\nproduct received by a particular user, \"normally used\" refers to a\ntypical or common use of that class of product, regardless of the status\nof the particular user or of the way in which the particular user\nactually uses, or expects or is expected to use, the product.  A product\nis a consumer product regardless of whether the product has substantial\ncommercial, industrial or non-consumer uses, unless such uses represent\nthe only significant mode of use of the product.\n\n  \"Installation Information\" for a User Product means any methods,\nprocedures, authorization keys, or other information required to install\nand execute modified versions of a covered work in that User Product from\na modified version of its Corresponding Source.  The information must\nsuffice to ensure that the continued functioning of the modified object\ncode is in no case prevented or interfered with solely because\nmodification has been made.\n\n  If you convey an object code work under this section in, or with, or\nspecifically for use in, a User Product, and the conveying occurs as\npart of a transaction in which the right of possession and use of the\nUser Product is transferred to the recipient in perpetuity or for a\nfixed term (regardless of how the transaction is characterized), the\nCorresponding Source conveyed under this section must be accompanied\nby the Installation Information.  But this requirement does not apply\nif neither you nor any third party retains the ability to install\nmodified object code on the User Product (for example, the work has\nbeen installed in ROM).\n\n  The requirement to provide Installation Information does not include a\nrequirement to continue to provide support service, warranty, or updates\nfor a work that has been modified or installed by the recipient, or for\nthe User Product in which it has been modified or installed.  Access to a\nnetwork may be denied when the modification itself materially and\nadversely affects the operation of the network or violates the rules and\nprotocols for communication across the network.\n\n  Corresponding Source conveyed, and Installation Information provided,\nin accord with this section must be in a format that is publicly\ndocumented (and with an implementation available to the public in\nsource code form), and must require no special password or key for\nunpacking, reading or copying.\n\n  7. Additional Terms.\n\n  \"Additional permissions\" are terms that supplement the terms of this\nLicense by making exceptions from one or more of its conditions.\nAdditional permissions that are applicable to the entire Program shall\nbe treated as though they were included in this License, to the extent\nthat they are valid under applicable law.  If additional permissions\napply only to part of the Program, that part may be used separately\nunder those permissions, but the entire Program remains governed by\nthis License without regard to the additional permissions.\n\n  When you convey a copy of a covered work, you may at your option\nremove any additional permissions from that copy, or from any part of\nit.  (Additional permissions may be written to require their own\nremoval in certain cases when you modify the work.)  You may place\nadditional permissions on material, added by you to a covered work,\nfor which you have or can give appropriate copyright permission.\n\n  Notwithstanding any other provision of this License, for material you\nadd to a covered work, you may (if authorized by the copyright holders of\nthat material) supplement the terms of this License with terms:\n\n    a) Disclaiming warranty or limiting liability differently from the\n    terms of sections 15 and 16 of this License; or\n\n    b) Requiring preservation of specified reasonable legal notices or\n    author attributions in that material or in the Appropriate Legal\n    Notices displayed by works containing it; or\n\n    c) Prohibiting misrepresentation of the origin of that material, or\n    requiring that modified versions of such material be marked in\n    reasonable ways as different from the original version; or\n\n    d) Limiting the use for publicity purposes of names of licensors or\n    authors of the material; or\n\n    e) Declining to grant rights under trademark law for use of some\n    trade names, trademarks, or service marks; or\n\n    f) Requiring indemnification of licensors and authors of that\n    material by anyone who conveys the material (or modified versions of\n    it) with contractual assumptions of liability to the recipient, for\n    any liability that these contractual assumptions directly impose on\n    those licensors and authors.\n\n  All other non-permissive additional terms are considered \"further\nrestrictions\" within the meaning of section 10.  If the Program as you\nreceived it, or any part of it, contains a notice stating that it is\ngoverned by this License along with a term that is a further\nrestriction, you may remove that term.  If a license document contains\na further restriction but permits relicensing or conveying under this\nLicense, you may add to a covered work material governed by the terms\nof that license document, provided that the further restriction does\nnot survive such relicensing or conveying.\n\n  If you add terms to a covered work in accord with this section, you\nmust place, in the relevant source files, a statement of the\nadditional terms that apply to those files, or a notice indicating\nwhere to find the applicable terms.\n\n  Additional terms, permissive or non-permissive, may be stated in the\nform of a separately written license, or stated as exceptions;\nthe above requirements apply either way.\n\n  8. Termination.\n\n  You may not propagate or modify a covered work except as expressly\nprovided under this License.  Any attempt otherwise to propagate or\nmodify it is void, and will automatically terminate your rights under\nthis License (including any patent licenses granted under the third\nparagraph of section 11).\n\n  However, if you cease all violation of this License, then your\nlicense from a particular copyright holder is reinstated (a)\nprovisionally, unless and until the copyright holder explicitly and\nfinally terminates your license, and (b) permanently, if the copyright\nholder fails to notify you of the violation by some reasonable means\nprior to 60 days after the cessation.\n\n  Moreover, your license from a particular copyright holder is\nreinstated permanently if the copyright holder notifies you of the\nviolation by some reasonable means, this is the first time you have\nreceived notice of violation of this License (for any work) from that\ncopyright holder, and you cure the violation prior to 30 days after\nyour receipt of the notice.\n\n  Termination of your rights under this section does not terminate the\nlicenses of parties who have received copies or rights from you under\nthis License.  If your rights have been terminated and not permanently\nreinstated, you do not qualify to receive new licenses for the same\nmaterial under section 10.\n\n  9. Acceptance Not Required for Having Copies.\n\n  You are not required to accept this License in order to receive or\nrun a copy of the Program.  Ancillary propagation of a covered work\noccurring solely as a consequence of using peer-to-peer transmission\nto receive a copy likewise does not require acceptance.  However,\nnothing other than this License grants you permission to propagate or\nmodify any covered work.  These actions infringe copyright if you do\nnot accept this License.  Therefore, by modifying or propagating a\ncovered work, you indicate your acceptance of this License to do so.\n\n  10. Automatic Licensing of Downstream Recipients.\n\n  Each time you convey a covered work, the recipient automatically\nreceives a license from the original licensors, to run, modify and\npropagate that work, subject to this License.  You are not responsible\nfor enforcing compliance by third parties with this License.\n\n  An \"entity transaction\" is a transaction transferring control of an\norganization, or substantially all assets of one, or subdividing an\norganization, or merging organizations.  If propagation of a covered\nwork results from an entity transaction, each party to that\ntransaction who receives a copy of the work also receives whatever\nlicenses to the work the party's predecessor in interest had or could\ngive under the previous paragraph, plus a right to possession of the\nCorresponding Source of the work from the predecessor in interest, if\nthe predecessor has it or can get it with reasonable efforts.\n\n  You may not impose any further restrictions on the exercise of the\nrights granted or affirmed under this License.  For example, you may\nnot impose a license fee, royalty, or other charge for exercise of\nrights granted under this License, and you may not initiate litigation\n(including a cross-claim or counterclaim in a lawsuit) alleging that\nany patent claim is infringed by making, using, selling, offering for\nsale, or importing the Program or any portion of it.\n\n  11. Patents.\n\n  A \"contributor\" is a copyright holder who authorizes use under this\nLicense of the Program or a work on which the Program is based.  The\nwork thus licensed is called the contributor's \"contributor version\".\n\n  A contributor's \"essential patent claims\" are all patent claims\nowned or controlled by the contributor, whether already acquired or\nhereafter acquired, that would be infringed by some manner, permitted\nby this License, of making, using, or selling its contributor version,\nbut do not include claims that would be infringed only as a\nconsequence of further modification of the contributor version.  For\npurposes of this definition, \"control\" includes the right to grant\npatent sublicenses in a manner consistent with the requirements of\nthis License.\n\n  Each contributor grants you a non-exclusive, worldwide, royalty-free\npatent license under the contributor's essential patent claims, to\nmake, use, sell, offer for sale, import and otherwise run, modify and\npropagate the contents of its contributor version.\n\n  In the following three paragraphs, a \"patent license\" is any express\nagreement or commitment, however denominated, not to enforce a patent\n(such as an express permission to practice a patent or covenant not to\nsue for patent infringement).  To \"grant\" such a patent license to a\nparty means to make such an agreement or commitment not to enforce a\npatent against the party.\n\n  If you convey a covered work, knowingly relying on a patent license,\nand the Corresponding Source of the work is not available for anyone\nto copy, free of charge and under the terms of this License, through a\npublicly available network server or other readily accessible means,\nthen you must either (1) cause the Corresponding Source to be so\navailable, or (2) arrange to deprive yourself of the benefit of the\npatent license for this particular work, or (3) arrange, in a manner\nconsistent with the requirements of this License, to extend the patent\nlicense to downstream recipients.  \"Knowingly relying\" means you have\nactual knowledge that, but for the patent license, your conveying the\ncovered work in a country, or your recipient's use of the covered work\nin a country, would infringe one or more identifiable patents in that\ncountry that you have reason to believe are valid.\n\n  If, pursuant to or in connection with a single transaction or\narrangement, you convey, or propagate by procuring conveyance of, a\ncovered work, and grant a patent license to some of the parties\nreceiving the covered work authorizing them to use, propagate, modify\nor convey a specific copy of the covered work, then the patent license\nyou grant is automatically extended to all recipients of the covered\nwork and works based on it.\n\n  A patent license is \"discriminatory\" if it does not include within\nthe scope of its coverage, prohibits the exercise of, or is\nconditioned on the non-exercise of one or more of the rights that are\nspecifically granted under this License.  You may not convey a covered\nwork if you are a party to an arrangement with a third party that is\nin the business of distributing software, under which you make payment\nto the third party based on the extent of your activity of conveying\nthe work, and under which the third party grants, to any of the\nparties who would receive the covered work from you, a discriminatory\npatent license (a) in connection with copies of the covered work\nconveyed by you (or copies made from those copies), or (b) primarily\nfor and in connection with specific products or compilations that\ncontain the covered work, unless you entered into that arrangement,\nor that patent license was granted, prior to 28 March 2007.\n\n  Nothing in this License shall be construed as excluding or limiting\nany implied license or other defenses to infringement that may\notherwise be available to you under applicable patent law.\n\n  12. No Surrender of Others' Freedom.\n\n  If conditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License.  If you cannot convey a\ncovered work so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you may\nnot convey it at all.  For example, if you agree to terms that obligate you\nto collect a royalty for further conveying from those to whom you convey\nthe Program, the only way you could satisfy both those terms and this\nLicense would be to refrain entirely from conveying the Program.\n\n  13. Use with the GNU Affero General Public License.\n\n  Notwithstanding any other provision of this License, you have\npermission to link or combine any covered work with a work licensed\nunder version 3 of the GNU Affero General Public License into a single\ncombined work, and to convey the resulting work.  The terms of this\nLicense will continue to apply to the part which is the covered work,\nbut the special requirements of the GNU Affero General Public License,\nsection 13, concerning interaction through a network will apply to the\ncombination as such.\n\n  14. Revised Versions of this License.\n\n  The Free Software Foundation may publish revised and/or new versions of\nthe GNU General Public License from time to time.  Such new versions will\nbe similar in spirit to the present version, but may differ in detail to\naddress new problems or concerns.\n\n  Each version is given a distinguishing version number.  If the\nProgram specifies that a certain numbered version of the GNU General\nPublic License \"or any later version\" applies to it, you have the\noption of following the terms and conditions either of that numbered\nversion or of any later version published by the Free Software\nFoundation.  If the Program does not specify a version number of the\nGNU General Public License, you may choose any version ever published\nby the Free Software Foundation.\n\n  If the Program specifies that a proxy can decide which future\nversions of the GNU General Public License can be used, that proxy's\npublic statement of acceptance of a version permanently authorizes you\nto choose that version for the Program.\n\n  Later license versions may give you additional or different\npermissions.  However, no additional obligations are imposed on any\nauthor or copyright holder as a result of your choosing to follow a\nlater version.\n\n  15. Disclaimer of Warranty.\n\n  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY\nAPPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT\nHOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY\nOF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,\nTHE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\nPURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM\nIS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF\nALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n\n  16. Limitation of Liability.\n\n  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\nWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS\nTHE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY\nGENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE\nUSE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF\nDATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD\nPARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),\nEVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF\nSUCH DAMAGES.\n\n  17. Interpretation of Sections 15 and 16.\n\n  If the disclaimer of warranty and limitation of liability provided\nabove cannot be given local legal effect according to their terms,\nreviewing courts shall apply local law that most closely approximates\nan absolute waiver of all civil liability in connection with the\nProgram, unless a warranty or assumption of liability accompanies a\ncopy of the Program in return for a fee.\n\n                     END OF TERMS AND CONDITIONS\n\n            How to Apply These Terms to Your New Programs\n\n  If you develop a new program, and you want it to be of the greatest\npossible use to the public, the best way to achieve this is to make it\nfree software which everyone can redistribute and change under these terms.\n\n  To do so, attach the following notices to the program.  It is safest\nto attach them to the start of each source file to most effectively\nstate the exclusion of warranty; and each file should have at least\nthe \"copyright\" line and a pointer to where the full notice is found.\n\n    <one line to give the program's name and a brief idea of what it does.>\n    Copyright (C) <year>  <name of author>\n\n    This program is free software: you can redistribute it and/or modify\n    it under the terms of the GNU General Public License as published by\n    the Free Software Foundation, either version 3 of the License, or\n    (at your option) any later version.\n\n    This program is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n    GNU General Public License for more details.\n\n    You should have received a copy of the GNU General Public License\n    along with this program.  If not, see <https://www.gnu.org/licenses/>.\n\nAlso add information on how to contact you by electronic and paper mail.\n\n  If the program does terminal interaction, make it output a short\nnotice like this when it starts in an interactive mode:\n\n    <program>  Copyright (C) <year>  <name of author>\n    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\n    This is free software, and you are welcome to redistribute it\n    under certain conditions; type `show c' for details.\n\nThe hypothetical commands `show w' and `show c' should show the appropriate\nparts of the General Public License.  Of course, your program's commands\nmight be different; for a GUI interface, you would use an \"about box\".\n\n  You should also get your employer (if you work as a programmer) or school,\nif any, to sign a \"copyright disclaimer\" for the program, if necessary.\nFor more information on this, and how to apply and follow the GNU GPL, see\n<https://www.gnu.org/licenses/>.\n\n  The GNU General Public License does not permit incorporating your program\ninto proprietary programs.  If your program is a subroutine library, you\nmay consider it more useful to permit linking proprietary applications with\nthe library.  If this is what you want to do, use the GNU Lesser General\nPublic License instead of this License.  But first, please read\n<https://www.gnu.org/licenses/why-not-lgpl.html>.\n"
  },
  {
    "path": "README.md",
    "content": "# BFR Manager\n<h1 align=\"center\">\n  <img src=\"https://github.com/taamarin/box_for_magisk/blob/master/docs/box.svg\" alt=\"BOX\" width=\"200\">\n  <br>BOX<br>\n</h1>\n<h4 align=\"center\"> BFR Manager</h4>\n\n<div align=\"center\">\n\n[![ANDROID](https://img.shields.io/badge/Android-3DDC84?logo=android&logoColor=white)]()\n[![BUILD APK](https://github.com/taamarin/box.manager/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/taamarin/box/actions/workflows/debug.yml)\n[![TELEGRAM CHANNEL](https://img.shields.io/badge/Telegram-2CA5E0?logo=telegram&logoColor=white)](https://t.me/nothing_taamarin)\n[![TELEGRAM](https://img.shields.io/badge/Telegram%20-Grups%20-blue?)](https://t.me/taamarin)\n  <a href=\"https://github.com/taamarin/box_for_magisk/releases\">\n    <img src=\"https://img.shields.io/github/release/taamarin/box_for_magisk/all.svg?\">\n  </a>\n\n</div>\n\n"
  },
  {
    "path": "app/.gitignore",
    "content": "/build\n/libs"
  },
  {
    "path": "app/build.gradle",
    "content": "plugins {\n    id 'com.android.application'\n    id 'org.jetbrains.kotlin.android'\n    id 'kotlin-parcelize'\n    id 'kotlin-kapt'\n    id 'dagger.hilt.android.plugin'\n    id 'androidx.navigation.safeargs'\n}\n\nandroid {\n    namespace 'xyz.chz.bfm'\n    compileSdk 33\n\n    defaultConfig {\n        applicationId \"xyz.chz.bfm\"\n        minSdk 24\n        targetSdk 33\n        versionCode 20241205\n        versionName \"1.14\"\n        testInstrumentationRunner \"androidx.test.runner.AndroidJUnitRunner\"\n        vectorDrawables.useSupportLibrary = true\n    }\n\n    signingConfigs {\n        release {\n            storeFile file('release.keystore')\n            storePassword 'qwerty'\n            keyAlias 'key.alias'\n            keyPassword 'qwerty'\n        }\n    }\n\n    buildTypes {\n        release {\n            signingConfig signingConfigs.release\n            minifyEnabled true\n            shrinkResources true\n            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'\n        }\n    }\n\n    compileOptions {\n        sourceCompatibility JavaVersion.VERSION_1_8\n        targetCompatibility JavaVersion.VERSION_1_8\n    }\n    kotlinOptions {\n        jvmTarget = '1.8'\n    }\n\n    buildFeatures {\n        viewBinding true\n    }\n}\n\ndependencies {\n    implementation project(':ke')\n    implementation 'androidx.core:core-ktx:1.9.0'\n    implementation 'androidx.appcompat:appcompat:1.6.1'\n    implementation 'com.google.android.material:material:1.9.0'\n    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'\n    testImplementation 'junit:junit:4.13.2'\n    androidTestImplementation 'androidx.test.ext:junit:1.1.5'\n    androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'\n    implementation 'com.google.android.material:material:1.9.0'\n    implementation 'androidx.navigation:navigation-fragment-ktx:2.5.3'\n    implementation 'androidx.navigation:navigation-ui-ktx:2.5.3'\n    implementation 'com.google.dagger:hilt-android:2.43.2'\n    kapt 'com.google.dagger:hilt-compiler:2.43.2'\n    implementation 'io.reactivex:rxjava:1.3.8'\n    implementation 'io.reactivex:rxandroid:1.2.1'\n    implementation 'androidx.preference:preference-ktx:1.2.1'\n    implementation 'com.squareup.okhttp3:okhttp:5.0.0-alpha.1'\n    implementation 'com.squareup.okhttp3:logging-interceptor:5.0.0-alpha.1'\n}\n"
  },
  {
    "path": "app/proguard-rules.pro",
    "content": "-keep class xyz.chz.bfm.data.** { *; }\n-keepclassmembers class rx.internal.util.unsafe.*ArrayQueue*Field* {\n   long producerIndex;\n   long consumerIndex;\n}"
  },
  {
    "path": "app/src/androidTest/java/xyz/chz/bfm/ExampleInstrumentedTest.kt",
    "content": "package xyz.chz.bfm\n\nimport androidx.test.ext.junit.runners.AndroidJUnit4\nimport androidx.test.platform.app.InstrumentationRegistry\nimport org.junit.Assert.*\nimport org.junit.Test\nimport org.junit.runner.RunWith\n\n/**\n * Instrumented test, which will execute on an Android device.\n *\n * See [testing documentation](http://d.android.com/tools/testing).\n */\n@RunWith(AndroidJUnit4::class)\nclass ExampleInstrumentedTest {\n    @Test\n    fun useAppContext() {\n        // Context of the app under test.\n        val appContext = InstrumentationRegistry.getInstrumentation().targetContext\n        assertEquals(\"xyz.chz.bfm\", appContext.packageName)\n    }\n}"
  },
  {
    "path": "app/src/main/AndroidManifest.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:tools=\"http://schemas.android.com/tools\">\n\n    <uses-permission android:name=\"android.permission.INTERNET\" />\n    <uses-permission\n        android:name=\"android.permission.QUERY_ALL_PACKAGES\"\n        tools:ignore=\"QueryAllPackagesPermission\" />\n\n    <application\n        android:name=\".BFRApp\"\n        android:allowBackup=\"true\"\n        android:dataExtractionRules=\"@xml/data_extraction_rules\"\n        android:fullBackupContent=\"@xml/backup_rules\"\n        android:icon=\"@drawable/ic_launcher\"\n        android:label=\"@string/app_name\"\n        android:networkSecurityConfig=\"@xml/network_security_config\"\n        android:roundIcon=\"@drawable/ic_launcher\"\n        android:supportsRtl=\"true\"\n        android:theme=\"@style/Base.Theme.BoxForRoot\"\n        android:usesCleartextTraffic=\"true\"\n        tools:targetApi=\"31\">\n        <activity\n            android:name=\".ui.core.CoreActivity\"\n            android:exported=\"false\" />\n        <activity\n            android:name=\".ui.converter.ConverterActivity\"\n            android:exported=\"false\" />\n        <activity\n            android:name=\".ui.MainActivity\"\n            android:exported=\"true\">\n            <intent-filter>\n                <action android:name=\"android.intent.action.MAIN\" />\n\n                <category android:name=\"android.intent.category.LAUNCHER\" />\n            </intent-filter>\n            <intent-filter>\n                <action android:name=\"android.service.quicksettings.action.QS_TILE_PREFERENCES\" />\n            </intent-filter>\n        </activity>\n\n        <service\n            android:name=\".service.TileBox\"\n            android:exported=\"true\"\n            android:icon=\"@drawable/ic_info\"\n            android:label=\"@string/app_name\"\n            android:permission=\"android.permission.BIND_QUICK_SETTINGS_TILE\">\n            <intent-filter>\n                <action android:name=\"android.service.quicksettings.action.QS_TILE\" />\n            </intent-filter>\n        </service>\n    </application>\n\n</manifest>\n"
  },
  {
    "path": "app/src/main/java/xyz/chz/bfm/BFRApp.kt",
    "content": "package xyz.chz.bfm\n\nimport android.app.Application\nimport android.os.StrictMode\nimport dagger.hilt.android.HiltAndroidApp\n\n@HiltAndroidApp\nclass BFRApp : Application() {\n    override fun onCreate() {\n        super.onCreate()\n        val policy = StrictMode.ThreadPolicy.Builder().permitAll().build()\n        StrictMode.setThreadPolicy(policy)\n    }\n}"
  },
  {
    "path": "app/src/main/java/xyz/chz/bfm/adapter/AppListAdapter.kt",
    "content": "package xyz.chz.bfm.adapter\n\nimport android.app.Activity\nimport android.view.LayoutInflater\nimport android.view.View\nimport android.view.ViewGroup\nimport androidx.recyclerview.widget.RecyclerView\nimport xyz.chz.bfm.R\nimport xyz.chz.bfm.data.AppInfo\nimport xyz.chz.bfm.databinding.ItemApplistBinding\n\nclass AppListAdapter(\n    val activity: Activity,\n    val apps: List<AppInfo>,\n    blacklist: MutableSet<String>?\n) :\n    RecyclerView.Adapter<AppListAdapter.BaseViewHolder>() {\n\n    companion object {\n        private const val VIEW_TYPE_HEADER = 0\n        private const val VIEW_TYPE_ITEM = 1\n    }\n\n    val blacklist = if (blacklist == null) HashSet() else HashSet(blacklist)\n\n    override fun onBindViewHolder(holder: BaseViewHolder, position: Int) {\n        if (holder is AppViewHolder) {\n            val appInfo = apps[position - 1]\n            holder.bind(appInfo)\n        }\n    }\n\n    override fun getItemCount() = apps.size + 1\n\n    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BaseViewHolder {\n        val ctx = parent.context\n        return when (viewType) {\n            VIEW_TYPE_HEADER -> {\n                val view = View(ctx)\n                view.layoutParams = ViewGroup.LayoutParams(\n                    ViewGroup.LayoutParams.MATCH_PARENT,\n                    ctx.resources.getDimensionPixelSize(R.dimen.list_header_height) * 0\n                )\n                BaseViewHolder(view)\n            }\n\n            else -> AppViewHolder(\n                ItemApplistBinding.inflate(\n                    LayoutInflater.from(ctx),\n                    parent,\n                    false\n                )\n            )\n        }\n    }\n\n    override fun getItemViewType(position: Int) =\n        if (position == 0) VIEW_TYPE_HEADER else VIEW_TYPE_ITEM\n\n    open class BaseViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView)\n\n    inner class AppViewHolder(private val item: ItemApplistBinding) :\n        BaseViewHolder(item.root),\n        View.OnClickListener {\n        private lateinit var appInfo: AppInfo\n        private val inBlacklist: Boolean get() = blacklist.contains(appInfo.packageName)\n\n        fun bind(appInfo: AppInfo) {\n            this.appInfo = appInfo\n            with(item) {\n                icon.setImageDrawable(appInfo.appIcon)\n                checkBox.isChecked = inBlacklist\n                item.packageName.text = appInfo.packageName\n                if (appInfo.isSystemApp) {\n                    item.name.text = String.format(\"** %1s\", appInfo.appName)\n                } else {\n                    item.name.text = appInfo.appName\n                }\n            }\n            itemView.setOnClickListener(this)\n        }\n\n        override fun onClick(v: View?) {\n            if (inBlacklist) {\n                blacklist.remove(appInfo.packageName)\n                item.checkBox.isChecked = false\n            } else {\n                blacklist.add(appInfo.packageName)\n                item.checkBox.isChecked = true\n            }\n        }\n    }\n}"
  },
  {
    "path": "app/src/main/java/xyz/chz/bfm/data/AppInfo.kt",
    "content": "package xyz.chz.bfm.data\n\nimport android.graphics.drawable.Drawable\n\ndata class AppInfo(\n    val appName: String,\n    val packageName: String,\n    val appIcon: Drawable,\n    val isSystemApp: Boolean,\n    var isSelected: Int\n)"
  },
  {
    "path": "app/src/main/java/xyz/chz/bfm/data/AppManager.kt",
    "content": "package xyz.chz.bfm.data\n\nimport android.Manifest\nimport android.content.Context\nimport android.content.pm.ApplicationInfo\nimport android.content.pm.PackageInfo\nimport android.content.pm.PackageManager\nimport rx.Observable\n\nobject AppManager {\n    fun loadNetworkAppList(ctx: Context): ArrayList<AppInfo> {\n        val packageManager = ctx.packageManager\n        val packages = packageManager.getInstalledPackages(PackageManager.GET_PERMISSIONS)\n        val apps = ArrayList<AppInfo>()\n\n        for (pkg in packages) {\n            if (!pkg.hasInternetPermission && pkg.packageName != \"android\") continue\n\n            val applicationInfo = pkg.applicationInfo\n\n            val appName = applicationInfo.loadLabel(packageManager).toString()\n            val appIcon = applicationInfo.loadIcon(packageManager)\n            val isSystemApp = (applicationInfo.flags and ApplicationInfo.FLAG_SYSTEM) > 0\n\n            val appInfo = AppInfo(appName, pkg.packageName, appIcon, isSystemApp, 0)\n            apps.add(appInfo)\n        }\n        return apps\n    }\n\n    fun rxLoadNetworkAppList(ctx: Context): Observable<ArrayList<AppInfo>> =\n        Observable.unsafeCreate {\n            it.onNext(loadNetworkAppList(ctx))\n        }\n\n\n    val PackageInfo.hasInternetPermission: Boolean\n        get() {\n            val permissions = requestedPermissions\n            return permissions?.any { it == Manifest.permission.INTERNET } ?: false\n        }\n}"
  },
  {
    "path": "app/src/main/java/xyz/chz/bfm/dialog/IMakeDialog.kt",
    "content": "package xyz.chz.bfm.dialog\n\nimport androidx.fragment.app.DialogFragment\n\ninterface IMakeDialog {\n    fun onDialogPositiveButton(dialog: DialogFragment)\n}"
  },
  {
    "path": "app/src/main/java/xyz/chz/bfm/dialog/ISettingDialog.kt",
    "content": "package xyz.chz.bfm.dialog\n\nimport androidx.fragment.app.DialogFragment\n\ninterface ISettingDialog {\n    fun onLoading(dialog: DialogFragment)\n    fun onAbout(dialog: DialogFragment)\n    fun onUpdate(dialog: DialogFragment)\n    fun onCheckIP(dialog: DialogFragment)\n}"
  },
  {
    "path": "app/src/main/java/xyz/chz/bfm/dialog/MakeDialog.kt",
    "content": "package xyz.chz.bfm.dialog\n\nimport android.content.Context\nimport android.os.Bundle\nimport android.view.LayoutInflater\nimport android.view.View\nimport android.view.ViewGroup\nimport androidx.fragment.app.Fragment\nimport xyz.chz.bfm.databinding.CustomDialogBinding\n\nclass MakeDialog(\n    private val strTitle: String? = \"\",\n    private val strMsg: String? = \"\",\n    private val isClick: Boolean? = false,\n    private val canCancel: Boolean? = true\n) : MaterialDialogFragment() {\n    private lateinit var binding: CustomDialogBinding\n\n    lateinit var listener: IMakeDialog\n\n    override fun onCreateView(\n        inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?\n    ): View {\n        binding = CustomDialogBinding.inflate(layoutInflater, container, false)\n        return binding.root\n    }\n\n    @Deprecated(\"Deprecated in Java\")\n    override fun onAttachFragment(childFragment: Fragment) {\n        super.onAttachFragment(childFragment)\n        try {\n            listener = context as IMakeDialog\n        } catch (e: ClassCastException) {\n            throw ClassCastException(\"not cast\")\n        }\n    }\n\n    override fun onAttach(context: Context) {\n        super.onAttach(context)\n        try {\n            listener = context as IMakeDialog\n        } catch (e: ClassCastException) {\n            throw ClassCastException(\"not cast\")\n        }\n    }\n\n    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {\n        super.onViewCreated(view, savedInstanceState)\n        binding.apply {\n            isCancelable = canCancel!!\n            tvTitle.text = strTitle\n            tvMessage.text = strMsg\n            btnOk.setOnClickListener {\n                if (isClick!!) listener.onDialogPositiveButton(this@MakeDialog)\n                this@MakeDialog.dismiss()\n            }\n        }\n    }\n\n}"
  },
  {
    "path": "app/src/main/java/xyz/chz/bfm/dialog/MaterialDialogFragment.kt",
    "content": "package xyz.chz.bfm.dialog\n\nimport android.annotation.SuppressLint\nimport android.app.Dialog\nimport android.os.Bundle\nimport android.view.LayoutInflater\nimport android.view.View\nimport androidx.fragment.app.DialogFragment\nimport com.google.android.material.dialog.MaterialAlertDialogBuilder\nimport xyz.chz.bfm.R\n\nopen class MaterialDialogFragment : DialogFragment() {\n\n    private var dialogView: View? = null\n\n    @SuppressLint(\"UseGetLayoutInflater\")\n    override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {\n        return MaterialAlertDialogBuilder(\n            requireContext(),\n            R.style.ThemeOverlay_MaterialComponents_MaterialAlertDialog_background\n        ).apply {\n            dialogView =\n                onCreateView(LayoutInflater.from(requireContext()), null, savedInstanceState)\n\n            dialogView?.let { onViewCreated(it, savedInstanceState) }\n            setView(dialogView)\n        }.create()\n    }\n\n    override fun getView(): View? {\n        return dialogView\n    }\n\n}"
  },
  {
    "path": "app/src/main/java/xyz/chz/bfm/dialog/SettingDialog.kt",
    "content": "package xyz.chz.bfm.dialog\n\nimport android.os.Bundle\nimport android.view.LayoutInflater\nimport android.view.View\nimport android.view.ViewGroup\nimport android.widget.AdapterView\nimport android.widget.AdapterView.OnItemSelectedListener\nimport android.widget.ArrayAdapter\nimport android.widget.Spinner\nimport androidx.fragment.app.Fragment\nimport xyz.chz.bfm.R\nimport xyz.chz.bfm.databinding.SettingDialogBinding\nimport xyz.chz.bfm.util.Util\nimport xyz.chz.bfm.util.command.SettingCmd\n\nclass SettingDialog : MaterialDialogFragment() {\n\n    private lateinit var binding: SettingDialogBinding\n\n    lateinit var listener: ISettingDialog\n\n    override fun onCreateView(\n        inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?\n    ): View {\n        super.onCreateView(inflater, container, savedInstanceState)\n        binding = SettingDialogBinding.inflate(layoutInflater, container, false)\n        return binding.root\n    }\n\n    @Deprecated(\"Deprecated in Java\")\n    override fun onAttachFragment(childFragment: Fragment) {\n        super.onAttachFragment(childFragment)\n        try {\n            listener = context as ISettingDialog\n        } catch (e: ClassCastException) {\n            throw ClassCastException(\"not cast\")\n        }\n    }\n\n    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {\n        super.onViewCreated(view, savedInstanceState)\n\n        enableDisable(!Util.isProxyed)\n        binding.apply {\n            with(SettingCmd) {\n\n                coreSelector.apply {\n                    buildSpinner(resources.getStringArray(R.array.core_array), this)\n                    setSelection(\n                        when (core) {\n                            \"clash\" -> 0\n                            \"sing-box\" -> 1\n                            \"xray\" -> 2\n                            \"hysteria\" -> 3\n                            else -> 4\n                        }\n                    )\n                    \n                    onItemSelectedListener = object : AdapterView.OnItemSelectedListener {\n                        override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) {\n                            val isClashSelected = position == 0\n                            val visibility = if (isClashSelected) View.VISIBLE else View.GONE\n                            \n                            clash1.visibility = visibility\n                            clash2.visibility = visibility\n                            clash4.visibility = visibility\n                            clash5.visibility = visibility\n                            clash6.visibility = visibility\n                            clash7.visibility = visibility\n                            clash8.visibility = visibility\n                            \n                            setCore = when (position) {\n                                0 -> \"clash\"\n                                1 -> \"sing-box\"\n                                2 -> \"xray\"\n                                3 -> \"hysteria\"\n                                else -> \"v2fly\"\n                            }\n                        }\n                \n                        override fun onNothingSelected(parent: AdapterView<*>?) {\n                        }\n                    }\n                }\n\n                spFindProc.apply {\n                    buildSpinner(resources.getStringArray(R.array.proc_array), this)\n                    when (findProc) {\n                        \"off\" -> setSelection(0)\n                        \"strict\" -> setSelection(1)\n                        else -> setSelection(2)\n                    }\n                    onItemSelectedListener = object : OnItemSelectedListener {\n                        override fun onItemSelected(\n                            p0: AdapterView<*>?, p1: View?, p2: Int, p3: Long\n                        ) {\n                            when (p2) {\n                                1 -> setFindProc(\"strict\")\n                                2 -> setFindProc(\"always\")\n                                else -> setFindProc(\"off\")\n                            }\n                        }\n                        override fun onNothingSelected(p0: AdapterView<*>?) {}\n                    }\n                }\n\n                spFindConf.apply {\n                    buildSpinner(resources.getStringArray(R.array.conf_array), this)\n                    when (findConf) {\n                        \"config.yaml\" -> setSelection(0)\n                        \"config2.yaml\" -> setSelection(1)\n                        else -> setSelection(2)\n                    }\n                    onItemSelectedListener = object : OnItemSelectedListener {\n                        override fun onItemSelected(\n                            p0: AdapterView<*>?, p1: View?, p2: Int, p3: Long\n                        ) {\n                            when (p2) {\n                                1 -> setFindConf(\"config2.yaml\")\n                                2 -> setFindConf(\"config3.yaml\")\n                                else -> setFindConf(\"config.yaml\")\n                            }\n                        }\n                        override fun onNothingSelected(p0: AdapterView<*>?) {}\n                    }\n                }\n\n                spClashType.apply {\n                    buildSpinner(resources.getStringArray(R.array.clash_core_array), this)\n                    setSelection(if (clashType == \"premium\") 0 else 1)\n                    onItemSelectedListener = object : OnItemSelectedListener {\n                        override fun onItemSelected(\n                            p0: AdapterView<*>?, p1: View?, p2: Int, p3: Long\n                        ) {\n                            setClashType(if (p2 == 0) \"premium\" else \"mihomo\")\n                        }\n                        override fun onNothingSelected(p0: AdapterView<*>?) {\n                        }\n                    }\n                }\n\n                spNetworkMode.apply {\n                    buildSpinner(resources.getStringArray(R.array.network_array), this)\n                    when (networkMode) {\n                        \"tproxy\" -> setSelection(0)\n                        \"redirect\" -> setSelection(1)\n                        \"enhance\" -> setSelection(2)\n                        \"mixed\" -> setSelection(3)\n                        else -> setSelection(4)\n                    }\n                    onItemSelectedListener = object : OnItemSelectedListener {\n                        override fun onItemSelected(\n                            p0: AdapterView<*>?, p1: View?, p2: Int, p3: Long\n                        ) {\n                            when (p2) {\n                                1 -> setNetworkMode(\"redirect\")\n                                2 -> setNetworkMode(\"enhance\")\n                                3 -> setNetworkMode(\"mixed\")\n                                4 -> setNetworkMode(\"tun\")\n                                else -> setNetworkMode(\"tproxy\")\n                            }\n                        }\n                        override fun onNothingSelected(p0: AdapterView<*>?) {}\n                    }\n                }\n\n                spProxyMode.apply {\n                    buildSpinner(resources.getStringArray(R.array.proxy_array), this)\n                    when (proxyMode) {\n                        \"whitelist\" -> setSelection(0)\n                        else -> setSelection(1)\n                    }\n                    onItemSelectedListener = object : OnItemSelectedListener {\n                        override fun onItemSelected(\n                            p0: AdapterView<*>?, p1: View?, p2: Int, p3: Long\n                        ) {\n                            when (p2) {\n                                1 -> setProxyMode(\"blacklist\")\n                                else -> setProxyMode(\"whitelist\")\n                            }\n                        }\n                        override fun onNothingSelected(p0: AdapterView<*>?) {}\n                    }\n                }\n\n                cbunifiedDelay.apply {\n                    isChecked = unified\n                    setOnCheckedChangeListener { _, b ->\n                        if (b) setUnified(\"true\") else setUnified(\"false\")\n                    }\n                }\n\n                cbsnifferrs.apply {\n                    isChecked = sniffer\n                    setOnCheckedChangeListener { _, b ->\n                        if (b) setSniffer(\"true\") else setSniffer(\"false\")\n                    }\n                }\n\n                cbredirHost.apply {\n                    isChecked = redirHost\n                    setOnCheckedChangeListener { _, b ->\n                        if (b) setRedirHost(\"redir-host\") else setRedirHost(\"fake-ip\")\n                    }\n                }\n\n                cbgeodataMod.apply {\n                    isChecked = geodata\n                    setOnCheckedChangeListener { _, b ->\n                        if (b) setGeodata(\"true\") else setGeodata(\"false\")\n                    }\n                }\n\n                cbsubs.apply {\n                    isChecked = subs.toBoolean()\n                    setOnCheckedChangeListener { _, b ->\n                        if (b) setSubs(\"true\") else setSubs(\"false\")\n                    }\n                }\n\n                cbgeo.apply {\n                    isChecked = geo.toBoolean()\n                    setOnCheckedChangeListener { _, b ->\n                        if (b) setGeo(\"true\") else setGeo(\"false\")\n                    }\n                }\n\n                cbmemcg.apply {\n                    isChecked = memcg.toBoolean()\n                    setOnCheckedChangeListener { _, b ->\n                        if (b) setMemcg(\"true\") else setMemcg(\"false\")\n                    }\n                }\n\n                cbblkio.apply {\n                    isChecked = blkio.toBoolean()\n                    setOnCheckedChangeListener { _, b ->\n                        if (b) setBlkio(\"true\") else setBlkio(\"false\")\n                    }\n                }\n\n                cbcpuset.apply {\n                    isChecked = cpuset.toBoolean()\n                    setOnCheckedChangeListener { _, b ->\n                        if (b) setCpuset(\"true\") else setCpuset(\"false\")\n                    }\n                }\n\n                cbquic.apply {\n                    isChecked = quic\n                    setOnCheckedChangeListener { _, b ->\n                        if (b) setQuic(\"enable\") else setQuic(\"disable\")\n                    }\n                }\n\n                cbipv6.apply {\n                    isChecked = ipv6\n                    setOnCheckedChangeListener { _, b ->\n                        if (b) setIpv6(\"true\") else setIpv6(\"false\")\n                    }\n                }\n\n                cbcron.apply {\n                    isChecked = cron.toBoolean()\n                    setOnCheckedChangeListener { _, b ->\n                        if (b) setCron(\"true\") else setCron(\"false\")\n                    }\n                }\n\n                aboutApp.setOnClickListener {\n                    listener.onAbout(this@SettingDialog)\n                }\n\n                checkIp.setOnClickListener {\n                    listener.onCheckIP(this@SettingDialog)\n                    this@SettingDialog.dismiss()\n                }\n\n                checkModule.setOnClickListener {\n                    listener.onUpdate(this@SettingDialog)\n                    this@SettingDialog.dismiss()\n                }\n            }\n        }\n        listener.onLoading(this@SettingDialog)\n    }\n\n    private fun buildSpinner(arr: Array<String>, spin: Spinner) {\n        val aa = ArrayAdapter(requireContext(), android.R.layout.simple_spinner_item, arr)\n        aa.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item)\n        spin.adapter = aa\n    }\n\n    private fun enableDisable(bo: Boolean) = with(binding) {\n        cbunifiedDelay.isEnabled = bo\n        cbsnifferrs.isEnabled = bo\n        cbcron.isEnabled = bo\n        cbipv6.isEnabled = bo\n        cbquic.isEnabled = bo\n        cbmemcg.isEnabled = bo\n        cbblkio.isEnabled = bo\n        cbcpuset.isEnabled = bo\n        cbgeo.isEnabled = bo\n        cbsubs.isEnabled = bo\n        cbgeodataMod.isEnabled = bo\n        cbredirHost.isEnabled = bo\n        coreSelector.isEnabled = bo\n        spProxyMode.isEnabled = bo\n        spNetworkMode.isEnabled = bo\n        spClashType.isEnabled = bo\n        spFindProc.isEnabled = bo\n        spFindConf.isEnabled = bo\n    }\n}"
  },
  {
    "path": "app/src/main/java/xyz/chz/bfm/enm/StatusConnection.kt",
    "content": "package xyz.chz.bfm.enm\n\nenum class StatusConnection(val str: String) {\n    Enabled(\"Enabled\"),\n    Error(\"Error\"),\n    Disabled(\"Disabled\"),\n    Loading(\"Loading\"),\n    Unknown(\"Unknown\")\n}"
  },
  {
    "path": "app/src/main/java/xyz/chz/bfm/service/TileBox.kt",
    "content": "package xyz.chz.bfm.service\n\nimport android.service.quicksettings.Tile\nimport android.service.quicksettings.TileService\nimport xyz.chz.bfm.util.Util\nimport xyz.chz.bfm.util.command.TermCmd\n\nclass TileBox : TileService() {\n    override fun onClick() {\n        super.onClick()\n        when (qsTile.state) {\n\n            Tile.STATE_INACTIVE -> {\n                qsTile.state = Tile.STATE_ACTIVE\n                qsTile.updateTile()\n                TermCmd.start {\n                    Util.isProxyed = if (it) {\n                        qsTile.state = Tile.STATE_ACTIVE\n                        qsTile.updateTile()\n                        true\n                    } else {\n                        qsTile.state = Tile.STATE_INACTIVE\n                        qsTile.updateTile()\n                        false\n                    }\n                }\n            }\n\n            else -> {\n                qsTile.state = Tile.STATE_INACTIVE\n                qsTile.updateTile()\n                TermCmd.stop {\n                    Util.isProxyed = if (it) {\n                        qsTile.state = Tile.STATE_INACTIVE\n                        qsTile.updateTile()\n                        false\n                    } else {\n                        qsTile.state = Tile.STATE_ACTIVE\n                        qsTile.updateTile()\n                        true\n                    }\n                }\n            }\n        }\n    }\n\n    override fun onStartListening() {\n        super.onStartListening()\n        if (Util.isProxyed) qsTile.state = Tile.STATE_ACTIVE else qsTile.state = Tile.STATE_INACTIVE\n        qsTile.updateTile()\n    }\n\n    override fun onStopListening() {\n        super.onStopListening()\n        qsTile.updateTile()\n    }\n\n}"
  },
  {
    "path": "app/src/main/java/xyz/chz/bfm/ui/MainActivity.kt",
    "content": "package xyz.chz.bfm.ui\n\nimport android.os.Bundle\nimport android.view.View\nimport android.view.WindowManager\nimport androidx.navigation.findNavController\nimport androidx.navigation.ui.setupWithNavController\nimport com.google.android.material.bottomnavigation.BottomNavigationView\nimport dagger.hilt.android.AndroidEntryPoint\nimport xyz.chz.bfm.R\nimport xyz.chz.bfm.databinding.ActivityMainBinding\nimport xyz.chz.bfm.ui.base.BaseActivity\n\n@AndroidEntryPoint\nclass MainActivity : BaseActivity() {\n\n    override fun onCreate(savedInstanceState: Bundle?) {\n        super.onCreate(savedInstanceState)\n        val binding = ActivityMainBinding.inflate(layoutInflater)\n        setContentView(binding.root)\n\n        val navView: BottomNavigationView = binding.navBottom\n        val navController = findNavController(R.id.nav_host_fragment_container)\n        navView.setupWithNavController(navController)\n\n        navController.addOnDestinationChangedListener { _, dest, _ ->\n            if (dest.id == R.id.nav_dashboard) this.window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN)\n            if (dest.id == R.id.configHelperFragment) navView.visibility =\n                View.GONE else navView.visibility = View.VISIBLE\n        }\n    }\n\n}"
  },
  {
    "path": "app/src/main/java/xyz/chz/bfm/ui/base/BaseActivity.kt",
    "content": "package xyz.chz.bfm.ui.base\n\nimport android.content.Intent\nimport android.net.Uri\nimport android.os.Bundle\nimport androidx.appcompat.app.AppCompatActivity\nimport androidx.fragment.app.DialogFragment\nimport dagger.hilt.android.AndroidEntryPoint\nimport xyz.chz.bfm.R\nimport xyz.chz.bfm.dialog.IMakeDialog\nimport xyz.chz.bfm.dialog.MakeDialog\nimport xyz.chz.bfm.enm.StatusConnection\nimport xyz.chz.bfm.util.modul.ModuleManager\n\n@AndroidEntryPoint\nopen class BaseActivity : AppCompatActivity(), IMakeDialog {\n    private var state: Int? = 0\n\n    override fun onCreate(savedInstanceState: Bundle?) {\n        super.onCreate(savedInstanceState)\n        if (ModuleManager.moduleVersionCode == \"\") {\n            val df = MakeDialog(\n                StatusConnection.Error.str,\n                getString(R.string.module_not_found),\n                true,\n                false\n            )\n            df.listener = this\n            df.show(supportFragmentManager, \"\")\n        } else {\n            if (ModuleManager.moduleVersionCode.toInt() < getString(R.string.min_module_vrsion).toInt()) {\n                val df = MakeDialog(\n                    StatusConnection.Loading.str,\n                    String.format(\n                        getString(R.string.update_module),\n                        ModuleManager.moduleVersionCode.toInt()\n                    ),\n                    true,\n                    false\n                )\n                df.listener = this\n                df.show(supportFragmentManager, \"\")\n                state = 1\n            }\n        }\n    }\n\n    override fun onDialogPositiveButton(dialog: DialogFragment) {\n        when (state) {\n            1 -> {\n                val intent =\n                    Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.release_repo_url)))\n                startActivity(intent)\n                finish()\n            }\n\n            else -> {\n                val intent =\n                    Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.module_repo_url)))\n                startActivity(intent)\n                finish()\n            }\n        }\n    }\n}"
  },
  {
    "path": "app/src/main/java/xyz/chz/bfm/ui/converter/ConfigManager.kt",
    "content": "package xyz.chz.bfm.ui.converter\n\nimport org.json.JSONObject\nimport xyz.chz.bfm.ui.converter.config.ClashData\nimport xyz.chz.bfm.ui.converter.config.ConfigType\nimport xyz.chz.bfm.ui.converter.config.ConfigUtil\nimport xyz.chz.bfm.ui.converter.config.SingBoxData\nimport java.util.regex.Pattern\n\nobject ConfigManager {\n\n    fun importConfig(config: String, isClash: Boolean, useIndent: Boolean = false): String {\n        try {\n            if (config.startsWith(ConfigType.VMESS.scheme)) {\n                var result = config.replace(ConfigType.VMESS.scheme, \"\")\n                result = ConfigUtil.decode(result)\n                if (result.isEmpty()) {\n                    return \"failed decode vms\"\n                }\n                return if (isClash) ClashData(result, useIndent).newVmessConfig() else SingBoxData(\n                    result\n                ).vmessSing()\n            } else if (config.startsWith(ConfigType.VLESS.scheme)) {\n                return if (isClash) ClashData(config, useIndent).newVlessConfig() else SingBoxData(\n                    config\n                ).vlessSing()\n            } else if (config.startsWith(ConfigType.TROJAN.scheme) || config.startsWith(ConfigType.TROJANGO.scheme)) {\n                return if (isClash) ClashData(config, useIndent).newTrojanConfig() else SingBoxData(\n                    config\n                ).trojanSing()\n            } else {\n                return \"\"\n            }\n        } catch (_: Exception) {\n        }\n        return \"\"\n    }\n\n    fun fullClashSimple(config: String, strRaw: String): String {\n        val name = \"match\"\n        val p = Pattern.compile(\"- name:(.*)\")\n        val m = p.matcher(config)\n        val sb = StringBuilder()\n        while (m.find()) {\n            sb.appendLine(\"    - ${m.group(1)?.trim()}\")\n        }\n        return String.format(\n            strRaw,\n            config,\n            ClashData().proxyGroupBuilder(name, sb.toString()),\n            name\n        )\n    }\n\n    fun fullSingSimple(config: String, strRaw: String): String {\n        val s = ArrayList<String>()\n        val p = Pattern.compile(\"\\\"tag\\\":(.*)\")\n        val m = p.matcher(config)\n        val sb = StringBuilder()\n        while (m.find()) {\n            s.add(m.group(1)?.trim()!!.replace(\"\\\"|,\", \"\"))\n        }\n        sb.appendLine(SingBoxData().buildHeaderSlector(s))\n        sb.appendLine(SingBoxData().buildHeaderBestUrl(s))\n        sb.append(config)\n        sb.appendLine(SingBoxData().buildFooter())\n        val strResult = String.format(strRaw, sb.toString())\n        return JSONObject(strResult).toString(2).replace(\"\\\\\", \"\").replace(\"null,\", \"\")\n    }\n}"
  },
  {
    "path": "app/src/main/java/xyz/chz/bfm/ui/converter/ConverterActivity.kt",
    "content": "package xyz.chz.bfm.ui.converter\n\nimport android.os.Bundle\nimport androidx.annotation.RawRes\nimport androidx.appcompat.app.AppCompatActivity\nimport dagger.hilt.android.AndroidEntryPoint\nimport xyz.chz.bfm.R\nimport xyz.chz.bfm.databinding.ActivityConverterBinding\nimport xyz.chz.bfm.util.copyToClipboard\nimport xyz.chz.bfm.util.isValidCheck\nimport xyz.chz.bfm.util.removeEmptyLines\nimport xyz.chz.bfm.util.toast\n\n@AndroidEntryPoint\nclass ConverterActivity : AppCompatActivity() {\n    private lateinit var binding: ActivityConverterBinding\n\n    override fun onCreate(savedInstanceState: Bundle?) {\n        super.onCreate(savedInstanceState)\n        binding = ActivityConverterBinding.inflate(layoutInflater)\n        setContentView(binding.root)\n        setupConfig()\n    }\n\n    private fun setupConfig() = with(binding) {\n        var isFull = false\n        var isSing = false\n        fullClashConfig.setOnCheckedChangeListener { _, b ->\n            isFull = b\n            isSing = false\n            fullSingConfig.isChecked = false\n        }\n        fullSingConfig.setOnCheckedChangeListener { _, b ->\n            if (b) {\n                isSing = true\n                isFull = false\n                fullClashConfig.isChecked = false\n            }\n        }\n        btnConvert.setOnClickListener {\n            if (textInput.isValidCheck()) {\n                val str = textInput.removeEmptyLines()\n                val spltStr = str.split(\"\\n\")\n                val result = StringBuilder()\n                for (x in spltStr) {\n                    result.appendLine(\n                        if (isSing) ConfigManager.importConfig(\n                            x,\n                            false\n                        ) + \",\" else ConfigManager.importConfig(x, true)\n                    )\n                }\n                if (isFull)\n                    tvResult.text =\n                        ConfigManager.fullClashSimple(\n                            result.toString(),\n                            readRawFile(R.raw.clashtemplate)\n                        )\n                else\n                    tvResult.text = if (isSing) ConfigManager.fullSingSimple(\n                        result.toString(),\n                        readRawFile(R.raw.singboxtemplate)\n                    ) else result\n                tvResult.apply {\n                    setOnClickListener {\n                        toast(\"Copied to Clipboard!\", this@ConverterActivity)\n                        copyToClipboard(this@ConverterActivity)\n                    }\n                }\n                toast(\"Click result for copy config\", this@ConverterActivity)\n            } else toast(\"???????????\", this@ConverterActivity)\n        }\n    }\n\n\n    private fun readRawFile(@RawRes id: Int): String {\n        return resources.openRawResource(id).bufferedReader().readText()\n    }\n\n}\n"
  },
  {
    "path": "app/src/main/java/xyz/chz/bfm/ui/converter/config/ClashData.kt",
    "content": "package xyz.chz.bfm.ui.converter.config\n\nimport android.net.Uri\nimport org.json.JSONObject\nimport java.net.URLDecoder\nimport kotlin.random.Random\n\nclass ClashData(private val masuk: String = \"\", private val indent: Boolean = false) {\n\n    fun proxyGroupBuilder(nameProxy: String, listProxy: String): String {\n        val sb = StringBuilder()\n        sb.appendLine(\"- name: $nameProxy\")\n        sb.appendLine(\"  type: select\")\n        sb.appendLine(\"  proxies:\")\n        sb.appendLine(\"    - urltest\")\n        sb.appendLine(\"    - loadbalance\")\n        sb.appendLine(\"    - fallback\")\n        sb.append(listProxy)\n\n        sb.appendLine(\"- name: urltest\")\n        sb.appendLine(\"  type: url-test\")\n        sb.appendLine(\"  url: 'http://www.gstatic.com/generate_204'\")\n        sb.appendLine(\"  interval: 300\")\n        sb.appendLine(\"  proxies:\")\n        sb.append(listProxy)\n\n        sb.appendLine(\"- name: loadbalance\")\n        sb.appendLine(\"  type: load-balance\")\n        sb.appendLine(\"  url: 'http://www.gstatic.com/generate_204'\")\n        sb.appendLine(\"  interval: 300\")\n        sb.appendLine(\"  # strategy: consistent-hashing # 可选 round-robin 和 sticky-sessions\")\n        sb.appendLine(\"  proxies:\")\n        sb.append(listProxy)\n\n        sb.appendLine(\"- name: fallback\")\n        sb.appendLine(\"  type: fallback\")\n        sb.appendLine(\"  url: 'http://www.gstatic.com/generate_204'\")\n        sb.appendLine(\"  interval: 300\")\n        sb.appendLine(\"  proxies:\")\n        sb.append(listProxy)\n\n        return sb.toString()\n    }\n\n    fun newVmessConfig(): String {\n        val jo = JSONObject(masuk)\n        val sb = StringBuilder()\n        val idnt: String = if (indent) \"  \" else \"\"\n        sb.appendLine(\n            \"${idnt}- name: ${\n                jo.optString(\n                    \"ps\",\n                    jo.optString(\"add\", \"new\")\n                )\n            }_vmess_${Random.nextInt(0, 7000)}\"\n        )\n        sb.appendLine(\"$idnt  server: ${jo.optString(\"add\", jo.optString(\"host\", \"\"))}\")\n        sb.appendLine(\"$idnt  port: ${jo.getString(\"port\")}\")\n        sb.appendLine(\"$idnt  type: vmess\")\n        sb.appendLine(\"$idnt  uuid: ${jo.getString(\"id\")}\")\n        sb.appendLine(\"$idnt  alterId: ${jo.optString(\"aid\", \"0\")}\")\n        sb.appendLine(\"$idnt  cipher: ${jo.optString(\"scy\", \"auto\")}\")\n        sb.appendLine(\"$idnt  tls: ${jo.optString(\"tls\", \"\") == \"tls\"}\")\n        sb.appendLine(\"$idnt  servername: ${jo.optString(\"sni\", jo.optString(\"add\", \"\"))}\")\n        sb.appendLine(\"$idnt  skip-cert-verify: true\")\n        sb.appendLine(\"$idnt  udp: true\")\n        when (jo.optString(\"net\", \"tcp\")) {\n            \"ws\" -> {\n                sb.appendLine(\"$idnt  network: ws\")\n                sb.appendLine(\"$idnt  ws-opts:\")\n                sb.appendLine(\"$idnt    path: ${jo.optString(\"path\", \"/\")}\")\n                sb.appendLine(\"$idnt    headers:\")\n                sb.append(\"$idnt      Host: ${jo.getString(\"host\")}\")\n            }\n\n            \"grpc\" -> {\n                sb.appendLine(\"$idnt  network: grpc\")\n                sb.appendLine(\"$idnt  grpc-opts:\")\n                sb.append(\"$idnt    grpc-service-name: ${jo.getString(\"path\")}\")\n            }\n\n            \"h2\" -> {\n                sb.appendLine(\"$idnt  network: h2\")\n                sb.appendLine(\"$idnt  h2-opts:\")\n                sb.append(\"$idnt    path: ${jo.optString(\"path\", \"/\")}\")\n            }\n\n            \"tcp\" -> {\n                if (jo.optString(\"type\", \"\") == \"http\") {\n                    sb.appendLine(\"$idnt  network: http\")\n                    sb.appendLine(\"$idnt  http-opts:\")\n                    sb.append(\"$idnt    path: ${jo.optString(\"path\", \"/\")}\")\n                }\n            }\n\n            else -> throw Exception(\"${jo.getString(\"net\")} not supported\")\n        }\n        return sb.toString()\n    }\n\n    fun newVlessConfig(): String {\n        val sb = StringBuilder()\n        val idnt: String = if (indent) \"  \" else \"\"\n        var url = masuk\n        if (!url.contains(\"@\")) url = ConfigUtil.safeDecodeURLB64(url)\n        val uri = Uri.parse(url)\n        sb.appendLine(\n            \"${idnt}- name: ${uri.fragment ?: \"new\"}_${uri.scheme}_${\n                Random.nextInt(\n                    0,\n                    7000\n                )\n            }\"\n        )\n        sb.appendLine(\"$idnt  server: ${uri.host ?: \"\"}\")\n        sb.appendLine(\"$idnt  port: ${uri.port}\")\n        sb.appendLine(\"$idnt  type: vless\")\n        if (uri.userInfo == null || uri.userInfo!!.isEmpty()) throw Exception(\"no user info\")\n        sb.appendLine(\"$idnt  uuid: ${uri.userInfo}\")\n        sb.appendLine(\n            \"$idnt  tls: ${\n                (ConfigUtil.getQueryParams(\n                    uri,\n                    \"security\"\n                ) ?: \"\") == \"tls\"\n            }\"\n        )\n        sb.appendLine(\n            \"$idnt  servername: ${\n                ConfigUtil.getQueryParams(\n                    uri,\n                    \"sni\"\n                ) ?: ConfigUtil.getQueryParams(uri, \"host\") ?: uri.host!!\n            }\"\n        )\n        sb.appendLine(\"$idnt  skip-cert-verify: true\")\n        sb.appendLine(\"$idnt  udp: true\")\n        if (ConfigUtil.getQueryParams(\n                uri,\n                \"flow\"\n            ) != null\n        ) sb.appendLine(\"$idnt  flow: ${ConfigUtil.getQueryParams(uri, \"flow\")!!}\")\n        val type = ConfigUtil.getQueryParams(uri, \"type\") ?: \"tcp\"\n        val decodePath =\n            URLDecoder.decode(ConfigUtil.getQueryParams(uri, \"path\") ?: \"\", \"UTF-8\")\n        val decodeHost =\n            URLDecoder.decode(ConfigUtil.getQueryParams(uri, \"host\") ?: \"\", \"UTF-8\")\n        when (type) {\n            \"ws\" -> {\n                sb.appendLine(\"$idnt  network: ws\")\n                sb.appendLine(\"$idnt  ws-opts:\")\n\n                sb.appendLine(\"$idnt    path: $decodePath\")\n                sb.appendLine(\"$idnt    headers:\")\n                sb.append(\"$idnt      Host: $decodeHost\")\n            }\n\n            \"tcp\" -> {}\n            \"http\" -> {}\n            \"grpc\" -> {\n                sb.appendLine(\"$idnt  network: grpc\")\n                sb.appendLine(\"$idnt  grpc-opts:\")\n                sb.append(\n                    \"$idnt    grpc-service-name: ${\n                        ConfigUtil.getQueryParams(\n                            uri,\n                            \"serviceName\"\n                        ) ?: \"\"\n                    }\"\n                )\n            }\n\n            else -> throw Exception(\"$type not supported\")\n        }\n        return sb.toString()\n    }\n\n    fun newTrojanConfig(): String {\n        val sb = StringBuilder()\n        val idnt: String = if (indent) \"  \" else \"\"\n        var url = masuk\n        if (!url.contains(\"@\")) url = ConfigUtil.safeDecodeURLB64(url)\n        val uri = Uri.parse(url)\n        sb.appendLine(\n            \"${idnt}- name: ${uri.fragment ?: \"new\"}_${uri.scheme}_${\n                Random.nextInt(\n                    0,\n                    7000\n                )\n            }\"\n        )\n        sb.appendLine(\"$idnt  server: ${uri.host ?: \"\"}\")\n        sb.appendLine(\"$idnt  port: ${uri.port}\")\n        sb.appendLine(\"$idnt  type: trojan\")\n        if (uri.userInfo == null || uri.userInfo!!.isEmpty()) throw Exception(\"no user info\")\n        sb.appendLine(\"$idnt  password: ${uri.userInfo}\")\n        sb.appendLine(\n            \"$idnt  sni: ${\n                ConfigUtil.getQueryParams(\n                    uri,\n                    \"sni\"\n                ) ?: ConfigUtil.getQueryParams(uri, \"host\") ?: uri.host!!\n            }\"\n        )\n        sb.appendLine(\"$idnt  skip-cert-verify: true\")\n        sb.appendLine(\"$idnt  udp: true\")\n        if (ConfigUtil.getQueryParams(\n                uri,\n                \"flow\"\n            ) != null\n        ) sb.appendLine(\"$idnt  flow: ${ConfigUtil.getQueryParams(uri, \"flow\")!!}\")\n        val alpnStr = URLDecoder.decode(ConfigUtil.getQueryParams(uri, \"alpn\") ?: \"\", \"UTF-8\")\n        if (alpnStr != \"\") sb.appendLine(\"$idnt  alpn: ${alpnStr.split(\",\")}\")\n\n        val type = ConfigUtil.getQueryParams(uri, \"type\") ?: \"tcp\"\n        val decodePath =\n            URLDecoder.decode(ConfigUtil.getQueryParams(uri, \"path\") ?: \"\", \"UTF-8\")\n        val decodeHost =\n            URLDecoder.decode(ConfigUtil.getQueryParams(uri, \"host\") ?: \"\", \"UTF-8\")\n\n        when (type) {\n            \"ws\" -> {\n                sb.appendLine(\"$idnt  network: ws\")\n                sb.appendLine(\"$idnt  ws-opts:\")\n\n                sb.appendLine(\"$idnt    path: $decodePath\")\n                sb.appendLine(\"$idnt    headers:\")\n                sb.append(\"$idnt      Host: $decodeHost\")\n            }\n\n            \"tcp\" -> {}\n            \"http\" -> {}\n            \"grpc\" -> {\n                sb.appendLine(\"$idnt  network: grpc\")\n                sb.appendLine(\"$idnt  grpc-opts:\")\n                sb.append(\n                    \"$idnt    grpc-service-name: ${\n                        ConfigUtil.getQueryParams(\n                            uri,\n                            \"serviceName\"\n                        ) ?: \"\"\n                    }\"\n                )\n            }\n\n            else -> throw Exception(\"$type not supported\")\n        }\n\n        return sb.toString()\n    }\n\n}\n"
  },
  {
    "path": "app/src/main/java/xyz/chz/bfm/ui/converter/config/ConfigType.kt",
    "content": "package xyz.chz.bfm.ui.converter.config\n\nenum class ConfigType(val scheme: String) {\n    VMESS(\"vmess://\"),\n    VLESS(\"vless://\"),\n    TROJAN(\"trojan://\"),\n    TROJANGO(\"trojan-go://\")\n}"
  },
  {
    "path": "app/src/main/java/xyz/chz/bfm/ui/converter/config/ConfigUtil.kt",
    "content": "package xyz.chz.bfm.ui.converter.config\n\nimport android.net.Uri\nimport android.util.Base64\n\nobject ConfigUtil {\n\n    fun safeDecodeURLB64(url: String): String {\n        val split = url.split(\"://\").toTypedArray()\n        val schema = split[0]\n        val result = split[1].substring(5)\n            .replace(' ', '-')\n            .replace('/', '_')\n            .replace('+', '-')\n        return \"$schema://$result\"\n    }\n\n    fun getQueryParams(uri: Uri, param: String): String? {\n        for (p in uri.queryParameterNames) {\n            if (param.equals(p, ignoreCase = true))\n                return uri.getQueryParameter(p)\n        }\n        return null\n    }\n\n    fun decode(text: String): String {\n        tryDecodeBase64(text)?.let { return it }\n        if (text.endsWith('=')) {\n            // try again for some loosely formatted base64\n            tryDecodeBase64(text.trimEnd('='))?.let { return it }\n        }\n        return \"\"\n    }\n\n    private fun tryDecodeBase64(text: String): String? {\n        try {\n            return Base64.decode(text, Base64.NO_WRAP).toString(charset(\"UTF-8\"))\n        } catch (e: Exception) {\n            e.printStackTrace()\n        }\n        try {\n            return Base64.decode(text, Base64.NO_WRAP.or(Base64.URL_SAFE))\n                .toString(charset(\"UTF-8\"))\n        } catch (e: Exception) {\n            e.printStackTrace()\n        }\n        return null\n    }\n\n}"
  },
  {
    "path": "app/src/main/java/xyz/chz/bfm/ui/converter/config/SingBoxData.kt",
    "content": "package xyz.chz.bfm.ui.converter.config\n\nimport android.net.Uri\nimport org.json.JSONObject\nimport xyz.chz.bfm.util.Util\nimport java.net.URLDecoder\nimport kotlin.random.Random\n\n//Template sing-box copied from singribet.deno.dev\nclass SingBoxData(private val masuk: String = \"\") {\n\n    fun vmessSing(): String {\n        val jo = JSONObject(masuk)\n        val json = Util.json {\n            \"tag\" to \"${jo.optString(\"ps\", jo.optString(\"add\", \"new\"))}_vmess_${\n                Random.nextInt(\n                    0,\n                    7000\n                )\n            }\"\n            \"type\" to \"vmess\"\n            \"server\" to jo.optString(\"add\", jo.optString(\"host\", \"\"))\n            \"server_port\" to jo.getString(\"port\").toInt()\n            \"uuid\" to jo.getString(\"id\")\n            \"security\" to jo.optString(\"scy\", \"auto\")\n            \"alter_id\" to jo.optString(\"aid\", \"0\").toInt()\n            \"multiplex\" to {\n                \"enabled\" to false\n                \"protocol\" to \"smux\"\n                \"max_streams\" to 32\n            }\n            if (jo.optString(\"tls\", \"\") == \"tls\") {\n                \"tls\" to {\n                    \"enabled\" to true\n                    \"server_name\" to jo.optString(\"sni\", jo.optString(\"add\", \"\"))\n                    \"insecure\" to true\n                    \"disable_sni\" to false\n                }\n            }\n            val type = jo.optString(\"net\", \"tcp\")\n            when (type) {\n                \"ws\" -> {\n                    \"transport\" to {\n                        \"type\" to \"ws\"\n                        \"path\" to jo.optString(\"path\", \"/\")\n                        \"headers\" to {\n                            \"Host\" to jo.optString(\"host\", jo.optString(\"add\", \"\"))\n                        }\n                    }\n                }\n\n                \"grpc\" -> {\n                    \"transport\" to {\n                        \"type\" to \"grpc\"\n                        \"service_name\" to jo.optString(\"path\", \"/\")\n                    }\n                }\n\n                \"tcp\" -> {}\n                \"h2\" -> {}\n                else -> throw Exception(\"$type not supported\")\n            }\n        }\n\n        return json.toString(2)\n    }\n\n    fun vlessSing(): String {\n        var url = masuk\n        if (!url.contains(\"@\")) url = ConfigUtil.safeDecodeURLB64(url)\n        val uri = Uri.parse(url)\n        val json = Util.json {\n            \"tag\" to \"${uri.fragment ?: \"new\"}_${uri.scheme}_${\n                Random.nextInt(\n                    0,\n                    7000\n                )\n            }\"\n            \"type\" to \"vless\"\n            (\"server\" to uri.host)\n            \"server_port\" to uri.port.toInt()\n            if (uri.userInfo == null || uri.userInfo!!.isEmpty()) throw Exception(\"no user info\")\n            \"uuid\" to uri.userInfo\n            if (ConfigUtil.getQueryParams(\n                    uri,\n                    \"flow\"\n                ) != null\n            ) \"flow\" to ConfigUtil.getQueryParams(uri, \"flow\")!! else \"flow\" to \"\"\n            \"packet_encoding\" to \"xudp\"\n            \"multiplex\" to {\n                \"enabled\" to false\n                \"protocol\" to \"smux\"\n                \"max_streams\" to 32\n            }\n            if ((ConfigUtil.getQueryParams(uri, \"security\") ?: \"\") == \"tls\") {\n                \"tls\" to {\n                    \"enabled\" to true\n                    \"server_name\" to (ConfigUtil.getQueryParams(uri, \"sni\")\n                        ?: ConfigUtil.getQueryParams(uri, \"host\") ?: uri.host!!)\n                    \"insecure\" to true\n                    \"disable_sni\" to false\n                }\n            }\n            val decodePath =\n                URLDecoder.decode(ConfigUtil.getQueryParams(uri, \"path\") ?: \"\", \"UTF-8\")\n            val decodeHost =\n                URLDecoder.decode(ConfigUtil.getQueryParams(uri, \"host\") ?: \"\", \"UTF-8\")\n            val type = ConfigUtil.getQueryParams(uri, \"type\") ?: \"tcp\"\n            when (type) {\n                \"ws\" -> {\n                    \"transport\" to {\n                        \"type\" to \"ws\"\n                        \"path\" to decodePath\n                        \"headers\" to {\n                            \"Host\" to decodeHost\n                        }\n                    }\n                }\n\n                \"grpc\" -> {\n                    \"transport\" to {\n                        \"type\" to \"grpc\"\n                        (\"service_name\" to ConfigUtil.getQueryParams(uri, \"serviceName\"))\n                        \"idle_timeout\" to \"15s\"\n                        \"ping_timeout\" to \"15s\"\n                        \"permit_without_stream\" to false\n                    }\n                }\n\n                \"tcp\" -> {}\n                \"http\" -> {}\n                else -> throw Exception(\"$type not supported\")\n            }\n        }\n        return json.toString(2)\n    }\n\n    fun trojanSing(): String {\n        var url = masuk\n        if (!url.contains(\"@\")) url = ConfigUtil.safeDecodeURLB64(url)\n        val uri = Uri.parse(url)\n        val json = Util.json {\n            \"tag\" to \"${uri.fragment ?: \"new\"}_${uri.scheme}_${\n                Random.nextInt(\n                    0,\n                    7000\n                )\n            }\"\n            \"type\" to \"trojan\"\n            (\"server\" to uri.host)\n            \"server_port\" to uri.port.toInt()\n            if (uri.userInfo == null || uri.userInfo!!.isEmpty()) throw Exception(\"no user info\")\n            \"password\" to uri.userInfo\n            \"multiplex\" to {\n                \"enabled\" to false\n                \"protocol\" to \"smux\"\n                \"max_streams\" to 32\n            }\n            if ((ConfigUtil.getQueryParams(uri, \"security\") ?: \"\") == \"tls\") {\n                \"tls\" to {\n                    \"enabled\" to true\n                    \"server_name\" to (ConfigUtil.getQueryParams(uri, \"sni\")\n                        ?: ConfigUtil.getQueryParams(uri, \"host\") ?: uri.host!!)\n                    \"insecure\" to true\n                    \"disable_sni\" to false\n                }\n            }\n            val decodePath =\n                URLDecoder.decode(ConfigUtil.getQueryParams(uri, \"path\") ?: \"\", \"UTF-8\")\n            val decodeHost =\n                URLDecoder.decode(ConfigUtil.getQueryParams(uri, \"host\") ?: \"\", \"UTF-8\")\n            val type = ConfigUtil.getQueryParams(uri, \"type\") ?: \"tcp\"\n            when (type) {\n                \"ws\" -> {\n                    \"transport\" to {\n                        \"type\" to \"ws\"\n                        \"path\" to decodePath\n                        \"headers\" to {\n                            \"Host\" to decodeHost\n                        }\n                    }\n                }\n\n                \"grpc\" -> {\n                    \"transport\" to {\n                        \"type\" to \"grpc\"\n                        (\"service_name\" to ConfigUtil.getQueryParams(uri, \"serviceName\"))\n                        \"idle_timeout\" to \"15s\"\n                        \"ping_timeout\" to \"15s\"\n                        \"permit_without_stream\" to false\n                    }\n                }\n\n                \"tcp\" -> {}\n                \"http\" -> {}\n                else -> throw Exception(\"$type not supported\")\n            }\n        }\n        return json.toString(2)\n    }\n\n    fun buildHeaderSlector(arrName: ArrayList<String>): String {\n        val sb = StringBuilder()\n        sb.append(\"{\\\"type\\\": \\\"selector\\\",\\\"tag\\\": \\\"match\\\",\")\n        sb.append(\"\\\"outbounds\\\": [\\\"urltest\\\",\")\n        for (x in arrName)\n            sb.append(x)\n        sb.append(\"]},\")\n        return sb.toString().replace(\",]\", \"]\")\n    }\n\n    fun buildHeaderBestUrl(arrName: ArrayList<String>): String {\n        val sb = StringBuilder()\n        sb.append(\"{\\\"type\\\": \\\"urltest\\\",\\\"tag\\\": \\\"urltest\\\",\\\"url\\\": \\\"http://www.gstatic.com/generate_204\\\",\\\"interval\\\": \\\"1m\\\",\\\"tolerance\\\": 50,\\\"interrupt_exist_connections\\\": false,\")\n        sb.append(\"\\\"outbounds\\\": [\")\n        for (x in arrName)\n            sb.append(x)\n        sb.append(\"]},\")\n        sb.append(\"{\\\"type\\\": \\\"selector\\\",\\\"tag\\\": \\\"ads-all\\\",\")\n        sb.append(\"\\\"outbounds\\\": [\\\"direct\\\",\\\"block\\\",\\\"match\\\"\")\n        sb.append(\"]},\")\n        return sb.toString().replace(\",]\", \"]\")\n    }\n\n    fun buildFooter(): String {\n        val json = Util.json {\n            \"type\" to \"direct\"\n            \"tag\" to \"direct\"\n        }\n        val json2 = Util.json {\n            \"type\" to \"block\"\n            \"tag\" to \"block\"\n        }\n        val json3 = Util.json {\n            \"type\" to \"dns\"\n            \"tag\" to \"dns-out\"\n        }\n        return \"${json.toString(2)},\\n${json2.toString(2)},\\n${json3.toString(2)}\"\n    }\n\n}"
  },
  {
    "path": "app/src/main/java/xyz/chz/bfm/ui/core/CoreActivity.kt",
    "content": "package xyz.chz.bfm.ui.core\n\nimport android.annotation.SuppressLint\nimport android.os.Bundle\nimport androidx.appcompat.app.AppCompatActivity\nimport androidx.core.view.isVisible\nimport dagger.hilt.android.AndroidEntryPoint\nimport okhttp3.Call\nimport okhttp3.Callback\nimport okhttp3.Response\nimport org.json.JSONArray\nimport org.json.JSONException\nimport org.json.JSONObject\nimport xyz.chz.bfm.databinding.ActivityCoreBinding\nimport xyz.chz.bfm.ui.core.util.CoreUtil\nimport xyz.chz.bfm.ui.core.util.DownloaderCore\nimport xyz.chz.bfm.ui.core.util.IDownloadCore\nimport xyz.chz.bfm.util.META_DOWNLOAD\nimport xyz.chz.bfm.util.META_REPO\nimport xyz.chz.bfm.util.OkHttpHelper\nimport xyz.chz.bfm.util.SING_DOWNLOAD\nimport xyz.chz.bfm.util.SING_REPO\nimport xyz.chz.bfm.util.command.CoreCmd\nimport xyz.chz.bfm.util.toast\nimport xyz.chz.bfm.util.urlText\nimport java.io.IOException\n\n@AndroidEntryPoint\n@SuppressLint(\"SetTextI18n\")\nclass CoreActivity : AppCompatActivity() {\n    private lateinit var binding: ActivityCoreBinding\n    private lateinit var dCore: DownloaderCore\n\n    private var urlClash = \"\"\n    private var urlSing = \"\"\n    private var tagNameClash = \"\"\n    private var tagNameSing = \"\"\n\n    override fun onCreate(savedInstanceState: Bundle?) {\n        super.onCreate(savedInstanceState)\n        binding = ActivityCoreBinding.inflate(layoutInflater)\n        setContentView(binding.root)\n        dCore = DownloaderCore(this)\n        checkClash()\n        buttonUp()\n    }\n\n    private fun checkClash() = with(binding) {\n        tvClash.text = \"Checking for mihomo\"\n        prgClash.isVisible = true\n        OkHttpHelper().reqGithub(META_REPO, object : Callback {\n            override fun onFailure(call: Call, e: IOException) {\n                runOnUiThread {\n                    tvClash.text = \"Failed to get repo clash, check ur internet connection\"\n                    prgClash.isVisible = false\n                }\n            }\n\n            override fun onResponse(call: Call, response: Response) {\n                val respom = response.body!!.string()\n                runOnUiThread {\n                    urlClash = parseClash(respom)\n                    if (parseVersionClashMeta() != CoreCmd.checkVerClashMeta) {\n                        tvClash.text = \"Update available mihomo\"\n                        btnClash.isVisible = true\n                    } else {\n                        tvClash.text = \"mihomo has Latest Version\"\n                        imgDoneClash.isVisible = true\n                        btnClash.isVisible = false\n                    }\n                    prgClash.isVisible = false\n                }\n            }\n        })\n    }\n\n    private fun parseClash(str: String): String {\n        return try {\n            val jo = JSONObject(str)\n            tagNameClash = jo.getString(\"tag_name\")\n            if (CoreUtil.getAbis().contains(\"arm64\")) {\n                \"$META_DOWNLOAD/$tagNameClash/mihomo-android-arm64-v8-$tagNameClash.gz\"\n            } else {\n                \"$META_DOWNLOAD/$tagNameClash/mihomo-android-armv7-$tagNameClash.gz\"\n            }\n        } catch (e: JSONException) {\n            e.message!!.toString()\n        }\n    }\n\n    private fun parseVersionClashMeta(): String {\n        return try {\n            \"$META_DOWNLOAD/$tagNameClash/version.txt\".urlText()\n        } catch (e: Exception) {\n            e.message.toString()\n        }\n    }\n\n    private fun buttonUp() = with(binding) {\n        btnClash.apply {\n            setOnClickListener {\n                dCore.downloadFile(\n                    urlClash,\n                    \"clash_meta.gz\",\n                    \"/data/adb/box/bin/xclash/mihomo\",\n                    object : IDownloadCore {\n                        override fun onDownloadingStart() {\n                            prgHrzClash.isVisible = true\n                            btnClash.isVisible = false\n                        }\n\n                        override fun onDownloadingProgress(progress: Int) {\n                            prgHrzClash.progress = progress\n                        }\n\n                        override fun onDownloadingComplete() {\n                            btnClash.isVisible = false\n                            prgHrzClash.isVisible = false\n                            imgDoneClash.isVisible = true\n                            tvClash.text = \"mihomo has Latest Version\"\n                        }\n\n                        override fun onDownloadingFailed(e: Exception?) {\n                            toast(\"failed downloading clash\", this@CoreActivity)\n                            btnClash.isVisible = true\n                            prgHrzClash.progress = 0\n                            prgHrzClash.isVisible = false\n                        }\n                    })\n                }\n        }\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/xyz/chz/bfm/ui/core/util/CoreUtil.kt",
    "content": "package xyz.chz.bfm.ui.core.util\n\nimport xyz.chz.bfm.util.terminal.TerminalHelper\nimport java.io.FileInputStream\nimport java.io.FileOutputStream\nimport java.io.IOException\nimport java.util.zip.GZIPInputStream\n\nobject CoreUtil {\n\n    fun gZipExtractor(gzipIn: String, gzipOut: String) {\n        try {\n            val fis = FileInputStream(gzipIn)\n            val gis = GZIPInputStream(fis)\n            val fos = FileOutputStream(gzipOut)\n            val buff = ByteArray(1024)\n            var len: Int\n            while (gis.read(buff).also { len = it } != -1) {\n                fos.write(buff, 0, len)\n            }\n            fos.close()\n            gis.close()\n        } catch (e: IOException) {\n            e.printStackTrace()\n        }\n    }\n\n    fun tarExtractUsingRoot(tarIn: String, tarOut: String) {\n        TerminalHelper.execRootCmdSilent(\"tar xfz $tarIn -C $tarOut && mv -f $tarOut/sing-box-v* $tarOut/sing-box && chmod 755 $tarOut/sing-box && chown root:net_admin $tarOut/sing-box\")\n    }\n\n    fun getAbis(): String {\n        for (abis in android.os.Build.SUPPORTED_ABIS) {\n            when (abis) {\n                \"arm64-v8a\" -> return \"arm64\"\n                \"armeabi-v7a\" -> return \"armv7\"\n            }\n        }\n        return throw RuntimeException(\"unable get abis\")\n    }\n}"
  },
  {
    "path": "app/src/main/java/xyz/chz/bfm/ui/core/util/DownloaderCore.kt",
    "content": "package xyz.chz.bfm.ui.core.util\n\nimport android.content.Context\nimport android.os.Handler\nimport android.os.Looper\nimport xyz.chz.bfm.util.command.CoreCmd\nimport java.io.BufferedInputStream\nimport java.io.File\nimport java.io.FileOutputStream\nimport java.io.InputStream\nimport java.net.URL\nimport java.util.concurrent.ExecutorService\nimport java.util.concurrent.Executors\n\nopen class DownloaderCore(private val ctx: Context) {\n    private var exFile: File? = null\n\n    fun downloadFile(\n        stringUrl: String,\n        nameFile: String,\n        path: String,\n        callback: IDownloadCore\n    ) {\n        val executor: ExecutorService = Executors.newSingleThreadExecutor()\n        val handler = Handler(Looper.getMainLooper())\n        executor.execute {\n            handler.post { callback.onDownloadingStart() }\n            try {\n                val url = URL(stringUrl)\n                val conection = url.openConnection()\n                conection.connect()\n                val lenghtOfFile = conection.contentLength\n                val input: InputStream = BufferedInputStream(url.openStream(), 8192)\n                exFile = File(ctx.getExternalFilesDir(null), nameFile)\n                if (exFile!!.exists()) exFile!!.delete()\n                val output = FileOutputStream(exFile)\n                val data = ByteArray(1024)\n                var total: Long = 0\n                while (true) {\n                    val read = input.read(data)\n                    if (read == -1) {\n                        break\n                    }\n                    output.write(data, 0, read)\n                    val j2 = total + read.toLong()\n                    if (lenghtOfFile > 0) {\n                        val progress = ((100 * j2 / lenghtOfFile.toLong()).toInt())\n                        callback.onDownloadingProgress(progress)\n                    }\n                    total = j2\n                }\n                output.flush()\n                output.close()\n                input.close()\n                handler.post { callback.onDownloadingComplete() }\n                if (nameFile.contains(\"clash\")) {\n                    val x = exFile.toString().replace(\".gz\", \"\")\n                    CoreUtil.gZipExtractor(\n                        exFile.toString(),\n                        x\n                    )\n                    CoreCmd.moveResult(x, path)\n                } else {\n                    CoreUtil.tarExtractUsingRoot(exFile.toString(), path)\n                }\n                exFile!!.delete()\n            } catch (e: Exception) {\n                handler.post {\n                    exFile!!.delete()\n                    callback.onDownloadingFailed(e)\n                }\n            }\n        }\n    }\n}"
  },
  {
    "path": "app/src/main/java/xyz/chz/bfm/ui/core/util/IDownloadCore.kt",
    "content": "package xyz.chz.bfm.ui.core.util\n\ninterface IDownloadCore {\n    fun onDownloadingStart()\n    fun onDownloadingProgress(progress: Int)\n    fun onDownloadingComplete()\n    fun onDownloadingFailed(e: Exception?)\n}"
  },
  {
    "path": "app/src/main/java/xyz/chz/bfm/ui/fragment/AppListFragment.kt",
    "content": "package xyz.chz.bfm.ui.fragment\n\nimport android.annotation.SuppressLint\nimport android.os.Bundle\nimport android.view.LayoutInflater\nimport android.view.View\nimport android.view.ViewGroup\nimport androidx.core.widget.doOnTextChanged\nimport androidx.fragment.app.Fragment\nimport androidx.preference.PreferenceManager\nimport androidx.recyclerview.widget.DividerItemDecoration\nimport androidx.recyclerview.widget.LinearLayoutManager\nimport dagger.hilt.android.AndroidEntryPoint\nimport rx.android.schedulers.AndroidSchedulers\nimport rx.schedulers.Schedulers\nimport xyz.chz.bfm.R\nimport xyz.chz.bfm.adapter.AppListAdapter\nimport xyz.chz.bfm.data.AppInfo\nimport xyz.chz.bfm.data.AppManager\nimport xyz.chz.bfm.databinding.FragmentAppListBinding\nimport xyz.chz.bfm.util.Util\nimport xyz.chz.bfm.util.command.TermCmd\nimport xyz.chz.bfm.util.setMyFab\nimport xyz.chz.bfm.util.showKeyboard\nimport java.text.Collator\n\n@AndroidEntryPoint\nclass AppListFragment : Fragment() {\n\n    private lateinit var binding: FragmentAppListBinding\n\n    private var adapter: AppListAdapter? = null\n    private var appsAll: List<AppInfo>? = null\n    private val defaultsSharedPreferences by lazy {\n        PreferenceManager.getDefaultSharedPreferences(\n            requireActivity()\n        )\n    }\n\n    override fun onCreateView(\n        inflater: LayoutInflater, container: ViewGroup?,\n        savedInstanceState: Bundle?\n    ): View {\n        binding = FragmentAppListBinding.inflate(layoutInflater, container, false)\n        return binding.root\n    }\n\n\n    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {\n        super.onViewCreated(view, savedInstanceState)\n        binding.apply {\n            val dividerItemDecoration =\n                DividerItemDecoration(requireActivity(), LinearLayoutManager.VERTICAL)\n            rvApps.addItemDecoration(dividerItemDecoration)\n\n            val applist = TermCmd.appidList\n\n            AppManager.rxLoadNetworkAppList(requireActivity())\n                .subscribeOn(Schedulers.io())\n                .map {\n                    if (applist != null) {\n                        it.forEach { one ->\n                            if ((applist.contains(one.packageName))) {\n                                one.isSelected = 1\n                            } else {\n                                one.isSelected = 0\n                            }\n                        }\n                        val comparator = Comparator<AppInfo> { p1, p2 ->\n                            when {\n                                p1.isSelected > p2.isSelected -> -1\n                                p1.isSelected == p2.isSelected -> 0\n                                else -> 1\n                            }\n                        }\n                        it.sortedWith(comparator)\n                    } else {\n                        val comparator = object : Comparator<AppInfo> {\n                            val collator = Collator.getInstance()\n                            override fun compare(o1: AppInfo, o2: AppInfo) =\n                                collator.compare(o1.appName, o2.appName)\n                        }\n                        it.sortedWith(comparator)\n                    }\n                }\n                .observeOn(AndroidSchedulers.mainThread())\n                .subscribe {\n                    appsAll = it\n                    adapter = AppListAdapter(requireActivity(), it, applist)\n                    rvApps.adapter = adapter\n                    prgWaiting.visibility = View.GONE\n                }\n\n            with(fbSave) {\n                setOnClickListener {\n                    setMyFab(\"#888F96\", R.drawable.ic_commit)\n                    if (Util.isProxyed) {\n                        TermCmd.renewBox {\n                            Util.runOnUiThread {\n                                if (it) {\n                                    setMyFab(\"#6fa251\", R.drawable.ic_done)\n                                } else {\n                                    setMyFab(\"#EC7474\", R.drawable.ic_error)\n                                }\n                            }\n                        }\n                    }\n                    adapter?.let {\n                        TermCmd.setAppidList(it.blacklist)\n                    }\n                }\n            }\n        }\n        setupSearchApp()\n        setupSelect()\n    }\n\n    @SuppressLint(\"NotifyDataSetChanged\")\n    private fun setupSelect() = with(binding) {\n        selectAll.setOnClickListener {\n            adapter?.let {\n                if (it.blacklist.containsAll(it.apps.map { it.packageName })) {\n                    it.apps.forEach {\n                        adapter?.blacklist!!.remove(it.packageName)\n                    }\n                } else {\n                    it.apps.forEach {\n                        adapter?.blacklist!!.add(it.packageName)\n\n                    }\n                }\n                it.notifyDataSetChanged()\n            }\n        }\n    }\n\n    private fun setupSearchApp() = with(binding) {\n        searchBtn.setOnClickListener {\n            tvInfoApps.visibility = View.GONE\n            edSearch.visibility = View.VISIBLE\n            edSearch.doOnTextChanged { text, _, _, _ ->\n                search(text.toString())\n            }\n            edSearch.showKeyboard()\n        }\n    }\n\n    @SuppressLint(\"NotifyDataSetChanged\")\n    private fun search(str: String) {\n        val apps = ArrayList<AppInfo>()\n\n        val key = str.uppercase()\n        if (key.isNotEmpty()) {\n            appsAll?.forEach {\n                if (it.appName.uppercase().indexOf(key) >= 0\n                    || it.packageName.uppercase().indexOf(key) >= 0\n                ) {\n                    apps.add(it)\n                }\n            }\n        } else {\n            appsAll?.forEach {\n                apps.add(it)\n            }\n        }\n\n        adapter = AppListAdapter(requireActivity(), apps, adapter?.blacklist)\n        binding.rvApps.adapter = adapter\n        adapter?.notifyDataSetChanged()\n    }\n}"
  },
  {
    "path": "app/src/main/java/xyz/chz/bfm/ui/fragment/ConfigHelperFragment.kt",
    "content": "package xyz.chz.bfm.ui.fragment\n\nimport android.content.Intent\nimport android.os.Bundle\nimport android.view.LayoutInflater\nimport android.view.View\nimport android.view.ViewGroup\nimport androidx.appcompat.app.AlertDialog\nimport androidx.fragment.app.Fragment\nimport xyz.chz.bfm.R\nimport xyz.chz.bfm.databinding.FragmentConfigHelperBinding\nimport xyz.chz.bfm.ui.converter.ConverterActivity\nimport xyz.chz.bfm.util.Util\nimport xyz.chz.bfm.util.command.TermCmd\nimport xyz.chz.bfm.util.terminal.TerminalHelper.execRootCmd\nimport xyz.chz.bfm.util.toast\n\n\nclass ConfigHelperFragment : Fragment() {\n\n    private lateinit var binding: FragmentConfigHelperBinding\n    private var statePath: String? = null\n\n    override fun onCreateView(\n        inflater: LayoutInflater, container: ViewGroup?,\n        savedInstanceState: Bundle?\n    ): View? {\n        binding = FragmentConfigHelperBinding.inflate(layoutInflater, container, false)\n        return binding.root\n    }\n\n    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {\n        super.onViewCreated(view, savedInstanceState)\n        setupEditor()\n        initEditor()\n        editorApply()\n    }\n\n    private fun setupEditor() = with(binding.myEditor) {\n        languageRuleBook = null\n        lineNumberGenerator = { l ->\n            (1..l).map { \" $it \" }\n        }\n        editable = true\n        showDivider = false\n        showMinimap = false\n    }\n\n    private fun initEditor() = with(binding) {\n        dialogConfig()\n    }\n\n    private fun editorApply() = with(binding) {\n        fbSave.apply {\n            setOnClickListener {\n                dialogSave()\n            }\n        }\n\n        fbConverter.apply {\n            setOnClickListener {\n                val intent = Intent(context, ConverterActivity::class.java)\n                startActivity(intent)\n            }\n        }\n    }\n\n    private fun dialogConfig() {\n        val builder = AlertDialog.Builder(\n            requireActivity(),\n            R.style.ThemeOverlay_MaterialComponents_MaterialAlertDialog_background\n        )\n        builder.setCancelable(false)\n        val items = TermCmd.proxyProviderPath.toTypedArray()\n        builder.setItems(items) { _, w ->\n            val configSlected = execRootCmd(\"cat ${items[w]}\")\n            if (configSlected.isNotEmpty()) {\n                binding.myEditor.text = configSlected\n            } else {\n                toast(\"Empty file\", requireActivity())\n            }\n            statePath = items[w]\n\n        }\n        val dialog = builder.create()\n        dialog.show()\n    }\n\n    private fun dialogSave() {\n        val builder = AlertDialog.Builder(\n            requireActivity(),\n            R.style.ThemeOverlay_MaterialComponents_MaterialAlertDialog_background\n        )\n        builder.setTitle(\"Save\")\n        builder.setMessage(\"Do you want save config now ?\")\n        builder.setPositiveButton(\"yes\") { _, _ ->\n            val input = binding.myEditor.text\n            TermCmd.saveConfig(requireActivity(), input, statePath!!) {\n                Util.runOnUiThread {\n                    if (it)\n                        toast(requireActivity().getString(R.string.success), requireActivity())\n                    else\n                        toast(requireActivity().getString(R.string.failed), requireActivity())\n                }\n            }\n        }\n        builder.setNegativeButton(\"cancel\") { d, _ ->\n            d.dismiss()\n        }\n        val dialog = builder.create()\n        dialog.show()\n    }\n\n}"
  },
  {
    "path": "app/src/main/java/xyz/chz/bfm/ui/fragment/DashboardFragment.kt",
    "content": "package xyz.chz.bfm.ui.fragment\n\nimport android.annotation.SuppressLint\nimport android.os.Bundle\nimport android.view.LayoutInflater\nimport android.view.View\nimport android.view.ViewGroup\nimport android.webkit.WebSettings\nimport android.webkit.WebViewClient\nimport androidx.fragment.app.DialogFragment\nimport androidx.fragment.app.Fragment\nimport dagger.hilt.android.AndroidEntryPoint\nimport xyz.chz.bfm.databinding.FragmentDashboardBinding\nimport xyz.chz.bfm.dialog.IMakeDialog\nimport xyz.chz.bfm.dialog.MakeDialog\nimport xyz.chz.bfm.util.Util\nimport xyz.chz.bfm.util.command.SettingCmd\nimport xyz.chz.bfm.util.command.TermCmd\n\n@AndroidEntryPoint\nclass DashboardFragment : Fragment(), IMakeDialog {\n\n    private lateinit var binding: FragmentDashboardBinding\n    override fun onCreateView(\n        inflater: LayoutInflater, container: ViewGroup?,\n        savedInstanceState: Bundle?\n    ): View {\n        binding = FragmentDashboardBinding.inflate(layoutInflater, container, false)\n        return binding.root\n    }\n\n\n    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {\n        super.onViewCreated(view, savedInstanceState)\n        if (Util.isClashOrSing) {\n            showRes()\n        } else {\n            MakeDialog(\n                \"Wowo :( \",\n                \"Your core is not clash or sing-box so dashboard not available\",\n                false,\n                false\n            ).show(requireActivity().supportFragmentManager, \"\")\n        }\n    }\n\n    @SuppressLint(\"SetJavaScriptEnabled\")\n    private fun showRes() = with(binding) {\n        val linkDB: String = if (SettingCmd.core == \"clash\") {\n            TermCmd.linkDBClash\n        } else {\n            TermCmd.linkDBSing\n        }\n        dbWebview.loadUrl(\"${linkDB}/ui/#/proxies\")\n\n        with(dbWebview.settings) {\n            domStorageEnabled = true\n            databaseEnabled = true\n            allowContentAccess = true\n            javaScriptEnabled = true\n            cacheMode = WebSettings.LOAD_NO_CACHE\n            dbWebview.webViewClient = WebViewClient()\n        }\n    }\n\n    override fun onDialogPositiveButton(dialog: DialogFragment) {\n    }\n}"
  },
  {
    "path": "app/src/main/java/xyz/chz/bfm/ui/fragment/MainFragment.kt",
    "content": "package xyz.chz.bfm.ui.fragment\n\nimport android.content.Intent\nimport android.os.Bundle\nimport android.util.Log\nimport android.view.LayoutInflater\nimport android.view.View\nimport android.view.ViewGroup\nimport androidx.fragment.app.DialogFragment\nimport androidx.fragment.app.Fragment\nimport androidx.fragment.app.viewModels\nimport androidx.navigation.fragment.findNavController\nimport dagger.hilt.android.AndroidEntryPoint\nimport okhttp3.Call\nimport okhttp3.Callback\nimport okhttp3.Response\nimport org.json.JSONException\nimport org.json.JSONObject\nimport xyz.chz.bfm.R\nimport xyz.chz.bfm.databinding.FragmentMainBinding\nimport xyz.chz.bfm.dialog.IMakeDialog\nimport xyz.chz.bfm.dialog.ISettingDialog\nimport xyz.chz.bfm.dialog.MakeDialog\nimport xyz.chz.bfm.dialog.SettingDialog\nimport xyz.chz.bfm.enm.StatusConnection\nimport xyz.chz.bfm.ui.core.CoreActivity\nimport xyz.chz.bfm.ui.model.MainViewModel\nimport xyz.chz.bfm.util.OkHttpHelper\nimport xyz.chz.bfm.util.Util\nimport xyz.chz.bfm.util.command.SettingCmd\nimport xyz.chz.bfm.util.command.TermCmd\nimport xyz.chz.bfm.util.modul.ModuleManager\nimport xyz.chz.bfm.util.moduleVer\nimport xyz.chz.bfm.util.setColorBackground\nimport xyz.chz.bfm.util.setImage\nimport xyz.chz.bfm.util.setTextHtml\nimport xyz.chz.bfm.util.toast\nimport java.io.IOException\n\n@AndroidEntryPoint\nclass MainFragment : Fragment(), ISettingDialog, IMakeDialog {\n\n    private lateinit var binding: FragmentMainBinding\n    private val viewModel: MainViewModel by viewModels()\n    private var state: Int? = 0\n\n    override fun onCreateView(\n        inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?\n    ): View {\n        binding = FragmentMainBinding.inflate(layoutInflater, container, false)\n        return binding.root\n    }\n\n    override fun onCreate(savedInstanceState: Bundle?) {\n        super.onCreate(savedInstanceState)\n        viewModel.dataLog()\n    }\n\n    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {\n        super.onViewCreated(view, savedInstanceState)\n        if (Util.isProxyed) {\n            setProxyCard(StatusConnection.Enabled.str)\n        } else {\n            setProxyCard(StatusConnection.Disabled.str)\n        }\n        binding.apply {\n            proxy.setOnClickListener { v ->\n                setProxyCard(StatusConnection.Loading.str)\n                v.isClickable = false\n                if (Util.isProxyed) {\n                    TermCmd.stop {\n                        Util.runOnUiThread {\n                            Util.isProxyed = if (it) {\n                                setProxyCard(StatusConnection.Disabled.str)\n                                false\n                            } else {\n                                setProxyCard(StatusConnection.Error.str)\n                                true\n                            }\n                            v.isClickable = true\n                        }\n                    }\n                } else {\n                    TermCmd.start {\n                        Util.runOnUiThread {\n                            Util.isProxyed = if (it) {\n                                setProxyCard(StatusConnection.Enabled.str)\n                                true\n                            } else {\n                                setProxyCard(StatusConnection.Error.str)\n                                false\n                            }\n                            v.isClickable = true\n                        }\n                    }\n                }\n            }\n        }\n        setupLog()\n        settings()\n        configEditor()\n        checkCore()\n    }\n\n    private fun setProxyCard(status: String) = with(binding) {\n        val strapps: String = if (TermCmd.appidList.size == 0) String.format(\n            getString(R.string.no_apps_count_list),\n            SettingCmd.proxyMode\n        )\n        else String.format(\n            getString(R.string.apps_count_list), TermCmd.appidList.size, SettingCmd.proxyMode\n        )\n\n        when (status) {\n            StatusConnection.Enabled.str -> {\n                statusTitle.text = StatusConnection.Enabled.str\n                tvApps.text = strapps\n                proxy.setColorBackground(\"#6fa251\")\n                statusIcon.setImage(R.drawable.ic_enabled)\n                statusSummary.moduleVer()\n            }\n\n            StatusConnection.Disabled.str -> {\n                statusTitle.text = StatusConnection.Disabled.str\n                tvApps.text = strapps\n                proxy.setColorBackground(\"#87afc7\")\n                statusIcon.setImage(R.drawable.ic_disabled)\n                statusSummary.moduleVer()\n            }\n\n            StatusConnection.Loading.str -> {\n                statusTitle.text = StatusConnection.Loading.str\n                tvApps.text = strapps\n                proxy.setColorBackground(\"#478fec\")\n                statusIcon.setImage(R.drawable.ic_loading)\n                statusSummary.moduleVer()\n            }\n\n            StatusConnection.Error.str -> {\n                statusTitle.text = StatusConnection.Error.str\n                tvApps.text = strapps\n                proxy.setColorBackground(\"#f35e5e\")\n                statusIcon.setImage(R.drawable.ic_error)\n                statusSummary.moduleVer()\n            }\n\n            else -> {\n                statusTitle.text = StatusConnection.Unknown.str\n                tvApps.text = strapps\n                proxy.setColorBackground(\"#26b545\")\n                statusIcon.setImage(R.drawable.ic_app)\n                statusSummary.moduleVer()\n            }\n        }\n    }\n\n    private fun settings() = with(binding) {\n        with(fbSetting) {\n            setOnClickListener {\n                visibility = View.GONE\n                prgLoading.visibility = View.VISIBLE\n                val sd = SettingDialog()\n                sd.listener = this@MainFragment\n                sd.show(requireActivity().supportFragmentManager, \"\")\n            }\n        }\n    }\n\n    private fun setupLog() = with(binding) {\n        viewModel.log.observe(viewLifecycleOwner) {\n            tvLog.text = setTextHtml(it)\n        }\n    }\n\n    private fun configEditor() = with(binding.fbConfig) {\n        setOnClickListener {\n            findNavController().navigate(R.id.action_nav_home_to_configHelperFragment)\n        }\n    }\n\n    private fun checkCore() = with(binding.imgModule) {\n        setOnClickListener {\n            startActivity(Intent(context, CoreActivity::class.java))\n        }\n    }\n\n    override fun onLoading(dialog: DialogFragment) {\n        binding.fbSetting.visibility = View.VISIBLE\n        binding.prgLoading.visibility = View.GONE\n    }\n\n    override fun onAbout(dialog: DialogFragment) {\n        // dont remove this :)\n        val df = MakeDialog(\"About\", \"App: t.me/chetoosz\\nModule: t.me/taamarin\")\n        df.listener = this@MainFragment\n        df.show(requireActivity().supportFragmentManager, \"\")\n    }\n\n    override fun onUpdate(dialog: DialogFragment) {\n        binding.prgLoadingTop.visibility = View.GONE\n        showRes(\n            \"https://raw.githubusercontent.com/taamarin/box_for_magisk/master/update.json\",\n            \"Updater\",\n            0\n        )\n        state = 0\n    }\n\n    override fun onCheckIP(dialog: DialogFragment) {\n        binding.prgLoadingTop.visibility = View.VISIBLE\n        showRes(\"http://ip-api.com/json\", \"MyIP\", 1)\n        state = 1\n    }\n\n    override fun onDialogPositiveButton(dialog: DialogFragment) = when (state) {\n        1 -> {}\n        else -> {}\n    }\n\n\n    private fun showRes(url: String, title: String, state: Int) {\n        binding.prgLoadingTop.visibility = View.VISIBLE\n        val request = OkHttpHelper()\n        request.getRawTextFromURL(url, object : Callback {\n            override fun onFailure(call: Call, e: IOException) {\n                Util.runOnUiThread {\n                    toast(e.message!!, requireActivity())\n                    binding.prgLoadingTop.visibility = View.GONE\n                }\n            }\n\n            override fun onResponse(call: Call, response: Response) {\n                try {\n                    val jo = JSONObject(response.body!!.string())\n                    var res: String? = \"\"\n                    res = if (state == 1) {\n                        \"IP: ${jo.getString(\"query\")}\\n\" +\n                                \"ISP: ${jo.getString(\"isp\")}\\n\" +\n                                \"TZ: ${jo.getString(\"timezone\")}\\n\" +\n                                \"C: ${jo.getString(\"country\")}\\n\" +\n                                \"City: ${jo.getString(\"city\")}\\n\"\n                    } else {\n                        if (jo.getString(\"versionCode\")\n                                .toInt() > ModuleManager.moduleVersionCode.toInt()\n                        ) {\n                            \"Update available\\nDo you want update now?\"\n                        } else {\n                            \"No update found\"\n                        }\n                    }\n                    val df = MakeDialog(title, res)\n                    df.listener = this@MainFragment\n                    df.show(requireActivity().supportFragmentManager, \"\")\n                } catch (e: JSONException) {\n                    Log.d(MainFragment().tag, e.message!!)\n                }\n                Util.runOnUiThread {\n                    binding.prgLoadingTop.visibility = View.GONE\n                }\n            }\n        })\n    }\n\n}"
  },
  {
    "path": "app/src/main/java/xyz/chz/bfm/ui/model/MainViewModel.kt",
    "content": "package xyz.chz.bfm.ui.model\n\nimport androidx.lifecycle.LiveData\nimport androidx.lifecycle.MutableLiveData\nimport androidx.lifecycle.ViewModel\nimport dagger.hilt.android.lifecycle.HiltViewModel\nimport kotlinx.coroutines.CoroutineScope\nimport kotlinx.coroutines.Dispatchers\nimport kotlinx.coroutines.Job\nimport kotlinx.coroutines.delay\nimport kotlinx.coroutines.isActive\nimport kotlinx.coroutines.launch\nimport okhttp3.Call\nimport okhttp3.Callback\nimport okhttp3.Response\nimport xyz.chz.bfm.util.OkHttpHelper\nimport xyz.chz.bfm.util.command.TermCmd\nimport xyz.chz.bfm.util.myReplacer\nimport javax.inject.Inject\n\n@HiltViewModel\nclass MainViewModel @Inject constructor() : ViewModel() {\n\n    private val _log = MutableLiveData<String>()\n    val log: LiveData<String> get() = _log\n\n    private val _theresult = MutableLiveData<String?>()\n    val theresult: LiveData<String?> = _theresult\n\n    fun dataLog(): Job {\n        return CoroutineScope(Dispatchers.IO).launch {\n            while (isActive) {\n                _log.postValue(\n                    TermCmd.readLog().myReplacer(\n                        \"\\\\[Info\\\\]\".toRegex() to \"<font color=\\\"#58869e\\\">[Info] </font>\",\n                        \"\\\\[Debug\\\\]\".toRegex() to \"<font color=\\\"#156238\\\">[Debug] </font>\",\n                        \"\\\\[Error\\\\]\".toRegex() to \"<font color=\\\"#8e2e41\\\">[Error] </font>\",\n                        \"\\\\[Warning\\\\]\".toRegex() to \"<font color=\\\"#fe9a01\\\">[Warning] </font>\",\n                        \"\\n\".toRegex() to \"<br>\"\n                    )\n                )\n                delay(1500)\n            }\n        }\n    }\n\n    fun getTextFromUrl(url: String) {\n        OkHttpHelper().getRawTextFromURL(url, object : Callback {\n            override fun onFailure(call: Call, e: java.io.IOException) {\n                _theresult.value = e.message!!\n            }\n\n            override fun onResponse(call: Call, response: Response) {\n                _theresult.postValue(response.body!!.string())\n            }\n        })\n    }\n}"
  },
  {
    "path": "app/src/main/java/xyz/chz/bfm/util/Constant.kt",
    "content": "package xyz.chz.bfm.util\n\n// bcs yq yaml cant get emojis\n// dont make this to regex\nconst val EXTRACTOR =\n    \"sed 's/\\\\[//g' | sed 's/\\\\]//g' | sed 's/\\\"//g' | sed 's/,//g' | sed 's/  //g' | awk 'NF'\"\nconst val QUOTES = \"sed 's/\\\"//g'\"\nconst val META_REPO = \"https://api.github.com/repos/MetaCubeX/mihomo/releases/latest\"\nconst val META_DOWNLOAD = \"https://github.com/MetaCubeX/mihomo/releases/download\"\nconst val SING_REPO = \"https://api.github.com/repos/shioeri/sing-box/releases\"\nconst val SING_DOWNLOAD = \"https://github.com/shioeri/sing-box/releases/download\""
  },
  {
    "path": "app/src/main/java/xyz/chz/bfm/util/OkHttpHelper.kt",
    "content": "package xyz.chz.bfm.util\n\nimport okhttp3.Call\nimport okhttp3.Callback\nimport okhttp3.OkHttpClient\nimport okhttp3.Request\n\nclass OkHttpHelper {\n    fun getRawTextFromURL(url: String, callback: Callback): Call {\n        val client = OkHttpClient()\n        val request = Request.Builder()\n            .url(url)\n            .build()\n\n        val call = client.newCall(request)\n        call.enqueue(callback)\n        return call\n    }\n\n    fun reqGithub(url: String, callback: Callback): Call {\n        val client = OkHttpClient()\n        val request = Request.Builder()\n            .url(url)\n            .addHeader(\"Accept\", \"application/vnd.github+json\")\n            .addHeader(\"X-GitHub-Api-Version\", \"2022-11-28\")\n            .build()\n\n        val call = client.newCall(request)\n        call.enqueue(callback)\n        return call\n    }\n}"
  },
  {
    "path": "app/src/main/java/xyz/chz/bfm/util/Util.kt",
    "content": "package xyz.chz.bfm.util\n\nimport android.os.Handler\nimport android.os.Looper\nimport org.json.JSONArray\nimport org.json.JSONObject\nimport xyz.chz.bfm.util.command.SettingCmd\nimport xyz.chz.bfm.util.command.TermCmd\nimport java.util.ArrayDeque\nimport java.util.Deque\n\nobject Util {\n    var isProxyed = TermCmd.isProxying()\n    private val handler = Handler(Looper.getMainLooper())\n\n    fun runOnUiThread(action: () -> Unit) {\n        if (Looper.myLooper() != Looper.getMainLooper()) {\n            handler.post(action)\n        } else {\n            action.invoke()\n        }\n    }\n\n    val isClashOrSing: Boolean\n        get() {\n            if (SettingCmd.core.contains(\"clash\") or SettingCmd.core.contains(\"sing-box\"))\n                return true\n            return false\n        }\n\n    fun json(build: JsonObjectBuilder.() -> Unit): JSONObject {\n        return JsonObjectBuilder().json(build)\n    }\n\n    class JsonObjectBuilder {\n        private val deque: Deque<JSONObject> = ArrayDeque()\n\n        fun json(build: JsonObjectBuilder.() -> Unit): JSONObject {\n            deque.push(JSONObject())\n            this.build()\n            return deque.pop()\n        }\n\n        infix fun <T> String.to(value: T) {\n            val wrapped = when (value) {\n                is Function0<*> -> json { value.invoke() }\n                is Array<*> -> JSONArray().apply { value.forEach { put(it) } }\n                else -> value\n            }\n\n            deque.peek().put(this, wrapped)\n        }\n    }\n}"
  },
  {
    "path": "app/src/main/java/xyz/chz/bfm/util/ViewUtils.kt",
    "content": "package xyz.chz.bfm.util\n\nimport android.annotation.SuppressLint\nimport android.app.Activity\nimport android.content.ClipData\nimport android.content.ClipboardManager\nimport android.content.Context\nimport android.content.res.ColorStateList\nimport android.graphics.Color\nimport android.os.Build\nimport android.text.Html\nimport android.text.Spanned\nimport android.util.TypedValue\nimport android.view.inputmethod.InputMethodManager\nimport android.widget.EditText\nimport android.widget.ImageView\nimport android.widget.TextView\nimport android.widget.Toast\nimport com.google.android.material.card.MaterialCardView\nimport com.google.android.material.floatingactionbutton.FloatingActionButton\nimport xyz.chz.bfm.ui.converter.config.ConfigType\nimport xyz.chz.bfm.util.modul.ModuleManager\nimport java.net.HttpURLConnection\nimport java.net.URL\n\n\nfun MaterialCardView.setColorBackground(str: String) {\n    this.setCardBackgroundColor(Color.parseColor(str))\n    this.radius =\n        TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8f, context.resources.displayMetrics)\n}\n\nfun ImageView.setImage(res: Int) {\n    this.setImageResource(res)\n}\n\nfun TextView.moduleVer() {\n    this.text = ModuleManager.moduleVersion\n}\n\nfun FloatingActionButton.setMyFab(color: String, res: Int) {\n    this.backgroundTintList = ColorStateList.valueOf(Color.parseColor(color))\n    this.setImageResource(res)\n}\n\nfun toast(str: String, ctx: Context) {\n    Toast.makeText(ctx, str, Toast.LENGTH_SHORT).show()\n}\n\nfun String.myReplacer(vararg replacements: Pair<Regex, String>): String =\n    replacements.fold(this) { acc, (old, new) -> acc.replace(old, new) }\n\n@SuppressLint(\"ObsoleteSdkInt\")\nfun setTextHtml(text: String): Spanned {\n    val res: Spanned = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {\n        Html.fromHtml(text, Html.FROM_HTML_MODE_LEGACY)\n    } else {\n        Html.fromHtml(text)\n    }\n    return res\n}\n\nfun EditText.hideKeyboard(): Boolean {\n    return (context.getSystemService(Activity.INPUT_METHOD_SERVICE) as InputMethodManager)\n        .hideSoftInputFromWindow(windowToken, 0)\n}\n\nfun EditText.showKeyboard(): Boolean {\n    return (context.getSystemService(Activity.INPUT_METHOD_SERVICE) as InputMethodManager)\n        .showSoftInput(this, 0)\n}\n\nfun EditText.removeEmptyLines(): String {\n    //val regex = Regex()\n    return this.text.replace(\"(?m)^[ \\t]*\\r?\\n\".toRegex(), \"\")\n}\n\nfun TextView.copyToClipboard(context: Context) {\n    (context.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager)\n        .setPrimaryClip(ClipData.newPlainText(\"copied\", this.text.toString()))\n}\n\nfun EditText.isValidCheck(): Boolean {\n    if (this.text.toString().isNotEmpty() || this.text.toString()\n            .startsWith(ConfigType.VMESS.scheme) || this.text.toString().startsWith(\n            ConfigType.VLESS.scheme\n        ) || this.text.toString().startsWith(ConfigType.TROJAN.scheme) || this.text.toString()\n            .startsWith(ConfigType.TROJANGO.scheme)\n    ) {\n        return true\n    }\n    return false\n}\n\nfun String.urlText(): String {\n    return URL(this).run {\n        openConnection().run {\n            this as HttpURLConnection\n            inputStream.bufferedReader().readText().trim()\n        }\n    }\n}"
  },
  {
    "path": "app/src/main/java/xyz/chz/bfm/util/command/CoreCmd.kt",
    "content": "package xyz.chz.bfm.util.command\n\nimport xyz.chz.bfm.util.terminal.TerminalHelper.execRootCmd\nimport xyz.chz.bfm.util.terminal.TerminalHelper.execRootCmdSilent\n\nobject CoreCmd {\n    private const val path = \"/data/adb/box\"\n\n    val checkVerSing: String\n        get() {\n            val cmd = \"$path/bin/sing-box version | awk '{print $3}' | awk '{print $1; exit}'\"\n            return execRootCmd(cmd)\n        }\n\n    val checkVerClashMeta: String\n        get() {\n            val cmd = \"$path/bin/xclash/mihomo -v | awk '{print $3}' | awk '{print $1; exit}'\"\n            return execRootCmd(cmd)\n        }\n\n    fun moveResult(pathOut: String, pathDir: String) {\n        val cmd = \"mv -f $pathOut $pathDir && chmod 755 $pathDir && chown root:net_admin $pathDir\"\n        execRootCmdSilent(cmd)\n    }\n}"
  },
  {
    "path": "app/src/main/java/xyz/chz/bfm/util/command/SettingCmd.kt",
    "content": "package xyz.chz.bfm.util.command\n\nimport xyz.chz.bfm.util.terminal.TerminalHelper.execRootCmd\n\nobject SettingCmd {\n\n    val networkMode: String\n        get() = execRootCmd(\"grep 'network_mode=' /data/adb/box/settings.ini | sed 's/^.*=//' | sed 's/\\\"//g'\")\n\n    fun setNetworkMode(mode: String): String {\n        return execRootCmd(\"sed -i 's/network_mode=.*/network_mode=\\\"$mode\\\"/;' /data/adb/box/settings.ini\")\n    }\n\n    val proxyMode: String\n        get() = execRootCmd(\"sed -n 's/^mode:\\\\([^ ]*\\\\).*/\\\\1/p' /data/adb/box/package.list.cfg\")\n\n    fun setProxyMode(mode: String): String {\n        return execRootCmd(\"sed -i 's/^mode:[^ ]*/mode:$mode/' /data/adb/box/package.list.cfg\")\n    }\n\n    val cron: String\n        get() = execRootCmd(\"grep 'run_crontab=' /data/adb/box/settings.ini | sed 's/^.*=//' | sed 's/\\\"//g'\")\n\n    fun setCron(mode: String): String {\n        return execRootCmd(\"sed -i 's/run_crontab=.*/run_crontab=\\\"$mode\\\"/;' /data/adb/box/settings.ini\")\n    }\n\n    val geo: String\n        get() = execRootCmd(\"grep 'update_geo=' /data/adb/box/settings.ini | sed 's/^.*=//' | sed 's/\\\"//g'\")\n\n    fun setGeo(mode: String): String {\n        return execRootCmd(\"sed -i 's/update_geo=.*/update_geo=\\\"$mode\\\"/;' /data/adb/box/settings.ini\")\n    }\n\n    val memcg: String\n        get() = execRootCmd(\"grep 'cgroup_memcg=' /data/adb/box/settings.ini | sed 's/^.*=//' | sed 's/\\\"//g'\")\n\n    fun setMemcg(mode: String): String {\n        return execRootCmd(\"sed -i 's/cgroup_memcg=.*/cgroup_memcg=\\\"$mode\\\"/;' /data/adb/box/settings.ini\")\n    }\n\n    val blkio: String\n        get() = execRootCmd(\"grep 'cgroup_blkio=' /data/adb/box/settings.ini | sed 's/^.*=//' | sed 's/\\\"//g'\")\n\n    fun setBlkio(mode: String): String {\n        return execRootCmd(\"sed -i 's/cgroup_blkio=.*/cgroup_blkio=\\\"$mode\\\"/;' /data/adb/box/settings.ini\")\n    }\n\n    val cpuset: String\n        get() = execRootCmd(\"grep 'cgroup_cpuset=' /data/adb/box/settings.ini | sed 's/^.*=//' | sed 's/\\\"//g'\")\n\n    fun setCpuset(mode: String): String {\n        return execRootCmd(\"sed -i 's/cgroup_cpuset=.*/cgroup_cpuset=\\\"$mode\\\"/;' /data/adb/box/settings.ini\")\n    }\n\n    val subs: String\n        get() = execRootCmd(\"grep 'update_subscription=' /data/adb/box/settings.ini | sed 's/^.*=//' | sed 's/\\\"//g'\")\n\n    fun setSubs(mode: String): String {\n        return execRootCmd(\"sed -i 's/update_subscription=.*/update_subscription=\\\"$mode\\\"/;' /data/adb/box/settings.ini\")\n    }\n\n    val redirHost: Boolean\n        get() = \"redir-host\" == execRootCmd(\"grep 'enhanced-mode:' /data/adb/box/clash/config.yaml | awk '{print $2}'\")\n\n    fun setRedirHost(mode: String): String {\n        return execRootCmd(\"sed -i 's/enhanced-mode:.*/enhanced-mode: $mode/;' /data/adb/box/clash/config.yaml\")\n    }\n\n    val quic: Boolean\n        get() = \"enable\" == execRootCmd(\"grep 'quic=' /data/adb/box/scripts/box.iptables | sed 's/^.*=//' | sed 's/\\\"//g'\")\n\n    fun setQuic(mode: String): String {\n        return execRootCmd(\"sed -i 's/quic=.*/quic=\\\"$mode\\\"/;' /data/adb/box/scripts/box.iptables\")\n    }\n\n    val unified: Boolean\n        get() = \"true\" == execRootCmd(\"grep 'unified-delay:' /data/adb/box/clash/config.yaml | awk '{print $2}'\")\n\n    fun setUnified(mode: String): String {\n        return execRootCmd(\"sed -i 's/unified-delay:.*/unified-delay: $mode/;' /data/adb/box/clash/config.yaml\")\n    }\n\n    val geodata: Boolean\n        get() = \"true\" == execRootCmd(\"grep 'geodata-mode:' /data/adb/box/clash/config.yaml | awk '{print $2}'\")\n\n    fun setGeodata(mode: String): String {\n        return execRootCmd(\"sed -i 's/geodata-mode:.*/geodata-mode: $mode/;' /data/adb/box/clash/config.yaml\")\n    }\n\n    val tcpCon: Boolean\n        get() = \"true\" == execRootCmd(\"grep 'tcp-concurrent:' /data/adb/box/clash/config.yaml | awk '{print $2}'\")\n\n    fun setTcpCon(mode: String): String {\n        return execRootCmd(\"sed -i 's/tcp-concurrent:.*/tcp-concurrent: $mode/;' /data/adb/box/clash/config.yaml\")\n    }\n\n    val sniffer: Boolean\n        get() = \"true\" == execRootCmd(\"grep -C 1 'sniffer:' /data/adb/box/clash/config.yaml  | grep 'enable:' | awk '{print $2}'\")\n\n    fun setSniffer(mode: String): String {\n        return execRootCmd(\"sed -i '/^sniffer:/{n;s/enable:.*/enable: $mode/;}' /data/adb/box/clash/config.yaml\")\n    }\n\n    val ipv6: Boolean\n        get() = \"true\" == execRootCmd(\"grep 'ipv6=' /data/adb/box/settings.ini | sed 's/^.*=//' | sed 's/\\\"//g'\")\n\n    fun setIpv6(mode: String): String {\n        return execRootCmd(\"sed -i 's/ipv6=.*/ipv6=\\\"$mode\\\"/;' /data/adb/box/settings.ini\")\n    }\n\n    val findProc: String\n        get() = execRootCmd(\"grep 'find-process-mode:' /data/adb/box/clash/config.yaml | awk '{print $2}'\")\n\n    fun setFindProc(mode: String): String {\n        return execRootCmd(\"sed -i 's/find-process-mode:.*/find-process-mode: $mode/;' /data/adb/box/clash/config.yaml\")\n    }\n\n    val findConf: String\n        get() = execRootCmd(\"grep 'name_clash_config=' /data/adb/box/settings.ini | sed 's/^.*=//' | sed 's/\\\"//g'\")\n\n    fun setFindConf(mode: String): String {\n        return execRootCmd(\"sed -i 's/name_clash_config=.*/name_clash_config=\\\"$mode\\\"/;' /data/adb/box/settings.ini\")\n    }\n\n    val clashType: String\n        get() = execRootCmd(\"grep 'xclash_option=' /data/adb/box/settings.ini | sed 's/^.*=//' | sed 's/\\\"//g'\")\n\n    fun setClashType(mode: String): String {\n        return execRootCmd(\"sed -i 's/xclash_option=.*/xclash_option=\\\"$mode\\\"/;' /data/adb/box/settings.ini\")\n    }\n\n    val core: String\n        get() = execRootCmd(\"grep 'bin_name=' /data/adb/box/settings.ini | sed 's/^.*=//g' | sed 's/\\\"//g'\")\n\n//    fun setCore(x: String): Boolean {\n//        return execRootCmdSilent(\"sed -i 's/bin_name=.*/bin_name=$x/;' /data/adb/box/settings.ini\") != -1\n//    }\n\n    var setCore: String = \"\"\n        set(value) {\n            field = value\n            execRootCmd(\"sed -i 's/bin_name=.*/bin_name=$field/;' /data/adb/box/settings.ini\")\n        }\n\n}"
  },
  {
    "path": "app/src/main/java/xyz/chz/bfm/util/command/TermCmd.kt",
    "content": "package xyz.chz.bfm.util.command\n\nimport android.annotation.SuppressLint\nimport android.content.Context\nimport xyz.chz.bfm.util.EXTRACTOR\nimport xyz.chz.bfm.util.QUOTES\nimport xyz.chz.bfm.util.terminal.TerminalHelper.execRootCmd\nimport xyz.chz.bfm.util.terminal.TerminalHelper.execRootCmdSilent\nimport xyz.chz.bfm.util.terminal.TerminalHelper.execRootCmdVoid\nimport java.io.File\nimport java.io.FileOutputStream\nimport kotlin.concurrent.thread\n\nobject TermCmd {\n    private const val path = \"/data/adb/box\"\n    private const val yq = \"${path}/bin/yq\"\n\n    fun isProxying(): Boolean {\n        return execRootCmdSilent(\"if [ -f ${path}/run/box.pid ] ; then exit 1;fi\") == 1\n    }\n\n    fun renewBox(callback: (Boolean) -> Unit) {\n        thread {\n            val cmd = \"${path}/scripts/box.iptables renew\"\n            execRootCmdVoid(cmd, callback)\n        }\n    }\n\n    fun start(callback: (Boolean) -> Unit) {\n        thread {\n            val cmd = \"${path}/scripts/box.service start && ${path}/scripts/box.iptables enable\"\n            execRootCmdVoid(cmd, callback)\n        }\n    }\n\n    fun stop(callback: (Boolean) -> Unit) {\n        thread {\n            val cmd = \"${path}/scripts/box.iptables disable && ${path}/scripts/box.service stop\"\n            execRootCmdVoid(cmd, callback)\n        }\n    }\n\n    fun readLog(): String {\n        return execRootCmd(\"cat ${path}/run/runs.log\")\n    }\n\n    val linkDBClash: String\n        get() {\n            return execRootCmd(\"grep 'external-controller:' ${path}/clash/config.yaml | awk '{print $2}'\")\n        }\n\n\n    val linkDBSing: String\n        get() {\n            val cmd =\n                \"grep -w 'external_controller' ${path}/sing-box/config.json | awk '{print $2}' | sed 's/\\\"//g' | sed 's/,//g'\"\n            return execRootCmd(cmd)\n        }\n\n    private val proxyProviderJsonKey: HashSet<String>\n        get() {\n            val s = HashSet<String>()\n            val cmd = \"$yq -oj '.proxy-providers | keys' $path/clash/config.yaml | $EXTRACTOR\"\n            val result = execRootCmd(cmd)\n            if (result.isEmpty())\n                return s\n            val list = result.split(\"\\n\")\n            for (x in list) {\n                s.add(x)\n            }\n            return s\n        }\n\n    val proxyProviderPath: HashSet<String>\n        @SuppressLint(\"SuspiciousIndentation\")\n        get() {\n            val s = HashSet<String>()\n            val ppKey = proxyProviderJsonKey\n            for (xs in ppKey) {\n                if (SettingCmd.core == \"clash\") {\n                    val pth =\n                        execRootCmd(\"exp=$xs $yq -oj '.proxy-providers.[env(exp)].path' $getPathOnly | $QUOTES\")\n                    if (pth.contains(\"./\")) {\n                        s.add(pth.replace(\"./\", \"$path/clash/\"))\n                    } else {\n                        s.add(pth)\n                    }\n                }\n            }\n            s.add(getPathOnly)\n            return s\n        }\n\n    val appidList: HashSet<String> get() {\n        val s = HashSet<String>()\n        val modeCommand = \"sed -n 's/^\\\\(mode:[^ ]*\\\\).*/\\\\1/p' ${path}/package.list.cfg\"\n        val packageCommand = \"sed -n '/^[^#]/s/^\\\\([^ ]*\\\\.[^ ]*\\\\).*/\\\\1/p' ${path}/package.list.cfg\"\n        val gidCommand = \"sed -n '/^[^#]/s/^\\\\([0-9]\\\\{1,8\\\\}\\\\).*/\\\\1/p' ${path}/package.list.cfg\"\n\n        val modeResult = execRootCmd(modeCommand)\n        val packageResult = execRootCmd(packageCommand)\n        val gidResult = execRootCmd(gidCommand)\n\n        val result = \"\"\"\n            $modeResult\n            $packageResult\n            $gidResult\n        \"\"\".trimIndent()\n        \n        if (result.isEmpty()) {\n            return s\n        }\n        \n        val appIds = result.split(\"\\n\")\n        for (i in appIds) {\n            if (i.isNotEmpty() && !i.startsWith(\"alook\")) {\n                s.add(i.trim())\n            }\n        }\n        return s\n    }\n\n    fun setAppidList(s: HashSet<String?>): Boolean {\n        val content = s.filterNotNull()\n            .filter { it.isNotEmpty() }\n            .joinToString(\" \")\n\n        val command = \"\"\"\n            echo \"$content\" > \"$path/package.list.cfg\" && \n            sed -i '/^#/!s/ /\\'$'\\n/g' \"${path}/package.list.cfg\"\n            sed -i '/alook\\\\|999_alook/s/^/#/' \"${path}/package.list.cfg\"\n        \"\"\".trimIndent()\n\n        return execRootCmdSilent(command) != -1\n\n    }\n\n    private fun getNameConfig(what: String, isClash: Boolean): String {\n        val m = if (isClash) \"yaml\" else \"json\"\n        return execRootCmd(\"find ${path}/$what/ -maxdepth 1 -name 'config.$m' -type f -exec basename {} \\\\;\")\n    }\n\n    val getPathOnly: String\n        get() {\n            val what = SettingCmd.core\n            val isClash = what == \"clash\"\n            val name = getNameConfig(what, isClash)\n            return \"$path/$what/$name\"\n        }\n\n    fun saveConfig(ctx: Context, str: String, pth: String, callback: (Boolean) -> Unit) {\n        thread {\n            val exFile = File(ctx.getExternalFilesDir(null), \"out.txt\")\n            val fos = FileOutputStream(exFile)\n            fos.write(str.toByteArray())\n            val cmd = \"mv -f $exFile $pth\"\n            execRootCmdVoid(cmd, callback)\n        }\n    }\n\n    private fun yqParser(dir: String, config: String, isClash: Boolean): String {\n        return if (isClash) {\n            val yamlToJson = \"$yq -oj ${path}/${dir}/${config} > ${path}/${dir}/xtemp.json\"\n            execRootCmd(\"$yamlToJson && $yq -oy ${path}/${dir}/xtemp.json > ${path}/${dir}/${config} && rm -f ${path}/${dir}/xtemp.json && cat ${path}/${dir}/${config}\")\n        } else {\n            execRootCmd(\"$yq -oj ${path}/${dir}/${config} > ${path}/${dir}/xtemp.json && mv -f ${path}/${dir}/xtemp.json ${path}/${dir}/${config} && cat ${path}/${dir}/${config}\")\n        }\n    }\n\n}"
  },
  {
    "path": "app/src/main/java/xyz/chz/bfm/util/modul/ModuleManager.kt",
    "content": "package xyz.chz.bfm.util.modul\n\nimport xyz.chz.bfm.util.terminal.TerminalHelper\n\nobject ModuleManager {\n    val moduleVersionCode: String\n        get() {\n            val cmd = \"cat /data/adb/modules/box_for_root/module.prop | grep '^versionCode='\"\n            val result = TerminalHelper.execRootCmd(cmd)\n            return if (result.isEmpty()) \"\" else result.split(\"=\")[1]\n        }\n\n    val moduleVersion: String\n        get() {\n            val cmd = \"cat /data/adb/modules/box_for_root/module.prop | grep '^version='\"\n            val result = TerminalHelper.execRootCmd(cmd)\n            return if (result.isEmpty()) \"\" else result.split(\"=\")[1]\n        }\n\n}"
  },
  {
    "path": "app/src/main/java/xyz/chz/bfm/util/terminal/TerminalHelper.kt",
    "content": "package xyz.chz.bfm.util.terminal\n\nimport android.util.Log\nimport xyz.chz.bfm.BuildConfig\n\nobject TerminalHelper {\n    private const val TAG = \"BoxForRoot.Terminal\"\n\n    fun execRootCmd(cmd: String): String {\n        return try {\n            val process: Process = Runtime.getRuntime().exec(\"su -c $cmd\")\n            process.waitFor()\n            val output = process.inputStream.bufferedReader().lineSequence().joinToString(\"\\n\")\n            if (BuildConfig.DEBUG) Log.d(TAG, output)\n            output\n        } catch (e: Exception) {\n            \"\"\n        }\n    }\n\n    fun execRootCmdSilent(cmd: String): Int {\n        return try {\n            val process: Process = Runtime.getRuntime().exec(\"su -c $cmd\")\n            process.waitFor()\n            process.exitValue()\n        } catch (e: Exception) {\n            -1\n        }\n    }\n\n    fun execRootCmdVoid(cmd: String, callback: (Boolean) -> Unit) {\n        try {\n            val process = Runtime.getRuntime().exec(\"su -c $cmd\")\n            process.waitFor()\n            callback(process.exitValue() == 0)\n        } catch (e: Exception) {\n            e.printStackTrace()\n            callback(false)\n        }\n    }\n}"
  },
  {
    "path": "app/src/main/res/drawable/ic_app.xml",
    "content": "<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:height=\"24dp\"\n    android:width=\"24dp\"\n    android:viewportWidth=\"24.0\"\n    android:viewportHeight=\"24.0\">\n    <path\n        android:fillColor=\"@android:color/white\"\n        android:pathData=\"M17.5,2.75C17.914,2.75 18.25,3.086 18.25,3.5V5.75H20.5C20.914,5.75 21.25,6.086 21.25,6.5C21.25,6.914 20.914,7.25 20.5,7.25H18.25V9.5C18.25,9.914 17.914,10.25 17.5,10.25C17.086,10.25 16.75,9.914 16.75,9.5V7.25H14.5C14.086,7.25 13.75,6.914 13.75,6.5C13.75,6.086 14.086,5.75 14.5,5.75H16.75V3.5C16.75,3.086 17.086,2.75 17.5,2.75Z\"\n        android:fillType=\"evenOdd\" />\n    <path\n        android:fillColor=\"@android:color/white\"\n        android:pathData=\"M2,6.5C2,4.379 2,3.318 2.659,2.659C3.318,2 4.379,2 6.5,2C8.621,2 9.682,2 10.341,2.659C11,3.318 11,4.379 11,6.5C11,8.621 11,9.682 10.341,10.341C9.682,11 8.621,11 6.5,11C4.379,11 3.318,11 2.659,10.341C2,9.682 2,8.621 2,6.5Z\" />\n    <path\n        android:fillColor=\"@android:color/white\"\n        android:pathData=\"M13,17.5C13,15.379 13,14.318 13.659,13.659C14.318,13 15.379,13 17.5,13C19.621,13 20.682,13 21.341,13.659C22,14.318 22,15.379 22,17.5C22,19.621 22,20.682 21.341,21.341C20.682,22 19.621,22 17.5,22C15.379,22 14.318,22 13.659,21.341C13,20.682 13,19.621 13,17.5Z\" />\n    <path\n        android:fillColor=\"@android:color/white\"\n        android:pathData=\"M2,17.5C2,15.379 2,14.318 2.659,13.659C3.318,13 4.379,13 6.5,13C8.621,13 9.682,13 10.341,13.659C11,14.318 11,15.379 11,17.5C11,19.621 11,20.682 10.341,21.341C9.682,22 8.621,22 6.5,22C4.379,22 3.318,22 2.659,21.341C2,20.682 2,19.621 2,17.5Z\" />\n</vector>\n"
  },
  {
    "path": "app/src/main/res/drawable/ic_commit.xml",
    "content": "<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:width=\"24dp\"\n    android:height=\"24dp\"\n    android:tint=\"#FFFFFF\"\n    android:viewportWidth=\"24\"\n    android:viewportHeight=\"24\">\n    <path\n        android:fillColor=\"@android:color/white\"\n        android:pathData=\"M16.9,11L16.9,11c-0.46,-2.28 -2.48,-4 -4.9,-4s-4.44,1.72 -4.9,4h0H2v2h5.1h0c0.46,2.28 2.48,4 4.9,4s4.44,-1.72 4.9,-4h0H22v-2H16.9zM12,15c-1.66,0 -3,-1.34 -3,-3s1.34,-3 3,-3s3,1.34 3,3S13.66,15 12,15z\" />\n</vector>\n"
  },
  {
    "path": "app/src/main/res/drawable/ic_config.xml",
    "content": "<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:height=\"24dp\"\n    android:width=\"24dp\"\n    android:viewportWidth=\"24.0\"\n    android:viewportHeight=\"24.0\">\n    <path\n        android:fillColor=\"@android:color/white\"\n        android:pathData=\"M16.519,16.501C16.694,16.365 16.853,16.206 17.17,15.889L21.128,11.931C21.223,11.836 21.179,11.671 21.052,11.626C20.584,11.464 19.977,11.16 19.408,10.592C18.84,10.023 18.536,9.416 18.374,8.948C18.329,8.821 18.164,8.777 18.069,8.873L14.111,12.83C13.794,13.147 13.635,13.306 13.499,13.481C13.338,13.688 13.2,13.911 13.087,14.147C12.991,14.348 12.92,14.561 12.779,14.986L12.595,15.537L12.303,16.412L12.03,17.232C11.96,17.442 12.015,17.673 12.171,17.829C12.327,17.985 12.558,18.04 12.768,17.97L13.588,17.697L14.463,17.405L15.014,17.221L15.014,17.221C15.439,17.08 15.652,17.008 15.853,16.913C16.089,16.8 16.312,16.662 16.519,16.501Z\" />\n    <path\n        android:fillColor=\"@android:color/white\"\n        android:pathData=\"M22.367,10.692C23.211,9.848 23.211,8.478 22.367,7.633C21.522,6.789 20.153,6.789 19.308,7.633L19.181,7.761C19.058,7.883 19.002,8.055 19.033,8.226C19.052,8.333 19.088,8.491 19.153,8.678C19.283,9.053 19.529,9.545 19.992,10.008C20.455,10.471 20.947,10.717 21.322,10.847C21.51,10.912 21.667,10.948 21.774,10.967C21.945,10.998 22.117,10.942 22.239,10.819L22.367,10.692Z\" />\n    <path\n        android:fillColor=\"@android:color/white\"\n        android:pathData=\"M4.172,3.172C3,4.343 3,6.229 3,10V14C3,17.771 3,19.657 4.172,20.828C5.343,22 7.229,22 11,22H13C16.771,22 18.657,22 19.828,20.828C20.981,19.676 21,17.832 21,14.18L18.182,16.998C17.912,17.268 17.691,17.489 17.441,17.684C17.149,17.912 16.833,18.108 16.498,18.267C16.212,18.403 15.916,18.502 15.554,18.622L13.242,19.393C12.493,19.643 11.668,19.448 11.11,18.89C10.552,18.332 10.357,17.507 10.607,16.758L10.88,15.938L11.356,14.512L11.377,14.446C11.498,14.084 11.597,13.788 11.733,13.502C11.892,13.167 12.088,12.851 12.316,12.559C12.511,12.309 12.732,12.088 13.002,11.818L17.008,7.812L18.12,6.7L18.247,6.573C18.963,5.857 19.9,5.5 20.838,5.5C20.687,4.469 20.394,3.737 19.828,3.172C18.657,2 16.771,2 13,2H11C7.229,2 5.343,2 4.172,3.172ZM7.25,9C7.25,8.586 7.586,8.25 8,8.25H14.5C14.914,8.25 15.25,8.586 15.25,9C15.25,9.414 14.914,9.75 14.5,9.75H8C7.586,9.75 7.25,9.414 7.25,9ZM7.25,13C7.25,12.586 7.586,12.25 8,12.25H10.5C10.914,12.25 11.25,12.586 11.25,13C11.25,13.414 10.914,13.75 10.5,13.75H8C7.586,13.75 7.25,13.414 7.25,13ZM7.25,17C7.25,16.586 7.586,16.25 8,16.25H9.5C9.914,16.25 10.25,16.586 10.25,17C10.25,17.414 9.914,17.75 9.5,17.75H8C7.586,17.75 7.25,17.414 7.25,17Z\"\n        android:fillType=\"evenOdd\" />\n</vector>\n"
  },
  {
    "path": "app/src/main/res/drawable/ic_converter.xml",
    "content": "<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:width=\"24dp\"\n    android:height=\"24dp\"\n    android:tint=\"#FFFFFF\"\n    android:viewportWidth=\"24\"\n    android:viewportHeight=\"24\">\n    <path\n        android:fillColor=\"@android:color/white\"\n        android:pathData=\"M9.4,16.6L4.8,12l4.6,-4.6L8,6l-6,6 6,6 1.4,-1.4zM14.6,16.6l4.6,-4.6 -4.6,-4.6L16,6l6,6 -6,6 -1.4,-1.4z\" />\n</vector>\n"
  },
  {
    "path": "app/src/main/res/drawable/ic_dashboard.xml",
    "content": "<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:height=\"24dp\"\n    android:width=\"24dp\"\n    android:viewportWidth=\"24.0\"\n    android:viewportHeight=\"24.0\">\n    <path\n        android:fillColor=\"@android:color/white\"\n        android:pathData=\"M7.75,2.5C7.75,2.086 7.414,1.75 7,1.75C6.586,1.75 6.25,2.086 6.25,2.5V4.079C4.811,4.195 3.866,4.477 3.172,5.172C2.477,5.866 2.195,6.811 2.079,8.25H21.921C21.806,6.811 21.523,5.866 20.828,5.172C20.134,4.477 19.189,4.195 17.75,4.079V2.5C17.75,2.086 17.414,1.75 17,1.75C16.586,1.75 16.25,2.086 16.25,2.5V4.013C15.585,4 14.839,4 14,4H10C9.161,4 8.415,4 7.75,4.013V2.5Z\" />\n    <path\n        android:fillColor=\"@android:color/white\"\n        android:pathData=\"M22,12V14C22,17.771 22,19.657 20.828,20.828C19.657,22 17.771,22 14,22H10C6.229,22 4.343,22 3.172,20.828C2,19.657 2,17.771 2,14V12C2,11.161 2,10.415 2.013,9.75H21.987C22,10.415 22,11.161 22,12ZM16,13.25C16.414,13.25 16.75,13.586 16.75,14V15.25L18,15.25C18.414,15.25 18.75,15.586 18.75,16C18.75,16.414 18.414,16.75 18,16.75H16.75V18C16.75,18.414 16.414,18.75 16,18.75C15.586,18.75 15.25,18.414 15.25,18V16.75L14,16.75C13.586,16.75 13.25,16.414 13.25,16C13.25,15.586 13.586,15.25 14,15.25H15.25V14C15.25,13.586 15.586,13.25 16,13.25Z\"\n        android:fillType=\"evenOdd\" />\n</vector>\n"
  },
  {
    "path": "app/src/main/res/drawable/ic_disabled.xml",
    "content": "<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:height=\"24dp\"\n    android:width=\"24dp\"\n    android:viewportWidth=\"24.0\"\n    android:viewportHeight=\"24.0\">\n    <path\n        android:fillColor=\"@android:color/white\"\n        android:pathData=\"M22,19.206V12C22,6.477 17.523,2 12,2C6.477,2 2,6.477 2,12V19.206C2,20.49 3.351,21.324 4.499,20.75C5.427,20.286 6.533,20.355 7.396,20.931C8.367,21.578 9.633,21.578 10.604,20.931L10.957,20.696C11.588,20.274 12.412,20.274 13.043,20.696L13.396,20.931C14.367,21.578 15.633,21.578 16.604,20.931C17.467,20.355 18.573,20.286 19.501,20.75C20.649,21.324 22,20.49 22,19.206ZM16,10.5C16,11.328 15.552,12 15,12C14.448,12 14,11.328 14,10.5C14,9.672 14.448,9 15,9C15.552,9 16,9.672 16,10.5ZM9,12C9.552,12 10,11.328 10,10.5C10,9.672 9.552,9 9,9C8.448,9 8,9.672 8,10.5C8,11.328 8.448,12 9,12Z\"\n        android:fillType=\"evenOdd\" />\n</vector>\n"
  },
  {
    "path": "app/src/main/res/drawable/ic_done.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:height=\"64dp\"\n    android:width=\"64dp\"\n    android:viewportWidth=\"24.0\"\n    android:viewportHeight=\"24.0\">\n    <path\n        android:fillColor=\"#FF1C274C\"\n        android:pathData=\"M9.606,5.563C10.372,5.563 10.52,5.406 12,5.406C13.48,5.406 13.628,5.563 14.394,5.563C15.032,5.563 16.948,4 17.905,4C18.863,4 19.98,4.563 19.98,6.188V8.063C19.978,8.555 19.799,10.063 19.099,9.66C20.211,10.974 19.98,12.582 19.98,14C19.98,17.906 14.713,19 12,19C9.287,19 4.02,17.906 4.02,14C4.02,12.582 3.789,10.974 4.901,9.66C4.201,10.063 4.022,8.555 4.02,8.063V6.188C4.02,4.563 5.137,4 6.095,4C7.052,4 8.968,5.563 9.606,5.563Z\"\n        android:strokeAlpha=\"0.5\"\n        android:fillAlpha=\"0.5\" />\n    <path\n        android:fillColor=\"#FF1C274C\"\n        android:pathData=\"M9.016,11.063C8.527,11.063 8.201,11.38 8.036,11.646C7.864,11.924 7.782,12.261 7.782,12.594C7.782,12.926 7.864,13.263 8.036,13.541C8.201,13.807 8.527,14.125 9.016,14.125C9.505,14.125 9.831,13.807 9.996,13.541C10.168,13.263 10.25,12.926 10.25,12.594C10.25,12.261 10.168,11.924 9.996,11.646C9.831,11.38 9.505,11.063 9.016,11.063Z\" />\n    <path\n        android:fillColor=\"#FF1C274C\"\n        android:pathData=\"M14.036,11.646C14.201,11.38 14.527,11.063 15.016,11.063C15.505,11.063 15.831,11.38 15.996,11.646C16.168,11.924 16.25,12.261 16.25,12.594C16.25,12.926 16.168,13.263 15.996,13.541C15.831,13.807 15.505,14.125 15.016,14.125C14.527,14.125 14.201,13.807 14.036,13.541C13.864,13.263 13.782,12.926 13.782,12.594C13.782,12.261 13.864,11.924 14.036,11.646Z\" />\n    <path\n        android:fillColor=\"#FF1C274C\"\n        android:pathData=\"M11.178,14.08C11.431,13.982 11.728,13.938 12.019,13.938C12.311,13.938 12.608,13.982 12.861,14.08C12.984,14.128 13.136,14.203 13.269,14.325C13.403,14.448 13.576,14.675 13.576,15C13.576,15.325 13.403,15.552 13.269,15.675C13.136,15.797 12.984,15.872 12.861,15.92C12.608,16.018 12.311,16.063 12.019,16.063C11.728,16.063 11.431,16.018 11.178,15.92C11.054,15.872 10.903,15.797 10.77,15.675C10.636,15.552 10.463,15.325 10.463,15C10.463,14.675 10.636,14.448 10.77,14.325C10.903,14.203 11.054,14.128 11.178,14.08Z\"\n        android:fillType=\"evenOdd\" />\n    <path\n        android:fillColor=\"#FF1C274C\"\n        android:pathData=\"M17.863,13.375C17.863,12.961 18.199,12.625 18.613,12.625C18.909,12.625 19.264,12.692 19.594,12.774C19.939,12.858 20.313,12.973 20.67,13.095C21.354,13.329 22.08,13.627 22.407,13.839C22.755,14.063 22.855,14.528 22.631,14.876C22.406,15.224 21.941,15.323 21.594,15.099C21.437,14.998 20.872,14.749 20.185,14.514C19.857,14.402 19.526,14.302 19.236,14.23C18.931,14.155 18.721,14.125 18.613,14.125C18.199,14.125 17.863,13.789 17.863,13.375Z\" />\n    <path\n        android:fillColor=\"#FF1C274C\"\n        android:pathData=\"M17.968,15.125C17.554,15.125 17.218,15.461 17.218,15.875C17.218,16.289 17.554,16.625 17.968,16.625C18.174,16.625 18.517,16.74 18.948,16.968C19.29,17.149 19.604,17.353 19.849,17.513C19.895,17.544 19.939,17.572 19.98,17.599C20.328,17.823 20.792,17.724 21.017,17.376C21.242,17.028 21.142,16.563 20.794,16.339C20.761,16.317 20.723,16.293 20.681,16.265C20.439,16.107 20.059,15.858 19.649,15.642C19.192,15.4 18.568,15.125 17.968,15.125Z\" />\n    <path\n        android:fillColor=\"#FF1C274C\"\n        android:pathData=\"M3.815,14.514C3.128,14.749 2.563,14.998 2.407,15.099C2.059,15.323 1.595,15.224 1.37,14.876C1.145,14.528 1.245,14.063 1.593,13.839C1.921,13.627 2.646,13.329 3.33,13.095C3.687,12.973 4.062,12.858 4.407,12.774C4.737,12.692 5.091,12.625 5.387,12.625C5.801,12.625 6.137,12.961 6.137,13.375C6.137,13.789 5.801,14.125 5.387,14.125C5.28,14.125 5.07,14.155 4.765,14.23C4.475,14.302 4.144,14.402 3.815,14.514Z\" />\n    <path\n        android:fillColor=\"#FF1C274C\"\n        android:pathData=\"M4.02,17.599C4.061,17.572 4.105,17.544 4.151,17.513C4.397,17.353 4.71,17.149 5.052,16.968C5.483,16.74 5.827,16.625 6.033,16.625C6.447,16.625 6.783,16.289 6.783,15.875C6.783,15.461 6.447,15.125 6.033,15.125C5.432,15.125 4.808,15.4 4.352,15.642C3.942,15.858 3.562,16.107 3.319,16.265C3.278,16.292 3.24,16.317 3.206,16.339C2.859,16.563 2.759,17.028 2.983,17.376C3.208,17.724 3.672,17.823 4.02,17.599Z\" />\n</vector>\n"
  },
  {
    "path": "app/src/main/res/drawable/ic_download.xml",
    "content": "<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:height=\"24dp\"\n    android:width=\"24dp\"\n    android:viewportWidth=\"24.0\"\n    android:viewportHeight=\"24.0\">\n    <path\n        android:fillColor=\"@android:color/white\"\n        android:pathData=\"M2,12C2,7.286 2,4.929 3.464,3.464C4.929,2 7.286,2 12,2C16.714,2 19.071,2 20.535,3.464C22,4.929 22,7.286 22,12C22,16.714 22,19.071 20.535,20.535C19.071,22 16.714,22 12,22C7.286,22 4.929,22 3.464,20.535C2,19.071 2,16.714 2,12ZM12,6.25C12.414,6.25 12.75,6.586 12.75,7V12.189L14.47,10.47C14.763,10.177 15.237,10.177 15.53,10.47C15.823,10.763 15.823,11.237 15.53,11.53L12.53,14.53C12.39,14.671 12.199,14.75 12,14.75C11.801,14.75 11.61,14.671 11.47,14.53L8.47,11.53C8.177,11.237 8.177,10.763 8.47,10.47C8.763,10.177 9.237,10.177 9.53,10.47L11.25,12.189V7C11.25,6.586 11.586,6.25 12,6.25ZM8,16.25C7.586,16.25 7.25,16.586 7.25,17C7.25,17.414 7.586,17.75 8,17.75H16C16.414,17.75 16.75,17.414 16.75,17C16.75,16.586 16.414,16.25 16,16.25H8Z\"\n        android:fillType=\"evenOdd\" />\n</vector>\n"
  },
  {
    "path": "app/src/main/res/drawable/ic_enabled.xml",
    "content": "<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:height=\"24dp\"\n    android:width=\"24dp\"\n    android:viewportWidth=\"24.0\"\n    android:viewportHeight=\"24.0\">\n    <path\n        android:fillColor=\"@android:color/white\"\n        android:pathData=\"M22,12V19.206C22,20.49 20.649,21.324 19.501,20.75C18.573,20.286 17.467,20.355 16.604,20.931C15.633,21.578 14.367,21.578 13.396,20.931L13.043,20.696C12.412,20.274 11.588,20.274 10.957,20.696L10.604,20.931C9.633,21.578 8.367,21.578 7.396,20.931C6.533,20.355 5.427,20.286 4.499,20.75C3.351,21.324 2,20.49 2,19.206V12C2,6.477 6.477,2 12,2C17.523,2 22,6.477 22,12ZM9.447,14.398C9.114,14.151 8.644,14.221 8.397,14.553C8.151,14.886 8.221,15.356 8.553,15.602C9.526,16.323 10.715,16.75 12,16.75C13.285,16.75 14.474,16.323 15.447,15.602C15.779,15.356 15.849,14.886 15.602,14.553C15.356,14.221 14.886,14.151 14.553,14.398C13.825,14.937 12.946,15.25 12,15.25C11.054,15.25 10.175,14.937 9.447,14.398ZM16,9.5C16,10.328 15.552,11 15,11C14.448,11 14,10.328 14,9.5C14,8.672 14.448,8 15,8C15.552,8 16,8.672 16,9.5ZM9,11C9.552,11 10,10.328 10,9.5C10,8.672 9.552,8 9,8C8.448,8 8,8.672 8,9.5C8,10.328 8.448,11 9,11Z\"\n        android:fillType=\"evenOdd\" />\n</vector>\n"
  },
  {
    "path": "app/src/main/res/drawable/ic_error.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:height=\"64dp\"\n    android:width=\"64dp\"\n    android:viewportWidth=\"24.0\"\n    android:viewportHeight=\"24.0\">\n    <path\n        android:fillColor=\"#FF1C274C\"\n        android:pathData=\"M12,3C9.689,3 8.23,5.587 5.312,10.762L4.948,11.406C2.523,15.706 1.31,17.856 2.406,19.428C3.502,21 6.214,21 11.636,21H12.364C17.786,21 20.498,21 21.594,19.428C22.69,17.856 21.477,15.706 19.052,11.406L18.688,10.762C15.77,5.587 14.311,3 12,3Z\"\n        android:strokeColor=\"#FF000000\"\n        android:strokeWidth=\"2.4E-4\"\n        android:strokeAlpha=\"0.5\"\n        android:fillAlpha=\"0.5\" />\n    <path\n        android:fillColor=\"#FF1C274C\"\n        android:pathData=\"M12,7.25C12.414,7.25 12.75,7.586 12.75,8V13C12.75,13.414 12.414,13.75 12,13.75C11.586,13.75 11.25,13.414 11.25,13V8C11.25,7.586 11.586,7.25 12,7.25Z\"\n        android:strokeColor=\"#FF000000\"\n        android:strokeWidth=\"2.4E-4\" />\n    <path\n        android:fillColor=\"#FF1C274C\"\n        android:pathData=\"M12,17C12.552,17 13,16.552 13,16C13,15.448 12.552,15 12,15C11.448,15 11,15.448 11,16C11,16.552 11.448,17 12,17Z\"\n        android:strokeColor=\"#FF000000\"\n        android:strokeWidth=\"2.4E-4\" />\n</vector>\n"
  },
  {
    "path": "app/src/main/res/drawable/ic_home.xml",
    "content": "<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:height=\"24dp\"\n    android:width=\"24dp\"\n    android:viewportWidth=\"24.0\"\n    android:viewportHeight=\"24.0\">\n    <path\n        android:fillColor=\"@android:color/white\"\n        android:pathData=\"M2.519,7.823C2,8.771 2,9.915 2,12.204V13.725C2,17.626 2,19.576 3.172,20.788C4.343,22 6.229,22 10,22H14C17.771,22 19.657,22 20.828,20.788C22,19.576 22,17.626 22,13.725V12.204C22,9.915 22,8.771 21.481,7.823C20.962,6.874 20.013,6.286 18.116,5.108L16.116,3.867C14.111,2.622 13.108,2 12,2C10.892,2 9.889,2.622 7.884,3.867L5.884,5.108C3.987,6.286 3.038,6.874 2.519,7.823ZM9.447,15.398C9.114,15.151 8.644,15.221 8.397,15.553C8.151,15.886 8.221,16.356 8.553,16.603C9.526,17.323 10.715,17.75 12,17.75C13.285,17.75 14.474,17.323 15.447,16.603C15.779,16.356 15.849,15.886 15.602,15.553C15.356,15.221 14.886,15.151 14.553,15.398C13.825,15.937 12.946,16.25 12,16.25C11.054,16.25 10.175,15.937 9.447,15.398Z\"\n        android:fillType=\"evenOdd\" />\n</vector>"
  },
  {
    "path": "app/src/main/res/drawable/ic_info.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:height=\"64dp\"\n    android:width=\"64dp\"\n    android:viewportWidth=\"24.0\"\n    android:viewportHeight=\"24.0\">\n    <path\n        android:fillColor=\"#FF1C274C\"\n        android:pathData=\"M9.606,5.563C10.372,5.563 10.52,5.406 12,5.406C13.48,5.406 13.628,5.563 14.394,5.563C15.032,5.563 16.948,4 17.905,4C18.863,4 19.98,4.563 19.98,6.188V8.063C19.978,8.555 19.799,10.063 19.099,9.66C20.211,10.974 19.98,12.582 19.98,14C19.98,17.906 14.713,19 12,19C9.287,19 4.02,17.906 4.02,14C4.02,12.582 3.789,10.974 4.901,9.66C4.201,10.063 4.022,8.555 4.02,8.063V6.188C4.02,4.563 5.137,4 6.095,4C7.052,4 8.968,5.563 9.606,5.563Z\"\n        android:strokeAlpha=\"0.5\"\n        android:fillAlpha=\"0.5\" />\n    <path\n        android:fillColor=\"#FF1C274C\"\n        android:pathData=\"M9.016,11.063C8.527,11.063 8.201,11.38 8.036,11.646C7.864,11.924 7.782,12.261 7.782,12.594C7.782,12.926 7.864,13.263 8.036,13.541C8.201,13.807 8.527,14.125 9.016,14.125C9.505,14.125 9.831,13.807 9.996,13.541C10.168,13.263 10.25,12.926 10.25,12.594C10.25,12.261 10.168,11.924 9.996,11.646C9.831,11.38 9.505,11.063 9.016,11.063Z\" />\n    <path\n        android:fillColor=\"#FF1C274C\"\n        android:pathData=\"M14.036,11.646C14.201,11.38 14.527,11.063 15.016,11.063C15.505,11.063 15.831,11.38 15.996,11.646C16.168,11.924 16.25,12.261 16.25,12.594C16.25,12.926 16.168,13.263 15.996,13.541C15.831,13.807 15.505,14.125 15.016,14.125C14.527,14.125 14.201,13.807 14.036,13.541C13.864,13.263 13.782,12.926 13.782,12.594C13.782,12.261 13.864,11.924 14.036,11.646Z\" />\n    <path\n        android:fillColor=\"#FF1C274C\"\n        android:pathData=\"M11.178,14.08C11.431,13.982 11.728,13.938 12.019,13.938C12.311,13.938 12.608,13.982 12.861,14.08C12.984,14.128 13.136,14.203 13.269,14.325C13.403,14.448 13.576,14.675 13.576,15C13.576,15.325 13.403,15.552 13.269,15.675C13.136,15.797 12.984,15.872 12.861,15.92C12.608,16.018 12.311,16.063 12.019,16.063C11.728,16.063 11.431,16.018 11.178,15.92C11.054,15.872 10.903,15.797 10.77,15.675C10.636,15.552 10.463,15.325 10.463,15C10.463,14.675 10.636,14.448 10.77,14.325C10.903,14.203 11.054,14.128 11.178,14.08Z\"\n        android:fillType=\"evenOdd\" />\n    <path\n        android:fillColor=\"#FF1C274C\"\n        android:pathData=\"M17.863,13.375C17.863,12.961 18.199,12.625 18.613,12.625C18.909,12.625 19.264,12.692 19.594,12.774C19.939,12.858 20.313,12.973 20.67,13.095C21.354,13.329 22.08,13.627 22.407,13.839C22.755,14.063 22.855,14.528 22.631,14.876C22.406,15.224 21.941,15.323 21.594,15.099C21.437,14.998 20.872,14.749 20.185,14.514C19.857,14.402 19.526,14.302 19.236,14.23C18.931,14.155 18.721,14.125 18.613,14.125C18.199,14.125 17.863,13.789 17.863,13.375Z\" />\n    <path\n        android:fillColor=\"#FF1C274C\"\n        android:pathData=\"M17.968,15.125C17.554,15.125 17.218,15.461 17.218,15.875C17.218,16.289 17.554,16.625 17.968,16.625C18.174,16.625 18.517,16.74 18.948,16.968C19.29,17.149 19.604,17.353 19.849,17.513C19.895,17.544 19.939,17.572 19.98,17.599C20.328,17.823 20.792,17.724 21.017,17.376C21.242,17.028 21.142,16.563 20.794,16.339C20.761,16.317 20.723,16.293 20.681,16.265C20.439,16.107 20.059,15.858 19.649,15.642C19.192,15.4 18.568,15.125 17.968,15.125Z\" />\n    <path\n        android:fillColor=\"#FF1C274C\"\n        android:pathData=\"M3.815,14.514C3.128,14.749 2.563,14.998 2.407,15.099C2.059,15.323 1.595,15.224 1.37,14.876C1.145,14.528 1.245,14.063 1.593,13.839C1.921,13.627 2.646,13.329 3.33,13.095C3.687,12.973 4.062,12.858 4.407,12.774C4.737,12.692 5.091,12.625 5.387,12.625C5.801,12.625 6.137,12.961 6.137,13.375C6.137,13.789 5.801,14.125 5.387,14.125C5.28,14.125 5.07,14.155 4.765,14.23C4.475,14.302 4.144,14.402 3.815,14.514Z\" />\n    <path\n        android:fillColor=\"#FF1C274C\"\n        android:pathData=\"M4.02,17.599C4.061,17.572 4.105,17.544 4.151,17.513C4.397,17.353 4.71,17.149 5.052,16.968C5.483,16.74 5.827,16.625 6.033,16.625C6.447,16.625 6.783,16.289 6.783,15.875C6.783,15.461 6.447,15.125 6.033,15.125C5.432,15.125 4.808,15.4 4.352,15.642C3.942,15.858 3.562,16.107 3.319,16.265C3.278,16.292 3.24,16.317 3.206,16.339C2.859,16.563 2.759,17.028 2.983,17.376C3.208,17.724 3.672,17.823 4.02,17.599Z\" />\n</vector>\n"
  },
  {
    "path": "app/src/main/res/drawable/ic_loading.xml",
    "content": "<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:height=\"24dp\"\n    android:width=\"24dp\"\n    android:viewportWidth=\"24.0\"\n    android:viewportHeight=\"24.0\">\n    <path\n        android:fillColor=\"@android:color/white\"\n        android:pathData=\"M3.284,11.266C3.151,9.267 3.084,8.267 3.677,7.634C4.27,7 5.272,7 7.276,7H12.724C14.728,7 15.73,7 16.323,7.634C16.485,7.807 16.598,8.008 16.674,8.25H17C19.526,8.25 21.75,10.062 21.75,12.5C21.75,14.938 19.526,16.75 17,16.75H16.35C16.338,16.923 16.327,17.089 16.316,17.25H3.685C3.666,16.983 3.647,16.699 3.627,16.399L3.284,11.266ZM16.45,15.25H17C18.892,15.25 20.25,13.928 20.25,12.5C20.25,11.072 18.892,9.75 17,9.75H16.801C16.788,10.18 16.755,10.68 16.716,11.266L16.45,15.25Z\"\n        android:fillType=\"evenOdd\" />\n    <path\n        android:fillColor=\"@android:color/white\"\n        android:pathData=\"M3.819,18.75H16.181C16.037,19.927 15.803,20.667 15.243,21.191C14.378,22 13.047,22 10.387,22H9.613C6.953,22 5.622,22 4.757,21.191C4.197,20.667 3.963,19.927 3.819,18.75Z\" />\n    <path\n        android:fillColor=\"@android:color/white\"\n        android:pathData=\"M6.977,1.327C7.314,1.567 7.393,2.036 7.152,2.373L6.766,2.914C7.392,3.388 7.531,4.278 7.072,4.921L6.661,5.497C6.421,5.834 5.952,5.912 5.615,5.672C5.278,5.431 5.199,4.963 5.44,4.626L5.826,4.084C5.2,3.61 5.062,2.721 5.52,2.077L5.931,1.502C6.172,1.165 6.64,1.086 6.977,1.327ZM10.977,1.327C11.314,1.567 11.393,2.036 11.152,2.373L10.766,2.914C11.392,3.388 11.531,4.278 11.072,4.921L10.661,5.497C10.421,5.834 9.952,5.912 9.615,5.672C9.278,5.431 9.199,4.963 9.44,4.626L9.826,4.084C9.2,3.61 9.061,2.721 9.52,2.077L9.931,1.502C10.172,1.165 10.64,1.086 10.977,1.327ZM14.977,1.327C15.314,1.567 15.393,2.036 15.152,2.373L14.766,2.914C15.392,3.388 15.531,4.278 15.072,4.921L14.661,5.497C14.421,5.834 13.952,5.912 13.615,5.672C13.278,5.431 13.199,4.963 13.44,4.626L13.826,4.084C13.2,3.61 13.061,2.721 13.521,2.077L13.931,1.502C14.172,1.165 14.64,1.086 14.977,1.327Z\"\n        android:fillType=\"evenOdd\" />\n</vector>\n"
  },
  {
    "path": "app/src/main/res/drawable/ic_log.xml",
    "content": "<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:width=\"24dp\"\n    android:height=\"24dp\"\n    android:autoMirrored=\"true\"\n    android:tint=\"#FFFFFF\"\n    android:viewportWidth=\"24\"\n    android:viewportHeight=\"24\">\n    <path\n        android:fillColor=\"@android:color/white\"\n        android:pathData=\"M17,10L7,10v2h10v-2zM19,3h-1L18,1h-2v2L8,3L8,1L6,1v2L5,3c-1.11,0 -1.99,0.9 -1.99,2L3,19c0,1.1 0.89,2 2,2h14c1.1,0 2,-0.9 2,-2L21,5c0,-1.1 -0.9,-2 -2,-2zM19,19L5,19L5,8h14v11zM14,14L7,14v2h7v-2z\" />\n</vector>\n"
  },
  {
    "path": "app/src/main/res/drawable/ic_modul.xml",
    "content": "<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:height=\"24dp\"\n    android:width=\"24dp\"\n    android:viewportWidth=\"24.0\"\n    android:viewportHeight=\"24.0\">\n    <path\n        android:fillColor=\"@android:color/white\"\n        android:pathData=\"M3.375,1.625C3.789,1.625 4.125,1.961 4.125,2.375L4.125,22.375C4.125,22.789 3.789,23.125 3.375,23.125C2.961,23.125 2.625,22.789 2.625,22.375L2.625,2.375C2.625,1.961 2.961,1.625 3.375,1.625Z\"\n        android:fillType=\"evenOdd\" />\n    <path\n        android:fillColor=\"@android:color/white\"\n        android:pathData=\"M7.375,7.875C7.375,6.94 7.375,6.473 7.576,6.125C7.708,5.897 7.897,5.708 8.125,5.576C8.473,5.375 8.94,5.375 9.875,5.375H18.875C19.81,5.375 20.277,5.375 20.625,5.576C20.853,5.708 21.042,5.897 21.174,6.125C21.375,6.473 21.375,6.94 21.375,7.875C21.375,8.81 21.375,9.277 21.174,9.625C21.042,9.853 20.853,10.042 20.625,10.174C20.277,10.375 19.81,10.375 18.875,10.375L9.875,10.375C8.94,10.375 8.473,10.375 8.125,10.174C7.897,10.042 7.708,9.853 7.576,9.625C7.375,9.277 7.375,8.81 7.375,7.875Z\" />\n    <path\n        android:fillColor=\"@android:color/white\"\n        android:pathData=\"M7.375,16.875C7.375,15.94 7.375,15.473 7.576,15.125C7.708,14.897 7.897,14.708 8.125,14.576C8.473,14.375 8.94,14.375 9.875,14.375L15.875,14.375C16.81,14.375 17.277,14.375 17.625,14.576C17.853,14.708 18.042,14.897 18.174,15.125C18.375,15.473 18.375,15.94 18.375,16.875C18.375,17.81 18.375,18.277 18.174,18.625C18.042,18.853 17.853,19.042 17.625,19.174C17.277,19.375 16.81,19.375 15.875,19.375H9.875C8.94,19.375 8.473,19.375 8.125,19.174C7.897,19.042 7.708,18.853 7.576,18.625C7.375,18.277 7.375,17.81 7.375,16.875Z\" />\n</vector>\n"
  },
  {
    "path": "app/src/main/res/drawable/ic_save.xml",
    "content": "<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:width=\"32dp\"\n    android:height=\"32dp\"\n    android:tint=\"#FFFFFF\"\n    android:viewportWidth=\"24\"\n    android:viewportHeight=\"24\">\n    <path\n        android:fillColor=\"@android:color/white\"\n        android:pathData=\"M17,3L5,3c-1.11,0 -2,0.9 -2,2v14c0,1.1 0.89,2 2,2h14c1.1,0 2,-0.9 2,-2L21,7l-4,-4zM12,19c-1.66,0 -3,-1.34 -3,-3s1.34,-3 3,-3 3,1.34 3,3 -1.34,3 -3,3zM15,9L5,9L5,5h10v4z\" />\n</vector>\n"
  },
  {
    "path": "app/src/main/res/drawable/ic_search.xml",
    "content": "<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:width=\"24dp\"\n    android:height=\"24dp\"\n    android:tint=\"#FFFFFF\"\n    android:viewportWidth=\"24\"\n    android:viewportHeight=\"24\">\n    <path\n        android:fillColor=\"@android:color/white\"\n        android:pathData=\"M15.5,14h-0.79l-0.28,-0.27C15.41,12.59 16,11.11 16,9.5 16,5.91 13.09,3 9.5,3S3,5.91 3,9.5 5.91,16 9.5,16c1.61,0 3.09,-0.59 4.23,-1.57l0.27,0.28v0.79l5,4.99L20.49,19l-4.99,-5zM9.5,14C7.01,14 5,11.99 5,9.5S7.01,5 9.5,5 14,7.01 14,9.5 11.99,14 9.5,14z\" />\n</vector>\n"
  },
  {
    "path": "app/src/main/res/drawable/ic_select_all.xml",
    "content": "<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:width=\"24dp\"\n    android:height=\"24dp\"\n    android:tint=\"#FFFFFF\"\n    android:viewportWidth=\"24\"\n    android:viewportHeight=\"24\">\n    <path\n        android:fillColor=\"@android:color/white\"\n        android:pathData=\"M3,5h2L5,3c-1.1,0 -2,0.9 -2,2zM3,13h2v-2L3,11v2zM7,21h2v-2L7,19v2zM3,9h2L5,7L3,7v2zM13,3h-2v2h2L13,3zM19,3v2h2c0,-1.1 -0.9,-2 -2,-2zM5,21v-2L3,19c0,1.1 0.9,2 2,2zM3,17h2v-2L3,15v2zM9,3L7,3v2h2L9,3zM11,21h2v-2h-2v2zM19,13h2v-2h-2v2zM19,21c1.1,0 2,-0.9 2,-2h-2v2zM19,9h2L21,7h-2v2zM19,17h2v-2h-2v2zM15,21h2v-2h-2v2zM15,5h2L17,3h-2v2zM7,17h10L17,7L7,7v10zM9,9h6v6L9,15L9,9z\" />\n</vector>\n"
  },
  {
    "path": "app/src/main/res/drawable/ic_setting.xml",
    "content": "<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:width=\"24dp\"\n    android:height=\"24dp\"\n    android:tint=\"#FFFFFF\"\n    android:viewportWidth=\"24\"\n    android:viewportHeight=\"24\">\n    <path\n        android:fillColor=\"@android:color/white\"\n        android:pathData=\"M19.14,12.94c0.04,-0.3 0.06,-0.61 0.06,-0.94c0,-0.32 -0.02,-0.64 -0.07,-0.94l2.03,-1.58c0.18,-0.14 0.23,-0.41 0.12,-0.61l-1.92,-3.32c-0.12,-0.22 -0.37,-0.29 -0.59,-0.22l-2.39,0.96c-0.5,-0.38 -1.03,-0.7 -1.62,-0.94L14.4,2.81c-0.04,-0.24 -0.24,-0.41 -0.48,-0.41h-3.84c-0.24,0 -0.43,0.17 -0.47,0.41L9.25,5.35C8.66,5.59 8.12,5.92 7.63,6.29L5.24,5.33c-0.22,-0.08 -0.47,0 -0.59,0.22L2.74,8.87C2.62,9.08 2.66,9.34 2.86,9.48l2.03,1.58C4.84,11.36 4.8,11.69 4.8,12s0.02,0.64 0.07,0.94l-2.03,1.58c-0.18,0.14 -0.23,0.41 -0.12,0.61l1.92,3.32c0.12,0.22 0.37,0.29 0.59,0.22l2.39,-0.96c0.5,0.38 1.03,0.7 1.62,0.94l0.36,2.54c0.05,0.24 0.24,0.41 0.48,0.41h3.84c0.24,0 0.44,-0.17 0.47,-0.41l0.36,-2.54c0.59,-0.24 1.13,-0.56 1.62,-0.94l2.39,0.96c0.22,0.08 0.47,0 0.59,-0.22l1.92,-3.32c0.12,-0.22 0.07,-0.47 -0.12,-0.61L19.14,12.94zM12,15.6c-1.98,0 -3.6,-1.62 -3.6,-3.6s1.62,-3.6 3.6,-3.6s3.6,1.62 3.6,3.6S13.98,15.6 12,15.6z\" />\n</vector>\n"
  },
  {
    "path": "app/src/main/res/layout/activity_converter.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:tools=\"http://schemas.android.com/tools\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    android:padding=\"20dp\"\n    tools:context=\".ui.converter.ConverterActivity\">\n\n    <LinearLayout\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        android:orientation=\"vertical\"\n        tools:ignore=\"UselessParent\">\n\n        <EditText\n            android:id=\"@+id/textInput\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"wrap_content\"\n            android:hint=\"paste your config here\\nseperate by enter or new line\"\n            android:maxLines=\"7\" />\n\n        <LinearLayout\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"wrap_content\"\n            android:orientation=\"horizontal\">\n\n            <CheckBox\n                android:id=\"@+id/fullClashConfig\"\n                android:layout_width=\"wrap_content\"\n                android:layout_height=\"25dp\"\n                android:text=\"clash configuration\" />\n\n            <CheckBox\n                android:id=\"@+id/fullSingConfig\"\n                android:layout_width=\"wrap_content\"\n                android:layout_height=\"25dp\"\n                android:text=\"sing-box configuration\" />\n        </LinearLayout>\n\n        <Button\n            android:id=\"@+id/btnConvert\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"wrap_content\"\n            android:layout_marginTop=\"5dp\"\n            android:text=\"convert\" />\n\n        <ScrollView\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"wrap_content\">\n\n            <LinearLayout\n                android:layout_width=\"match_parent\"\n                android:layout_height=\"wrap_content\"\n                android:layout_marginBottom=\"50dp\"\n                android:orientation=\"vertical\">\n\n                <TextView\n                    android:id=\"@+id/tvResult\"\n                    android:layout_width=\"match_parent\"\n                    android:layout_height=\"wrap_content\"\n                    android:layout_marginTop=\"20dp\"\n                    android:layout_marginBottom=\"25dp\" />\n            </LinearLayout>\n        </ScrollView>\n    </LinearLayout>\n</RelativeLayout>"
  },
  {
    "path": "app/src/main/res/layout/activity_core.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n  xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n  xmlns:tools=\"http://schemas.android.com/tools\"\n  android:layout_width=\"match_parent\"\n  android:layout_height=\"match_parent\"\n  android:background=\"?attr/bg\"\n  android:orientation=\"vertical\"\n  android:padding=\"20dp\"\n  tools:context=\".ui.core.CoreActivity\">\n\n  <LinearLayout\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"50dp\">\n\n    <TextView\n      android:layout_width=\"match_parent\"\n      android:layout_height=\"match_parent\"\n      android:gravity=\"center\"\n      android:text=\"UPDATER CORE\"\n      android:textSize=\"32sp\"\n      android:textStyle=\"bold\" />\n  </LinearLayout>\n\n  <LinearLayout\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"wrap_content\"\n    android:layout_marginLeft=\"5dp\"\n    android:layout_marginTop=\"35dp\"\n    android:layout_marginRight=\"5dp\"\n    android:layout_marginBottom=\"5dp\">\n\n    <RelativeLayout\n      android:layout_width=\"match_parent\"\n      android:layout_height=\"wrap_content\">\n\n      <TextView\n        android:id=\"@+id/tvClash\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:layout_marginStart=\"15dp\"\n        android:layout_marginTop=\"5dp\"\n        android:textSize=\"16sp\"\n        tools:text=\"testc\" />\n\n      <ProgressBar\n        android:id=\"@+id/prgClash\"\n        style=\"@android:style/Widget.DeviceDefault.ProgressBar\"\n        android:layout_width=\"24dp\"\n        android:layout_height=\"24dp\"\n        android:layout_marginStart=\"10dp\"\n        android:layout_toEndOf=\"@+id/tvClash\"\n        android:visibility=\"gone\"\n        tools:visibility=\"visible\" />\n\n      <ProgressBar\n        android:id=\"@+id/prgHrzClash\"\n        style=\"?android:attr/progressBarStyleHorizontal\"\n        android:layout_width=\"150dp\"\n        android:layout_height=\"wrap_content\"\n        android:layout_below=\"@+id/tvClash\"\n        android:layout_marginStart=\"15dp\"\n        android:layout_marginTop=\"8dp\"\n        android:progress=\"0\"\n        android:visibility=\"gone\"\n        tools:progress=\"20\"\n        tools:visibility=\"visible\" />\n\n      <ImageView\n        android:id=\"@+id/btnClash\"\n        android:layout_width=\"32dp\"\n        android:layout_height=\"32dp\"\n        android:layout_alignParentEnd=\"true\"\n        android:layout_centerVertical=\"true\"\n        android:layout_marginEnd=\"15dp\"\n        android:src=\"@drawable/ic_download\"\n        android:visibility=\"gone\"\n        app:tint=\"@color/material_blue\"\n        tools:visibility=\"visible\" />\n\n      <ImageView\n        android:id=\"@+id/imgErrorClash\"\n        android:layout_width=\"32dp\"\n        android:layout_height=\"32dp\"\n        android:layout_alignParentEnd=\"true\"\n        android:layout_centerVertical=\"true\"\n        android:layout_marginEnd=\"15dp\"\n        android:src=\"@drawable/ic_error\"\n        android:visibility=\"gone\"\n        app:tint=\"@color/material_red\"\n        tools:visibility=\"visible\" />\n\n      <ImageView\n        android:id=\"@+id/imgDoneClash\"\n        android:layout_width=\"32dp\"\n        android:layout_height=\"32dp\"\n        android:layout_alignParentEnd=\"true\"\n        android:layout_centerVertical=\"true\"\n        android:layout_marginEnd=\"15dp\"\n        android:src=\"@drawable/ic_done\"\n        android:visibility=\"gone\"\n        app:tint=\"@color/green\"\n        tools:visibility=\"visible\" />\n\n    </RelativeLayout>\n  </LinearLayout>\n</LinearLayout>"
  },
  {
    "path": "app/src/main/res/layout/activity_main.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<androidx.constraintlayout.widget.ConstraintLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    xmlns:tools=\"http://schemas.android.com/tools\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    tools:context=\".ui.MainActivity\">\n\n    <com.google.android.material.bottomnavigation.BottomNavigationView\n        android:id=\"@+id/nav_bottom\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        android:background=\"?attr/bg\"\n        app:layout_constraintBottom_toBottomOf=\"parent\"\n        app:layout_constraintEnd_toEndOf=\"parent\"\n        app:layout_constraintStart_toStartOf=\"parent\"\n        app:menu=\"@menu/bottom_nav_menu\" />\n\n    <fragment\n        android:id=\"@+id/nav_host_fragment_container\"\n        android:name=\"androidx.navigation.fragment.NavHostFragment\"\n        android:layout_width=\"0dp\"\n        android:layout_height=\"0dp\"\n        app:defaultNavHost=\"true\"\n        app:layout_constraintBottom_toTopOf=\"@+id/nav_bottom\"\n        app:layout_constraintEnd_toEndOf=\"parent\"\n        app:layout_constraintStart_toStartOf=\"parent\"\n        app:layout_constraintTop_toTopOf=\"parent\"\n        app:navGraph=\"@navigation/nav_main\" />\n\n</androidx.constraintlayout.widget.ConstraintLayout>"
  },
  {
    "path": "app/src/main/res/layout/custom_dialog.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<ScrollView xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:tools=\"http://schemas.android.com/tools\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"wrap_content\"\n    android:padding=\"20dp\">\n\n    <RelativeLayout\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\">\n\n        <TextView\n            android:id=\"@+id/tvTitle\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"wrap_content\"\n            android:gravity=\"center\"\n            android:textSize=\"20sp\"\n            android:textStyle=\"bold\"\n            tools:text=\"This is title\" />\n\n        <TextView\n            android:id=\"@+id/tvMessage\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"wrap_content\"\n            android:layout_below=\"@+id/tvTitle\"\n            android:layout_marginTop=\"10dp\"\n            android:textSize=\"16sp\"\n            tools:text=\"This is message\" />\n\n        <com.google.android.material.button.MaterialButton\n            android:id=\"@+id/btnOk\"\n            android:layout_width=\"wrap_content\"\n            android:layout_height=\"wrap_content\"\n            android:layout_below=\"@+id/tvMessage\"\n            android:layout_alignParentEnd=\"true\"\n            android:layout_marginTop=\"20dp\"\n            android:text=\"@string/ok\" />\n\n    </RelativeLayout>\n\n</ScrollView>"
  },
  {
    "path": "app/src/main/res/layout/fragment_app_list.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    xmlns:tools=\"http://schemas.android.com/tools\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    android:background=\"?attr/bg\"\n    tools:context=\".ui.fragment.AppListFragment\">\n\n\n    <LinearLayout\n        android:id=\"@+id/header_view\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"@dimen/list_header_height\"\n        android:orientation=\"horizontal\">\n\n        <RelativeLayout\n            android:id=\"@+id/conainer_app_bypass\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"match_parent\"\n            android:orientation=\"horizontal\">\n\n            <androidx.appcompat.widget.AppCompatTextView\n                android:id=\"@+id/tvInfoApps\"\n                android:layout_width=\"wrap_content\"\n                android:layout_height=\"wrap_content\"\n                android:layout_marginStart=\"15dp\"\n                android:layout_marginTop=\"20dp\"\n                android:text=\"@string/for_clash_only\"\n                android:textAppearance=\"@style/TextAppearance.AppCompat.Small\" />\n\n            <EditText\n                android:id=\"@+id/edSearch\"\n                android:layout_width=\"match_parent\"\n                android:layout_height=\"wrap_content\"\n                android:layout_marginStart=\"20dp\"\n                android:layout_marginTop=\"10dp\"\n                android:layout_marginEnd=\"80dp\"\n                android:singleLine=\"true\"\n                android:visibility=\"gone\"\n                tools:visibility=\"visible\" />\n\n            <ImageButton\n                android:id=\"@+id/searchBtn\"\n                android:layout_width=\"wrap_content\"\n                android:layout_height=\"wrap_content\"\n                android:layout_alignParentEnd=\"true\"\n                android:layout_marginTop=\"15dp\"\n                android:layout_marginEnd=\"50dp\"\n                android:background=\"@color/transparent\"\n                android:src=\"@drawable/ic_search\"\n                app:tint=\"@color/material_blue\" />\n\n            <ImageButton\n                android:id=\"@+id/selectAll\"\n                android:layout_width=\"wrap_content\"\n                android:layout_height=\"wrap_content\"\n                android:layout_alignParentEnd=\"true\"\n                android:layout_marginTop=\"15dp\"\n                android:layout_marginEnd=\"15dp\"\n                android:background=\"@color/transparent\"\n                android:src=\"@drawable/ic_select_all\"\n                app:tint=\"@color/material_blue\" />\n\n        </RelativeLayout>\n\n    </LinearLayout>\n\n    <androidx.recyclerview.widget.RecyclerView\n        android:id=\"@+id/rvApps\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\"\n        android:layout_below=\"@id/header_view\"\n        android:layout_marginTop=\"5dp\"\n        app:layoutManager=\"androidx.recyclerview.widget.LinearLayoutManager\"\n        tools:context=\".ui.fragment.AppListFragment\" />\n\n    <ProgressBar\n        android:id=\"@+id/prg_waiting\"\n        style=\"@android:style/Widget.DeviceDefault.ProgressBar\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        android:layout_centerInParent=\"true\" />\n\n    <com.google.android.material.floatingactionbutton.FloatingActionButton\n        android:id=\"@+id/fbSave\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:layout_alignParentEnd=\"true\"\n        android:layout_alignParentBottom=\"true\"\n        android:layout_marginEnd=\"20dp\"\n        android:layout_marginBottom=\"20dp\"\n        android:src=\"@drawable/ic_save\"\n        app:fabSize=\"mini\"\n        app:tint=\"@null\" />\n\n</RelativeLayout>"
  },
  {
    "path": "app/src/main/res/layout/fragment_config_helper.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    xmlns:tools=\"http://schemas.android.com/tools\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    android:background=\"?attr/bg\"\n    android:fitsSystemWindows=\"true\"\n    tools:context=\".ui.fragment.ConfigHelperFragment\">\n\n    <de.markusressel.kodeeditor.library.view.CodeEditorLayout\n        android:id=\"@+id/myEditor\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\"\n        android:fadeScrollbars=\"true\"\n        android:scrollbars=\"horizontal|vertical\"\n        app:ke_editor_backgroundColor=\"?attr/bg\"\n        app:ke_editor_followCursor=\"true\"\n        app:ke_editor_maxZoom=\"10.0\"\n        app:ke_lineNumbers_backgroundColor=\"#ccc\"\n        app:ke_lineNumbers_textColor=\"#000\"\n        app:ke_minimap_borderColor=\"#000\"\n        app:ke_minimap_enabled=\"false\"\n        app:ke_minimap_indicatorColor=\"#f00\"\n        app:ke_minimap_maxDimension=\"200dp\" />\n\n    <com.google.android.material.floatingactionbutton.FloatingActionButton\n        android:id=\"@+id/fbConverter\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:layout_above=\"@id/fbSave\"\n        android:layout_alignParentEnd=\"true\"\n        android:layout_marginEnd=\"20dp\"\n        android:layout_marginBottom=\"10dp\"\n        android:contentDescription=\"Converter\"\n        android:src=\"@drawable/ic_converter\"\n        app:fabSize=\"mini\"\n        app:tint=\"@null\" />\n\n    <com.google.android.material.floatingactionbutton.FloatingActionButton\n        android:id=\"@+id/fbSave\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:layout_alignParentEnd=\"true\"\n        android:layout_alignParentBottom=\"true\"\n        android:layout_marginEnd=\"20dp\"\n        android:layout_marginBottom=\"30dp\"\n        android:contentDescription=\"Save\"\n        android:src=\"@drawable/ic_save\"\n        app:fabSize=\"mini\"\n        app:tint=\"@null\" />\n\n</RelativeLayout>"
  },
  {
    "path": "app/src/main/res/layout/fragment_dashboard.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:tools=\"http://schemas.android.com/tools\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    android:background=\"?attr/bg\"\n    tools:context=\".ui.fragment.DashboardFragment\">\n\n    <WebView\n        android:id=\"@+id/dbWebview\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\" />\n</RelativeLayout>"
  },
  {
    "path": "app/src/main/res/layout/fragment_main.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    xmlns:tools=\"http://schemas.android.com/tools\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    android:background=\"?attr/bg\"\n    android:padding=\"20dp\"\n    tools:context=\".ui.fragment.MainFragment\">\n\n    <FrameLayout\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\"\n        android:clipChildren=\"false\"\n        android:clipToPadding=\"false\"\n        tools:ignore=\"MissingPrefix\">\n\n        <LinearLayout\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"wrap_content\"\n            android:animateLayoutChanges=\"true\"\n            android:orientation=\"vertical\"\n            tools:context=\".ui.activity.MainActivity\"\n            tools:ignore=\"UselessParent\">\n\n            <RelativeLayout\n                android:layout_width=\"match_parent\"\n                android:layout_height=\"72dp\"\n                android:layout_marginStart=\"2dp\"\n                android:layout_marginEnd=\"2dp\"\n                android:layout_marginBottom=\"10dp\"\n                android:clipChildren=\"false\"\n                android:clipToPadding=\"false\">\n\n                <ImageView\n                    android:id=\"@+id/app_icon\"\n                    android:layout_width=\"42dp\"\n                    android:layout_height=\"42dp\"\n                    android:layout_centerVertical=\"true\"\n                    android:layout_marginStart=\"16dp\"\n                    android:contentDescription=\"@string/app_name\"\n                    android:src=\"@drawable/ic_launcher\" />\n\n                <TextView\n                    android:id=\"@+id/boxTitleApp\"\n                    android:layout_width=\"wrap_content\"\n                    android:layout_height=\"wrap_content\"\n                    android:layout_centerVertical=\"true\"\n                    android:layout_marginStart=\"10dp\"\n                    android:layout_toEndOf=\"@id/app_icon\"\n                    android:contentDescription=\"@string/app_name\"\n                    android:text=\"@string/app_name\"\n                    android:textAppearance=\"@style/TextAppearance.AppCompat.Title\"\n                    android:textSize=\"20sp\"\n                    tools:ignore=\"RelativeOverlap\" />\n\n                <ProgressBar\n                    android:id=\"@+id/prgLoadingTop\"\n                    style=\"@android:style/Widget.DeviceDefault.ProgressBar\"\n                    android:layout_width=\"24dp\"\n                    android:layout_height=\"24dp\"\n                    android:layout_gravity=\"center\"\n                    android:layout_marginStart=\"10dp\"\n                    android:layout_marginTop=\"23dp\"\n                    android:layout_toEndOf=\"@id/boxTitleApp\"\n                    android:visibility=\"gone\"\n                    tools:visibility=\"visible\" />\n\n                <ImageView\n                    android:id=\"@+id/imgModule\"\n                    android:layout_width=\"42dp\"\n                    android:layout_height=\"42dp\"\n                    android:layout_alignParentEnd=\"true\"\n                    android:layout_centerVertical=\"true\"\n                    android:layout_marginEnd=\"10dp\"\n                    android:contentDescription=\"@string/app_name\"\n                    android:src=\"@drawable/ic_modul\"\n                    app:tint=\"@color/material_blue\" />\n\n            </RelativeLayout>\n\n            <com.google.android.material.card.MaterialCardView\n                android:id=\"@+id/proxy\"\n                style=\"@style/MyCardView\"\n                android:layout_width=\"match_parent\"\n                android:layout_height=\"wrap_content\"\n                android:layout_marginHorizontal=\"16dp\"\n                android:layout_marginTop=\"10dp\"\n                android:clickable=\"true\"\n                android:focusable=\"true\"\n                android:foreground=\"?attr/selectableItemBackground\"\n                app:cardBackgroundColor=\"#6fa251\">\n\n                <RelativeLayout\n                    android:layout_width=\"match_parent\"\n                    android:layout_height=\"wrap_content\"\n                    android:paddingStart=\"18dp\"\n                    android:paddingTop=\"20dp\"\n                    android:paddingEnd=\"18dp\"\n                    android:paddingBottom=\"20dp\">\n\n                    <ImageView\n                        android:id=\"@+id/status_icon\"\n                        android:layout_width=\"28dp\"\n                        android:layout_height=\"28dp\"\n                        android:layout_centerVertical=\"true\"\n                        app:srcCompat=\"@drawable/ic_app\"\n                        app:tint=\"?android:attr/textColorPrimaryInverse\" />\n\n                    <TextView\n                        android:id=\"@+id/status_title\"\n                        android:layout_width=\"wrap_content\"\n                        android:layout_height=\"wrap_content\"\n                        android:layout_marginStart=\"25dp\"\n                        android:layout_toEndOf=\"@id/status_icon\"\n                        android:textAppearance=\"@style/TextAppearance.AppCompat.Medium\"\n                        android:textColor=\"?android:attr/textColorPrimaryInverse\"\n                        tools:text=\"status\" />\n\n                    <TextView\n                        android:id=\"@+id/status_summary\"\n                        android:layout_width=\"wrap_content\"\n                        android:layout_height=\"wrap_content\"\n                        android:layout_below=\"@id/status_title\"\n                        android:layout_alignStart=\"@id/status_title\"\n                        android:layout_marginTop=\"2dp\"\n                        android:textAppearance=\"@style/TextAppearance.AppCompat.Small\"\n                        android:textColor=\"?android:attr/textColorPrimaryInverse\"\n                        tools:text=\"version\" />\n\n                    <TextView\n                        android:id=\"@+id/tvApps\"\n                        android:layout_width=\"wrap_content\"\n                        android:layout_height=\"wrap_content\"\n                        android:layout_below=\"@id/status_summary\"\n                        android:layout_alignStart=\"@+id/status_summary\"\n                        android:layout_marginTop=\"2dp\"\n                        android:ellipsize=\"end\"\n                        android:textAppearance=\"@style/TextAppearance.AppCompat.Small\"\n                        android:textColor=\"?android:attr/textColorPrimaryInverse\"\n                        android:textSize=\"16sp\"\n                        tools:text=\"tes text\" />\n\n\n                </RelativeLayout>\n\n            </com.google.android.material.card.MaterialCardView>\n\n\n            <com.google.android.material.card.MaterialCardView\n                android:id=\"@+id/cardLog\"\n                style=\"@style/MyCardView\"\n                android:layout_width=\"match_parent\"\n                android:layout_height=\"wrap_content\"\n                android:layout_marginHorizontal=\"16dp\"\n                android:layout_marginTop=\"5dp\"\n                android:layout_marginBottom=\"10dp\"\n                app:cardCornerRadius=\"8dp\"\n                app:cardElevation=\"4dp\"\n                app:cardPreventCornerOverlap=\"false\">\n\n                <ScrollView\n                    android:layout_width=\"match_parent\"\n                    android:layout_height=\"wrap_content\"\n                    android:padding=\"10dp\">\n\n                    <TextView\n                        android:id=\"@+id/tvLog\"\n                        android:layout_width=\"match_parent\"\n                        android:layout_height=\"wrap_content\" />\n\n                </ScrollView>\n\n            </com.google.android.material.card.MaterialCardView>\n        </LinearLayout>\n\n    </FrameLayout>\n\n    <ProgressBar\n        android:id=\"@+id/prgLoading\"\n        style=\"@android:style/Widget.DeviceDefault.ProgressBar\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:layout_alignParentEnd=\"true\"\n        android:layout_alignParentBottom=\"true\"\n        android:visibility=\"gone\"\n        tools:visibility=\"visible\" />\n\n    <com.google.android.material.floatingactionbutton.FloatingActionButton\n        android:id=\"@+id/fbConfig\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:layout_alignParentEnd=\"true\"\n        android:layout_alignParentBottom=\"true\"\n        android:layout_marginVertical=\"60dp\"\n        android:layout_marginBottom=\"10dp\"\n        android:contentDescription=\"config\"\n        android:src=\"@drawable/ic_config\"\n        app:fabSize=\"mini\"\n        app:tint=\"@null\" />\n\n    <com.google.android.material.floatingactionbutton.FloatingActionButton\n        android:id=\"@+id/fbSetting\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:layout_alignParentEnd=\"true\"\n        android:layout_alignParentBottom=\"true\"\n        android:contentDescription=\"@string/setting\"\n        android:src=\"@drawable/ic_setting\"\n        app:fabSize=\"mini\"\n        app:tint=\"@null\" />\n\n</RelativeLayout>"
  },
  {
    "path": "app/src/main/res/layout/item_applist.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"wrap_content\"\n    android:clickable=\"true\"\n    android:focusable=\"true\"\n    android:foreground=\"?android:attr/selectableItemBackground\"\n    android:gravity=\"center_vertical\">\n\n    <androidx.appcompat.widget.AppCompatImageView\n        android:id=\"@+id/icon\"\n        android:layout_width=\"60dp\"\n        android:layout_height=\"60dp\"\n        android:padding=\"10dp\" />\n\n    <LinearLayout\n        android:layout_width=\"0dp\"\n        android:layout_height=\"60dp\"\n        android:layout_weight=\"1.0\"\n        android:gravity=\"center\"\n        android:orientation=\"vertical\"\n        android:paddingStart=\"16dp\"\n        android:paddingEnd=\"16dp\">\n\n        <androidx.appcompat.widget.AppCompatTextView\n            android:id=\"@+id/name\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"wrap_content\"\n            android:ellipsize=\"end\"\n            android:maxLines=\"1\" />\n\n        <androidx.appcompat.widget.AppCompatTextView\n            android:id=\"@+id/package_name\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"wrap_content\"\n            android:ellipsize=\"end\"\n            android:maxLines=\"1\"\n            android:textAppearance=\"@style/TextAppearance.AppCompat.Small\" />\n\n    </LinearLayout>\n\n    <androidx.appcompat.widget.AppCompatCheckBox\n        android:id=\"@+id/check_box\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:clickable=\"false\"\n        android:focusable=\"false\"\n        android:paddingStart=\"2dp\"\n        android:paddingLeft=\"2dp\"\n        android:paddingEnd=\"6dp\"\n        android:paddingRight=\"6dp\" />\n\n</LinearLayout>"
  },
  {
    "path": "app/src/main/res/layout/setting_dialog.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<ScrollView xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:tools=\"http://schemas.android.com/tools\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    android:orientation=\"vertical\"\n    android:padding=\"10dp\">\n\n    <LinearLayout\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"0dp\"\n        android:layout_marginTop=\"10dp\"\n        android:layout_weight=\"1\"\n        android:orientation=\"vertical\"\n        tools:context=\".ui.activity.MainActivity\">\n\n        <TextView\n            android:layout_width=\"wrap_content\"\n            android:layout_height=\"wrap_content\"\n            android:layout_marginStart=\"9dp\"\n            android:layout_marginLeft=\"9dp\"\n            android:text=\"@string/select_core\" />\n\n        <LinearLayout\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"wrap_content\"\n            android:layout_marginStart=\"9dp\"\n            android:layout_marginLeft=\"9dp\"\n            android:layout_marginRight=\"9dp\"\n            android:layout_weight=\"0\"\n            android:orientation=\"horizontal\">\n\n            <Spinner\n                android:id=\"@+id/coreSelector\"\n                android:layout_width=\"wrap_content\"\n                android:layout_height=\"50dp\"\n                android:layout_weight=\"1\">\n\n            </Spinner>\n\n        </LinearLayout>\n\n        <TextView\n            android:id=\"@+id/clash1\"\n            android:layout_width=\"wrap_content\"\n            android:layout_height=\"wrap_content\"\n            android:layout_marginStart=\"9dp\"\n            android:layout_marginLeft=\"9dp\"\n            android:text=\"@string/clash_settings\"\n            android:visibility=\"gone\" />\n\n        <LinearLayout\n            android:id=\"@+id/clash2\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"wrap_content\"\n            android:layout_weight=\"0\"\n            android:gravity=\"center\"\n            android:orientation=\"horizontal\"\n            android:visibility=\"gone\">\n\n            <TextView\n                android:layout_width=\"0dp\"\n                android:layout_height=\"wrap_content\"\n                android:layout_marginLeft=\"9dp\"\n                android:layout_weight=\"1.6\"\n                android:text=\"@string/find_procces\" />\n\n            <TextView\n                android:layout_width=\"0dp\"\n                android:layout_height=\"wrap_content\"\n                android:layout_weight=\"0.1\"\n                android:text=\" :\" />\n\n            <Spinner\n                android:id=\"@+id/spFindProc\"\n                android:layout_width=\"0dp\"\n                android:layout_height=\"wrap_content\"\n                android:layout_weight=\"1.5\">\n\n            </Spinner>\n\n        </LinearLayout>\n\n        <LinearLayout\n            android:id=\"@+id/clash4\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"wrap_content\"\n            android:layout_weight=\"0\"\n            android:gravity=\"center\"\n            android:orientation=\"horizontal\"\n            android:visibility=\"gone\">\n\n            <TextView\n                android:layout_width=\"0dp\"\n                android:layout_height=\"wrap_content\"\n                android:layout_marginLeft=\"9dp\"\n                android:layout_weight=\"1.6\"\n                android:text=\"@string/find_config\" />\n\n            <TextView\n                android:layout_width=\"0dp\"\n                android:layout_height=\"wrap_content\"\n                android:layout_weight=\"0.1\"\n                android:text=\" :\" />\n\n            <Spinner\n                android:id=\"@+id/spFindConf\"\n                android:layout_width=\"0dp\"\n                android:layout_height=\"wrap_content\"\n                android:layout_weight=\"1.5\">\n\n            </Spinner>\n\n        </LinearLayout>\n \n        <LinearLayout\n            android:id=\"@+id/clash8\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"wrap_content\"\n            android:layout_weight=\"0\"\n            android:gravity=\"center\"\n            android:orientation=\"horizontal\"\n            android:visibility=\"gone\">\n\n            <TextView\n                android:layout_width=\"0dp\"\n                android:layout_height=\"wrap_content\"\n                android:layout_marginLeft=\"9dp\"\n                android:layout_weight=\"1.6\"\n                android:text=\"@string/clash_options\" />\n\n            <TextView\n                android:layout_width=\"0dp\"\n                android:layout_height=\"wrap_content\"\n                android:layout_weight=\"0.1\"\n                android:text=\" :\" />\n\n            <Spinner\n                android:id=\"@+id/spClashType\"\n                android:layout_width=\"0dp\"\n                android:layout_height=\"wrap_content\"\n                android:layout_weight=\"1.5\">\n\n            </Spinner>\n\n        </LinearLayout>\n\n        <LinearLayout\n            android:id=\"@+id/clash5\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"wrap_content\"\n            android:layout_weight=\"0\"\n            android:gravity=\"center\"\n            android:orientation=\"horizontal\"\n            android:visibility=\"gone\">\n\n            <CheckBox\n                android:id=\"@+id/cbunified_delay\"\n                android:layout_width=\"0dp\"\n                android:layout_height=\"wrap_content\"\n                android:layout_weight=\"1\"\n                android:text=\"@string/unified_delay\"\n                android:textSize=\"12sp\" />\n\n            <CheckBox\n                android:id=\"@+id/cbsnifferrs\"\n                android:layout_width=\"0dp\"\n                android:layout_height=\"wrap_content\"\n                android:layout_weight=\"1\"\n                android:text=\"@string/sniffer\"\n                android:textSize=\"12sp\" />\n\n        </LinearLayout>\n\n        <LinearLayout\n            android:id=\"@+id/clash6\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"wrap_content\"\n            android:layout_weight=\"0\"\n            android:gravity=\"center\"\n            android:orientation=\"horizontal\"\n            android:visibility=\"gone\">\n\n            <CheckBox\n                android:id=\"@+id/cbredir_host\"\n                android:layout_width=\"0dp\"\n                android:layout_height=\"wrap_content\"\n                android:layout_weight=\"1\"\n                android:text=\"@string/redir_host\"\n                android:textSize=\"12sp\" />\n\n            <CheckBox\n                android:id=\"@+id/cbgeodata_mod\"\n                android:layout_width=\"0dp\"\n                android:layout_height=\"wrap_content\"\n                android:layout_weight=\"1\"\n                android:text=\"@string/geodata_meta\"\n                android:textSize=\"12sp\" />\n\n        </LinearLayout>\n\n        <LinearLayout\n            android:id=\"@+id/clash7\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"wrap_content\"\n            android:layout_weight=\"0\"\n            android:gravity=\"center\"\n            android:orientation=\"horizontal\"\n            android:visibility=\"gone\">\n\n            <CheckBox\n                android:id=\"@+id/cbsubs\"\n                android:layout_width=\"0dp\"\n                android:layout_height=\"wrap_content\"\n                android:layout_weight=\"1\"\n                android:text=\"@string/subscription\"\n                android:textSize=\"12sp\" />\n\n        </LinearLayout>\n\n        <TextView\n            android:layout_width=\"wrap_content\"\n            android:layout_height=\"wrap_content\"\n            android:layout_marginStart=\"9dp\"\n            android:layout_marginLeft=\"9dp\"\n            android:text=\"@string/module_settings\" />\n\n        <LinearLayout\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"wrap_content\"\n            android:layout_weight=\"0\"\n            android:gravity=\"center\"\n            android:orientation=\"horizontal\">\n\n            <CheckBox\n                android:id=\"@+id/cbquic\"\n                android:layout_width=\"0dp\"\n                android:layout_height=\"wrap_content\"\n                android:layout_weight=\"1\"\n                android:text=\"@string/quic\"\n                android:textSize=\"12sp\" />\n\n            <CheckBox\n                android:id=\"@+id/cbipv6\"\n                android:layout_width=\"0dp\"\n                android:layout_height=\"wrap_content\"\n                android:layout_weight=\"1\"\n                android:text=\"@string/ipv6\"\n                android:textSize=\"12sp\" />\n\n            <CheckBox\n                android:id=\"@+id/cbgeo\"\n                android:layout_width=\"0dp\"\n                android:layout_height=\"wrap_content\"\n                android:layout_weight=\"1\"\n                android:text=\"@string/geox\"\n                android:textSize=\"12sp\" />\n\n            <CheckBox\n                android:id=\"@+id/cbcron\"\n                android:layout_width=\"0dp\"\n                android:layout_height=\"wrap_content\"\n                android:layout_weight=\"1\"\n                android:text=\"@string/crontab\"\n                android:textSize=\"12sp\" />\n\n        </LinearLayout>\n\n        <TextView\n            android:layout_width=\"wrap_content\"\n            android:layout_height=\"wrap_content\"\n            android:layout_marginStart=\"9dp\"\n            android:layout_marginLeft=\"9dp\"\n            android:text=\"@string/cgroup_settings\" />\n\n        <LinearLayout\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"wrap_content\"\n            android:layout_weight=\"0\"\n            android:gravity=\"center\"\n            android:orientation=\"horizontal\">\n            <CheckBox\n                android:id=\"@+id/cbmemcg\"\n                android:layout_width=\"0dp\"\n                android:layout_height=\"wrap_content\"\n                android:layout_weight=\"1\"\n                android:text=\"@string/memcg\"\n                android:textSize=\"12sp\" />\n\n            <CheckBox\n                android:id=\"@+id/cbblkio\"\n                android:layout_width=\"0dp\"\n                android:layout_height=\"wrap_content\"\n                android:layout_weight=\"1\"\n                android:text=\"@string/blkio\"\n                android:textSize=\"12sp\" />\n\n            <CheckBox\n                android:id=\"@+id/cbcpuset\"\n                android:layout_width=\"0dp\"\n                android:layout_height=\"wrap_content\"\n                android:layout_weight=\"1\"\n                android:text=\"@string/cpuset\"\n                android:textSize=\"12sp\" />\n        </LinearLayout>\n\n        <LinearLayout\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"wrap_content\"\n            android:gravity=\"center\"\n            android:orientation=\"vertical\">\n\n            <LinearLayout\n                android:layout_width=\"match_parent\"\n                android:layout_height=\"wrap_content\"\n                android:gravity=\"center\"\n                android:orientation=\"horizontal\">\n\n                <TextView\n                    android:layout_width=\"0dp\"\n                    android:layout_height=\"wrap_content\"\n                    android:layout_marginLeft=\"9dp\"\n                    android:layout_weight=\"1.6\"\n                    android:text=\"@string/networkmode\" />\n\n                <TextView\n                    android:layout_width=\"0dp\"\n                    android:layout_height=\"wrap_content\"\n                    android:layout_weight=\"0.1\"\n                    android:text=\":\" />\n\n                <Spinner\n                    android:id=\"@+id/spNetworkMode\"\n                    android:layout_width=\"0dp\"\n                    android:layout_height=\"wrap_content\"\n                    android:layout_weight=\"1.5\" />\n            </LinearLayout>\n\n            <LinearLayout\n                android:layout_width=\"match_parent\"\n                android:layout_height=\"wrap_content\"\n                android:gravity=\"center\"\n                android:orientation=\"horizontal\">\n\n                <TextView\n                    android:layout_width=\"0dp\"\n                    android:layout_height=\"wrap_content\"\n                    android:layout_marginLeft=\"9dp\"\n                    android:layout_weight=\"1.6\"\n                    android:text=\"@string/proxymode\" />\n\n                <TextView\n                    android:layout_width=\"0dp\"\n                    android:layout_height=\"wrap_content\"\n                    android:layout_weight=\"0.1\"\n                    android:text=\":\" />\n\n                <Spinner\n                    android:id=\"@+id/spProxyMode\"\n                    android:layout_width=\"0dp\"\n                    android:layout_height=\"wrap_content\"\n                    android:layout_weight=\"1.5\" />\n            </LinearLayout>\n        </LinearLayout>\n\n\n        <LinearLayout\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"wrap_content\"\n            android:layout_marginTop=\"10dp\"\n            android:layout_weight=\"0\"\n            android:gravity=\"center\"\n            android:orientation=\"horizontal\">\n\n            <com.google.android.material.button.MaterialButton\n                android:id=\"@+id/checkModule\"\n                android:layout_width=\"0dp\"\n                android:layout_height=\"wrap_content\"\n                android:layout_weight=\"1\"\n                android:background=\"@color/transparent\"\n                android:text=\"@string/check_module\"\n                android:textColor=\"@color/material_blue\"\n                android:textSize=\"12sp\" />\n\n            <com.google.android.material.button.MaterialButton\n                android:id=\"@+id/checkIp\"\n                android:layout_width=\"0dp\"\n                android:layout_height=\"wrap_content\"\n                android:layout_weight=\"1\"\n                android:background=\"@color/transparent\"\n                android:text=\"@string/myip\"\n                android:textColor=\"@color/material_blue\"\n                android:textSize=\"12sp\" />\n\n            <com.google.android.material.button.MaterialButton\n                android:id=\"@+id/aboutApp\"\n                android:layout_width=\"0dp\"\n                android:layout_height=\"wrap_content\"\n                android:layout_weight=\"1\"\n                android:background=\"@color/transparent\"\n                android:text=\"about\"\n                android:textColor=\"@color/material_blue\"\n                android:textSize=\"12sp\" />\n\n        </LinearLayout>\n\n    </LinearLayout>\n\n</ScrollView>"
  },
  {
    "path": "app/src/main/res/menu/bottom_nav_menu.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<menu xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <item\n        android:id=\"@+id/nav_home\"\n        android:icon=\"@drawable/ic_home\"\n        android:title=\"@string/home\" />\n\n    <item\n        android:id=\"@+id/nav_dashboard\"\n        android:icon=\"@drawable/ic_dashboard\"\n        android:title=\"@string/dashboard\" />\n\n    <item\n        android:id=\"@+id/nav_applist\"\n        android:icon=\"@drawable/ic_app\"\n        android:title=\"@string/app\" />\n\n</menu>"
  },
  {
    "path": "app/src/main/res/navigation/nav_main.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<navigation xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    xmlns:tools=\"http://schemas.android.com/tools\"\n    android:id=\"@+id/nav_main\"\n    app:startDestination=\"@id/nav_home\">\n\n    <fragment\n        android:id=\"@+id/nav_home\"\n        android:name=\"xyz.chz.bfm.ui.fragment.MainFragment\"\n        android:label=\"fragment_main\"\n        tools:layout=\"@layout/fragment_main\">\n        <action\n            android:id=\"@+id/action_mainFragment_to_appListFragment\"\n            app:destination=\"@id/nav_applist\" />\n        <action\n            android:id=\"@+id/action_mainFragment_to_logFragment\"\n            app:destination=\"@id/nav_dashboard\" />\n        <action\n            android:id=\"@+id/action_nav_home_to_configHelperFragment\"\n            app:destination=\"@id/configHelperFragment\" />\n    </fragment>\n    <fragment\n        android:id=\"@+id/nav_applist\"\n        android:name=\"xyz.chz.bfm.ui.fragment.AppListFragment\"\n        android:label=\"fragment_app_list\"\n        tools:layout=\"@layout/fragment_app_list\" />\n    <fragment\n        android:id=\"@+id/nav_dashboard\"\n        android:name=\"xyz.chz.bfm.ui.fragment.DashboardFragment\"\n        android:label=\"fragment_log\"\n        tools:layout=\"@layout/fragment_dashboard\">\n        <action\n            android:id=\"@+id/action_nav_dashboard_to_nav_home\"\n            app:destination=\"@id/nav_home\" />\n    </fragment>\n    <fragment\n        android:id=\"@+id/configHelperFragment\"\n        android:name=\"xyz.chz.bfm.ui.fragment.ConfigHelperFragment\"\n        android:label=\"fragment_config_helper\"\n        tools:layout=\"@layout/fragment_config_helper\">\n        <action\n            android:id=\"@+id/action_configHelperFragment_to_nav_home\"\n            app:destination=\"@id/nav_home\" />\n    </fragment>\n</navigation>"
  },
  {
    "path": "app/src/main/res/raw/clashtemplate",
    "content": "# port: 6550\n# socks-port: 6551\n# mixed-port: 6552\nredir-port: 9797\ntproxy-port: 9898\nmode: rule\nallow-lan: true\nbind-address: \"*\"\nlog-level: warning\nunified-delay: true\ngeodata-mode: true\ngeodata-loader: memconservative\nipv6: false\nexternal-controller: 0.0.0.0:9090\nsecret: \"\"\nexternal-ui: /data/adb/box/clash/dashboard\nprofile:\n  store-selected: true\n  store-fake-ip: false\nfind-process-mode: off\ngeox-url:\n  geoip: \"https://github.com/MetaCubeX/meta-rules-dat/raw/release/geoip-lite.dat\"\n  mmdb: \"https://github.com/MetaCubeX/meta-rules-dat/raw/release/country-lite.mmdb\"\n  geosite: \"https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat\"\nsniffer:\n  enable: false\n  force-dns-mapping: false\n  parse-pure-ip: false\n  override-destination: false\n  sniff:\n    TLS:\n      ports: [443, 8443]\n    HTTP:\n      ports: [80, 8080-8880]\n      override-destination: true\n  sniffing: [tls, http]\n  port-whitelist: [80, 443]\ndns:\n  enable: true\n  prefer-h3: false\n  ipv6: false\n  default-nameserver:\n    - '8.8.8.8#match'\n    - 1.1.1.1\n  listen: 0.0.0.0:1053\n  use-hosts: true\n  enhanced-mode: fake-ip\n  fake-ip-range: 28.0.0.1/8\n  fake-ip-filter:\n    - \"*.lan\"\n    - \"*.ntp.*\"\n  nameserver:\n    - 9.9.9.9\n    - 94.140.14.14\n    - '8.8.8.8#match'\n  # proxy-server-nameserver:\n    # - 112.215.198.248\n    # - \"[2400:9800:2:2::246]\"\n  # nameserver-policy:\n    # \"geosite:category-ads-all\": rcode://success\n    # \"geosite:nameserver-policy\":\n       # - 112.215.198.248\n       # - '[2404:c0:1000::a:0:1]'\ntun:\n  enable: false\n  mtu: 9000\n  device: tun9\n  stack: system\n  dns-hijack:\n    - any:53\n    - tcp://any:53\n  auto-route: true\n  strict-route: false\n  auto-detect-interface: true\n  include-android-user: [0, 10]\n  exclude-package: []\nproxies:\n%1$sproxy-groups:\n%2$srules:\n# - DOMAIN-SUFFIX,googlesyndication.com,%3$s\n# - DOMAIN-SUFFIX,adtival.network,%3$s\n# - IP-CIDR,127.0.0.1/32,REJECT,no-resolve\n# - IP-CIDR,28.0.0.1/8,REJECT,no-resolve\n# - IP-CIDR6,::1/128,REJECT,no-resolve\n# - GEOSITE,category-ads-all,REJECT\n# - AND,((NETWORK,udp),(GEOSITE,youtube)),REJECT\n- MATCH,%3$s"
  },
  {
    "path": "app/src/main/res/raw/singboxtemplate",
    "content": "{\n  \"log\": {\n    \"disabled\": false,\n    \"level\": \"panic\",\n    \"output\": \"/data/adb/box/run/sing-box.log\",\n    \"timestamp\": true\n  },\n  \"dns\": {\n    \"servers\": [\n      {\n        \"tag\": \"AdGuard\",\n        \"address\": \"94.140.14.14\"\n      },\n      {\n        \"tag\": \"local\",\n        \"address\": \"YOUR DNS\",\n        \"detour\": \"direct\"\n      },\n      {\n        \"tag\": \"rcode\",\n        \"address\": \"rcode://success\"\n      }\n    ],\n    \"rules\": [\n      {\n        \"outbound\": \"any\",\n        \"server\": \"local\",\n        \"disable_cache\": true\n      }\n    ],\n    \"final\": \"AdGuard\",\n    \"reverse_mapping\": false,\n    \"disable_cache\": false,\n    \"independent_cache\": false\n  },\n  \"inbounds\": [\n    {\n      \"type\": \"tproxy\",\n      \"tag\": \"tproxy-in\",\n      \"listen\": \"::\",\n      \"listen_port\": 9898,\n      \"sniff\": true,\n      \"sniff_override_destination\": false\n    }\n  ],\n  \"outbounds\": [\n    %1$s\n  ],\n  \"route\": {\n    \"rule_set\": [\n      {\n        \"type\": \"remote\",\n        \"tag\": \"geosite-category-ads-all\",\n        \"url\": \"https://github.com/MetaCubeX/meta-rules-dat/raw/sing/geo/geosite/category-ads-all.srs\",\n        \"download_detour\": \"match\",\n        \"update_interval\": \"24h\",\n        \"format\": \"binary\"\n      }\n    ],\n    \"rules\": [\n      {\n        \"protocol\": \"dns\",\n        \"outbound\": \"dns-out\"\n      },\n      {\n        \"rule_set\": [\n          \"geosite-category-ads-all\"\n        ],\n        \"outbound\": \"ads-all\"\n      }\n    ],\n    \"final\": \"match\",\n    \"find_process\": true,\n    \"auto_detect_interface\": true\n  },\n  \"experimental\": {\n    \"cache_file\": {\n      \"enabled\": true,\n      \"path\": \"cache.db\",\n      \"store_fakeip\": false\n    },\n    \"clash_api\": {\n      \"external_controller\": \"0.0.0.0:9090\",\n      \"external_ui\": \"./dashboard\"\n    }\n  }\n}"
  },
  {
    "path": "app/src/main/res/values/colors.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n    <color name=\"material_blue\">#2196F3</color>\n    <color name=\"material_blue5p\">#0D2196F3</color>\n    <color name=\"dots_bg\">#192196F3</color>\n    <color name=\"dots_half\">#802196F3</color>\n    <color name=\"material_red\">#EC7474</color>\n    <color name=\"light_white\">#FCFCFC</color>\n    <color name=\"green\">#009E00</color>\n    <color name=\"dark\">#0E121A</color>\n    <color name=\"black\">#000000</color>\n    <color name=\"light_dark\">#171C26</color>\n    <color name=\"black_bold_text\">#4F565E</color>\n    <color name=\"black_regular_text\">#888F96</color>\n    <color name=\"black_hint_text\">#80888F96</color>\n    <color name=\"white\">#FFFFFFFF</color>\n    <color name=\"bgdialog\">#1E0304</color>\n    <color name=\"transparent\">#00FFFFFF</color>\n    <color name=\"white_bold_text\">#FCFCFC</color>\n    <color name=\"white_regular_text\">#F2F5F6</color>\n    <color name=\"white_hint_text\">#80F2F5F6</color>\n    <color name=\"ripple_color\">#7F717171</color>\n    <color name=\"color_bg_dialog\">@color/white</color>\n    <attr name=\"card\" format=\"color\" />\n    <attr name=\"bg\" format=\"color\" />\n    <attr name=\"boldText\" format=\"color\" />\n    <attr name=\"regularText\" format=\"color\" />\n    <attr name=\"hintText\" format=\"color\" />\n    <attr name=\"appbar\" format=\"color\" />\n    <attr name=\"appbarAttribute\" format=\"color\" />\n</resources>"
  },
  {
    "path": "app/src/main/res/values/dimens.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n    <dimen name=\"list_header_height\">50dp</dimen>\n</resources>"
  },
  {
    "path": "app/src/main/res/values/strings.xml",
    "content": "<resources>\n    <!-- Apps -->\n    <string name=\"app_name\">BoxForRoot</string>\n    <string name=\"min_module_vrsion\">20230814</string>\n    <string name=\"apps_count_list\">added %d apps in mode %s</string>\n    <string name=\"no_apps_count_list\">mode %s</string>\n    <string name=\"ok\">OK</string>\n    <string name=\"for_clash_only\">clash only work on redir-host</string>\n    <string name=\"module_not_found\">Module Not Found</string>\n    <string name=\"update_module\">Please upgrade ur Module :)\\nMinimum ver: %d</string>\n    <string name=\"module_repo_url\">https://github.com/taamarin/box_for_magisk</string>\n    <string name=\"release_repo_url\">https://github.com/taamarin/box_for_magisk/releases</string>\n\n    <string name=\"success\">Success</string>\n    <string name=\"failed\">Failed</string>\n    <string name=\"home\">Home</string>\n    <string name=\"dashboard\">Dashboard</string>\n    <string name=\"app\">App</string>\n\n    <!-- Setting Dialog-->\n    <string name=\"select_core\">select core :</string>\n    <string name=\"clash_settings\">clash settings:</string>\n    <string name=\"find_procces\">find procces</string>\n    <string name=\"find_config\">find config</string>\n    <string name=\"clash_options\">clash options</string>\n    <string name=\"unified_delay\">unified delay[meta]</string>\n    <string name=\"sniffer\">sniffer[meta]</string>\n    <string name=\"redir_host\">redir-host[meta]</string>\n    <string name=\"geodata_meta\">geodata[meta]</string>\n    <string name=\"subscription\">subscription</string>\n    <string name=\"module_settings\">module settings:</string>\n    <string name=\"cgroup_settings\">cgroup:</string>\n    <string name=\"memcg\">memcg</string>\n    <string name=\"blkio\">blkio</string>\n    <string name=\"cpuset\">cpuset</string>\n    <string name=\"quic\">quic</string>\n    <string name=\"ipv6\">ipv6</string>\n    <string name=\"port_detect\">port detect</string>\n    <string name=\"crontab\">crontab</string>\n    <string name=\"geox\">geox</string>\n    <string name=\"networkmode\">NetworkMode</string>\n    <string name=\"proxymode\">ProxyMode</string>\n    <string name=\"check_module\">check module</string>\n    <string name=\"myip\">MyIP</string>\n    <string name=\"setting\">Setting</string>\n\n    <!--Setting Dialog-->\n    <string-array name=\"core_array\">\n        <item>clash</item>\n        <item>sing-box</item>\n        <item>xray</item>\n        <item>hysteria</item>\n        <item>v2fly</item>\n    </string-array>\n\n    <string-array name=\"proc_array\">\n        <item>off</item>\n        <item>strict</item>\n        <item>always</item>\n    </string-array>\n\n    <string-array name=\"conf_array\">\n        <item>default</item>\n        <item>config2</item>\n        <item>config3</item>\n    </string-array>\n\n    <string-array name=\"clash_core_array\">\n        <item>premium</item>\n        <item>mihomo</item>\n    </string-array>\n\n    <string-array name=\"network_array\">\n        <item>tproxy</item>\n        <item>redirect</item>\n        <item>enhance</item>\n        <item>mixed</item>\n        <item>tun</item>\n    </string-array>\n\n    <string-array name=\"proxy_array\">\n        <item>whitelist</item>\n        <item>blacklist</item>\n    </string-array>\n\n\n</resources>"
  },
  {
    "path": "app/src/main/res/values/styles.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n\n    <style name=\"MyCardView\" parent=\"@style/Widget.MaterialComponents.CardView\">\n        <item name=\"shapeAppearanceOverlay\">@style/ShapeAppearanceOverlay.MaterialCardView.Cut\n        </item>\n    </style>\n\n    <style name=\"ShapeAppearanceOverlay.MaterialCardView.Cut\" parent=\"\">\n        <item name=\"cornerFamily\">rounded</item>\n        <item name=\"cornerSizeTopRight\">8dp</item>\n        <item name=\"cornerSizeTopLeft\">8dp</item>\n        <item name=\"cornerSizeBottomLeft\">8dp</item>\n        <item name=\"cornerSizeBottomRight\">8dp</item>\n    </style>\n\n    <style name=\"ThemeOverlay.MaterialComponents.MaterialAlertDialog_background\" parent=\"@style/ThemeOverlay.MaterialComponents.MaterialAlertDialog\">\n        <item name=\"android:background\">@color/color_bg_dialog</item>\n        <!--        <item name=\"colorOnSurface\">@color/material_blue</item>-->\n        <item name=\"shapeAppearanceOverlay\">@style/DialogCorners</item>\n        <item name=\"buttonBarPositiveButtonStyle\">@style/PositiveButtonStyle</item>\n        <item name=\"buttonBarNegativeButtonStyle\">@style/PositiveButtonStyle</item>\n    </style>\n\n    <style name=\"PositiveButtonStyle\" parent=\"@style/Widget.MaterialComponents.Button\">\n        <item name=\"android:background\">@color/transparent</item>\n        <item name=\"android:textColor\">@color/material_blue</item>\n        <item name=\"backgroundTint\">@color/material_blue</item>\n    </style>\n\n    <style name=\"DialogCorners\">\n        <item name=\"cornerFamily\">rounded</item>\n        <item name=\"cornerSize\">16dp</item>\n    </style>\n\n</resources>"
  },
  {
    "path": "app/src/main/res/values/themes.xml",
    "content": "<resources>\n    <!-- Base application theme. -->\n    <style name=\"Base.Theme.BoxForRoot\" parent=\"Theme.MaterialComponents.DayNight.NoActionBar\">\n        <!-- Primary brand color. -->\n        <item name=\"colorPrimary\">@color/material_blue</item>\n        <item name=\"colorPrimaryVariant\">@color/material_blue</item>\n        <item name=\"colorOnPrimary\">@color/white</item>\n        <item name=\"bg\">@color/light_white</item>\n        <item name=\"boldText\">@color/black_bold_text</item>\n        <item name=\"regularText\">@color/black_regular_text</item>\n        <item name=\"appbar\">@color/light_white</item>\n        <item name=\"card\">@color/white</item>\n        <item name=\"appbarAttribute\">@color/material_blue</item>\n        <item name=\"hintText\">@color/black_hint_text</item>\n        <!-- Secondary brand color. -->\n        <item name=\"colorSecondary\">@color/material_blue</item>\n        <item name=\"colorSecondaryVariant\">@color/material_blue</item>\n        <item name=\"colorOnSecondary\">@color/material_blue</item>\n        <!-- Status bar color. -->\n        <item name=\"android:statusBarColor\">@color/light_white</item>\n        <item name=\"android:windowLightStatusBar\">true</item>\n        <!-- Customize your theme here. -->\n    </style>\n\n</resources>"
  },
  {
    "path": "app/src/main/res/values-night/colors.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n    <color name=\"black\">#000000</color>\n    <color name=\"bgdialog\">#0F2227</color>\n    <color name=\"color_bg_dialog\">@color/bgdialog</color>\n</resources>"
  },
  {
    "path": "app/src/main/res/values-night/themes.xml",
    "content": "<resources>\n    <!-- Base application theme. -->\n    <style name=\"Base.Theme.BoxForRoot\" parent=\"Theme.MaterialComponents.DayNight.NoActionBar\">\n        <!-- Primary brand color. -->\n        <item name=\"colorPrimary\">@color/material_blue</item>\n        <item name=\"colorPrimaryVariant\">@color/material_blue</item>\n        <item name=\"colorOnPrimary\">@color/light_dark</item>\n        <item name=\"bg\">@color/dark</item>\n        <item name=\"boldText\">@color/white_bold_text</item>\n        <item name=\"regularText\">@color/white_regular_text</item>\n        <item name=\"appbar\">@color/dark</item>\n        <item name=\"card\">@color/light_dark</item>\n        <item name=\"appbarAttribute\">@color/material_blue</item>\n        <item name=\"hintText\">@color/white_hint_text</item>\n        <!-- Secondary brand color. -->\n        <item name=\"colorSecondary\">@color/material_blue</item>\n        <item name=\"colorSecondaryVariant\">@color/material_blue</item>\n        <item name=\"colorOnSecondary\">@color/material_blue</item>\n        <!-- Status bar color. -->\n        <item name=\"android:statusBarColor\">@color/dark</item>\n        <item name=\"android:windowLightStatusBar\">false</item>\n        <!-- Customize your theme here. -->\n    </style>\n\n</resources>"
  },
  {
    "path": "app/src/main/res/xml/backup_rules.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?><!--\n   Sample backup rules file; uncomment and customize as necessary.\n   See https://developer.android.com/guide/topics/data/autobackup\n   for details.\n   Note: This file is ignored for devices older that API 31\n   See https://developer.android.com/about/versions/12/backup-restore\n-->\n<full-backup-content>\n    <!--\n   <include domain=\"sharedpref\" path=\".\"/>\n   <exclude domain=\"sharedpref\" path=\"device.xml\"/>\n-->\n</full-backup-content>"
  },
  {
    "path": "app/src/main/res/xml/data_extraction_rules.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?><!--\n   Sample data extraction rules file; uncomment and customize as necessary.\n   See https://developer.android.com/about/versions/12/backup-restore#xml-changes\n   for details.\n-->\n<data-extraction-rules>\n    <cloud-backup>\n        <!-- TODO: Use <include> and <exclude> to control what is backed up.\n        <include .../>\n        <exclude .../>\n        -->\n    </cloud-backup>\n    <!--\n    <device-transfer>\n        <include .../>\n        <exclude .../>\n    </device-transfer>\n    -->\n</data-extraction-rules>"
  },
  {
    "path": "app/src/main/res/xml/network_security_config.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<network-security-config>\n    <base-config cleartextTrafficPermitted=\"true\">\n        <trust-anchors>\n            <certificates src=\"system\" />\n        </trust-anchors>\n    </base-config>\n    <debug-overrides>\n        <trust-anchors>\n            <certificates src=\"system\" />\n            <certificates src=\"user\" />\n        </trust-anchors>\n    </debug-overrides>\n    <domain-config cleartextTrafficPermitted=\"true\">\n        <domain includeSubdomains=\"true\">127.0.0.1</domain>\n        <domain includeSubdomains=\"true\">0.0.0.0</domain>\n        <domain includeSubdomains=\"true\">ip-api.com</domain>\n    </domain-config>\n</network-security-config>"
  },
  {
    "path": "app/src/test/java/xyz/chz/bfm/ExampleUnitTest.kt",
    "content": "package xyz.chz.bfm\n\nimport org.junit.Assert.assertEquals\nimport org.junit.Test\n\n/**\n * Example local unit test, which will execute on the development machine (host).\n *\n * See [testing documentation](http://d.android.com/tools/testing).\n */\nclass ExampleUnitTest {\n    @Test\n    fun addition_isCorrect() {\n        assertEquals(4, 2 + 2)\n    }\n}"
  },
  {
    "path": "build.gradle",
    "content": "// Top-level build file where you can add configuration options common to all sub-projects/modules.\nbuildscript {\n    ext.kotlin_version = '1.8.0'\n    dependencies {\n        classpath 'com.google.dagger:hilt-android-gradle-plugin:2.43.2'\n        classpath 'androidx.navigation:navigation-safe-args-gradle-plugin:2.5.1'\n \tclasspath 'org.jetbrains.dokka:dokka-gradle-plugin:1.6.10'\n    }\n}\nplugins {\n    id 'com.android.application' version '7.4.2' apply false\n    id 'com.android.library' version '7.4.2' apply false\n    id 'org.jetbrains.kotlin.android' version '1.8.0' apply false\n}\ntask clean(type: Delete) {\n    delete rootProject.buildDir\n}"
  },
  {
    "path": "gradle/wrapper/gradle-wrapper.properties",
    "content": "distributionBase=GRADLE_USER_HOME\ndistributionPath=wrapper/dists\ndistributionUrl=https\\://services.gradle.org/distributions/gradle-7.5-bin.zip\nzipStoreBase=GRADLE_USER_HOME\nzipStorePath=wrapper/dists\n"
  },
  {
    "path": "gradle.properties",
    "content": "# Project-wide Gradle settings.\n# IDE (e.g. Android Studio) users:\n# Gradle settings configured through the IDE *will override*\n# any settings specified in this file.\n# For more details on how to configure your build environment visit\n# http://www.gradle.org/docs/current/userguide/build_environment.html\n# Specifies the JVM arguments used for the daemon process.\n# The setting is particularly useful for tweaking memory settings.\norg.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8\n# When configured, Gradle will run in incubating parallel mode.\n# This option should only be used with decoupled projects. More details, visit\n# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects\n# org.gradle.parallel=true\n# AndroidX package structure to make it clearer which packages are bundled with the\n# Android operating system, and which are packaged with your app's APK\n# https://developer.android.com/topic/libraries/support-library/androidx-rn\nandroid.useAndroidX=true\n# Kotlin code style for this project: \"official\" or \"obsolete\":\nkotlin.code.style=official\n# Enables namespacing of each library's R class so that its R class includes only the\n# resources declared in the library itself and none from the library's dependencies,\n# thereby reducing the size of the R class for that library\nandroid.nonTransitiveRClass=true"
  },
  {
    "path": "gradlew",
    "content": "#!/usr/bin/env sh\n\n#\n# Copyright 2015 the original author or authors.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#      https://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n##############################################################################\n##\n##  Gradle start up script for UN*X\n##\n##############################################################################\n\n# Attempt to set APP_HOME\n# Resolve links: $0 may be a link\nPRG=\"$0\"\n# Need this for relative symlinks.\nwhile [ -h \"$PRG\" ] ; do\n    ls=`ls -ld \"$PRG\"`\n    link=`expr \"$ls\" : '.*-> \\(.*\\)$'`\n    if expr \"$link\" : '/.*' > /dev/null; then\n        PRG=\"$link\"\n    else\n        PRG=`dirname \"$PRG\"`\"/$link\"\n    fi\ndone\nSAVED=\"`pwd`\"\ncd \"`dirname \\\"$PRG\\\"`/\" >/dev/null\nAPP_HOME=\"`pwd -P`\"\ncd \"$SAVED\" >/dev/null\n\nAPP_NAME=\"Gradle\"\nAPP_BASE_NAME=`basename \"$0\"`\n\n# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.\nDEFAULT_JVM_OPTS='\"-Xmx64m\" \"-Xms64m\"'\n\n# Use the maximum available, or set MAX_FD != -1 to use that value.\nMAX_FD=\"maximum\"\n\nwarn () {\n    echo \"$*\"\n}\n\ndie () {\n    echo\n    echo \"$*\"\n    echo\n    exit 1\n}\n\n# OS specific support (must be 'true' or 'false').\ncygwin=false\nmsys=false\ndarwin=false\nnonstop=false\ncase \"`uname`\" in\n  CYGWIN* )\n    cygwin=true\n    ;;\n  Darwin* )\n    darwin=true\n    ;;\n  MINGW* )\n    msys=true\n    ;;\n  NONSTOP* )\n    nonstop=true\n    ;;\nesac\n\nCLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar\n\n\n# Determine the Java command to use to start the JVM.\nif [ -n \"$JAVA_HOME\" ] ; then\n    if [ -x \"$JAVA_HOME/jre/sh/java\" ] ; then\n        # IBM's JDK on AIX uses strange locations for the executables\n        JAVACMD=\"$JAVA_HOME/jre/sh/java\"\n    else\n        JAVACMD=\"$JAVA_HOME/bin/java\"\n    fi\n    if [ ! -x \"$JAVACMD\" ] ; then\n        die \"ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME\n\nPlease set the JAVA_HOME variable in your environment to match the\nlocation of your Java installation.\"\n    fi\nelse\n    JAVACMD=\"java\"\n    which java >/dev/null 2>&1 || die \"ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.\n\nPlease set the JAVA_HOME variable in your environment to match the\nlocation of your Java installation.\"\nfi\n\n# Increase the maximum file descriptors if we can.\nif [ \"$cygwin\" = \"false\" -a \"$darwin\" = \"false\" -a \"$nonstop\" = \"false\" ] ; then\n    MAX_FD_LIMIT=`ulimit -H -n`\n    if [ $? -eq 0 ] ; then\n        if [ \"$MAX_FD\" = \"maximum\" -o \"$MAX_FD\" = \"max\" ] ; then\n            MAX_FD=\"$MAX_FD_LIMIT\"\n        fi\n        ulimit -n $MAX_FD\n        if [ $? -ne 0 ] ; then\n            warn \"Could not set maximum file descriptor limit: $MAX_FD\"\n        fi\n    else\n        warn \"Could not query maximum file descriptor limit: $MAX_FD_LIMIT\"\n    fi\nfi\n\n# For Darwin, add options to specify how the application appears in the dock\nif $darwin; then\n    GRADLE_OPTS=\"$GRADLE_OPTS \\\"-Xdock:name=$APP_NAME\\\" \\\"-Xdock:icon=$APP_HOME/media/gradle.icns\\\"\"\nfi\n\n# For Cygwin or MSYS, switch paths to Windows format before running java\nif [ \"$cygwin\" = \"true\" -o \"$msys\" = \"true\" ] ; then\n    APP_HOME=`cygpath --path --mixed \"$APP_HOME\"`\n    CLASSPATH=`cygpath --path --mixed \"$CLASSPATH\"`\n\n    JAVACMD=`cygpath --unix \"$JAVACMD\"`\n\n    # We build the pattern for arguments to be converted via cygpath\n    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`\n    SEP=\"\"\n    for dir in $ROOTDIRSRAW ; do\n        ROOTDIRS=\"$ROOTDIRS$SEP$dir\"\n        SEP=\"|\"\n    done\n    OURCYGPATTERN=\"(^($ROOTDIRS))\"\n    # Add a user-defined pattern to the cygpath arguments\n    if [ \"$GRADLE_CYGPATTERN\" != \"\" ] ; then\n        OURCYGPATTERN=\"$OURCYGPATTERN|($GRADLE_CYGPATTERN)\"\n    fi\n    # Now convert the arguments - kludge to limit ourselves to /bin/sh\n    i=0\n    for arg in \"$@\" ; do\n        CHECK=`echo \"$arg\"|egrep -c \"$OURCYGPATTERN\" -`\n        CHECK2=`echo \"$arg\"|egrep -c \"^-\"`                                 ### Determine if an option\n\n        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition\n            eval `echo args$i`=`cygpath --path --ignore --mixed \"$arg\"`\n        else\n            eval `echo args$i`=\"\\\"$arg\\\"\"\n        fi\n        i=`expr $i + 1`\n    done\n    case $i in\n        0) set -- ;;\n        1) set -- \"$args0\" ;;\n        2) set -- \"$args0\" \"$args1\" ;;\n        3) set -- \"$args0\" \"$args1\" \"$args2\" ;;\n        4) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" ;;\n        5) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" ;;\n        6) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" ;;\n        7) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" ;;\n        8) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" \"$args7\" ;;\n        9) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" \"$args7\" \"$args8\" ;;\n    esac\nfi\n\n# Escape application args\nsave () {\n    for i do printf %s\\\\n \"$i\" | sed \"s/'/'\\\\\\\\''/g;1s/^/'/;\\$s/\\$/' \\\\\\\\/\" ; done\n    echo \" \"\n}\nAPP_ARGS=`save \"$@\"`\n\n# Collect all arguments for the java command, following the shell quoting and substitution rules\neval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS \"\\\"-Dorg.gradle.appname=$APP_BASE_NAME\\\"\" -classpath \"\\\"$CLASSPATH\\\"\" org.gradle.wrapper.GradleWrapperMain \"$APP_ARGS\"\n\nexec \"$JAVACMD\" \"$@\"\n"
  },
  {
    "path": "gradlew.bat",
    "content": "@rem\n@rem Copyright 2015 the original author or authors.\n@rem\n@rem Licensed under the Apache License, Version 2.0 (the \"License\");\n@rem you may not use this file except in compliance with the License.\n@rem You may obtain a copy of the License at\n@rem\n@rem      https://www.apache.org/licenses/LICENSE-2.0\n@rem\n@rem Unless required by applicable law or agreed to in writing, software\n@rem distributed under the License is distributed on an \"AS IS\" BASIS,\n@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n@rem See the License for the specific language governing permissions and\n@rem limitations under the License.\n@rem\n\n@if \"%DEBUG%\" == \"\" @echo off\n@rem ##########################################################################\n@rem\n@rem  Gradle startup script for Windows\n@rem\n@rem ##########################################################################\n\n@rem Set local scope for the variables with windows NT shell\nif \"%OS%\"==\"Windows_NT\" setlocal\n\nset DIRNAME=%~dp0\nif \"%DIRNAME%\" == \"\" set DIRNAME=.\nset APP_BASE_NAME=%~n0\nset APP_HOME=%DIRNAME%\n\n@rem Resolve any \".\" and \"..\" in APP_HOME to make it shorter.\nfor %%i in (\"%APP_HOME%\") do set APP_HOME=%%~fi\n\n@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.\nset DEFAULT_JVM_OPTS=\"-Xmx64m\" \"-Xms64m\"\n\n@rem Find java.exe\nif defined JAVA_HOME goto findJavaFromJavaHome\n\nset JAVA_EXE=java.exe\n%JAVA_EXE% -version >NUL 2>&1\nif \"%ERRORLEVEL%\" == \"0\" goto execute\n\necho.\necho ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.\necho.\necho Please set the JAVA_HOME variable in your environment to match the\necho location of your Java installation.\n\ngoto fail\n\n:findJavaFromJavaHome\nset JAVA_HOME=%JAVA_HOME:\"=%\nset JAVA_EXE=%JAVA_HOME%/bin/java.exe\n\nif exist \"%JAVA_EXE%\" goto execute\n\necho.\necho ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%\necho.\necho Please set the JAVA_HOME variable in your environment to match the\necho location of your Java installation.\n\ngoto fail\n\n:execute\n@rem Setup the command line\n\nset CLASSPATH=%APP_HOME%\\gradle\\wrapper\\gradle-wrapper.jar\n\n\n@rem Execute Gradle\n\"%JAVA_EXE%\" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% \"-Dorg.gradle.appname=%APP_BASE_NAME%\" -classpath \"%CLASSPATH%\" org.gradle.wrapper.GradleWrapperMain %*\n\n:end\n@rem End local scope for the variables with windows NT shell\nif \"%ERRORLEVEL%\"==\"0\" goto mainEnd\n\n:fail\nrem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of\nrem the _cmd.exe /c_ return code!\nif  not \"\" == \"%GRADLE_EXIT_CONSOLE%\" exit 1\nexit /b 1\n\n:mainEnd\nif \"%OS%\"==\"Windows_NT\" endlocal\n\n:omega\n"
  },
  {
    "path": "ke/.gitignore",
    "content": "/build\n/libs"
  },
  {
    "path": "ke/build.gradle",
    "content": "apply plugin: 'com.android.library'\napply plugin: 'kotlin-android'\napply plugin: 'org.jetbrains.dokka'\n\n\nandroid {\n    compileSdkVersion 33\n\n    defaultConfig {\n        minSdkVersion 24\n        targetSdkVersion 33\n        testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'\n    }\n\n    buildTypes {\n        release {\n            minifyEnabled false\n            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'\n        }\n    }\n    compileOptions {\n        sourceCompatibility JavaVersion.VERSION_1_8\n        targetCompatibility JavaVersion.VERSION_1_8\n    }\n    kotlinOptions {\n        jvmTarget = '1.8'\n    }\n}\n\ndependencies {\n    implementation \"org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.8.0\"\n//    api 'org.jetbrains.kotlinx:kotlinx-coroutines-android:0.25.0'\n\n    implementation 'androidx.appcompat:appcompat:1.4.1'\n    implementation 'androidx.annotation:annotation:1.3.0'\n\n    // RxFlow\n    implementation \"io.github.reactivecircus.flowbinding:flowbinding-android:1.2.0\"\n    implementation 'androidx.core:core-ktx:1.9.0'\n    implementation 'com.google.android.material:material:1.9.0'\n\n    // Lifecycle\n    def lifecycle_version = \"2.4.1\"\n    implementation \"androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version\"\n\n    // Syntax Highlighting\n    api(\"com.github.markusressel.KodeHighlighter:core:v3.0.0\")\n\n    implementation \"org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2\"\n    implementation \"org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.2\"\n\n    // Zoom Layout Container\n    api 'com.otaliastudios:zoomlayout:1.9.0'\n\n    testImplementation 'junit:junit:4.13.2'\n    androidTestImplementation 'androidx.test.ext:junit:1.1.3'\n    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'\n}\n\nconfigurations.all {\n    resolutionStrategy.cacheChangingModulesFor 0, 'seconds'\n}\n\n// build a jar with source files\ntask sourcesJar(type: Jar) {\n    from android.sourceSets.main.java.srcDirs\n    classifier = 'sources'\n}\n\ntask dokkaJar(type: Jar, dependsOn: dokkaHtml) {\n    classifier = 'javadoc'\n    from dokkaHtml.outputDirectory\n}\n\ndokkaHtml.configure {\n    dokkaSourceSets {\n        named(\"main\") {\n            noAndroidSdkLink.set(false)\n        }\n    }\n}\n\nartifacts {\n    archives sourcesJar\n    archives dokkaJar\n}\n"
  },
  {
    "path": "ke/proguard-rules.pro",
    "content": "# Add project specific ProGuard rules here.\n# You can control the set of applied configuration files using the\n# proguardFiles setting in build.gradle.\n#\n# For more details, see\n#   http://developer.android.com/guide/developing/tools/proguard.html\n\n# If your project uses WebView with JS, uncomment the following\n# and specify the fully qualified class name to the JavaScript interface\n# class:\n#-keepclassmembers class fqcn.of.javascript.interface.for.webview {\n#   public *;\n#}\n\n# Uncomment this to preserve the line number information for\n# debugging stack traces.\n#-keepattributes SourceFile,LineNumberTable\n\n# If you keep the line number information, uncomment this to\n# hide the original source file name.\n#-renamesourcefileattribute SourceFile\n"
  },
  {
    "path": "ke/src/main/AndroidManifest.xml",
    "content": "<manifest package=\"de.markusressel.kodeeditor.library\" />\n"
  },
  {
    "path": "ke/src/main/java/de/markusressel/kodeeditor/library/extensions/Extensions.kt",
    "content": "package de.markusressel.kodeeditor.library.extensions\n\nimport android.content.Context\nimport android.content.res.TypedArray\nimport android.graphics.Bitmap\nimport android.graphics.Canvas\nimport android.graphics.Color\nimport android.graphics.drawable.Drawable\nimport android.util.TypedValue\nimport android.view.View\nimport androidx.annotation.AttrRes\nimport androidx.annotation.ColorInt\nimport androidx.annotation.StyleableRes\nimport androidx.core.content.ContextCompat\nimport androidx.core.view.ViewCompat\n\n/**\n * Get a color from this TypedArray or use the first default that is found\n *\n * @param context view context\n * @param defaultColor default if none of the styleable or attribute values was found\n * @param styleableRes styleable resource\n * @param attr theme attribute resource\n */\n@ColorInt\nfun TypedArray.getColor(context: Context, @ColorInt defaultColor: Int = Color.BLACK, @StyleableRes styleableRes: Int, @AttrRes vararg attr: Int): Int {\n    return getColor(styleableRes, attr.find { context.getThemeAttrColor(it) != null }\n            ?: defaultColor)\n}\n\n/**\n * Get Color from Theme attribute\n *\n * @param attr    Attribute resource ID\n * @return Color as Int\n */\n@ColorInt\nfun Context.getThemeAttrColor(@AttrRes attr: Int): Int? {\n    val typedValue = TypedValue()\n    if (theme.resolveAttribute(attr, typedValue, true)) {\n        if (typedValue.type >= TypedValue.TYPE_FIRST_INT && typedValue.type <= TypedValue.TYPE_LAST_INT) {\n            return typedValue.data\n        } else if (typedValue.type == TypedValue.TYPE_STRING) {\n            return ContextCompat.getColor(this, typedValue.resourceId)\n        }\n    }\n\n    return null\n}\n\n/**\n * Sets a view background without resetting it's padding\n *\n * @param background the background drawable to use (may be null)\n */\nfun View.setViewBackgroundWithoutResettingPadding(background: Drawable?) {\n    val paddingBottom = this.paddingBottom\n    val paddingStart = ViewCompat.getPaddingStart(this)\n    val paddingEnd = ViewCompat.getPaddingEnd(this)\n    val paddingTop = this.paddingTop\n    ViewCompat.setBackground(this, background)\n    ViewCompat.setPaddingRelative(this, paddingStart, paddingTop, paddingEnd, paddingBottom)\n}\n\n/**\n * Converts the given number to a px value assuming it is a dp value.\n *\n * @return px value\n */\nfun Number.dpToPx(context: Context): Float {\n    return TypedValue.applyDimension(\n            TypedValue.COMPLEX_UNIT_DIP,\n            this.toFloat(),\n            context.resources.displayMetrics)\n}\n\n/**\n * Renders a view to a bitmap\n *\n * @param dimensionLimit the maximum image dimension\n * @param backgroundColor background color in case the view doesn't have one\n * @return the rendered image or null if the view has no measured dimensions (yet)\n */\nfun View.createSnapshot(dimensionLimit: Number = 1F, backgroundColor: Int = Color.TRANSPARENT): Bitmap? {\n    if (measuredWidth == 0 || measuredHeight == 0) {\n        // the view has no dimensions so it can't be rendered\n        return null\n    }\n\n    val limitAsFloat = dimensionLimit.toFloat()\n\n    // select smaller scaling factor to match dimensionLimit\n    val scaleFactor = Math.min(\n            Math.min(\n                    limitAsFloat / measuredWidth,\n                    limitAsFloat / measuredHeight),\n            1F)\n\n    // Define a bitmap with the target dimensions\n    val returnedBitmap = Bitmap.createBitmap(\n            (this.measuredWidth * scaleFactor).toInt(),\n            (this.measuredHeight * scaleFactor).toInt(),\n            Bitmap.Config.ARGB_8888)\n\n    // bind a canvas to the bitmap\n    Canvas(returnedBitmap).apply {\n        scale(scaleFactor, scaleFactor)\n        drawColor(backgroundColor)\n        background?.draw(this)\n        draw(this)\n    }\n\n    return returnedBitmap\n}\n"
  },
  {
    "path": "ke/src/main/java/de/markusressel/kodeeditor/library/view/CodeEditText.kt",
    "content": "package de.markusressel.kodeeditor.library.view\n\nimport android.content.Context\nimport android.os.Build\nimport android.text.Layout\nimport android.util.AttributeSet\nimport android.util.Log\nimport androidx.appcompat.widget.AppCompatEditText\nimport de.markusressel.kodehighlighter.core.util.EditTextHighlighter\nimport kotlinx.coroutines.*\nimport kotlinx.coroutines.flow.catch\nimport kotlinx.coroutines.flow.debounce\nimport kotlinx.coroutines.flow.launchIn\nimport kotlinx.coroutines.flow.onEach\nimport reactivecircus.flowbinding.android.widget.textChanges\nimport java.util.concurrent.TimeUnit\n\n/**\n * EditText modified for longer texts and support for syntax highlighting\n */\nclass CodeEditText\n@JvmOverloads\nconstructor(context: Context,\n            attrs: AttributeSet? = null,\n            defStyleAttr: Int = 0)\n    : AppCompatEditText(context, attrs, defStyleAttr) {\n\n    /**\n     * The current syntax highlighter\n     */\n    var highlighter: EditTextHighlighter? = null\n        set(value) {\n            // clear any old style\n            field?.clearAppliedStyles()\n\n            // set new highlighter\n            field = value\n\n            // and initialize it\n            initSyntaxHighlighter()\n        }\n\n    /**\n     * Listener for selection changes\n     */\n    var selectionChangedListener: SelectionChangedListener? = null\n\n    private var highlightingTimeout = 50L to TimeUnit.MILLISECONDS\n    private var highlightingJob: Job? = null\n\n    init {\n        reInit()\n    }\n\n    private fun reInit() {\n        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {\n            hyphenationFrequency = Layout.HYPHENATION_FREQUENCY_NONE\n        }\n\n        initSyntaxHighlighter()\n        isClickable = true\n        isFocusableInTouchMode = true\n    }\n\n    @OptIn(FlowPreview::class)\n    private fun initSyntaxHighlighter() {\n        highlightingJob?.cancel(\"Reinitializing\")\n\n        highlighter?.let {\n            refreshSyntaxHighlighting()\n            highlightingJob = textChanges()\n                    .debounce(highlightingTimeout.second.toMillis(highlightingTimeout.first))\n                    .onEach {\n                        refreshSyntaxHighlighting()\n                    }\n                    .catch {\n                        Log.e(CodeTextView.TAG, \"Error while refreshing syntax highlighting\", it)\n                    }\n                    .launchIn(CoroutineScope(Job() + Dispatchers.Main))\n        }\n\n    }\n\n    override fun setText(text: CharSequence?, type: BufferType?) {\n        super.setText(text, type)\n        refreshSyntaxHighlighting()\n    }\n\n    /**\n     * Set the timeout before new text is highlighted after the user has stopped typing.\n     *\n     * @param timeout arbitrary value\n     * @param timeUnit the time unit to use\n     */\n    @Suppress(\"unused\")\n    fun setHighlightingTimeout(timeout: Long, timeUnit: TimeUnit) {\n        highlightingTimeout = timeout to timeUnit\n        reInit()\n    }\n\n    /**\n     * Get the current syntax highlighter timeout in milliseconds.\n     *\n     * @return timeout in milliseconds\n     */\n    @Suppress(\"unused\")\n    fun getHighlightingTimeout(): Long {\n        return highlightingTimeout.second.toMillis(highlightingTimeout.first)\n    }\n\n    /**\n     * Force a refresh of the syntax highlighting\n     */\n    @Synchronized\n    fun refreshSyntaxHighlighting() {\n        highlighter?.refreshHighlighting()\n                ?: Log.w(TAG, \"No syntax highlighter is set!\")\n    }\n\n    override fun onSelectionChanged(selStart: Int, selEnd: Int) {\n        super.onSelectionChanged(selStart, selEnd)\n        selectionChangedListener?.onSelectionChanged(selStart, selEnd, hasSelection())\n    }\n\n    companion object {\n        const val TAG = \"CodeEditText\"\n    }\n\n}"
  },
  {
    "path": "ke/src/main/java/de/markusressel/kodeeditor/library/view/CodeEditorLayout.kt",
    "content": "package de.markusressel.kodeeditor.library.view\n\nimport android.content.Context\nimport android.graphics.Color\nimport android.graphics.Matrix\nimport android.graphics.PointF\nimport android.graphics.Rect\nimport android.graphics.drawable.GradientDrawable\nimport android.os.Build\nimport android.text.Layout\nimport android.util.AttributeSet\nimport android.util.Log\nimport android.util.TypedValue\nimport android.view.*\nimport android.widget.FrameLayout\nimport android.widget.TextView\nimport androidx.annotation.ColorInt\nimport androidx.annotation.StringRes\nimport com.otaliastudios.zoom.*\nimport de.markusressel.kodeeditor.library.R\nimport de.markusressel.kodeeditor.library.extensions.createSnapshot\nimport de.markusressel.kodeeditor.library.extensions.dpToPx\nimport de.markusressel.kodeeditor.library.extensions.getColor\nimport de.markusressel.kodehighlighter.core.LanguageRuleBook\nimport kotlinx.coroutines.CoroutineScope\nimport kotlinx.coroutines.Dispatchers\nimport kotlinx.coroutines.Job\nimport kotlinx.coroutines.flow.catch\nimport kotlinx.coroutines.flow.debounce\nimport kotlinx.coroutines.flow.launchIn\nimport kotlinx.coroutines.flow.onEach\nimport reactivecircus.flowbinding.android.widget.textChanges\nimport kotlin.math.max\nimport kotlin.math.min\nimport kotlin.math.roundToInt\n\n\n/**\n * Code Editor that allows pinch-to-zoom, line numbers etc.\n */\nopen class CodeEditorLayout\n@JvmOverloads\nconstructor(\n        context: Context,\n        attrs: AttributeSet? = null,\n        defStyleAttr: Int = 0)\n    : FrameLayout(context, attrs, defStyleAttr) {\n\n    /**\n     * The ZoomLayout containing the [CodeEditText].\n     */\n    lateinit var codeEditorView: CodeEditorView\n\n    /**\n     * Indicates whether the engine has fully initialized\n     **/\n    private val isEngineInitialized: Boolean\n        get() = codeEditorView.engine.computeVerticalScrollRange() > 0\n                && codeEditorView.engine.computeHorizontalScrollRange() > 0\n\n    /**\n     * The view displaying line numbers.\n     * This is also a [ZoomLayout] so the line numbers can be scaled and panned according to the\n     * code editor's zoom and pan.\n     */\n    internal lateinit var lineNumberZoomLayout: ZoomLayout\n\n    /**\n     * The [TextView] with the actual line numbers as a multiline text.\n     */\n    internal lateinit var lineNumberTextView: TextView\n\n    /**\n     * Set how the lines number are generated based on total\n     * number of lines\n     */\n    var lineNumberGenerator: (Long) -> List<String> = { lines ->\n        (1..lines).map { \"$it$LINE_NUMBER_SUFFIX\" }\n    }\n\n    /**\n     * The container layout for the minimap.\n     */\n    internal lateinit var minimapContainerLayout: ViewGroup\n\n    /**\n     * The [ZoomLayout] used for the minimap.\n     */\n    internal lateinit var minimapZoomLayout: ZoomImageView\n\n    /**\n     * The rectangle on the minimap indicating the currently visible area.\n     */\n    internal lateinit var minimapIndicator: View\n\n    /**\n     * The (optional) divider between [lineNumberZoomLayout] and [codeEditorView]\n     */\n    internal lateinit var dividerView: View\n\n    /**\n     * Controls whether to follow cursor movements or not.\n     */\n    var isMoveWithCursorEnabled = true\n    private var internalMoveWithCursorEnabled = false\n\n    /**\n     * The currently set text\n     */\n    var text: String\n        set(value) {\n            codeEditorView.text = value\n        }\n        get() = codeEditorView.text\n\n    /**\n     * The currently active syntax highlighter (if any)\n     */\n    var languageRuleBook: LanguageRuleBook?\n        get() = codeEditorView.languageRuleBook\n        set(value) {\n            codeEditorView.languageRuleBook = value\n        }\n\n    /**\n     * Set the text in the editor\n     *\n     * @param text string resource of the new text\n     */\n    fun setText(@StringRes text: Int) {\n        this.text = context.getString(text)\n    }\n\n    /**\n     * Controls wheter the text is editable or not.\n     */\n    var editable: Boolean\n        set(value) {\n            codeEditorView.editable = value\n            updateMinimap()\n        }\n        get() = codeEditorView.editable\n\n    /**\n     * Controls whether the divider between line numbers and code editor is visible.\n     */\n    var showDivider: Boolean\n        set(value) {\n            dividerView.visibility = if (value) View.VISIBLE else View.GONE\n        }\n        get() = dividerView.visibility == View.VISIBLE\n\n    /**\n     * Indicates if the minimap should be shown or not.\n     */\n    var showMinimap = DEFAULT_SHOW_MINIMAP\n        set(value) {\n            field = value\n            minimapContainerLayout.visibility = if (value) View.VISIBLE else View.GONE\n            if (value) updateMinimap()\n        }\n\n    /**\n     * The width & height limit of the minimap\n     */\n    var minimapMaxDimension = DEFAULT_MINIMAP_MAX_DIMENSION_DP.dpToPx(context)\n        set(value) {\n            field = value\n            updateMinimap()\n        }\n\n    /**\n     * The width of the border around the minimap\n     */\n    var minimapBorderWidth: Number = DEFAULT_MINIMAP_BORDER_SIZE_DP.dpToPx(context)\n        set(value) {\n            field = value\n            updateMinimapBorder()\n        }\n\n    /**\n     * The color of the minimap border\n     */\n    @ColorInt\n    var minimapBorderColor: Int = 0\n        set(value) {\n            field = value\n\n            updateMinimapBorderColor(minimapBorderWidth.toFloat().roundToInt())\n        }\n\n    /**\n     * The color of the minimap indicator\n     */\n    @ColorInt\n    var minimapIndicatorColor: Int = 0\n        set(value) {\n            field = value\n\n            minimapIndicator.background = GradientDrawable().apply {\n                setStroke(2.dpToPx(context).roundToInt(), field)\n            }\n        }\n\n    /**\n     * The positioning gravity of the minimap\n     */\n    var minimapGravity: Int = Gravity.TOP or Gravity.END\n        set(value) {\n            field = value\n            (minimapContainerLayout.layoutParams as LayoutParams).gravity = field\n            minimapContainerLayout.requestLayout()\n        }\n\n    private var currentDrawnLineCount = -1L\n\n    /**\n     * Text size in SP\n     */\n    private var textSizeSp: Float = DEFAULT_TEXT_SIZE_SP\n\n    /**\n     * Text size in PX\n     */\n    private var textSizePx: Float\n        get() = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, textSizeSp, context.resources.displayMetrics)\n        set(value) {\n            textSizeSp = value / resources.displayMetrics.scaledDensity\n        }\n\n    @ColorInt\n    private var editorBackgroundColor: Int = 0\n\n    init {\n        inflateViews(LayoutInflater.from(context))\n        readParameters(attrs, defStyleAttr)\n        setListeners()\n    }\n\n    private fun inflateViews(layoutInflater: LayoutInflater) {\n        layoutInflater.inflate(R.layout.layout_code_editor__main_layout, this)\n\n        lineNumberZoomLayout = findViewById(R.id.cel_linenumbers_zoomLayout)\n        lineNumberTextView = findViewById(R.id.cel_linenumbers_textview)\n        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {\n            lineNumberTextView.hyphenationFrequency = Layout.HYPHENATION_FREQUENCY_NONE\n        }\n\n        dividerView = findViewById(R.id.cel_divider)\n        codeEditorView = findViewById(R.id.cel_codeEditorView)\n\n        minimapContainerLayout = findViewById(R.id.cel_minimap_container)\n        minimapZoomLayout = minimapContainerLayout.findViewById(R.id.cel_minimap)\n        minimapIndicator = minimapContainerLayout.findViewById(R.id.cel_minimap_indicator)\n    }\n\n    private fun readParameters(attrs: AttributeSet?, defStyleAttr: Int) {\n        val a = context.obtainStyledAttributes(attrs, R.styleable.CodeEditorLayout, defStyleAttr, 0)\n\n        val lineNumberTextColor = a.getColor(context,\n                defaultColor = Color.BLACK,\n                styleableRes = R.styleable.CodeEditorLayout_ke_lineNumbers_textColor,\n                attr = intArrayOf(R.attr.ke_lineNumbers_textColor,\n                        android.R.attr.textColorPrimary))\n        lineNumberTextView.setTextColor(lineNumberTextColor)\n\n        val lineNumberBackgroundColor = a.getColor(context,\n                defaultColor = Color.WHITE,\n                styleableRes = R.styleable.CodeEditorLayout_ke_lineNumbers_backgroundColor,\n                attr = intArrayOf(R.attr.ke_lineNumbers_backgroundColor,\n                        android.R.attr.windowBackground))\n        lineNumberZoomLayout.setBackgroundColor(lineNumberBackgroundColor)\n\n\n        showDivider = a.getBoolean(R.styleable.CodeEditorLayout_ke_divider_enabled, DEFAULT_SHOW_DIVIDER)\n\n        val dividerColor = a.getColor(context,\n                defaultColor = Color.BLACK,\n                styleableRes = R.styleable.CodeEditorLayout_ke_divider_color,\n                attr = intArrayOf(R.attr.ke_divider_color,\n                        android.R.attr.textColorPrimary))\n        dividerView.setBackgroundColor(dividerColor)\n\n        editorBackgroundColor = a.getColor(context,\n                defaultColor = Color.WHITE,\n                styleableRes = R.styleable.CodeEditorLayout_ke_editor_backgroundColor,\n                attr = intArrayOf(R.attr.ke_editor_backgroundColor,\n                        android.R.attr.windowBackground))\n        codeEditorView.setBackgroundColor(editorBackgroundColor)\n        isMoveWithCursorEnabled = a.getBoolean(R.styleable.CodeEditorLayout_ke_editor_followCursor, true)\n\n        val codeEditorMaxZoom = a.getFloat(R.styleable.CodeEditorLayout_ke_editor_maxZoom, CodeEditorView.DEFAULT_MAX_ZOOM)\n        lineNumberZoomLayout.setMaxZoom(codeEditorMaxZoom, ZoomApi.TYPE_REAL_ZOOM)\n        codeEditorView.setMaxZoom(codeEditorMaxZoom, ZoomApi.TYPE_REAL_ZOOM)\n\n        showMinimap = a.getBoolean(R.styleable.CodeEditorLayout_ke_minimap_enabled, DEFAULT_SHOW_MINIMAP)\n        minimapMaxDimension = a.getDimensionPixelSize(R.styleable.CodeEditorLayout_ke_minimap_maxDimension, DEFAULT_MINIMAP_MAX_DIMENSION_DP).toFloat()\n        minimapBorderColor = a.getColor(context,\n                defaultColor = Color.BLACK,\n                styleableRes = R.styleable.CodeEditorLayout_ke_minimap_borderColor,\n                attr = intArrayOf(R.attr.ke_minimap_borderColor))\n\n        minimapIndicatorColor = a.getColor(context,\n                defaultColor = Color.RED,\n                styleableRes = R.styleable.CodeEditorLayout_ke_minimap_indicatorColor,\n                attr = intArrayOf(R.attr.ke_minimap_indicatorColor))\n\n        a.recycle()\n    }\n\n    private fun setListeners() {\n        // add listener to code editor to keep linenumbers position and zoom in sync\n        codeEditorView.engine.addListener(object : ZoomEngine.Listener {\n            override fun onIdle(engine: ZoomEngine) {}\n\n            override fun onUpdate(engine: ZoomEngine, matrix: Matrix) {\n                if (!isEngineInitialized) return\n\n                val editorRect = calculateVisibleCodeArea()\n                updateLineNumbers(editorRect, updateLineCount = false)\n                updateMinimapIndicator(editorRect)\n            }\n        })\n\n        codeEditorView.addOnLayoutChangeListener { _, _, _, _, _, _, _, _, _ ->\n            if (!isEngineInitialized) return@addOnLayoutChangeListener\n            // linenumbers always have to be the exact same size as the content\n            lineNumberTextView.height = codeEditorView.engine.computeVerticalScrollRange()\n            updateLineNumbers()\n            updateMinimap()\n        }\n\n        @Suppress(\"ClickableViewAccessibility\")\n        minimapZoomLayout.setOnTouchListener { v, event ->\n            if (!showMinimap) return@setOnTouchListener false\n\n            when (event.action) {\n                MotionEvent.ACTION_DOWN or MotionEvent.ACTION_MOVE -> {\n                    val viewX = event.x - v.left\n                    val viewY = event.y - v.top\n                    val offsetX = minimapIndicator.width / 2F\n                    val offsetY = minimapIndicator.height / 2F\n                    val percentageX = (viewX - offsetX) / v.width\n                    val percentageY = (viewY - offsetY) / v.height\n\n                    moveEditorToPercentage(percentageX, percentageY)\n                    true\n                }\n                else -> false\n            }\n        }\n\n        setOnTouchListener { view, motionEvent ->\n            when (motionEvent.action) {\n                MotionEvent.ACTION_MOVE -> {\n                    internalMoveWithCursorEnabled = false\n                }\n            }\n            false\n        }\n\n        codeEditorView.codeEditText.setOnClickListener {\n            internalMoveWithCursorEnabled = true\n        }\n\n        codeEditorView.selectionChangedListener = object : SelectionChangedListener {\n            override fun onSelectionChanged(start: Int, end: Int, hasSelection: Boolean) {\n                if (!isMoveWithCursorEnabled) return\n\n                internalMoveWithCursorEnabled = true\n                try {\n                    moveToCursorIfNecessary()\n                } catch (e: Throwable) {\n                    Log.e(CodeEditorView.TAG, \"Error moving screen with cursor\", e)\n                }\n            }\n        }\n\n        codeEditorView.codeEditText.textChanges()\n                .debounce(50)\n                .onEach {\n                    try {\n                        updateLineNumbers()\n                    } catch (e: Throwable) {\n                        Log.e(CodeEditorView.TAG, \"Error updating line numbers\", e)\n                    }\n                }\n                .catch {\n                    Log.e(CodeEditorView.TAG, \"Unrecoverable error while updating line numbers\", it)\n                }.launchIn(CoroutineScope(Job() + Dispatchers.Main))\n    }\n\n    /**\n     * Helper function to move the editor content to a percentage based position\n     *\n     * @param percentageX x-axis percentage\n     * @param percentageY y-axis percentage\n     */\n    private fun moveEditorToPercentage(percentageX: Float, percentageY: Float) {\n        val targetX = -codeEditorView.engine.computeHorizontalScrollRange() / codeEditorView.engine.zoom * percentageX\n        val targetY = -codeEditorView.engine.computeVerticalScrollRange() / codeEditorView.engine.zoom * percentageY\n\n        codeEditorView.moveTo(codeEditorView.zoom, targetX, targetY, false)\n    }\n\n    /**\n     * Updates the minimap\n     */\n    private fun updateMinimap() {\n        if (!showMinimap) return\n        if (!isEngineInitialized) return\n\n        updateMinimapImage()\n        updateMinimapIndicator()\n    }\n\n    /**\n     * Renders the current text and applies it to the minimap\n     */\n    private fun updateMinimapImage() {\n        if (!showMinimap) return\n\n        val targetView: View = if (editable) codeEditorView.codeEditText else codeEditorView.codeTextView\n        targetView.apply {\n            post {\n                createSnapshot(\n                        dimensionLimit = minimapMaxDimension,\n                        backgroundColor = editorBackgroundColor\n                )?.let {\n                    minimapZoomLayout.setImageBitmap(it)\n                }\n            }\n        }\n    }\n\n    private fun updateMinimapBorder() {\n        if (!showMinimap) return\n\n        val valueAsInt = minimapBorderWidth.toFloat().roundToInt()\n        minimapContainerLayout.post {\n            minimapContainerLayout.setPadding(valueAsInt, valueAsInt, valueAsInt, valueAsInt)\n            updateMinimapBorderColor(valueAsInt)\n        }\n    }\n\n    private fun updateMinimapBorderColor(width: Int) {\n        minimapContainerLayout.post {\n            minimapContainerLayout.background = GradientDrawable().apply {\n                setStroke(width, minimapBorderColor)\n            }\n        }\n    }\n\n    /**\n     * Updates the minimap indicator position and size\n     *\n     * @param editorRect the dimensions of the [codeEditorView]\n     */\n    private fun updateMinimapIndicator(editorRect: Rect = calculateVisibleCodeArea()) {\n        if (!showMinimap) return\n\n        val engine = codeEditorView.engine\n\n        // update minimap indicator position and size\n        (minimapIndicator.layoutParams as MarginLayoutParams).apply {\n            topMargin = ((minimapZoomLayout.height *\n                    (engine.computeVerticalScrollOffset().toFloat() / engine.computeVerticalScrollRange()))).roundToInt()\n            leftMargin = ((minimapZoomLayout.width *\n                    (engine.computeHorizontalScrollOffset().toFloat() / engine.computeHorizontalScrollRange()))).roundToInt()\n\n            width = (minimapZoomLayout.width * (editorRect.width().toFloat() / engine.computeHorizontalScrollRange())).roundToInt()\n            height = (minimapZoomLayout.height * (editorRect.height().toFloat() / engine.computeVerticalScrollRange())).roundToInt()\n            minimapIndicator.layoutParams = this\n        }\n    }\n\n    /**\n     * Synchronizes zoom & position of [lineNumberTextView] with the [codeEditorView],\n     * and updates the line number text.\n     *\n     * @param updateLineCount true updates line numbers (this is quite expensive), false doesn't\n     */\n    private fun updateLineNumbers(editorRect: Rect = calculateVisibleCodeArea(),\n                                  updateLineCount: Boolean = true) {\n        if (updateLineCount) {\n            updateLineNumberText()\n        }\n\n        // adjust width of line numbers based on zoom\n        val engine = codeEditorView.engine\n\n        val scaledWidth = lineNumberTextView.width * engine.realZoom\n        val maxWidth = editorRect.width() / 3F\n        val targetWidth = min(scaledWidth, maxWidth).roundToInt()\n        lineNumberZoomLayout.layoutParams.apply {\n            width = targetWidth\n            lineNumberZoomLayout.layoutParams = this\n        }\n\n        // synchronize zoom and vertical pan to match code editor\n        lineNumberZoomLayout.moveTo(\n                engine.zoom,\n                -engine.computeHorizontalScrollRange().toFloat(),\n                engine.panY,\n                false)\n    }\n\n    /**\n     * Updates the text of the [lineNumberTextView] to match the line count in the [codeEditorView]\n     *\n     * @param lineCount the amount of lines to show\n     */\n    private fun updateLineNumberText(lineCount: Long = codeEditorView.getLineCount()) {\n        val linesToDraw = max(MIN_LINES_DRAWN, lineCount)\n        if (linesToDraw == currentDrawnLineCount) {\n            return\n        }\n\n        currentDrawnLineCount = linesToDraw\n        lineNumberTextView.text = createLineNumberText(linesToDraw)\n    }\n\n    /**\n     * Creates the text that is used on [lineNumberTextView] to show line numbers.\n     *\n     * @param lines the amount of lines\n     * @return the text to show for the given amount of lines\n     */\n    private fun createLineNumberText(lines: Long): String {\n        return lineNumberGenerator(lines).joinToString(separator = \"\\n\")\n    }\n\n    /**\n     * Moves the screen so that the cursor is visible.\n     */\n    private fun moveToCursorIfNecessary() {\n        val cursorPosition = getCursorScreenPosition() ?: return\n        val targetArea = calculateVisibleCodeArea()\n        val padding = (32 * codeEditorView.realZoom).toInt()\n        targetArea.inset(padding, padding)\n        targetArea.offset(0, -padding)\n\n        if (!targetArea.contains(cursorPosition.x.roundToInt(), cursorPosition.y.roundToInt())) {\n            val targetLocation = calculateTargetPoint(cursorPosition, targetArea)\n            codeEditorView.moveTo(codeEditorView.zoom, targetLocation.x, targetLocation.y, false)\n        }\n    }\n\n    /**\n     * Calculates the new top-left point to show the cursor on screen.\n     *\n     * @param cursorPosition the position of the cursor\n     * @param targetArea the target area the cursor position should be in\n     */\n    private fun calculateTargetPoint(cursorPosition: PointF, targetArea: Rect): AbsolutePoint {\n        val newX = when {\n            cursorPosition.x < targetArea.left -> {\n                codeEditorView.panX + (targetArea.left - cursorPosition.x) / codeEditorView.realZoom\n            }\n            cursorPosition.x > targetArea.right -> {\n                codeEditorView.panX + (targetArea.right - cursorPosition.x) / codeEditorView.realZoom\n            }\n            else -> codeEditorView.panX\n        }\n\n        val newY = when {\n            cursorPosition.y < targetArea.top -> {\n                codeEditorView.panY + (targetArea.top - cursorPosition.y) / codeEditorView.realZoom\n            }\n            cursorPosition.y > targetArea.bottom -> {\n                codeEditorView.panY + (targetArea.bottom - cursorPosition.y) / codeEditorView.realZoom\n            }\n            else -> codeEditorView.panY\n        }\n\n        return AbsolutePoint(newX, newY)\n    }\n\n    /**\n     * @return the currently visible area of the [codeEditorView]\n     */\n    private fun calculateVisibleCodeArea() = Rect().apply {\n        codeEditorView.getLocalVisibleRect(this)\n    }\n\n    /**\n     * @return the position of the cursor in relation to the [codeEditorView] content.\n     */\n    private fun getCursorScreenPosition(): PointF? {\n        val pos = codeEditorView.codeEditText.selectionStart\n        val layout = codeEditorView.codeEditText.layout ?: return null\n\n        val line = layout.getLineForOffset(pos)\n        val baseline = layout.getLineBaseline(line)\n        val ascent = layout.getLineAscent(line)\n        val x = layout.getPrimaryHorizontal(pos)\n        val y = (baseline + ascent).toFloat()\n\n        return PointF((x + codeEditorView.panX) * codeEditorView.realZoom,\n                (y + codeEditorView.panY) * codeEditorView.realZoom)\n    }\n\n    companion object {\n        const val MIN_LINES_DRAWN = 1L\n        const val DEFAULT_TEXT_SIZE_SP = 12F\n        const val LINE_NUMBER_SUFFIX = \":\"\n\n        const val DEFAULT_SHOW_DIVIDER = true\n        const val DEFAULT_SHOW_MINIMAP = true\n        const val DEFAULT_MINIMAP_MAX_DIMENSION_DP = 150\n        const val DEFAULT_MINIMAP_BORDER_SIZE_DP = 2\n    }\n\n}\n"
  },
  {
    "path": "ke/src/main/java/de/markusressel/kodeeditor/library/view/CodeEditorView.kt",
    "content": "package de.markusressel.kodeeditor.library.view\n\nimport android.content.Context\nimport android.graphics.Color\nimport android.util.AttributeSet\nimport android.view.LayoutInflater\nimport android.view.View\nimport android.widget.TextView\nimport androidx.annotation.CallSuper\nimport androidx.annotation.StringRes\nimport com.otaliastudios.zoom.ZoomApi\nimport com.otaliastudios.zoom.ZoomLayout\nimport de.markusressel.kodeeditor.library.R\nimport de.markusressel.kodeeditor.library.extensions.getColor\nimport de.markusressel.kodeeditor.library.extensions.setViewBackgroundWithoutResettingPadding\nimport de.markusressel.kodehighlighter.core.LanguageRuleBook\nimport de.markusressel.kodehighlighter.core.util.EditTextHighlighter\nimport de.markusressel.kodehighlighter.core.util.StatefulSpannableHighlighter\n\n/**\n * Code Editor that allows pinch-to-zoom\n */\nopen class CodeEditorView\n@JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0)\n    : ZoomLayout(context, attrs, defStyleAttr), SelectionChangedListener {\n\n    /**\n     * The actual text editor content\n     */\n    lateinit var codeEditText: CodeEditText\n\n    /**\n     * A text view for the non-editable state\n     */\n    lateinit var codeTextView: CodeTextView\n\n    /**\n     * The currently active syntax highlighter (if any)\n     */\n    var languageRuleBook: LanguageRuleBook?\n        get() = codeEditText.highlighter?.languageRuleBook\n        set(value) {\n            if (value != null) {\n                codeEditText.highlighter = EditTextHighlighter(codeEditText, value)\n                codeTextView.highlighter = StatefulSpannableHighlighter(value, value.defaultColorScheme)\n            } else {\n                codeEditText.highlighter = null\n                codeTextView.highlighter = null\n            }\n        }\n\n    /**\n     * Listener for selection changes\n     */\n    var selectionChangedListener: SelectionChangedListener? = null\n\n    /**\n     * The current text\n     */\n    var text: String\n        get() = codeEditText.text?.toString() ?: \"\"\n        set(value) {\n            codeEditText.setText(value)\n            codeTextView.text = value\n        }\n\n    /** The start index of the current selection */\n    val selectionStart: Int\n        get() {\n            val activeView: TextView = if (editable) codeEditText else codeTextView\n            return activeView.selectionStart\n        }\n\n    /** The end index of the current selection */\n    val selectionEnd: Int\n        get() {\n            val activeView: TextView = if (editable) codeEditText else codeTextView\n            return activeView.selectionEnd\n        }\n\n    /** True when a range is selected */\n    val hasSelection: Boolean\n        get() {\n            val activeView: TextView = if (editable) codeEditText else codeTextView\n            return activeView.hasSelection()\n        }\n\n    /**\n     * Set the text in the editor\n     *\n     * @param text string resource of the new text to set\n     */\n    @Suppress(\"unused\")\n    fun setText(@StringRes text: Int) {\n        this.text = context.getString(text)\n    }\n\n    /**\n     * Controls whether the text is editable\n     */\n    var editable: Boolean\n        get() = codeEditText.visibility == View.VISIBLE\n        set(value) {\n            if (value) {\n                codeEditText.visibility = View.VISIBLE\n                codeTextView.visibility = View.GONE\n            } else {\n                codeTextView.text = codeEditText.text\n                codeEditText.visibility = View.GONE\n                codeTextView.visibility = View.VISIBLE\n            }\n        }\n\n    init {\n        setHasClickableChildren(true)\n        isFocusableInTouchMode = true\n\n        inflateViews(LayoutInflater.from(context))\n        readParameters(attrs, defStyleAttr)\n\n        setListeners()\n    }\n\n    private fun readParameters(attrs: AttributeSet?, defStyleAttr: Int) {\n        val a = context.obtainStyledAttributes(attrs, R.styleable.CodeEditorView, defStyleAttr, 0)\n\n        val editTextBackgroundColor = a.getColor(context,\n                defaultColor = Color.WHITE,\n                styleableRes = R.styleable.CodeEditorView_ke_editor_backgroundColor,\n                attr = intArrayOf(R.attr.ke_editor_backgroundColor,\n                        android.R.attr.windowBackground))\n        codeEditText.setBackgroundColor(editTextBackgroundColor)\n\n        val maxRealZoom = a.getFloat(R.styleable.CodeEditorView_ke_editor_maxZoom, DEFAULT_MAX_ZOOM)\n        setMaxZoom(maxRealZoom, ZoomApi.TYPE_REAL_ZOOM)\n\n        a.recycle()\n    }\n\n    private fun inflateViews(inflater: LayoutInflater) {\n        inflater.inflate(R.layout.view_code_editor__inner_layout, this)\n\n        codeEditText = findViewById(R.id.cev_editor_codeEditText)\n        codeEditText.setViewBackgroundWithoutResettingPadding(null)\n        codeEditText.post {\n            codeEditText.setSelection(0)\n        }\n        codeEditText.selectionChangedListener = this\n\n        codeTextView = findViewById(R.id.cev_editor_codeTextView)\n        codeTextView.setViewBackgroundWithoutResettingPadding(null)\n        codeTextView.selectionChangedListener = this\n    }\n\n    private var firstInit = true\n\n    private fun setListeners() {\n        addOnLayoutChangeListener { v, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom ->\n            if (firstInit) {\n                firstInit = false\n\n                setMinimumDimensions()\n            }\n        }\n    }\n\n    /**\n     * Applies minimum dimensions for the [CodeEditText] and [CodeTextView] so that they always\n     * fill up the parent.\n     */\n    private fun setMinimumDimensions() {\n        val containerWidth = width - (paddingLeft + paddingRight)\n        val containerHeight = height - (paddingTop + paddingBottom)\n\n        val codeEditTextLayoutParams = (codeEditText.layoutParams as MarginLayoutParams)\n        val minimumWidth = containerWidth + (codeEditTextLayoutParams.leftMargin + codeEditTextLayoutParams.rightMargin)\n        val minimumHeight = containerHeight - (codeEditTextLayoutParams.topMargin + codeEditTextLayoutParams.bottomMargin)\n\n        codeEditText.minWidth = minimumWidth\n        codeTextView.minWidth = minimumWidth\n\n        codeEditText.minHeight = minimumHeight\n        codeTextView.minHeight = minimumHeight\n    }\n\n    /**\n     * @return the current count of lines of code in the editor.\n     */\n    fun getLineCount(): Long {\n        val currentText = codeEditText.text\n        return if (currentText != null) {\n            currentText.count { it == '\\n' } + 1L\n        } else {\n            0L\n        }\n    }\n\n    /**\n     * Called when the selection changes.\n     * Override this if you are interested in such events.\n     */\n    @CallSuper\n    override fun onSelectionChanged(start: Int, end: Int, hasSelection: Boolean) {\n        selectionChangedListener?.onSelectionChanged(start, end, hasSelection)\n    }\n\n    companion object {\n        const val TAG = \"CodeEditorView\"\n\n        const val DEFAULT_MAX_ZOOM = 10F\n    }\n\n}\n"
  },
  {
    "path": "ke/src/main/java/de/markusressel/kodeeditor/library/view/CodeTextView.kt",
    "content": "package de.markusressel.kodeeditor.library.view\n\nimport android.content.Context\nimport android.os.Build\nimport android.text.Layout\nimport android.text.Spannable\nimport android.text.SpannableString\nimport android.util.AttributeSet\nimport android.util.Log\nimport androidx.appcompat.widget.AppCompatTextView\nimport de.markusressel.kodehighlighter.core.util.StatefulSpannableHighlighter\nimport kotlinx.coroutines.*\nimport kotlinx.coroutines.flow.catch\nimport kotlinx.coroutines.flow.debounce\nimport kotlinx.coroutines.flow.launchIn\nimport kotlinx.coroutines.flow.onEach\nimport reactivecircus.flowbinding.android.widget.textChanges\nimport java.util.concurrent.TimeUnit\n\n/**\n * TextView modified for longer texts and support for syntax highlighting\n */\nclass CodeTextView\n@JvmOverloads\nconstructor(context: Context,\n            attrs: AttributeSet? = null,\n            defStyleAttr: Int = 0)\n    : AppCompatTextView(context, attrs, defStyleAttr) {\n\n    /**\n     * The current syntax highlighter\n     */\n    var highlighter: StatefulSpannableHighlighter? = null\n        set(value) {\n            // clear any old style\n            field?.clearAppliedStyles(text as Spannable)\n\n            // set new highlighter\n            field = value\n\n            // and initialize it\n            initSyntaxHighlighter()\n        }\n\n    /**\n     * Listener for selection changes\n     */\n    var selectionChangedListener: SelectionChangedListener? = null\n\n    private var highlightingTimeout = 50L to TimeUnit.MILLISECONDS\n    private var highlightingJob: Job? = null\n\n    init {\n        CoroutineScope(Job() + Dispatchers.Main).launch {\n            reInit()\n        }\n    }\n\n    private fun reInit() {\n        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {\n            hyphenationFrequency = Layout.HYPHENATION_FREQUENCY_NONE\n        }\n\n        initSyntaxHighlighter()\n    }\n\n    @OptIn(FlowPreview::class)\n    private fun initSyntaxHighlighter() {\n        highlightingJob?.cancel(\"Reinitializing\")\n\n        if (highlighter != null) {\n            CoroutineScope(Dispatchers.Main).launch {\n                refreshSyntaxHighlighting()\n            }\n\n            highlightingJob = textChanges()\n                    .debounce(highlightingTimeout.second.toMillis(highlightingTimeout.first))\n                    .onEach {\n                        refreshSyntaxHighlighting()\n                    }\n                    .catch {\n                        Log.e(TAG, \"Error while refreshing syntax highlighting\", it)\n                    }\n                    .launchIn(CoroutineScope(Job() + Dispatchers.Main))\n        }\n    }\n\n    override fun setText(text: CharSequence?, type: BufferType?) {\n        super.setText(SpannableString.valueOf(text), BufferType.SPANNABLE)\n        CoroutineScope(Job() + Dispatchers.Default).launch {\n            refreshSyntaxHighlighting()\n        }\n    }\n\n    /**\n     * Set the timeout before new text is highlighted after the user has stopped typing.\n     *\n     * @param timeout arbitrary value\n     * @param timeUnit the time unit to use\n     */\n    @Suppress(\"unused\")\n    fun setHighlightingTimeout(timeout: Long, timeUnit: TimeUnit) {\n        highlightingTimeout = timeout to timeUnit\n        reInit()\n    }\n\n    /**\n     * Get the current syntax highlighter timeout in milliseconds.\n     *\n     * @return timeout in milliseconds\n     */\n    @Suppress(\"unused\")\n    fun getHighlightingTimeout(): Long {\n        return highlightingTimeout.second.toMillis(highlightingTimeout.first)\n    }\n\n    /**\n     * Force a refresh of the syntax highlighting\n     */\n    @Synchronized\n    fun refreshSyntaxHighlighting() {\n        if (highlighter == null) {\n            Log.w(TAG, \"No syntax highlighter is set!\")\n        }\n\n        highlighter?.apply {\n            CoroutineScope(Dispatchers.Main).launch {\n                highlight(text as Spannable)\n            }\n        }\n    }\n\n    override fun onSelectionChanged(selStart: Int, selEnd: Int) {\n        super.onSelectionChanged(selStart, selEnd)\n        selectionChangedListener?.onSelectionChanged(selStart, selEnd, hasSelection())\n    }\n\n    companion object {\n        const val TAG = \"CodeTextView\"\n    }\n\n}"
  },
  {
    "path": "ke/src/main/java/de/markusressel/kodeeditor/library/view/SelectionChangedListener.kt",
    "content": "package de.markusressel.kodeeditor.library.view\n\n/**\n * Interface for a listener of selection changes\n */\ninterface SelectionChangedListener {\n\n    /**\n     * Called when the selection changes\n     *\n     * @param start selection start index\n     * @param end selection end index\n     * @param hasSelection true when a range is selected (start != end)\n     */\n    fun onSelectionChanged(start: Int, end: Int, hasSelection: Boolean)\n\n}"
  },
  {
    "path": "ke/src/main/res/drawable/ic_launcher_background.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:width=\"108dp\"\n    android:height=\"108dp\"\n    android:viewportWidth=\"108\"\n    android:viewportHeight=\"108\">\n    <path\n        android:fillColor=\"#3DDC84\"\n        android:pathData=\"M0,0h108v108h-108z\" />\n    <path\n        android:fillColor=\"#00000000\"\n        android:pathData=\"M9,0L9,108\"\n        android:strokeWidth=\"0.8\"\n        android:strokeColor=\"#33FFFFFF\" />\n    <path\n        android:fillColor=\"#00000000\"\n        android:pathData=\"M19,0L19,108\"\n        android:strokeWidth=\"0.8\"\n        android:strokeColor=\"#33FFFFFF\" />\n    <path\n        android:fillColor=\"#00000000\"\n        android:pathData=\"M29,0L29,108\"\n        android:strokeWidth=\"0.8\"\n        android:strokeColor=\"#33FFFFFF\" />\n    <path\n        android:fillColor=\"#00000000\"\n        android:pathData=\"M39,0L39,108\"\n        android:strokeWidth=\"0.8\"\n        android:strokeColor=\"#33FFFFFF\" />\n    <path\n        android:fillColor=\"#00000000\"\n        android:pathData=\"M49,0L49,108\"\n        android:strokeWidth=\"0.8\"\n        android:strokeColor=\"#33FFFFFF\" />\n    <path\n        android:fillColor=\"#00000000\"\n        android:pathData=\"M59,0L59,108\"\n        android:strokeWidth=\"0.8\"\n        android:strokeColor=\"#33FFFFFF\" />\n    <path\n        android:fillColor=\"#00000000\"\n        android:pathData=\"M69,0L69,108\"\n        android:strokeWidth=\"0.8\"\n        android:strokeColor=\"#33FFFFFF\" />\n    <path\n        android:fillColor=\"#00000000\"\n        android:pathData=\"M79,0L79,108\"\n        android:strokeWidth=\"0.8\"\n        android:strokeColor=\"#33FFFFFF\" />\n    <path\n        android:fillColor=\"#00000000\"\n        android:pathData=\"M89,0L89,108\"\n        android:strokeWidth=\"0.8\"\n        android:strokeColor=\"#33FFFFFF\" />\n    <path\n        android:fillColor=\"#00000000\"\n        android:pathData=\"M99,0L99,108\"\n        android:strokeWidth=\"0.8\"\n        android:strokeColor=\"#33FFFFFF\" />\n    <path\n        android:fillColor=\"#00000000\"\n        android:pathData=\"M0,9L108,9\"\n        android:strokeWidth=\"0.8\"\n        android:strokeColor=\"#33FFFFFF\" />\n    <path\n        android:fillColor=\"#00000000\"\n        android:pathData=\"M0,19L108,19\"\n        android:strokeWidth=\"0.8\"\n        android:strokeColor=\"#33FFFFFF\" />\n    <path\n        android:fillColor=\"#00000000\"\n        android:pathData=\"M0,29L108,29\"\n        android:strokeWidth=\"0.8\"\n        android:strokeColor=\"#33FFFFFF\" />\n    <path\n        android:fillColor=\"#00000000\"\n        android:pathData=\"M0,39L108,39\"\n        android:strokeWidth=\"0.8\"\n        android:strokeColor=\"#33FFFFFF\" />\n    <path\n        android:fillColor=\"#00000000\"\n        android:pathData=\"M0,49L108,49\"\n        android:strokeWidth=\"0.8\"\n        android:strokeColor=\"#33FFFFFF\" />\n    <path\n        android:fillColor=\"#00000000\"\n        android:pathData=\"M0,59L108,59\"\n        android:strokeWidth=\"0.8\"\n        android:strokeColor=\"#33FFFFFF\" />\n    <path\n        android:fillColor=\"#00000000\"\n        android:pathData=\"M0,69L108,69\"\n        android:strokeWidth=\"0.8\"\n        android:strokeColor=\"#33FFFFFF\" />\n    <path\n        android:fillColor=\"#00000000\"\n        android:pathData=\"M0,79L108,79\"\n        android:strokeWidth=\"0.8\"\n        android:strokeColor=\"#33FFFFFF\" />\n    <path\n        android:fillColor=\"#00000000\"\n        android:pathData=\"M0,89L108,89\"\n        android:strokeWidth=\"0.8\"\n        android:strokeColor=\"#33FFFFFF\" />\n    <path\n        android:fillColor=\"#00000000\"\n        android:pathData=\"M0,99L108,99\"\n        android:strokeWidth=\"0.8\"\n        android:strokeColor=\"#33FFFFFF\" />\n    <path\n        android:fillColor=\"#00000000\"\n        android:pathData=\"M19,29L89,29\"\n        android:strokeWidth=\"0.8\"\n        android:strokeColor=\"#33FFFFFF\" />\n    <path\n        android:fillColor=\"#00000000\"\n        android:pathData=\"M19,39L89,39\"\n        android:strokeWidth=\"0.8\"\n        android:strokeColor=\"#33FFFFFF\" />\n    <path\n        android:fillColor=\"#00000000\"\n        android:pathData=\"M19,49L89,49\"\n        android:strokeWidth=\"0.8\"\n        android:strokeColor=\"#33FFFFFF\" />\n    <path\n        android:fillColor=\"#00000000\"\n        android:pathData=\"M19,59L89,59\"\n        android:strokeWidth=\"0.8\"\n        android:strokeColor=\"#33FFFFFF\" />\n    <path\n        android:fillColor=\"#00000000\"\n        android:pathData=\"M19,69L89,69\"\n        android:strokeWidth=\"0.8\"\n        android:strokeColor=\"#33FFFFFF\" />\n    <path\n        android:fillColor=\"#00000000\"\n        android:pathData=\"M19,79L89,79\"\n        android:strokeWidth=\"0.8\"\n        android:strokeColor=\"#33FFFFFF\" />\n    <path\n        android:fillColor=\"#00000000\"\n        android:pathData=\"M29,19L29,89\"\n        android:strokeWidth=\"0.8\"\n        android:strokeColor=\"#33FFFFFF\" />\n    <path\n        android:fillColor=\"#00000000\"\n        android:pathData=\"M39,19L39,89\"\n        android:strokeWidth=\"0.8\"\n        android:strokeColor=\"#33FFFFFF\" />\n    <path\n        android:fillColor=\"#00000000\"\n        android:pathData=\"M49,19L49,89\"\n        android:strokeWidth=\"0.8\"\n        android:strokeColor=\"#33FFFFFF\" />\n    <path\n        android:fillColor=\"#00000000\"\n        android:pathData=\"M59,19L59,89\"\n        android:strokeWidth=\"0.8\"\n        android:strokeColor=\"#33FFFFFF\" />\n    <path\n        android:fillColor=\"#00000000\"\n        android:pathData=\"M69,19L69,89\"\n        android:strokeWidth=\"0.8\"\n        android:strokeColor=\"#33FFFFFF\" />\n    <path\n        android:fillColor=\"#00000000\"\n        android:pathData=\"M79,19L79,89\"\n        android:strokeWidth=\"0.8\"\n        android:strokeColor=\"#33FFFFFF\" />\n</vector>\n"
  },
  {
    "path": "ke/src/main/res/drawable/ic_launcher_foreground.xml",
    "content": "<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:aapt=\"http://schemas.android.com/aapt\"\n    android:width=\"108dp\"\n    android:height=\"108dp\"\n    android:viewportWidth=\"108\"\n    android:viewportHeight=\"108\">\n    <path android:pathData=\"M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z\">\n        <aapt:attr name=\"android:fillColor\">\n            <gradient\n                android:endX=\"85.84757\"\n                android:endY=\"92.4963\"\n                android:startX=\"42.9492\"\n                android:startY=\"49.59793\"\n                android:type=\"linear\">\n                <item\n                    android:color=\"#44000000\"\n                    android:offset=\"0.0\" />\n                <item\n                    android:color=\"#00000000\"\n                    android:offset=\"1.0\" />\n            </gradient>\n        </aapt:attr>\n    </path>\n    <path\n        android:fillColor=\"#FFFFFF\"\n        android:fillType=\"nonZero\"\n        android:pathData=\"M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z\"\n        android:strokeWidth=\"1\"\n        android:strokeColor=\"#00000000\" />\n</vector>"
  },
  {
    "path": "ke/src/main/res/layout/layout_code_editor__main_layout.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    android:orientation=\"horizontal\">\n\n    <include layout=\"@layout/view_code_editor__linenumbers\" />\n\n    <include layout=\"@layout/view_code_editor__divider\" />\n\n    <FrameLayout\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\">\n\n        <de.markusressel.kodeeditor.library.view.CodeEditorView\n            android:id=\"@+id/cel_codeEditorView\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"match_parent\"\n            android:scrollbars=\"horizontal|vertical\"\n            app:alignment=\"left|top\"\n            app:hasClickableChildren=\"true\"\n            app:maxZoom=\"30.0\"\n            app:maxZoomType=\"realZoom\"\n            app:minZoom=\"1\"\n            app:minZoomType=\"realZoom\"\n            app:overPinchable=\"false\"\n            app:overScrollHorizontal=\"false\"\n            app:overScrollVertical=\"false\"\n            app:transformation=\"none\"\n            app:transformationGravity=\"top|left\" />\n\n        <include layout=\"@layout/view_code_editor__minimap\" />\n\n    </FrameLayout>\n\n</LinearLayout>"
  },
  {
    "path": "ke/src/main/res/layout/view_code_editor__divider.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<View xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:id=\"@+id/cel_divider\"\n    android:layout_width=\"1dp\"\n    android:layout_height=\"match_parent\" />"
  },
  {
    "path": "ke/src/main/res/layout/view_code_editor__inner_layout.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<FrameLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:id=\"@+id/cev_editor_contentLayout\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    android:orientation=\"vertical\">\n\n    <de.markusressel.kodeeditor.library.view.CodeEditText\n        android:id=\"@+id/cev_editor_codeEditText\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:layout_margin=\"@dimen/cev_editor_text_margin\"\n        android:editable=\"true\"\n        android:focusableInTouchMode=\"true\"\n        android:gravity=\"top|start\"\n        android:imeOptions=\"flagNoExtractUi\"\n        android:inputType=\"textMultiLine|textNoSuggestions\"\n        android:maxLength=\"99999999\"\n        android:maxLines=\"99999999\"\n        android:scrollbars=\"none\"\n        android:scrollHorizontally=\"false\"\n        android:textSize=\"@dimen/cev_editor_text_size\"\n        android:typeface=\"monospace\"\n        android:visibility=\"visible\" />\n\n    <de.markusressel.kodeeditor.library.view.CodeTextView\n        android:id=\"@+id/cev_editor_codeTextView\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:layout_margin=\"@dimen/cev_editor_text_margin\"\n        android:scrollbars=\"none\"\n        android:textIsSelectable=\"true\"\n        android:textSize=\"@dimen/cev_editor_text_size\"\n        android:typeface=\"monospace\"\n        android:visibility=\"gone\" />\n\n</FrameLayout>"
  },
  {
    "path": "ke/src/main/res/layout/view_code_editor__linenumbers.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<com.otaliastudios.zoom.ZoomLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    android:id=\"@+id/cel_linenumbers_zoomLayout\"\n    android:layout_width=\"@dimen/cev_linenumber_width\"\n    android:layout_height=\"match_parent\"\n    android:scrollbars=\"none\"\n    app:alignment=\"top|right\"\n    app:hasClickableChildren=\"false\"\n    app:horizontalPanEnabled=\"false\"\n    app:transformation=\"none\"\n    app:transformationGravity=\"top|right\"\n    app:verticalPanEnabled=\"false\"\n    app:zoomEnabled=\"false\">\n\n    <TextView\n        android:id=\"@+id/cel_linenumbers_textview\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\"\n        android:layout_marginTop=\"4dp\"\n        android:layout_marginBottom=\"4dp\"\n        android:gravity=\"end|top\"\n        android:textSize=\"@dimen/cev_editor_text_size\"\n        android:typeface=\"monospace\" />\n\n</com.otaliastudios.zoom.ZoomLayout>"
  },
  {
    "path": "ke/src/main/res/layout/view_code_editor__minimap.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<FrameLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    android:id=\"@+id/cel_minimap_container\"\n    android:layout_width=\"wrap_content\"\n    android:layout_height=\"wrap_content\"\n    android:layout_gravity=\"top|end\"\n    android:layout_margin=\"16dp\">\n\n    <com.otaliastudios.zoom.ZoomImageView\n        android:id=\"@+id/cel_minimap\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:scrollbars=\"none\"\n        app:alignment=\"left|top\"\n        app:hasClickableChildren=\"true\"\n        app:maxZoom=\"30.0\"\n        app:maxZoomType=\"realZoom\"\n        app:minZoom=\"1\"\n        app:minZoomType=\"realZoom\"\n        app:overPinchable=\"false\"\n        app:overScrollHorizontal=\"false\"\n        app:overScrollVertical=\"false\"\n        app:transformation=\"none\"\n        app:transformationGravity=\"top|left\" />\n\n    <View\n        android:id=\"@+id/cel_minimap_indicator\"\n        android:layout_width=\"1dp\"\n        android:layout_height=\"1dp\" />\n\n</FrameLayout>"
  },
  {
    "path": "ke/src/main/res/mipmap-anydpi-v26/ic_launcher.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<adaptive-icon xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <background android:drawable=\"@drawable/ic_launcher_background\" />\n    <foreground android:drawable=\"@drawable/ic_launcher_foreground\" />\n    <monochrome android:drawable=\"@drawable/ic_launcher_foreground\" />\n</adaptive-icon>"
  },
  {
    "path": "ke/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<adaptive-icon xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <background android:drawable=\"@drawable/ic_launcher_background\" />\n    <foreground android:drawable=\"@drawable/ic_launcher_foreground\" />\n    <monochrome android:drawable=\"@drawable/ic_launcher_foreground\" />\n</adaptive-icon>"
  },
  {
    "path": "ke/src/main/res/values/attributes.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n\n    <attr name=\"ke_editor_backgroundColor\" format=\"reference|color\" />\n    <attr name=\"ke_editor_maxZoom\" format=\"float\" />\n\n    <declare-styleable name=\"CodeEditorLayout\">\n        <attr name=\"ke_lineNumbers_textColor\" format=\"reference|color\" />\n        <attr name=\"ke_lineNumbers_backgroundColor\" format=\"reference|color\" />\n        <attr name=\"ke_divider_enabled\" format=\"boolean\" />\n        <attr name=\"ke_divider_color\" format=\"reference|color\" />\n\n        <attr name=\"ke_editor_backgroundColor\" />\n        <attr name=\"ke_editor_maxZoom\" />\n        <attr name=\"ke_editor_followCursor\" format=\"boolean\" />\n\n        <attr name=\"ke_minimap_enabled\" format=\"boolean\" />\n        <attr name=\"ke_minimap_maxDimension\" format=\"dimension\" />\n        <attr name=\"ke_minimap_borderColor\" format=\"reference|color\" />\n        <attr name=\"ke_minimap_indicatorColor\" format=\"reference|color\" />\n    </declare-styleable>\n\n    <declare-styleable name=\"CodeEditorView\">\n        <attr name=\"ke_editor_backgroundColor\" />\n        <attr name=\"ke_editor_maxZoom\" />\n    </declare-styleable>\n\n</resources>"
  },
  {
    "path": "ke/src/main/res/values/colors.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n    <color name=\"purple_200\">#FFBB86FC</color>\n    <color name=\"purple_500\">#FF6200EE</color>\n    <color name=\"purple_700\">#FF3700B3</color>\n    <color name=\"teal_200\">#FF03DAC5</color>\n    <color name=\"teal_700\">#FF018786</color>\n    <color name=\"black\">#FF000000</color>\n    <color name=\"white\">#FFFFFFFF</color>\n</resources>"
  },
  {
    "path": "ke/src/main/res/values/dimens.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n    <dimen name=\"cev_linenumber_width\">36dp</dimen>\n    <dimen name=\"cev_editor_text_margin\">4dp</dimen>\n    <dimen name=\"cev_editor_text_size\">16sp</dimen>\n</resources>"
  },
  {
    "path": "ke/src/main/res/values/library_kodeeditor_strings.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<resources>\n    <string name=\"define_kodeeditor\"></string>\n    <!-- Author section -->\n    <string name=\"library_kodeeditor_author\">Markus Ressel</string>\n    <string name=\"library_kodeeditor_authorWebsite\">http://markusressel.de</string>\n    <!-- Library section -->\n    <string name=\"library_kodeeditor_libraryName\">KodeEditor</string>\n    <string name=\"library_kodeeditor_libraryDescription\">A simple code editor with syntax highlighting and pinch to zoom</string>\n    <string name=\"library_kodeeditor_libraryWebsite\">@string/library_kodeeditor_repositoryLink</string>\n    <string name=\"library_kodeeditor_libraryVersion\">2.1.1</string>\n    <!-- OpenSource section -->\n    <string name=\"library_kodeeditor_isOpenSource\">true</string>\n    <string name=\"library_kodeeditor_repositoryLink\">https://github.com/markusressel/KodeEditor</string>\n    <!-- ClassPath for autoDetect section -->\n    <string name=\"library_kodeeditor_classPath\">de.markusressel.kodeeditor</string>\n    <!-- License section -->\n    <string name=\"library_kodeeditor_licenseId\">mit</string>\n    <!-- Custom variables section -->\n</resources>\n"
  },
  {
    "path": "ke/src/main/res/values/strings.xml",
    "content": "<resources>\n    <string name=\"app_name\">KodeEditor</string>\n</resources>"
  },
  {
    "path": "ke/src/main/res/values/themes.xml",
    "content": "<resources xmlns:tools=\"http://schemas.android.com/tools\">\n    <!-- Base application theme. -->\n    <style name=\"Theme.BoxForRoot\" parent=\"Theme.MaterialComponents.DayNight.DarkActionBar\">\n        <!-- Primary brand color. -->\n        <item name=\"colorPrimary\">@color/purple_500</item>\n        <item name=\"colorPrimaryVariant\">@color/purple_700</item>\n        <item name=\"colorOnPrimary\">@color/white</item>\n        <!-- Secondary brand color. -->\n        <item name=\"colorSecondary\">@color/teal_200</item>\n        <item name=\"colorSecondaryVariant\">@color/teal_700</item>\n        <item name=\"colorOnSecondary\">@color/black</item>\n        <!-- Status bar color. -->\n        <item name=\"android:statusBarColor\">?attr/colorPrimaryVariant</item>\n        <!-- Customize your theme here. -->\n    </style>\n</resources>"
  },
  {
    "path": "ke/src/main/res/values-night/themes.xml",
    "content": "<resources xmlns:tools=\"http://schemas.android.com/tools\">\n    <!-- Base application theme. -->\n    <style name=\"Theme.BoxForRoot\" parent=\"Theme.MaterialComponents.DayNight.DarkActionBar\">\n        <!-- Primary brand color. -->\n        <item name=\"colorPrimary\">@color/purple_200</item>\n        <item name=\"colorPrimaryVariant\">@color/purple_700</item>\n        <item name=\"colorOnPrimary\">@color/black</item>\n        <!-- Secondary brand color. -->\n        <item name=\"colorSecondary\">@color/teal_200</item>\n        <item name=\"colorSecondaryVariant\">@color/teal_200</item>\n        <item name=\"colorOnSecondary\">@color/black</item>\n        <!-- Status bar color. -->\n        <item name=\"android:statusBarColor\">?attr/colorPrimaryVariant</item>\n        <!-- Customize your theme here. -->\n    </style>\n</resources>"
  },
  {
    "path": "settings.gradle",
    "content": "pluginManagement {\n    repositories {\n        google()\n        mavenCentral()\n        gradlePluginPortal()\n    }\n}\ndependencyResolutionManagement {\n    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)\n    repositories {\n        google()\n        mavenCentral()\n        maven { url \"https://jitpack.io\" }\n    }\n}\n\nrootProject.name = \"BoxForRoot\"\ninclude ':app'\ninclude ':ke'\n"
  }
]